Fix pre- and post-indexed load / store encoding bugs.
[oota-llvm.git] / lib / Target / ARM / ARMConstantIslandPass.cpp
index f577de5b3652e0e671cc51e6b611b9a97e285d43..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 {
-    /// 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
@@ -129,7 +126,7 @@ namespace {
     bool isThumb;
   public:
     static char ID;
-    ARMConstantIslands() : MachineFunctionPass((intptr_t)&ID) {}
+    ARMConstantIslands() : MachineFunctionPass(&ID) {}
 
     virtual bool runOnMachineFunction(MachineFunction &Fn);
 
@@ -237,7 +234,7 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &Fn) {
   }
   
   /// 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
@@ -416,7 +413,7 @@ void ARMConstantIslands::InitialFunctionScan(MachineFunction &Fn,
 
       // Scan the instructions for constant pool operands.
       for (unsigned op = 0, e = I->getNumOperands(); op != e; ++op)
-        if (I->getOperand(op).isConstantPoolIndex()) {
+        if (I->getOperand(op).isCPI()) {
           // We found one.  The addressing mode tells us the max displacement
           // from the PC that this instruction permits.
           
@@ -818,7 +815,7 @@ int ARMConstantIslands::LookForExistingCPEntry(CPUser& U, unsigned UserOffset)
       U.CPEMI = CPEs[i].CPEMI;
       // Change the CPI in the instruction operand to refer to the clone.
       for (unsigned j = 0, e = UserMI->getNumOperands(); j != e; ++j)
-        if (UserMI->getOperand(j).isConstantPoolIndex()) {
+        if (UserMI->getOperand(j).isCPI()) {
           UserMI->getOperand(j).setIndex(CPEs[i].CPI);
           break;
         }
@@ -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.
-  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