* Switch to operation on pointers with PointerTy more consistently

* Fix misspeling
* Catch SIGFPE for traps
* info XXX now prints the raw contents of the GenericValue
* Switch to calloc instead of malloc (temporarily I hope) to bandaid Olden benchmarks
* Implement binary And & Or
* Convert expressions like this:
     PointerTy SrcPtr = getOperandValue(I->getPtrOperand(), SF).PointerVal;
  to:
    GenericValue SRC = getOperandValue(I->getPtrOperand(), SF);
    PointerTy SrcPtr = SRC.PointerVal;
  because the prior way confuses purify.
* Taint the initial values of the value planes
* Handling 'print bb4' in the interpreter without crashing
* Print nicer stack frames with concise return type
* printf doesn't suck nearly as badly as it used to


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1177 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2001-11-07 19:46:27 +00:00
parent aa6ec735cf
commit ea38c0e85c
3 changed files with 149 additions and 76 deletions

View File

@ -202,7 +202,7 @@ GenericValue lle_X_exit(MethodType *M, const vector<GenericValue> &Args) {
GenericValue lle_X_malloc(MethodType *M, const vector<GenericValue> &Args) {
assert(Args.size() == 1 && "Malloc expects one argument!");
GenericValue GV;
GV.PointerVal = (uint64_t)malloc(Args[0].UIntVal);
GV.PointerVal = (PointerTy)malloc(Args[0].UIntVal);
return GV;
}
@ -269,40 +269,45 @@ GenericValue lle_X_printf(MethodType *M, const vector<GenericValue> &Args) {
break;
}
case '%': { // Handle format specifiers
bool isLong = false;
++FmtStr;
if (*FmtStr == 'l') {
isLong = true;
FmtStr++;
char FmtBuf[100] = "", Buffer[1000] = "";
char *FB = FmtBuf;
*FB++ = *FmtStr++;
char Last = *FB++ = *FmtStr++;
unsigned HowLong = 0;
while (Last != 'c' && Last != 'd' && Last != 'i' && Last != 'u' &&
Last != 'o' && Last != 'x' && Last != 'X' && Last != 'e' &&
Last != 'E' && Last != 'g' && Last != 'G' && Last != 'f' &&
Last != 'p' && Last != 's' && Last != '%') {
if (Last == 'l' || Last == 'L') HowLong++; // Keep track of l's
Last = *FB++ = *FmtStr++;
}
if (*FmtStr == '%')
cout << *FmtStr; // %%
else {
char Fmt[] = "%d", Buffer[1000] = "";
Fmt[1] = *FmtStr;
switch (*FmtStr) {
case 'c':
sprintf(Buffer, Fmt, Args[ArgNo++].SByteVal); break;
case 'd': case 'i':
case 'u': case 'o':
case 'x': case 'X':
sprintf(Buffer, Fmt, Args[ArgNo++].IntVal); break;
case 'e': case 'E': case 'g': case 'G': case 'f':
sprintf(Buffer, Fmt, Args[ArgNo++].DoubleVal); break;
case 'p':
sprintf(Buffer, Fmt, (void*)Args[ArgNo++].PointerVal); break;
case 's': cout << (char*)Args[ArgNo++].PointerVal; break; // %s
default: cout << "<unknown printf code '" << *FmtStr << "'!>";
ArgNo++; break;
}
cout << Buffer;
*FB = 0;
switch (Last) {
case '%':
sprintf(Buffer, FmtBuf); break;
case 'c':
sprintf(Buffer, FmtBuf, Args[ArgNo++].SByteVal); break;
case 'd': case 'i':
case 'u': case 'o':
case 'x': case 'X':
if (HowLong == 2)
sprintf(Buffer, FmtBuf, Args[ArgNo++].ULongVal);
else
sprintf(Buffer, FmtBuf, Args[ArgNo++].IntVal); break;
case 'e': case 'E': case 'g': case 'G': case 'f':
sprintf(Buffer, FmtBuf, Args[ArgNo++].DoubleVal); break;
case 'p':
sprintf(Buffer, FmtBuf, (void*)Args[ArgNo++].PointerVal); break;
case 's':
sprintf(Buffer, FmtBuf, (char*)Args[ArgNo++].PointerVal); break;
default: cout << "<unknown printf code '" << *FmtStr << "'!>";
ArgNo++; break;
}
cout << Buffer;
}
++FmtStr;
break;
}
}
}
}