summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-04-11 00:23:49 +0000
committerLang Hames <lhames@gmail.com>2015-04-11 00:23:49 +0000
commiteb9bdb5d1686cc1e55d45fee419f1d07124d915e (patch)
tree23e7cdce78b7e4295409df0565159178f1f5b95f /llvm/lib/ExecutionEngine
parent256a869d312b37ed7b5d131329050fcdadb11148 (diff)
downloadbcm5719-llvm-eb9bdb5d1686cc1e55d45fee419f1d07124d915e.tar.gz
bcm5719-llvm-eb9bdb5d1686cc1e55d45fee419f1d07124d915e.zip
[Orc] Tidy up IndirectionUtils API a little, add some comments. NFC.
llvm-svn: 234669
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
index 74766450e8c..bcf22f58266 100644
--- a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp
@@ -18,13 +18,20 @@
namespace llvm {
namespace orc {
-GlobalVariable* createImplPointer(Function &F, const Twine &Name,
- Constant *Initializer) {
- assert(F.getParent() && "Function isn't in a module.");
+Constant* createIRTypedAddress(FunctionType &FT, TargetAddress Addr) {
+ Constant *AddrIntVal =
+ ConstantInt::get(Type::getInt64Ty(FT.getContext()), Addr);
+ Constant *AddrPtrVal =
+ ConstantExpr::getCast(Instruction::IntToPtr, AddrIntVal,
+ PointerType::get(&FT, 0));
+ return AddrPtrVal;
+}
+
+GlobalVariable* createImplPointer(PointerType &PT, Module &M,
+ const Twine &Name, Constant *Initializer) {
if (!Initializer)
- Initializer = Constant::getNullValue(F.getType());
- Module &M = *F.getParent();
- return new GlobalVariable(M, F.getType(), false, GlobalValue::ExternalLinkage,
+ Initializer = Constant::getNullValue(&PT);
+ return new GlobalVariable(M, &PT, false, GlobalValue::ExternalLinkage,
Initializer, Name, nullptr,
GlobalValue::NotThreadLocal, 0, true);
}
@@ -51,6 +58,7 @@ void partition(Module &M, const ModulePartitionMap &PMap) {
auto ExtractGlobalVars =
[&](GlobalVariable &New, const GlobalVariable &Orig,
ValueToValueMapTy &VMap) {
+ assert(Orig.hasName() && "Extracted globals must have names.");
if (KVPair.second.count(&Orig)) {
copyGVInitializer(New, Orig, VMap);
}
@@ -62,6 +70,7 @@ void partition(Module &M, const ModulePartitionMap &PMap) {
auto ExtractFunctions =
[&](Function &New, const Function &Orig, ValueToValueMapTy &VMap) {
+ assert(Orig.hasName() && "Extracted functions must have names.");
if (KVPair.second.count(&Orig))
copyFunctionBody(New, Orig, VMap);
if (New.hasLocalLinkage()) {
OpenPOWER on IntegriCloud