summaryrefslogtreecommitdiffstats
path: root/llvm/examples/BrainF/BrainFDriver.cpp
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2019-01-31 21:51:58 +0000
committerJames Y Knight <jyknight@google.com>2019-01-31 21:51:58 +0000
commitfadf25068e32b44b010e6e03c6ab93bec41eae82 (patch)
tree9b22878f495e0b75d9e86cd01bcf199308dc9234 /llvm/examples/BrainF/BrainFDriver.cpp
parentc62214da3de04f702e29e4ba4772c9463e2829ca (diff)
downloadbcm5719-llvm-fadf25068e32b44b010e6e03c6ab93bec41eae82.tar.gz
bcm5719-llvm-fadf25068e32b44b010e6e03c6ab93bec41eae82.zip
Revert "[opaque pointer types] Add a FunctionCallee wrapper type, and use it."
This reverts commit f47d6b38c7a61d50db4566b02719de05492dcef1 (r352791). Seems to run into compilation failures with GCC (but not clang, where I tested it). Reverting while I investigate. llvm-svn: 352800
Diffstat (limited to 'llvm/examples/BrainF/BrainFDriver.cpp')
-rw-r--r--llvm/examples/BrainF/BrainFDriver.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/examples/BrainF/BrainFDriver.cpp b/llvm/examples/BrainF/BrainFDriver.cpp
index 2c63b254246..85c563d136d 100644
--- a/llvm/examples/BrainF/BrainFDriver.cpp
+++ b/llvm/examples/BrainF/BrainFDriver.cpp
@@ -72,13 +72,11 @@ JIT("jit", cl::desc("Run program Just-In-Time"));
//Add main function so can be fully compiled
void addMainFunction(Module *mod) {
//define i32 @main(i32 %argc, i8 **%argv)
- FunctionType *main_func_fty = FunctionType::get(
- Type::getInt32Ty(mod->getContext()),
- {Type::getInt32Ty(mod->getContext()),
- Type::getInt8Ty(mod->getContext())->getPointerTo()->getPointerTo()});
- Function *main_func =
- Function::create(main_func_fty, Function::ExternalLinkage, "main", mod);
-
+ Function *main_func = cast<Function>(mod->
+ getOrInsertFunction("main", IntegerType::getInt32Ty(mod->getContext()),
+ IntegerType::getInt32Ty(mod->getContext()),
+ PointerType::getUnqual(PointerType::getUnqual(
+ IntegerType::getInt8Ty(mod->getContext())))));
{
Function::arg_iterator args = main_func->arg_begin();
Value *arg_0 = &*args++;
OpenPOWER on IntegriCloud