[llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Jun 16 11:09:40 PDT 2006



Changes in directory llvm/lib/ExecutionEngine/JIT:

JITEmitter.cpp updated: 1.103 -> 1.104
---
Log message:

Only count instructions as code size, not constant pools and other per-function stuff.


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

 JITEmitter.cpp |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)


Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.103 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.104
--- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.103	Thu Jun  1 12:29:22 2006
+++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp	Fri Jun 16 13:09:26 2006
@@ -760,8 +760,14 @@
   
   emitJumpTableInfo(F.getJumpTableInfo());
   
-  MemMgr.endFunctionBody(F.getFunction(), BufferBegin, CurBufferPtr);
-  NumBytes += getCurrentPCOffset();
+  // FnStart is the start of the text, not the start of the constant pool and
+  // other per-function data.
+  unsigned char *FnStart =
+    (unsigned char *)TheJIT->getPointerToGlobalIfAvailable(F.getFunction());
+  unsigned char *FnEnd   = CurBufferPtr;
+  
+  MemMgr.endFunctionBody(F.getFunction(), BufferBegin, FnEnd);
+  NumBytes += FnEnd-FnStart;
 
   if (!Relocations.empty()) {
     NumRelos += Relocations.size();
@@ -815,11 +821,9 @@
     }
   }
 
-  DEBUG(void *FnStart = TheJIT->getPointerToGlobalIfAvailable(F.getFunction());
-        char *FnEnd   = (char*)getCurrentPCOffset();
-        std::cerr << "JIT: Finished CodeGen of [" << FnStart
+  DEBUG(std::cerr << "JIT: Finished CodeGen of [" << (void*)FnStart
                   << "] Function: " << F.getFunction()->getName()
-                  << ": " << (FnEnd-(char*)FnStart) << " bytes of text, "
+                  << ": " << (FnEnd-FnStart) << " bytes of text, "
                   << Relocations.size() << " relocations\n");
   Relocations.clear();
   return false;






More information about the llvm-commits mailing list