[llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp

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



Changes in directory llvm/lib/Target/X86:

X86CodeEmitter.cpp updated: 1.95 -> 1.96
---
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)

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


Index: llvm/lib/Target/X86/X86CodeEmitter.cpp
diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.95 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.96
--- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.95	Tue May  2 12:16:20 2006
+++ llvm/lib/Target/X86/X86CodeEmitter.cpp	Tue May  2 13:27:26 2006
@@ -81,13 +81,17 @@
          "JIT relocation model must be set to static or default!");
   II = ((X86TargetMachine&)MF.getTarget()).getInstrInfo();
 
-  MCE.startFunction(MF);
-  MCE.emitConstantPool(MF.getConstantPool());
-  MCE.initJumpTableInfo(MF.getJumpTableInfo());
-  for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
-    emitBasicBlock(*I);
-  MCE.emitJumpTableInfo(MF.getJumpTableInfo(), BasicBlockAddrs);
-  MCE.finishFunction(MF);
+  do {
+    BBRefs.clear();
+    BasicBlockAddrs.clear();
+
+    MCE.startFunction(MF);
+    MCE.emitConstantPool(MF.getConstantPool());
+    MCE.initJumpTableInfo(MF.getJumpTableInfo());
+    for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I)
+      emitBasicBlock(*I);
+    MCE.emitJumpTableInfo(MF.getJumpTableInfo(), BasicBlockAddrs);
+  } while (MCE.finishFunction(MF));
 
   // Resolve all forward branches now.
   for (unsigned i = 0, e = BBRefs.size(); i != e; ++i) {






More information about the llvm-commits mailing list