diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/AutoUpgrade.h | 6 | ||||
-rw-r--r-- | include/llvm/Bitcode/LLVMBitCodes.h | 1 | ||||
-rw-r--r-- | include/llvm/InstrTypes.h | 1 | ||||
-rw-r--r-- | include/llvm/Instruction.def | 10 | ||||
-rw-r--r-- | include/llvm/Instructions.h | 70 | ||||
-rw-r--r-- | include/llvm/Support/IRBuilder.h | 15 | ||||
-rw-r--r-- | include/llvm/Support/InstVisitor.h | 1 |
7 files changed, 15 insertions, 89 deletions
diff --git a/include/llvm/AutoUpgrade.h b/include/llvm/AutoUpgrade.h index 0235877..3a97353 100644 --- a/include/llvm/AutoUpgrade.h +++ b/include/llvm/AutoUpgrade.h @@ -35,12 +35,6 @@ namespace llvm { /// so that it can update all calls to the old function. void UpgradeCallsToIntrinsic(Function* F); - /// This is an auto-upgrade hook for mutiple-value return statements. - /// This function auto-upgrades all such return statements in the given - /// function to use aggregate return values built with insertvalue - /// instructions. - void UpgradeMultipleReturnValues(Function *F); - } // End llvm namespace #endif diff --git a/include/llvm/Bitcode/LLVMBitCodes.h b/include/llvm/Bitcode/LLVMBitCodes.h index ef7f870..50af9d5 100644 --- a/include/llvm/Bitcode/LLVMBitCodes.h +++ b/include/llvm/Bitcode/LLVMBitCodes.h @@ -202,6 +202,7 @@ namespace bitc { // this is so information only available in the pointer type (e.g. address // spaces) is retained. FUNC_CODE_INST_STORE2 = 24, // STORE: [ptrty,ptr,val, align, vol] + // FIXME: Remove GETRESULT in favor of EXTRACTVAL in LLVM 3.0 FUNC_CODE_INST_GETRESULT = 25, // GETRESULT: [ty, opval, n] FUNC_CODE_INST_EXTRACTVAL = 26, // EXTRACTVAL: [n x operands] FUNC_CODE_INST_INSERTVAL = 27 // INSERTVAL: [n x operands] diff --git a/include/llvm/InstrTypes.h b/include/llvm/InstrTypes.h index 0a3fbed..c8dd4e6 100644 --- a/include/llvm/InstrTypes.h +++ b/include/llvm/InstrTypes.h @@ -117,7 +117,6 @@ public: I->getOpcode() == Instruction::Free || I->getOpcode() == Instruction::Load || I->getOpcode() == Instruction::VAArg || - I->getOpcode() == Instruction::GetResult || I->getOpcode() == Instruction::ExtractValue || (I->getOpcode() >= CastOpsBegin && I->getOpcode() < CastOpsEnd); } diff --git a/include/llvm/Instruction.def b/include/llvm/Instruction.def index 2189c86..dcc22e5 100644 --- a/include/llvm/Instruction.def +++ b/include/llvm/Instruction.def @@ -164,12 +164,10 @@ HANDLE_OTHER_INST(47, VAArg , VAArgInst ) // vaarg instruction HANDLE_OTHER_INST(48, ExtractElement, ExtractElementInst)// extract from vector HANDLE_OTHER_INST(49, InsertElement, InsertElementInst) // insert into vector HANDLE_OTHER_INST(50, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. -HANDLE_OTHER_INST(51, GetResult, GetResultInst) // Extract individual value - //from aggregate result -HANDLE_OTHER_INST(52, ExtractValue, ExtractValueInst)// extract from aggregate -HANDLE_OTHER_INST(53, InsertValue, InsertValueInst) // insert into aggregate -HANDLE_OTHER_INST(54, VICmp , VICmpInst ) // Vec Int comparison instruction. -HANDLE_OTHER_INST(55, VFCmp , VFCmpInst ) // Vec FP point comparison instr. +HANDLE_OTHER_INST(51, ExtractValue, ExtractValueInst)// extract from aggregate +HANDLE_OTHER_INST(52, InsertValue, InsertValueInst) // insert into aggregate +HANDLE_OTHER_INST(53, VICmp , VICmpInst ) // Vec Int comparison instruction. +HANDLE_OTHER_INST(54, VFCmp , VFCmpInst ) // Vec FP point comparison instr. LAST_OTHER_INST(55) diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index d625293..41daca3 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -2000,7 +2000,6 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(PHINode, Value) /// class ReturnInst : public TerminatorInst { ReturnInst(const ReturnInst &RI); - void init(Value * const* retVals, unsigned N); private: // ReturnInst constructors: @@ -2011,16 +2010,11 @@ private: // ReturnInst(Value* X, Inst *I) - 'ret X' instruction, insert before I // ReturnInst( null, BB *B) - 'ret void' instruction, insert @ end of B // ReturnInst(Value* X, BB *B) - 'ret X' instruction, insert @ end of B - // ReturnInst(Value* X, N) - 'ret X,X+1...X+N-1' instruction - // ReturnInst(Value* X, N, Inst *I) - 'ret X,X+1...X+N-1', insert before I - // ReturnInst(Value* X, N, BB *B) - 'ret X,X+1...X+N-1', insert @ end of B // // NOTE: If the Value* passed is of type void then the constructor behaves as // if it was passed NULL. explicit ReturnInst(Value *retVal = 0, Instruction *InsertBefore = 0); ReturnInst(Value *retVal, BasicBlock *InsertAtEnd); - ReturnInst(Value * const* retVals, unsigned N, Instruction *InsertBefore = 0); - ReturnInst(Value * const* retVals, unsigned N, BasicBlock *InsertAtEnd); explicit ReturnInst(BasicBlock *InsertAtEnd); public: static ReturnInst* Create(Value *retVal = 0, Instruction *InsertBefore = 0) { @@ -2029,19 +2023,10 @@ public: static ReturnInst* Create(Value *retVal, BasicBlock *InsertAtEnd) { return new(!!retVal) ReturnInst(retVal, InsertAtEnd); } - static ReturnInst* Create(Value * const* retVals, unsigned N, - Instruction *InsertBefore = 0) { - return new(N) ReturnInst(retVals, N, InsertBefore); - } - static ReturnInst* Create(Value * const* retVals, unsigned N, - BasicBlock *InsertAtEnd) { - return new(N) ReturnInst(retVals, N, InsertAtEnd); - } static ReturnInst* Create(BasicBlock *InsertAtEnd) { return new(0) ReturnInst(InsertAtEnd); } virtual ~ReturnInst(); - inline void operator delete(void*); virtual ReturnInst *clone() const; @@ -2072,16 +2057,10 @@ public: }; template <> -struct OperandTraits<ReturnInst> : VariadicOperandTraits<> { +struct OperandTraits<ReturnInst> : OptionalOperandTraits<> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value) -void ReturnInst::operator delete(void *it) { - ReturnInst* me(static_cast<ReturnInst*>(it)); - Use::zap(OperandTraits<ReturnInst>::op_begin(me), - OperandTraits<ReturnInst>::op_end(me), - true); -} //===----------------------------------------------------------------------===// // BranchInst Class @@ -3126,53 +3105,6 @@ public: } }; -//===----------------------------------------------------------------------===// -// GetResultInst Class -//===----------------------------------------------------------------------===// - -/// GetResultInst - This instruction extracts individual result value from -/// aggregate value, where aggregate value is returned by CallInst. -/// -class GetResultInst : public UnaryInstruction { - unsigned Idx; - GetResultInst(const GetResultInst &GRI) : - UnaryInstruction(GRI.getType(), Instruction::GetResult, GRI.getOperand(0)), - Idx(GRI.Idx) { - } - -public: - GetResultInst(Value *Aggr, unsigned index, - const std::string &Name = "", - Instruction *InsertBefore = 0); - - /// isValidOperands - Return true if an getresult instruction can be - /// formed with the specified operands. - static bool isValidOperands(const Value *Aggr, unsigned index); - - virtual GetResultInst *clone() const; - - Value *getAggregateValue() { - return getOperand(0); - } - - const Value *getAggregateValue() const { - return getOperand(0); - } - - unsigned getIndex() const { - return Idx; - } - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const GetResultInst *) { return true; } - static inline bool classof(const Instruction *I) { - return (I->getOpcode() == Instruction::GetResult); - } - static inline bool classof(const Value *V) { - return isa<Instruction>(V) && classof(cast<Instruction>(V)); - } -}; - } // End llvm namespace #endif diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h index 95d9c5a..b025d4c 100644 --- a/include/llvm/Support/IRBuilder.h +++ b/include/llvm/Support/IRBuilder.h @@ -102,7 +102,15 @@ public: } ReturnInst *CreateRet(Value * const* retVals, unsigned N) { - return Insert(ReturnInst::Create(retVals, N)); + const Type *RetType = BB->getParent()->getReturnType(); + if (N == 0 && RetType == Type::VoidTy) + return CreateRetVoid(); + if (N == 1 && retVals[0]->getType() == RetType) + return Insert(ReturnInst::Create(retVals[0])); + Value *V = UndefValue::get(RetType); + for (unsigned i = 0; i != N; ++i) + V = CreateInsertValue(V, retVals[i], i, "mrv"); + return Insert(ReturnInst::Create(V)); } /// CreateBr - Create an unconditional 'br label X' instruction. @@ -568,11 +576,6 @@ public: return Insert(new ShuffleVectorInst(V1, V2, Mask), Name); } - GetResultInst *CreateGetResult(Value *V, unsigned Index, - const char *Name = "") { - return Insert(new GetResultInst(V, Index), Name); - } - Value *CreateExtractValue(Value *Agg, unsigned Idx, const char *Name = "") { if (Constant *AggC = dyn_cast<Constant>(Agg)) diff --git a/include/llvm/Support/InstVisitor.h b/include/llvm/Support/InstVisitor.h index 9606187..932e7fb 100644 --- a/include/llvm/Support/InstVisitor.h +++ b/include/llvm/Support/InstVisitor.h @@ -196,7 +196,6 @@ public: RetTy visitExtractElementInst(ExtractElementInst &I) { DELEGATE(Instruction);} RetTy visitInsertElementInst(InsertElementInst &I) { DELEGATE(Instruction); } RetTy visitShuffleVectorInst(ShuffleVectorInst &I) { DELEGATE(Instruction); } - RetTy visitGetResultInst(GetResultInst &I) { DELEGATE(Instruction); } RetTy visitExtractValueInst(ExtractValueInst &I) { DELEGATE(Instruction);} RetTy visitInsertValueInst(InsertValueInst &I) { DELEGATE(Instruction); } |