From eff566d19ab5d40e5c4a6f4ce44d3a0b218b4bec Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Tue, 29 Jun 2010 11:41:38 +0000 Subject: [PATCH] encode operand initializations (at fixed index) in terms of Op<> and ArgOffset. This works for values of {0, 1} for ArgOffset. Please note that ArgOffset will become 0 soon and will go away eventually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107129 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Instructions.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 1a091d65810..e8ac392d71f 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -231,8 +231,7 @@ CallInst::~CallInst() { void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) { assert(NumOperands == NumParams+1 && "NumOperands not set up?"); - Use *OL = OperandList; - OL[0] = Func; + Op() = Func; const FunctionType *FTy = cast(cast(Func->getType())->getElementType()); @@ -245,16 +244,15 @@ void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) { assert((i >= FTy->getNumParams() || FTy->getParamType(i) == Params[i]->getType()) && "Calling a function with a bad signature!"); - OL[i+1] = Params[i]; + OperandList[i + ArgOffset] = Params[i]; } } void CallInst::init(Value *Func, Value *Actual1, Value *Actual2) { assert(NumOperands == 3 && "NumOperands not set up?"); - Use *OL = OperandList; - OL[0] = Func; - OL[1] = Actual1; - OL[2] = Actual2; + Op() = Func; + Op() = Actual1; + Op() = Actual2; const FunctionType *FTy = cast(cast(Func->getType())->getElementType()); @@ -273,9 +271,8 @@ void CallInst::init(Value *Func, Value *Actual1, Value *Actual2) { void CallInst::init(Value *Func, Value *Actual) { assert(NumOperands == 2 && "NumOperands not set up?"); - Use *OL = OperandList; - OL[0] = Func; - OL[1] = Actual; + Op() = Func; + Op() = Actual; const FunctionType *FTy = cast(cast(Func->getType())->getElementType()); @@ -291,8 +288,7 @@ void CallInst::init(Value *Func, Value *Actual) { void CallInst::init(Value *Func) { assert(NumOperands == 1 && "NumOperands not set up?"); - Use *OL = OperandList; - OL[0] = Func; + Op() = Func; const FunctionType *FTy = cast(cast(Func->getType())->getElementType());