[llvm-commits] [llvm] r58877 - in /llvm/trunk/lib/Target/ARM: ARMConstantIslandPass.cpp ARMJITInfo.h ARMMachineFunctionInfo.h

Evan Cheng evan.cheng at apple.com
Fri Nov 7 16:51:41 PST 2008


Author: evancheng
Date: Fri Nov  7 18:51:41 2008
New Revision: 58877

URL: http://llvm.org/viewvc/llvm-project?rev=58877&view=rev
Log:
Use ARMFunctionInfo to track number of constpool entries and jumptables.

Modified:
    llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp
    llvm/trunk/lib/Target/ARM/ARMJITInfo.h
    llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h

Modified: llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp?rev=58877&r1=58876&r2=58877&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMConstantIslandPass.cpp Fri Nov  7 18:51:41 2008
@@ -47,9 +47,6 @@
   ///   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
@@ -237,7 +234,7 @@
   }
   
   /// 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
@@ -1019,7 +1016,7 @@
 
   // 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

Modified: llvm/trunk/lib/Target/ARM/ARMJITInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMJITInfo.h?rev=58877&r1=58876&r2=58877&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMJITInfo.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMJITInfo.h Fri Nov  7 18:51:41 2008
@@ -14,10 +14,11 @@
 #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/Target/TargetJITInfo.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
 
@@ -85,8 +86,9 @@
     /// 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

Modified: llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h?rev=58877&r1=58876&r2=58877&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMMachineFunctionInfo.h Fri Nov  7 18:51:41 2008
@@ -87,6 +87,8 @@
   ///
   unsigned JumpTableUId;
 
+  unsigned ConstPoolEntryUId;
+
 public:
   ARMFunctionInfo() :
     isThumb(false), 
@@ -96,7 +98,7 @@
     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()),
@@ -107,7 +109,7 @@
     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; }
 
@@ -203,7 +205,7 @@
     SpilledCSRegs.set(Reg);
   }
 
-  bool isCSRegisterSpilled(unsigned Reg) {
+  bool isCSRegisterSpilled(unsigned Reg) const {
     return SpilledCSRegs[Reg];
   }
 
@@ -214,6 +216,22 @@
   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
 





More information about the llvm-commits mailing list