diff options
author | Chris Lattner <sabre@nondot.org> | 2003-01-13 00:58:52 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-01-13 00:58:52 +0000 |
commit | 4e7aa44644cf51ceb1f38ccac546c302628d4973 (patch) | |
tree | 9af588dc1d7e5a9dad81c03e19dca43595ed6e2c /llvm/lib/ExecutionEngine | |
parent | 93fbc677201fc4590335f697569e6118be121200 (diff) | |
download | bcm5719-llvm-4e7aa44644cf51ceb1f38ccac546c302628d4973.tar.gz bcm5719-llvm-4e7aa44644cf51ceb1f38ccac546c302628d4973.zip |
Handle value promotion properly to work with tracing better
llvm-svn: 5253
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r-- | llvm/lib/ExecutionEngine/Interpreter/Execution.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp index 65c75635973..70e8886a93f 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -815,8 +815,28 @@ void Interpreter::executeCallInst(CallInst &I, ExecutionContext &SF) { ECStack.back().Caller = &I; vector<GenericValue> ArgVals; ArgVals.reserve(I.getNumOperands()-1); - for (unsigned i = 1; i < I.getNumOperands(); ++i) + for (unsigned i = 1; i < I.getNumOperands(); ++i) { ArgVals.push_back(getOperandValue(I.getOperand(i), SF)); + // Promote all integral types whose size is < sizeof(int) into ints. We do + // this by zero or sign extending the value as appropriate according to the + // source type. + if (I.getOperand(i)->getType()->isIntegral() && + I.getOperand(i)->getType()->getPrimitiveSize() < 4) { + const Type *Ty = I.getOperand(i)->getType(); + if (Ty == Type::ShortTy) + ArgVals.back().IntVal = ArgVals.back().ShortVal; + else if (Ty == Type::UShortTy) + ArgVals.back().UIntVal = ArgVals.back().UShortVal; + else if (Ty == Type::SByteTy) + ArgVals.back().IntVal = ArgVals.back().SByteVal; + else if (Ty == Type::UByteTy) + ArgVals.back().UIntVal = ArgVals.back().UByteVal; + else if (Ty == Type::BoolTy) + ArgVals.back().UIntVal = ArgVals.back().BoolVal; + else + assert(0 && "Unknown type!"); + } + } // To handle indirect calls, we must get the pointer value from the argument // and treat it as a function pointer. |