Use ARMFunctionInfo to track number of constpool entries and jumptables.
authorEvan Cheng <evan.cheng@apple.com>
Sat, 8 Nov 2008 00:51:41 +0000 (00:51 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Sat, 8 Nov 2008 00:51:41 +0000 (00:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58877 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMConstantIslandPass.cpp
lib/Target/ARM/ARMJITInfo.h
lib/Target/ARM/ARMMachineFunctionInfo.h

index 5d1384763bdcb8384bd78b8dd54504291ed05de4..16de61524dffba6a07827a1354b5d9e7c2041522 100644 (file)
@@ -47,9 +47,6 @@ namespace {
   ///   CPE     - A constant pool entry that has been placed somewhere, which
   ///             tracks a list of users.
   class VISIBILITY_HIDDEN ARMConstantIslands : public MachineFunctionPass {
   ///   CPE     - A constant pool entry that has been placed somewhere, which
   ///             tracks a list of users.
   class VISIBILITY_HIDDEN ARMConstantIslands : public MachineFunctionPass {
-    /// NextUID - Assign unique ID's to CPE's.
-    unsigned NextUID;
-
     /// BBSizes - The size of each MachineBasicBlock in bytes of code, indexed
     /// by MBB Number.  The two-byte pads required for Thumb alignment are
     /// counted as part of the following block (i.e., the offset and size for
     /// BBSizes - The size of each MachineBasicBlock in bytes of code, indexed
     /// by MBB Number.  The two-byte pads required for Thumb alignment are
     /// counted as part of the following block (i.e., the offset and size for
@@ -237,7 +234,7 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &Fn) {
   }
   
   /// The next UID to take is the first unused one.
   }
   
   /// The next UID to take is the first unused one.
-  NextUID = CPEMIs.size();
+  AFI->initConstPoolEntryUId(CPEMIs.size());
   
   // Do the initial scan of the function, building up information about the
   // sizes of each block, the location of all the water, and finding all of the
   
   // Do the initial scan of the function, building up information about the
   // sizes of each block, the location of all the water, and finding all of the
@@ -1019,7 +1016,7 @@ bool ARMConstantIslands::HandleConstantPoolUser(MachineFunction &Fn,
 
   // No existing clone of this CPE is within range.
   // We will be generating a new clone.  Get a UID for it.
 
   // No existing clone of this CPE is within range.
   // We will be generating a new clone.  Get a UID for it.
-  unsigned ID  = NextUID++;
+  unsigned ID  = AFI->createConstPoolEntryUId();
 
   // Look for water where we can place this CPE.  We look for the farthest one
   // away that will work.  Forward references only for now (although later
 
   // Look for water where we can place this CPE.  We look for the farthest one
   // away that will work.  Forward references only for now (although later
index feb7eea6aabc4a6933ec8bd1759fa0961943780b..3610a6e479f1614bb4a97588dea8361673950aef 100644 (file)
 #ifndef ARMJITINFO_H
 #define ARMJITINFO_H
 
 #ifndef ARMJITINFO_H
 #define ARMJITINFO_H
 
-#include "llvm/Target/TargetJITInfo.h"
+#include "ARMMachineFunctionInfo.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineJumpTableInfo.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineJumpTableInfo.h"
+#include "llvm/Target/TargetJITInfo.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 
@@ -85,8 +86,9 @@ namespace llvm {
     /// Initialize - Initialize internal stage. Get the list of constant pool
     /// Resize constant pool ids to CONSTPOOL_ENTRY addresses map.
     void Initialize(const MachineFunction &MF) {
     /// Initialize - Initialize internal stage. Get the list of constant pool
     /// Resize constant pool ids to CONSTPOOL_ENTRY addresses map.
     void Initialize(const MachineFunction &MF) {
-      ConstPoolId2AddrMap.resize(MF.getConstantPool()->getConstants().size());
-      JumpTableId2AddrMap.resize(MF.getJumpTableInfo()->getJumpTables().size());
+      const ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
+      ConstPoolId2AddrMap.resize(AFI->getNumConstPoolEntries());
+      JumpTableId2AddrMap.resize(AFI->getNumJumpTables());
     }
 
     /// getConstantPoolEntryAddr - The ARM target puts all constant
     }
 
     /// getConstantPoolEntryAddr - The ARM target puts all constant
index eeb61d76860e8beb164a539b67cc46d282d11781..6662be12a57860df1a3abb2e1e83d18389a01d1d 100644 (file)
@@ -87,6 +87,8 @@ class ARMFunctionInfo : public MachineFunctionInfo {
   ///
   unsigned JumpTableUId;
 
   ///
   unsigned JumpTableUId;
 
+  unsigned ConstPoolEntryUId;
+
 public:
   ARMFunctionInfo() :
     isThumb(false), 
 public:
   ARMFunctionInfo() :
     isThumb(false), 
@@ -96,7 +98,7 @@ public:
     FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
     GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0),
     GPRCS1Frames(0), GPRCS2Frames(0), DPRCSFrames(0),
     FramePtrSpillOffset(0), GPRCS1Offset(0), GPRCS2Offset(0), DPRCSOffset(0),
     GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0),
     GPRCS1Frames(0), GPRCS2Frames(0), DPRCSFrames(0),
-    JumpTableUId(0) {}
+    JumpTableUId(0), ConstPoolEntryUId(0) {}
 
   ARMFunctionInfo(MachineFunction &MF) :
     isThumb(MF.getTarget().getSubtarget<ARMSubtarget>().isThumb()),
 
   ARMFunctionInfo(MachineFunction &MF) :
     isThumb(MF.getTarget().getSubtarget<ARMSubtarget>().isThumb()),
@@ -107,7 +109,7 @@ public:
     GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0),
     GPRCS1Frames(32), GPRCS2Frames(32), DPRCSFrames(32),
     SpilledCSRegs(MF.getTarget().getRegisterInfo()->getNumRegs()),
     GPRCS1Size(0), GPRCS2Size(0), DPRCSSize(0),
     GPRCS1Frames(32), GPRCS2Frames(32), DPRCSFrames(32),
     SpilledCSRegs(MF.getTarget().getRegisterInfo()->getNumRegs()),
-    JumpTableUId(0) {}
+    JumpTableUId(0), ConstPoolEntryUId(0) {}
 
   bool isThumbFunction() const { return isThumb; }
 
 
   bool isThumbFunction() const { return isThumb; }
 
@@ -203,7 +205,7 @@ public:
     SpilledCSRegs.set(Reg);
   }
 
     SpilledCSRegs.set(Reg);
   }
 
-  bool isCSRegisterSpilled(unsigned Reg) {
+  bool isCSRegisterSpilled(unsigned Reg) const {
     return SpilledCSRegs[Reg];
   }
 
     return SpilledCSRegs[Reg];
   }
 
@@ -214,6 +216,22 @@ public:
   unsigned createJumpTableUId() {
     return JumpTableUId++;
   }
   unsigned createJumpTableUId() {
     return JumpTableUId++;
   }
+
+  unsigned getNumJumpTables() const {
+    return JumpTableUId;
+  }
+
+  void initConstPoolEntryUId(unsigned UId) {
+    ConstPoolEntryUId = UId;
+  }
+
+  unsigned getNumConstPoolEntries() const {
+    return ConstPoolEntryUId;
+  }
+
+  unsigned createConstPoolEntryUId() {
+    return ConstPoolEntryUId++;
+  }
 };
 } // End llvm namespace
 
 };
 } // End llvm namespace