Add some convenience methods for querying attributes, and

use them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44403 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands
2007-11-28 17:07:01 +00:00
parent 1e7b1bbd9c
commit afa3b6da11
15 changed files with 81 additions and 88 deletions

View File

@@ -896,18 +896,15 @@ void Interpreter::visitCallSite(CallSite CS) {
e = SF.Caller.arg_end(); i != e; ++i, ++pNum) {
Value *V = *i;
ArgVals.push_back(getOperandValue(V, SF));
if (F) {
// Promote all integral types whose size is < sizeof(i32) into i32.
// We do this by zero or sign extending the value as appropriate
// according to the parameter attributes
const Type *Ty = V->getType();
if (Ty->isInteger() && (ArgVals.back().IntVal.getBitWidth() < 32))
if (const ParamAttrsList *PA = F->getParamAttrs())
if (PA->paramHasAttr(pNum, ParamAttr::ZExt))
ArgVals.back().IntVal = ArgVals.back().IntVal.zext(32);
else if (PA->paramHasAttr(pNum, ParamAttr::SExt))
ArgVals.back().IntVal = ArgVals.back().IntVal.sext(32);
}
// Promote all integral types whose size is < sizeof(i32) into i32.
// We do this by zero or sign extending the value as appropriate
// according to the parameter attributes
const Type *Ty = V->getType();
if (Ty->isInteger() && (ArgVals.back().IntVal.getBitWidth() < 32))
if (CS.paramHasAttr(pNum, ParamAttr::ZExt))
ArgVals.back().IntVal = ArgVals.back().IntVal.zext(32);
else if (CS.paramHasAttr(pNum, ParamAttr::SExt))
ArgVals.back().IntVal = ArgVals.back().IntVal.sext(32);
}
// To handle indirect calls, we must get the pointer value from the argument