summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-03-29 23:23:59 +0000
committerBill Wendling <isanbard@gmail.com>2012-03-29 23:23:59 +0000
commit76fdc4b885794df96f85d370f64a22f2b5e6b24a (patch)
tree98361b617f519c9f0341998fed91307874ea003c /llvm/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h
parentd8af9a5ee13e4a4b14e61bc608e6b19a095b203c (diff)
downloadbcm5719-llvm-76fdc4b885794df96f85d370f64a22f2b5e6b24a.tar.gz
bcm5719-llvm-76fdc4b885794df96f85d370f64a22f2b5e6b24a.zip
Revert r153694. It was causing failures in the buildbots.
llvm-svn: 153701
Diffstat (limited to 'llvm/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h')
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h38
1 files changed, 36 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h b/llvm/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h
index a68949aa41c..118b0d42ee8 100644
--- a/llvm/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h
+++ b/llvm/lib/ExecutionEngine/MCJIT/MCJITMemoryManager.h
@@ -34,12 +34,12 @@ public:
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID) {
- return JMM->allocateSpace(Size, Alignment);
+ return JMM->allocateDataSection(Size, Alignment, SectionID);
}
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID) {
- return JMM->allocateSpace(Size, Alignment);
+ return JMM->allocateCodeSection(Size, Alignment, SectionID);
}
virtual void *getPointerToNamedFunction(const std::string &Name,
@@ -47,6 +47,40 @@ public:
return JMM->getPointerToNamedFunction(Name, AbortOnFailure);
}
+ // Allocate ActualSize bytes, or more, for the named function. Return
+ // a pointer to the allocated memory and update Size to reflect how much
+ // memory was acutally allocated.
+ uint8_t *startFunctionBody(const char *Name, uintptr_t &Size) {
+ // FIXME: This should really reference the MCAsmInfo to get the global
+ // prefix.
+ if (Name[0] == '_') ++Name;
+ Function *F = M->getFunction(Name);
+ // Some ObjC names have a prefixed \01 in the IR. If we failed to find
+ // the symbol and it's of the ObjC conventions (starts with "-" or
+ // "+"), try prepending a \01 and see if we can find it that way.
+ if (!F && (Name[0] == '-' || Name[0] == '+'))
+ F = M->getFunction((Twine("\1") + Name).str());
+ assert(F && "No matching function in JIT IR Module!");
+ return JMM->startFunctionBody(F, Size);
+ }
+
+ // Mark the end of the function, including how much of the allocated
+ // memory was actually used.
+ void endFunctionBody(const char *Name, uint8_t *FunctionStart,
+ uint8_t *FunctionEnd) {
+ // FIXME: This should really reference the MCAsmInfo to get the global
+ // prefix.
+ if (Name[0] == '_') ++Name;
+ Function *F = M->getFunction(Name);
+ // Some ObjC names have a prefixed \01 in the IR. If we failed to find
+ // the symbol and it's of the ObjC conventions (starts with "-" or
+ // "+"), try prepending a \01 and see if we can find it that way.
+ if (!F && (Name[0] == '-' || Name[0] == '+'))
+ F = M->getFunction((Twine("\1") + Name).str());
+ assert(F && "No matching function in JIT IR Module!");
+ JMM->endFunctionBody(F, FunctionStart, FunctionEnd);
+ }
+
};
} // End llvm namespace
OpenPOWER on IntegriCloud