From: Vikram S. Adve Date: Sat, 28 Sep 2002 17:03:54 +0000 (+0000) Subject: Fixed method getReturnValue(): it should return NULL if the X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f425884e275c66f975a68e56f24b33a2d1c6e5c6;p=oota-llvm.git Fixed method getReturnValue(): it should return NULL if the callee does not return a value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3968 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/MachineInstrAnnot.h b/include/llvm/CodeGen/MachineInstrAnnot.h index bd3f7333e32..be3aaac299d 100644 --- a/include/llvm/CodeGen/MachineInstrAnnot.h +++ b/include/llvm/CodeGen/MachineInstrAnnot.h @@ -68,12 +68,12 @@ public: unsigned int getNumArgs() const { return argInfoVec.size(); } CallArgInfo& getArgInfo(unsigned int op) { assert(op < argInfoVec.size()); return argInfoVec[op]; } - const CallInst* getReturnValue() const { return callInstr; } + const CallInst* getReturnValue() const; const Value* getIndirectFuncPtr() const { return funcPtr; } TmpInstruction* getReturnAddrReg() const { return retAddrReg; } bool isVarArgsFunc() const { return isVarArgs; } bool hasNoPrototype() const { return noPrototype; } - + // Annotation mechanism to annotate a MachineInstr with the descriptor. // This is not demand-driven because annotations can only be created // at restricted points during code generation. diff --git a/lib/CodeGen/MachineInstrAnnot.cpp b/lib/CodeGen/MachineInstrAnnot.cpp index 960c49283e5..ef064450ed0 100644 --- a/lib/CodeGen/MachineInstrAnnot.cpp +++ b/lib/CodeGen/MachineInstrAnnot.cpp @@ -30,3 +30,10 @@ CallArgsDescriptor::CallArgsDescriptor(const CallInst* _callInstr, for (unsigned int i=1; i < numArgs; ++i) argInfoVec.push_back(CallArgInfo(callInstr->getOperand(i))); } + + +const CallInst* +CallArgsDescriptor::getReturnValue() const +{ + return (callInstr->getType() == Type::VoidTy? NULL : callInstr); +} diff --git a/lib/Target/SparcV9/MachineInstrAnnot.h b/lib/Target/SparcV9/MachineInstrAnnot.h index bd3f7333e32..be3aaac299d 100644 --- a/lib/Target/SparcV9/MachineInstrAnnot.h +++ b/lib/Target/SparcV9/MachineInstrAnnot.h @@ -68,12 +68,12 @@ public: unsigned int getNumArgs() const { return argInfoVec.size(); } CallArgInfo& getArgInfo(unsigned int op) { assert(op < argInfoVec.size()); return argInfoVec[op]; } - const CallInst* getReturnValue() const { return callInstr; } + const CallInst* getReturnValue() const; const Value* getIndirectFuncPtr() const { return funcPtr; } TmpInstruction* getReturnAddrReg() const { return retAddrReg; } bool isVarArgsFunc() const { return isVarArgs; } bool hasNoPrototype() const { return noPrototype; } - + // Annotation mechanism to annotate a MachineInstr with the descriptor. // This is not demand-driven because annotations can only be created // at restricted points during code generation.