[llvm-commits] CVS: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp

Evan Cheng evan.cheng at apple.com
Wed Jan 31 10:29:46 PST 2007



Changes in directory llvm/lib/Target/ARM:

ARMConstantIslandPass.cpp updated: 1.15 -> 1.16
---
Log message:

Some comments.

---
Diffs of the changes:  (+6 -2)

 ARMConstantIslandPass.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)


Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.15 llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.16
--- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.15	Wed Jan 31 12:19:07 2007
+++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp	Wed Jan 31 12:29:27 2007
@@ -420,6 +420,7 @@
   NewBB->splice(NewBB->end(), OrigBB, MI, OrigBB->end());
   
   // Add an unconditional branch from OrigBB to NewBB.
+  // Note the new unconditional branch is not being recorded.
   BuildMI(OrigBB, TII->get(isThumb ? ARM::tB : ARM::B)).addMBB(NewBB);
   NumSplit++;
   
@@ -498,6 +499,7 @@
     assert(BBHasFallthrough(UserMBB) && "Expected a fallthrough BB!");
     NewMBB = next(MachineFunction::iterator(UserMBB));
     // Add an unconditional branch from UserMBB to fallthrough block.
+    // Note the new unconditional branch is not being recorded.
     BuildMI(UserMBB, TII->get(isThumb ? ARM::tB : ARM::B)).addMBB(NewMBB);
     BBSizes[UserMBB->getNumber()] += isThumb ? 2 : 4;
   } else {
@@ -590,7 +592,9 @@
   return true;
 }
 
-static inline unsigned getUncondBranchDisp(int Opc) {
+/// getUnconditionalBrDisp - Returns the maximum displacement that can fit in the
+/// specific unconditional branch instruction.
+static inline unsigned getUnconditionalBrDisp(int Opc) {
   return (Opc == ARM::tB) ? (1<<10)*2 : (1<<23)*4;
 }
 
@@ -653,7 +657,7 @@
   BuildMI(MBB, TII->get(MI->getOpcode())).addMBB(NextBB).addImm(CC);
   Br.MI = &MBB->back();
   BuildMI(MBB, TII->get(Br.UncondBr)).addMBB(DestBB);
-  unsigned MaxDisp = getUncondBranchDisp(Br.UncondBr);
+  unsigned MaxDisp = getUnconditionalBrDisp(Br.UncondBr);
   ImmBranches.push_back(ImmBranch(&MBB->back(), MaxDisp, false, Br.UncondBr));
   MI->eraseFromParent();
 






More information about the llvm-commits mailing list