summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-05-18 21:06:40 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-05-18 21:06:40 +0000
commitc65c525617e3f2cd4d1c0902562a9ee064e90b09 (patch)
tree855d20cf227bdffa3e069bda688c4f57057bd138 /llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
parentc1585be6bd6f40605294b359642b72ce67f9c2f6 (diff)
downloadbcm5719-llvm-c65c525617e3f2cd4d1c0902562a9ee064e90b09.tar.gz
bcm5719-llvm-c65c525617e3f2cd4d1c0902562a9ee064e90b09.zip
Allow the JIT ExecutionEngine to report details about the generated machine code.
Introduce a new class (MachineCodeInfo) that the JIT can fill in with details. Right now, just the address and the size of the machine code are reported. Patch by Evan Phoenix! llvm-svn: 72040
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
index 58563563887..fe1d96ad19a 100644
--- a/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -26,6 +26,7 @@
#include "llvm/CodeGen/MachineRelocation.h"
#include "llvm/ExecutionEngine/JITMemoryManager.h"
#include "llvm/ExecutionEngine/GenericValue.h"
+#include "llvm/CodeGen/MachineCodeInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetJITInfo.h"
#include "llvm/Target/TargetMachine.h"
@@ -614,9 +615,12 @@ namespace {
// ExtFnStubs - A map of external function names to stubs which have entries
// in the JITResolver's ExternalFnToStubMap.
StringMap<void *> ExtFnStubs;
-
+
+ // MCI - A pointer to a MachineCodeInfo object to update with information.
+ MachineCodeInfo *MCI;
+
public:
- JITEmitter(JIT &jit, JITMemoryManager *JMM) : Resolver(jit), CurFn(0) {
+ JITEmitter(JIT &jit, JITMemoryManager *JMM) : Resolver(jit), CurFn(0), MCI(0) {
MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager();
if (jit.getJITInfo().needsGOT()) {
MemMgr->AllocateGOT();
@@ -712,6 +716,10 @@ namespace {
JITMemoryManager *getMemMgr(void) const { return MemMgr; }
+ void setMachineCodeInfo(MachineCodeInfo *mci) {
+ MCI = mci;
+ }
+
private:
void *getPointerToGlobal(GlobalValue *GV, void *Reference, bool NoNeedStub);
void *getPointerToGVIndirectSym(GlobalValue *V, void *Reference,
@@ -1155,6 +1163,12 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
<< "] Function: " << F.getFunction()->getName()
<< ": " << (FnEnd-FnStart) << " bytes of text, "
<< Relocations.size() << " relocations\n";
+
+ if (MCI) {
+ MCI->setAddress(FnStart);
+ MCI->setSize(FnEnd-FnStart);
+ }
+
Relocations.clear();
ConstPoolAddresses.clear();
@@ -1478,6 +1492,13 @@ void *JIT::getPointerToFunctionOrStub(Function *F) {
return JE->getJITResolver().getFunctionStub(F);
}
+void JIT::registerMachineCodeInfo(MachineCodeInfo *mc) {
+ assert(isa<JITEmitter>(MCE) && "Unexpected MCE?");
+ JITEmitter *JE = cast<JITEmitter>(getCodeEmitter());
+
+ JE->setMachineCodeInfo(mc);
+}
+
void JIT::updateFunctionStub(Function *F) {
// Get the empty stub we generated earlier.
assert(isa<JITEmitter>(MCE) && "Unexpected MCE?");
OpenPOWER on IntegriCloud