Commit 031ca77f authored by Naman Dixit's avatar Naman Dixit

Removed comments from old complicated interpreter

parent 8eb0ee24
......@@ -282,37 +282,19 @@ int demo (void)
errno = 0;
// llvm::FunctionCallee Exit = Mod->getOrInsertFunction("exit",
// llvm::Type::getVoidTy(Context),
// llvm::Type::getInt32Ty(Context));
EE->runStaticConstructorsDestructors(false);
// (void)EE->getPointerToFunction(EntryFn);
// Run main.
llvm::GenericValue Result = EE->runFunction(EntryFn, llvm::ArrayRef<llvm::GenericValue>());
uint64_t ResultValue = Result.IntVal.getZExtValue();
// Run static destructors.
EE->runStaticConstructorsDestructors(true);
std::cout << "Returns: " << ResultValue << std::endl;
// if (llvm::Function *ExitF =
// llvm::dyn_cast<llvm::Function>(Exit.getCallee()->stripPointerCasts())) {
// if (ExitF->getFunctionType() == Exit.getFunctionType()) {
// std::vector<llvm::GenericValue> Args;
// llvm::GenericValue ResultGV;
// ResultGV.IntVal = llvm::APInt(32, static_cast<uint64_t>(Result));
// Args.push_back(ResultGV);
// EE->runFunction(ExitF, Args);
// llvm::WithColor::error(llvm::errs(), code_name.c_str())
// << "exit(" << Result << ") returned!\n";
// abort();
// }
// llvm::WithColor::error(llvm::errs(), code_name.c_str()) << "exit defined with wrong prototype!\n";
// abort();
// }
{ // Execute
// Run static constructors.
EE->runStaticConstructorsDestructors(false);
// Run main.
llvm::GenericValue Result = EE->runFunction(EntryFn, llvm::ArrayRef<llvm::GenericValue>());
uint64_t ResultValue = Result.IntVal.getZExtValue();
// Run static destructors.
EE->runStaticConstructorsDestructors(true);
std::cout << "Returns: " << ResultValue << std::endl;
}
return static_cast<int>(ResultValue);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment