[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue May 2 11:27:42 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCCodeEmitter.cpp updated: 1.53 -> 1.54
---
Log message:

Refactor the machine code emitter interface to pull the pointers for the current
code emission location into the base class, instead of being in the derived classes.

This change means that low-level methods like emitByte/emitWord now are no longer
virtual (yaay for speed), and we now have a framework to support growable code 
segments.  This implements feature request #1 of PR469: http://llvm.cs.uiuc.edu/PR469 .


---
Diffs of the changes:  (+11 -7)

 PPCCodeEmitter.cpp |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp
diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.53 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.54
--- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.53	Sat Apr 22 13:53:45 2006
+++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp	Tue May  2 13:27:26 2006
@@ -89,13 +89,17 @@
   assert((MF.getTarget().getRelocationModel() != Reloc::Default ||
           MF.getTarget().getRelocationModel() != Reloc::Static) &&
          "JIT relocation model must be set to static or default!");
-  MCE.startFunction(MF);
-  MCE.emitConstantPool(MF.getConstantPool());
-  MCE.initJumpTableInfo(MF.getJumpTableInfo());
-  for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); BB != E; ++BB)
-    emitBasicBlock(*BB);
-  MCE.emitJumpTableInfo(MF.getJumpTableInfo(), BBLocations);
-  MCE.finishFunction(MF);
+  do {
+    BBRefs.clear();
+    BBLocations.clear();
+
+    MCE.startFunction(MF);
+    MCE.emitConstantPool(MF.getConstantPool());
+    MCE.initJumpTableInfo(MF.getJumpTableInfo());
+    for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); BB != E; ++BB)
+      emitBasicBlock(*BB);
+    MCE.emitJumpTableInfo(MF.getJumpTableInfo(), BBLocations);
+  } while (MCE.finishFunction(MF));
 
   // Resolve branches to BasicBlocks for the entire function
   for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) {






More information about the llvm-commits mailing list