summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc')
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp5
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp19
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp11
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h20
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp18
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp7
6 files changed, 50 insertions, 30 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp
index ed425449784..1dfa0a1d492 100644
--- a/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp
@@ -19,7 +19,10 @@ namespace {
TEST(IndirectionUtilsTest, MakeStub) {
LLVMContext Context;
ModuleBuilder MB(Context, "x86_64-apple-macosx10.10", "");
- Function *F = MB.createFunctionDecl<void(DummyStruct, DummyStruct)>("");
+ FunctionType *FTy = FunctionType::get(
+ Type::getVoidTy(Context),
+ {getDummyStructTy(Context), getDummyStructTy(Context)}, false);
+ Function *F = MB.createFunctionDecl(FTy, "");
AttributeSet FnAttrs = AttributeSet::get(
Context, AttrBuilder().addAttribute(Attribute::NoUnwind));
AttributeSet RetAttrs; // None
diff --git a/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp
index 8c9c958cc42..b3696c6ca4a 100644
--- a/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/LegacyRTDyldObjectLinkingLayerTest.cpp
@@ -123,6 +123,8 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
if (!SupportsJIT)
return;
+ Type *Int32Ty = IntegerType::get(Context, 32);
+
ExecutionSession ES;
auto MM = std::make_shared<SectionMemoryManagerWrapper>();
@@ -153,7 +155,8 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
ModuleBuilder MB1(Context, "", "dummy");
{
MB1.getModule()->setDataLayout(TM->createDataLayout());
- Function *BarImpl = MB1.createFunctionDecl<int32_t(void)>("bar");
+ Function *BarImpl =
+ MB1.createFunctionDecl(FunctionType::get(Int32Ty, {}, false), "bar");
BasicBlock *BarEntry = BasicBlock::Create(Context, "entry", BarImpl);
IRBuilder<> Builder(BarEntry);
IntegerType *Int32Ty = IntegerType::get(Context, 32);
@@ -166,8 +169,10 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoDuplicateFinalization) {
ModuleBuilder MB2(Context, "", "dummy");
{
MB2.getModule()->setDataLayout(TM->createDataLayout());
- Function *BarDecl = MB2.createFunctionDecl<int32_t(void)>("bar");
- Function *FooImpl = MB2.createFunctionDecl<int32_t(void)>("foo");
+ Function *BarDecl =
+ MB2.createFunctionDecl(FunctionType::get(Int32Ty, {}, false), "bar");
+ Function *FooImpl =
+ MB2.createFunctionDecl(FunctionType::get(Int32Ty, {}, false), "foo");
BasicBlock *FooEntry = BasicBlock::Create(Context, "entry", FooImpl);
IRBuilder<> Builder(FooEntry);
Builder.CreateRet(Builder.CreateCall(BarDecl));
@@ -207,6 +212,8 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
if (!SupportsJIT)
return;
+ Type *Int32Ty = IntegerType::get(Context, 32);
+
ExecutionSession ES;
auto MM = std::make_shared<SectionMemoryManagerWrapper>();
@@ -233,7 +240,8 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
ModuleBuilder MB1(Context, "", "dummy");
{
MB1.getModule()->setDataLayout(TM->createDataLayout());
- Function *BarImpl = MB1.createFunctionDecl<int32_t(void)>("foo");
+ Function *BarImpl =
+ MB1.createFunctionDecl(FunctionType::get(Int32Ty, {}, false), "foo");
BasicBlock *BarEntry = BasicBlock::Create(Context, "entry", BarImpl);
IRBuilder<> Builder(BarEntry);
IntegerType *Int32Ty = IntegerType::get(Context, 32);
@@ -246,7 +254,8 @@ TEST_F(LegacyRTDyldObjectLinkingLayerExecutionTest, NoPrematureAllocation) {
ModuleBuilder MB2(Context, "", "dummy");
{
MB2.getModule()->setDataLayout(TM->createDataLayout());
- Function *BarImpl = MB2.createFunctionDecl<int32_t(void)>("bar");
+ Function *BarImpl =
+ MB2.createFunctionDecl(FunctionType::get(Int32Ty, {}, false), "bar");
BasicBlock *BarEntry = BasicBlock::Create(Context, "entry", BarImpl);
IRBuilder<> Builder(BarEntry);
IntegerType *Int32Ty = IntegerType::get(Context, 32);
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
index b288b6bab2c..54d81569626 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
@@ -27,8 +27,15 @@ class OrcCAPIExecutionTest : public testing::Test, public OrcExecutionTest {
protected:
std::unique_ptr<Module> createTestModule(const Triple &TT) {
ModuleBuilder MB(Context, TT.str(), "");
- Function *TestFunc = MB.createFunctionDecl<int()>("testFunc");
- Function *Main = MB.createFunctionDecl<int(int, char*[])>("main");
+ Type *IntTy = Type::getScalarTy<int>(Context);
+ Function *TestFunc =
+ MB.createFunctionDecl(FunctionType::get(IntTy, {}, false), "testFunc");
+ Function *Main = MB.createFunctionDecl(
+ FunctionType::get(
+ IntTy,
+ {IntTy, Type::getInt8PtrTy(Context)->getPointerTo()},
+ false),
+ "main");
Main->getBasicBlockList().push_back(BasicBlock::Create(Context));
IRBuilder<> B(&Main->back());
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
index e76d2fae5e3..e25c513d947 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
@@ -22,7 +22,6 @@
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
-#include "llvm/IR/TypeBuilder.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
@@ -169,11 +168,8 @@ public:
ModuleBuilder(LLVMContext &Context, StringRef Triple,
StringRef Name);
- template <typename FuncType>
- Function* createFunctionDecl(StringRef Name) {
- return Function::Create(
- TypeBuilder<FuncType, false>::get(M->getContext()),
- GlobalValue::ExternalLinkage, Name, M.get());
+ Function *createFunctionDecl(FunctionType *FTy, StringRef Name) {
+ return Function::Create(FTy, GlobalValue::ExternalLinkage, Name, M.get());
}
Module* getModule() { return M.get(); }
@@ -189,15 +185,9 @@ struct DummyStruct {
int X[256];
};
-// TypeBuilder specialization for DummyStruct.
-template <bool XCompile>
-class TypeBuilder<DummyStruct, XCompile> {
-public:
- static StructType *get(LLVMContext &Context) {
- return StructType::get(
- TypeBuilder<types::i<32>[256], XCompile>::get(Context));
- }
-};
+inline StructType *getDummyStructTy(LLVMContext &Context) {
+ return StructType::get(ArrayType::get(Type::getInt32Ty(Context), 256));
+}
template <typename HandleT, typename ModuleT>
class MockBaseLayer {
diff --git a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
index 6b1dbe93d5e..2db237f9a33 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
@@ -131,13 +131,17 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) {
ModuleBuilder MB(*TSCtx.getContext(), TM->getTargetTriple().str(), "dummy");
MB.getModule()->setDataLayout(TM->createDataLayout());
- Function *FooImpl = MB.createFunctionDecl<void()>("foo");
+ Function *FooImpl = MB.createFunctionDecl(
+ FunctionType::get(Type::getVoidTy(*TSCtx.getContext()), {}, false),
+ "foo");
BasicBlock *FooEntry =
BasicBlock::Create(*TSCtx.getContext(), "entry", FooImpl);
IRBuilder<> B1(FooEntry);
B1.CreateRetVoid();
- Function *BarImpl = MB.createFunctionDecl<void()>("bar");
+ Function *BarImpl = MB.createFunctionDecl(
+ FunctionType::get(Type::getVoidTy(*TSCtx.getContext()), {}, false),
+ "bar");
BasicBlock *BarEntry =
BasicBlock::Create(*TSCtx.getContext(), "entry", BarImpl);
IRBuilder<> B2(BarEntry);
@@ -181,9 +185,9 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) {
FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
CompileResult operator()(Module &M) {
- Function *BarImpl =
- Function::Create(TypeBuilder<void(), false>::get(M.getContext()),
- GlobalValue::ExternalLinkage, "bar", &M);
+ Function *BarImpl = Function::Create(
+ FunctionType::get(Type::getVoidTy(M.getContext()), {}, false),
+ GlobalValue::ExternalLinkage, "bar", &M);
BasicBlock *BarEntry =
BasicBlock::Create(M.getContext(), "entry", BarImpl);
IRBuilder<> B(BarEntry);
@@ -200,7 +204,9 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) {
ModuleBuilder MB(*TSCtx.getContext(), TM->getTargetTriple().str(), "dummy");
MB.getModule()->setDataLayout(TM->createDataLayout());
- Function *FooImpl = MB.createFunctionDecl<void()>("foo");
+ Function *FooImpl = MB.createFunctionDecl(
+ FunctionType::get(Type::getVoidTy(*TSCtx.getContext()), {}, false),
+ "foo");
BasicBlock *FooEntry =
BasicBlock::Create(*TSCtx.getContext(), "entry", FooImpl);
IRBuilder<> B(FooEntry);
diff --git a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
index 09224c289b4..4ffd7416a4a 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RemoteObjectLayerTest.cpp
@@ -95,7 +95,12 @@ MockObjectLayer::ObjectPtr createTestObject() {
LLVMContext Ctx;
ModuleBuilder MB(Ctx, TM->getTargetTriple().str(), "TestModule");
MB.getModule()->setDataLayout(TM->createDataLayout());
- auto *Main = MB.createFunctionDecl<void(int, char**)>("main");
+ auto *Main = MB.createFunctionDecl(
+ FunctionType::get(Type::getInt32Ty(Ctx),
+ {Type::getInt32Ty(Ctx),
+ Type::getInt8PtrTy(Ctx)->getPointerTo()},
+ false),
+ "main");
Main->getBasicBlockList().push_back(BasicBlock::Create(Ctx));
IRBuilder<> B(&Main->back());
B.CreateRet(ConstantInt::getSigned(Type::getInt32Ty(Ctx), 42));
OpenPOWER on IntegriCloud