mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
Simplify code a bit, print error message always instead of asserting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15793 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e8bf58c170
commit
b47130c580
@ -58,29 +58,32 @@ JIT::~JIT() {
|
|||||||
///
|
///
|
||||||
GenericValue JIT::runFunction(Function *F,
|
GenericValue JIT::runFunction(Function *F,
|
||||||
const std::vector<GenericValue> &ArgValues) {
|
const std::vector<GenericValue> &ArgValues) {
|
||||||
assert (F && "Function *F was null at entry to run()");
|
assert(F && "Function *F was null at entry to run()");
|
||||||
GenericValue rv;
|
GenericValue rv;
|
||||||
|
|
||||||
|
void *FPtr = getPointerToFunction(F);
|
||||||
|
assert(PFtr && "Pointer to fn's code was null after getPointerToFunction");
|
||||||
|
|
||||||
if (ArgValues.size() == 3) {
|
if (ArgValues.size() == 3) {
|
||||||
int (*PF)(int, char **, const char **) =
|
int (*PF)(int, char **, const char **) =
|
||||||
(int(*)(int, char **, const char **))getPointerToFunction(F);
|
(int(*)(int, char **, const char **))FPtr;
|
||||||
assert(PF && "Pointer to fn's code was null after getPointerToFunction");
|
|
||||||
|
|
||||||
// Call the function.
|
// Call the function.
|
||||||
int ExitCode = PF(ArgValues[0].IntVal, (char **) GVTOP (ArgValues[1]),
|
rv.IntVal = PF(ArgValues[0].IntVal, (char **)GVTOP(ArgValues[1]),
|
||||||
(const char **) GVTOP (ArgValues[2]));
|
(const char **)GVTOP(ArgValues[2]));
|
||||||
|
return rv;
|
||||||
rv.IntVal = ExitCode;
|
} else if (ArgValues.size() == 1) {
|
||||||
} else {
|
int (*PF)(int) = (int(*)(int))FPtr;
|
||||||
// FIXME: This code should handle a couple of common cases efficiently, but
|
rv.IntVal = PF(ArgValues[0].IntVal);
|
||||||
// it should also implement the general case by code-gening a new anonymous
|
return rv;
|
||||||
// nullary function to call.
|
|
||||||
assert(ArgValues.size() == 1);
|
|
||||||
void (*PF)(int) = (void(*)(int))getPointerToFunction(F);
|
|
||||||
assert(PF && "Pointer to fn's code was null after getPointerToFunction");
|
|
||||||
PF(ArgValues[0].IntVal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: This code should handle a couple of common cases efficiently, but
|
||||||
|
// it should also implement the general case by code-gening a new anonymous
|
||||||
|
// nullary function to call.
|
||||||
|
std::cerr << "Sorry, unimplemented feature in the LLVM JIT. See LLVM"
|
||||||
|
<< " PR#419\n for details.\n";
|
||||||
|
abort();
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user