[llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Jan 21 11:59:51 PST 2005
Changes in directory llvm/lib/ExecutionEngine/Interpreter:
ExternalFunctions.cpp updated: 1.82 -> 1.83
---
Log message:
If the interpreter tries to execute an external function, kill it. Of course
since we are dirty, special case __main. This should fix the infinite loop
horrible stuff that happens on linux-alpha when configuring llvm-gcc. It
might also help cygwin, who knows??
---
Diffs of the changes: (+8 -6)
Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.82 llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.83
--- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.82 Sat Jan 15 19:31:31 2005
+++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Fri Jan 21 13:59:37 2005
@@ -82,22 +82,24 @@
return FnPtr;
}
-GenericValue Interpreter::callExternalFunction(Function *M,
+GenericValue Interpreter::callExternalFunction(Function *F,
const std::vector<GenericValue> &ArgVals) {
TheInterpreter = this;
// Do a lookup to see if the function is in our cache... this should just be a
// deferred annotation!
- std::map<const Function *, ExFunc>::iterator FI = Functions.find(M);
- ExFunc Fn = (FI == Functions.end()) ? lookupFunction(M) : FI->second;
+ std::map<const Function *, ExFunc>::iterator FI = Functions.find(F);
+ ExFunc Fn = (FI == Functions.end()) ? lookupFunction(F) : FI->second;
if (Fn == 0) {
std::cout << "Tried to execute an unknown external function: "
- << M->getType()->getDescription() << " " << M->getName() << "\n";
- return GenericValue();
+ << F->getType()->getDescription() << " " << F->getName() << "\n";
+ if (F->getName() == "__main")
+ return GenericValue();
+ abort();
}
// TODO: FIXME when types are not const!
- GenericValue Result = Fn(const_cast<FunctionType*>(M->getFunctionType()),
+ GenericValue Result = Fn(const_cast<FunctionType*>(F->getFunctionType()),
ArgVals);
return Result;
}
More information about the llvm-commits
mailing list