mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-26 13:10:34 +00:00
For PR1146:
* Add ParamAttrs to InvokeInst class too. * Make sure all initializes of ParamAttrs in CallInst and InvokeInst are 0 * Destruct the ParamAttrs in Call/Invoke destructors to avoid memory leaks. This will change when ParamAttrsList is uniquified but needs to be correct until then. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35824 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3aad26e4da
commit
fa3e91242f
@ -737,10 +737,11 @@ public:
|
||||
SubclassData = (SubclassData & 1) | (CC << 1);
|
||||
}
|
||||
|
||||
/// Obtains a constant pointer to the ParamAttrsList object which holds the
|
||||
/// parameter attributes information, if any.
|
||||
/// Obtains a pointer to the ParamAttrsList object which holds the
|
||||
/// parameter attributes information, if any.
|
||||
/// @returns 0 if no attributes have been set.
|
||||
/// @brief Get the parameter attributes.
|
||||
const ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
|
||||
ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
|
||||
|
||||
/// Sets the parameter attributes for this CallInst. To construct a
|
||||
/// ParamAttrsList, see ParameterAttributes.h
|
||||
@ -1445,6 +1446,7 @@ private:
|
||||
/// calling convention of the call.
|
||||
///
|
||||
class InvokeInst : public TerminatorInst {
|
||||
ParamAttrsList *ParamAttrs;
|
||||
InvokeInst(const InvokeInst &BI);
|
||||
void init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
||||
Value* const *Args, unsigned NumArgs);
|
||||
@ -1466,6 +1468,17 @@ public:
|
||||
SubclassData = CC;
|
||||
}
|
||||
|
||||
/// Obtains a pointer to the ParamAttrsList object which holds the
|
||||
/// parameter attributes information, if any.
|
||||
/// @returns 0 if no attributes have been set.
|
||||
/// @brief Get the parameter attributes.
|
||||
ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
|
||||
|
||||
/// Sets the parameter attributes for this InvokeInst. To construct a
|
||||
/// ParamAttrsList, see ParameterAttributes.h
|
||||
/// @brief Set the parameter attributes.
|
||||
void setParamAttrs(ParamAttrsList *attrs) { ParamAttrs = attrs; }
|
||||
|
||||
/// getCalledFunction - Return the function called, or null if this is an
|
||||
/// indirect function invocation.
|
||||
///
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Function.h"
|
||||
#include "llvm/Instructions.h"
|
||||
#include "llvm/ParameterAttributes.h"
|
||||
#include "llvm/Support/CallSite.h"
|
||||
#include "llvm/Support/ConstantRange.h"
|
||||
using namespace llvm;
|
||||
@ -185,6 +186,7 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
|
||||
|
||||
CallInst::~CallInst() {
|
||||
delete [] OperandList;
|
||||
delete ParamAttrs; // FIXME: ParamAttrsList should be uniqued!
|
||||
}
|
||||
|
||||
void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) {
|
||||
@ -337,6 +339,7 @@ CallInst::CallInst(Value *Func, const std::string &Name,
|
||||
CallInst::CallInst(const CallInst &CI)
|
||||
: Instruction(CI.getType(), Instruction::Call, new Use[CI.getNumOperands()],
|
||||
CI.getNumOperands()) {
|
||||
ParamAttrs = 0;
|
||||
SubclassData = CI.SubclassData;
|
||||
Use *OL = OperandList;
|
||||
Use *InOL = CI.OperandList;
|
||||
@ -351,10 +354,12 @@ CallInst::CallInst(const CallInst &CI)
|
||||
|
||||
InvokeInst::~InvokeInst() {
|
||||
delete [] OperandList;
|
||||
delete ParamAttrs; // FIXME: ParamAttrsList should be uniqued!
|
||||
}
|
||||
|
||||
void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
||||
Value* const *Args, unsigned NumArgs) {
|
||||
ParamAttrs = 0;
|
||||
NumOperands = 3+NumArgs;
|
||||
Use *OL = OperandList = new Use[3+NumArgs];
|
||||
OL[0].init(Fn, this);
|
||||
@ -402,6 +407,7 @@ InvokeInst::InvokeInst(Value *Fn, BasicBlock *IfNormal,
|
||||
InvokeInst::InvokeInst(const InvokeInst &II)
|
||||
: TerminatorInst(II.getType(), Instruction::Invoke,
|
||||
new Use[II.getNumOperands()], II.getNumOperands()) {
|
||||
ParamAttrs = 0;
|
||||
SubclassData = II.SubclassData;
|
||||
Use *OL = OperandList, *InOL = II.OperandList;
|
||||
for (unsigned i = 0, e = II.getNumOperands(); i != e; ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user