mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
Devirtualizing Value destructor (PR889). Patch by Pawel Kunio!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44747 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -35,6 +35,11 @@ class Argument : public Value { // Defined in the Function.cpp file
|
|||||||
friend class SymbolTableListTraits<Argument, Function>;
|
friend class SymbolTableListTraits<Argument, Function>;
|
||||||
void setParent(Function *parent);
|
void setParent(Function *parent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void destroyThis(Argument*v) {
|
||||||
|
Value::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// Argument ctor - If Function argument is specified, this argument is
|
/// Argument ctor - If Function argument is specified, this argument is
|
||||||
/// inserted at the end of the argument list for the function.
|
/// inserted at the end of the argument list for the function.
|
||||||
|
@ -65,6 +65,9 @@ private :
|
|||||||
BasicBlock(const BasicBlock &); // Do not implement
|
BasicBlock(const BasicBlock &); // Do not implement
|
||||||
void operator=(const BasicBlock &); // Do not implement
|
void operator=(const BasicBlock &); // Do not implement
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void destroyThis(BasicBlock*);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// Instruction iterators...
|
/// Instruction iterators...
|
||||||
typedef InstListType::iterator iterator;
|
typedef InstListType::iterator iterator;
|
||||||
@ -76,7 +79,6 @@ public:
|
|||||||
///
|
///
|
||||||
explicit BasicBlock(const std::string &Name = "", Function *Parent = 0,
|
explicit BasicBlock(const std::string &Name = "", Function *Parent = 0,
|
||||||
BasicBlock *InsertBefore = 0);
|
BasicBlock *InsertBefore = 0);
|
||||||
~BasicBlock();
|
|
||||||
|
|
||||||
/// getParent - Return the enclosing method, or null if none
|
/// getParent - Return the enclosing method, or null if none
|
||||||
///
|
///
|
||||||
@ -206,6 +208,33 @@ private:
|
|||||||
const BasicBlock *getPrev() const { return Prev; }
|
const BasicBlock *getPrev() const { return Prev; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// DummyInst - An instance of this class is used to mark the end of the
|
||||||
|
/// instruction list. This is not a real instruction.
|
||||||
|
class DummyInst : public Instruction {
|
||||||
|
protected:
|
||||||
|
static void destroyThis(DummyInst* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
|
DummyInst();
|
||||||
|
|
||||||
|
Instruction *clone() const {
|
||||||
|
assert(0 && "Cannot clone EOL");abort();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const char *getOpcodeName() const { return "*end-of-list-inst*"; }
|
||||||
|
|
||||||
|
// Methods for support type inquiry through isa, cast, and dyn_cast...
|
||||||
|
static inline bool classof(const DummyInst *) { return true; }
|
||||||
|
static inline bool classof(const Instruction *I) {
|
||||||
|
return I->getOpcode() == OtherOpsEnd;
|
||||||
|
}
|
||||||
|
static inline bool classof(const Value *V) {
|
||||||
|
return isa<Instruction>(V) && classof(cast<Instruction>(V));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
inline int
|
inline int
|
||||||
ilist_traits<Instruction>::getListOffset() {
|
ilist_traits<Instruction>::getListOffset() {
|
||||||
return BasicBlock::getInstListOffset();
|
return BasicBlock::getInstListOffset();
|
||||||
|
@ -43,6 +43,10 @@ protected:
|
|||||||
: User(Ty, vty, Ops, NumOps) {}
|
: User(Ty, vty, Ops, NumOps) {}
|
||||||
|
|
||||||
void destroyConstantImpl();
|
void destroyConstantImpl();
|
||||||
|
static void destroyThis(Constant*v) {
|
||||||
|
User::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// Static constructor to get a '0' constant of arbitrary type...
|
/// Static constructor to get a '0' constant of arbitrary type...
|
||||||
///
|
///
|
||||||
|
@ -46,6 +46,11 @@ class ConstantInt : public Constant {
|
|||||||
ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT
|
ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT
|
||||||
ConstantInt(const IntegerType *Ty, const APInt& V);
|
ConstantInt(const IntegerType *Ty, const APInt& V);
|
||||||
APInt Val;
|
APInt Val;
|
||||||
|
protected:
|
||||||
|
static void destroyThis(ConstantInt*v) {
|
||||||
|
Constant::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// Return the constant as an APInt value reference. This allows clients to
|
/// Return the constant as an APInt value reference. This allows clients to
|
||||||
/// obtain a copy of the value, with all its precision in tact.
|
/// obtain a copy of the value, with all its precision in tact.
|
||||||
@ -218,6 +223,10 @@ class ConstantFP : public Constant {
|
|||||||
ConstantFP(const ConstantFP &); // DO NOT IMPLEMENT
|
ConstantFP(const ConstantFP &); // DO NOT IMPLEMENT
|
||||||
protected:
|
protected:
|
||||||
ConstantFP(const Type *Ty, const APFloat& V);
|
ConstantFP(const Type *Ty, const APFloat& V);
|
||||||
|
static void destroyThis(ConstantFP*v) {
|
||||||
|
Constant::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// get() - Static factory methods - Return objects of the specified value
|
/// get() - Static factory methods - Return objects of the specified value
|
||||||
static ConstantFP *get(const Type *Ty, const APFloat& V);
|
static ConstantFP *get(const Type *Ty, const APFloat& V);
|
||||||
@ -266,6 +275,11 @@ class ConstantAggregateZero : public Constant {
|
|||||||
protected:
|
protected:
|
||||||
explicit ConstantAggregateZero(const Type *Ty)
|
explicit ConstantAggregateZero(const Type *Ty)
|
||||||
: Constant(Ty, ConstantAggregateZeroVal, 0, 0) {}
|
: Constant(Ty, ConstantAggregateZeroVal, 0, 0) {}
|
||||||
|
|
||||||
|
static void destroyThis(ConstantAggregateZero*v) {
|
||||||
|
Constant::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// get() - static factory method for creating a null aggregate. It is
|
/// get() - static factory method for creating a null aggregate. It is
|
||||||
/// illegal to call this method with a non-aggregate type.
|
/// illegal to call this method with a non-aggregate type.
|
||||||
@ -295,7 +309,8 @@ class ConstantArray : public Constant {
|
|||||||
ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT
|
ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT
|
||||||
protected:
|
protected:
|
||||||
ConstantArray(const ArrayType *T, const std::vector<Constant*> &Val);
|
ConstantArray(const ArrayType *T, const std::vector<Constant*> &Val);
|
||||||
~ConstantArray();
|
static void destroyThis(ConstantArray*);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// get() - Static factory methods - Return objects of the specified value
|
/// get() - Static factory methods - Return objects of the specified value
|
||||||
static Constant *get(const ArrayType *T, const std::vector<Constant*> &);
|
static Constant *get(const ArrayType *T, const std::vector<Constant*> &);
|
||||||
@ -361,7 +376,8 @@ class ConstantStruct : public Constant {
|
|||||||
ConstantStruct(const ConstantStruct &); // DO NOT IMPLEMENT
|
ConstantStruct(const ConstantStruct &); // DO NOT IMPLEMENT
|
||||||
protected:
|
protected:
|
||||||
ConstantStruct(const StructType *T, const std::vector<Constant*> &Val);
|
ConstantStruct(const StructType *T, const std::vector<Constant*> &Val);
|
||||||
~ConstantStruct();
|
static void destroyThis(ConstantStruct*);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// get() - Static factory methods - Return objects of the specified value
|
/// get() - Static factory methods - Return objects of the specified value
|
||||||
///
|
///
|
||||||
@ -405,7 +421,8 @@ class ConstantVector : public Constant {
|
|||||||
ConstantVector(const ConstantVector &); // DO NOT IMPLEMENT
|
ConstantVector(const ConstantVector &); // DO NOT IMPLEMENT
|
||||||
protected:
|
protected:
|
||||||
ConstantVector(const VectorType *T, const std::vector<Constant*> &Val);
|
ConstantVector(const VectorType *T, const std::vector<Constant*> &Val);
|
||||||
~ConstantVector();
|
static void destroyThis(ConstantVector*v);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// get() - Static factory methods - Return objects of the specified value
|
/// get() - Static factory methods - Return objects of the specified value
|
||||||
static Constant *get(const VectorType *T, const std::vector<Constant*> &);
|
static Constant *get(const VectorType *T, const std::vector<Constant*> &);
|
||||||
@ -462,7 +479,10 @@ protected:
|
|||||||
explicit ConstantPointerNull(const PointerType *T)
|
explicit ConstantPointerNull(const PointerType *T)
|
||||||
: Constant(reinterpret_cast<const Type*>(T),
|
: Constant(reinterpret_cast<const Type*>(T),
|
||||||
Value::ConstantPointerNullVal, 0, 0) {}
|
Value::ConstantPointerNullVal, 0, 0) {}
|
||||||
|
static void destroyThis(ConstantPointerNull*v) {
|
||||||
|
Constant::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// get() - Static factory methods - Return objects of the specified value
|
/// get() - Static factory methods - Return objects of the specified value
|
||||||
@ -524,6 +544,10 @@ protected:
|
|||||||
static Constant *getShuffleVectorTy(const Type *Ty, Constant *V1,
|
static Constant *getShuffleVectorTy(const Type *Ty, Constant *V1,
|
||||||
Constant *V2, Constant *Mask);
|
Constant *V2, Constant *Mask);
|
||||||
|
|
||||||
|
static void destroyThis(ConstantExpr* v) {
|
||||||
|
Constant::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
// Static methods to construct a ConstantExpr of different kinds. Note that
|
// Static methods to construct a ConstantExpr of different kinds. Note that
|
||||||
// these methods may return a object that is not an instance of the
|
// these methods may return a object that is not an instance of the
|
||||||
@ -709,6 +733,10 @@ class UndefValue : public Constant {
|
|||||||
UndefValue(const UndefValue &); // DO NOT IMPLEMENT
|
UndefValue(const UndefValue &); // DO NOT IMPLEMENT
|
||||||
protected:
|
protected:
|
||||||
explicit UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {}
|
explicit UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {}
|
||||||
|
static void destroyThis(UndefValue*v) {
|
||||||
|
Constant::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// get() - Static factory methods - Return an 'undef' object of the specified
|
/// get() - Static factory methods - Return an 'undef' object of the specified
|
||||||
/// type.
|
/// type.
|
||||||
@ -728,6 +756,120 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// GetElementPtrConstantExpr - Helper class for Constants.cpp,
|
||||||
|
/// used behind the scenes to implement getelementpr constant exprs.
|
||||||
|
class GetElementPtrConstantExpr : public ConstantExpr {
|
||||||
|
protected:
|
||||||
|
static void destroyThis(GetElementPtrConstantExpr*v) {
|
||||||
|
delete [] v->OperandList;
|
||||||
|
ConstantExpr::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
|
GetElementPtrConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
|
||||||
|
const Type *DestTy);
|
||||||
|
};
|
||||||
|
|
||||||
|
/// UnaryConstantExpr - Helper class for Constants.cpp, used
|
||||||
|
/// behind the scenes to implement unary constant exprs.
|
||||||
|
class UnaryConstantExpr : public ConstantExpr {
|
||||||
|
Use Op;
|
||||||
|
protected:
|
||||||
|
static void destroyThis(UnaryConstantExpr*v) {
|
||||||
|
ConstantExpr::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
|
UnaryConstantExpr(unsigned Opcode, Constant *C, const Type *Ty);
|
||||||
|
};
|
||||||
|
|
||||||
|
/// BinaryConstantExpr - Helper class for Constants.cpp, used
|
||||||
|
/// behind the scenes to implement binary constant exprs.
|
||||||
|
class BinaryConstantExpr : public ConstantExpr {
|
||||||
|
Use Ops[2];
|
||||||
|
protected:
|
||||||
|
static void destroyThis(BinaryConstantExpr*v) {
|
||||||
|
ConstantExpr::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
|
BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2)
|
||||||
|
: ConstantExpr(C1->getType(), Opcode, Ops, 2) {
|
||||||
|
Ops[0].init(C1, this);
|
||||||
|
Ops[1].init(C2, this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// SelectConstantExpr - Helper class for Constants.cpp, used
|
||||||
|
/// behind the scenes to implement select constant exprs.
|
||||||
|
class SelectConstantExpr : public ConstantExpr {
|
||||||
|
Use Ops[3];
|
||||||
|
protected:
|
||||||
|
static void destroyThis(SelectConstantExpr*v) {
|
||||||
|
ConstantExpr::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
|
SelectConstantExpr(Constant *C1, Constant *C2, Constant *C3);
|
||||||
|
};
|
||||||
|
|
||||||
|
/// ExtractElementConstantExpr - Helper class for Constants.cpp, used
|
||||||
|
/// behind the scenes to implement extractelement constant exprs.
|
||||||
|
class ExtractElementConstantExpr : public ConstantExpr {
|
||||||
|
Use Ops[2];
|
||||||
|
protected:
|
||||||
|
static void destroyThis(ExtractElementConstantExpr*v) {
|
||||||
|
ConstantExpr::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
|
ExtractElementConstantExpr(Constant *C1, Constant *C2);
|
||||||
|
};
|
||||||
|
|
||||||
|
/// InsertElementConstantExpr - Helper class for Constants.cpp, used
|
||||||
|
/// behind the scenes to implement insertelement constant exprs.
|
||||||
|
class InsertElementConstantExpr : public ConstantExpr {
|
||||||
|
Use Ops[3];
|
||||||
|
protected:
|
||||||
|
static void destroyThis(InsertElementConstantExpr*v) {
|
||||||
|
ConstantExpr::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
|
InsertElementConstantExpr(Constant *C1, Constant *C2, Constant *C3);
|
||||||
|
};
|
||||||
|
|
||||||
|
/// ShuffleVectorConstantExpr - Helper class for Constants.cpp, used
|
||||||
|
/// behind the scenes to implement shufflevector constant exprs.
|
||||||
|
class ShuffleVectorConstantExpr : public ConstantExpr {
|
||||||
|
Use Ops[3];
|
||||||
|
protected:
|
||||||
|
static void destroyThis(ShuffleVectorConstantExpr*v) {
|
||||||
|
ConstantExpr::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
|
ShuffleVectorConstantExpr(Constant *C1, Constant *C2, Constant *C3);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// CompareConstantExpr - Helper class for Constants.cpp, used
|
||||||
|
// behind the scenes to implement ICmp and FCmp constant expressions. This is
|
||||||
|
// needed in order to store the predicate value for these instructions.
|
||||||
|
class CompareConstantExpr : public ConstantExpr {
|
||||||
|
protected:
|
||||||
|
static void destroyThis(CompareConstantExpr*v) {
|
||||||
|
ConstantExpr::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
|
unsigned short predicate;
|
||||||
|
Use Ops[2];
|
||||||
|
CompareConstantExpr(unsigned opc, unsigned short pred,
|
||||||
|
Constant* LHS, Constant* RHS);
|
||||||
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,6 +53,9 @@ template<> struct ilist_traits<Argument>
|
|||||||
};
|
};
|
||||||
|
|
||||||
class Function : public GlobalValue, public Annotable {
|
class Function : public GlobalValue, public Annotable {
|
||||||
|
protected:
|
||||||
|
static void destroyThis(Function*v);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
typedef iplist<Argument> ArgumentListType;
|
typedef iplist<Argument> ArgumentListType;
|
||||||
typedef iplist<BasicBlock> BasicBlockListType;
|
typedef iplist<BasicBlock> BasicBlockListType;
|
||||||
@ -109,7 +112,6 @@ public:
|
|||||||
///
|
///
|
||||||
Function(const FunctionType *Ty, LinkageTypes Linkage,
|
Function(const FunctionType *Ty, LinkageTypes Linkage,
|
||||||
const std::string &N = "", Module *M = 0);
|
const std::string &N = "", Module *M = 0);
|
||||||
~Function();
|
|
||||||
|
|
||||||
const Type *getReturnType() const; // Return the type of the ret val
|
const Type *getReturnType() const; // Return the type of the ret val
|
||||||
const FunctionType *getFunctionType() const; // Return the FunctionType for me
|
const FunctionType *getFunctionType() const; // Return the FunctionType for me
|
||||||
|
@ -43,6 +43,11 @@ class GlobalAlias : public GlobalValue {
|
|||||||
const GlobalAlias *getPrev() const { return Prev; }
|
const GlobalAlias *getPrev() const { return Prev; }
|
||||||
|
|
||||||
Use Aliasee;
|
Use Aliasee;
|
||||||
|
protected:
|
||||||
|
static void destroyThis(GlobalAlias*v) {
|
||||||
|
GlobalValue::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// GlobalAlias ctor - If a parent module is specified, the alias is
|
/// GlobalAlias ctor - If a parent module is specified, the alias is
|
||||||
/// automatically inserted into the end of the specified module's alias list.
|
/// automatically inserted into the end of the specified module's alias list.
|
||||||
|
@ -63,11 +63,12 @@ protected:
|
|||||||
unsigned Visibility : 2; // The visibility style of this global
|
unsigned Visibility : 2; // The visibility style of this global
|
||||||
unsigned Alignment : 16; // Alignment of this symbol, must be power of two
|
unsigned Alignment : 16; // Alignment of this symbol, must be power of two
|
||||||
std::string Section; // Section to emit this into, empty mean default
|
std::string Section; // Section to emit this into, empty mean default
|
||||||
public:
|
|
||||||
~GlobalValue() {
|
|
||||||
removeDeadConstantUsers(); // remove any dead constants using this.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
static void destroyThis(GlobalValue*v) {
|
||||||
|
v->removeDeadConstantUsers(); // remove any dead constants using this.
|
||||||
|
Constant::destroyThis(v);
|
||||||
|
}
|
||||||
|
public:
|
||||||
unsigned getAlignment() const { return Alignment; }
|
unsigned getAlignment() const { return Alignment; }
|
||||||
void setAlignment(unsigned Align) {
|
void setAlignment(unsigned Align) {
|
||||||
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
|
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
|
||||||
|
@ -45,6 +45,11 @@ class GlobalVariable : public GlobalValue {
|
|||||||
bool isThreadLocalSymbol : 1; // Is this symbol "Thread Local"?
|
bool isThreadLocalSymbol : 1; // Is this symbol "Thread Local"?
|
||||||
Use Initializer;
|
Use Initializer;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void destroyThis(GlobalVariable*v) {
|
||||||
|
GlobalValue::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// GlobalVariable ctor - If a parent module is specified, the global is
|
/// GlobalVariable ctor - If a parent module is specified, the global is
|
||||||
/// automatically inserted into the end of the specified modules global list.
|
/// automatically inserted into the end of the specified modules global list.
|
||||||
|
@ -36,9 +36,12 @@ class InlineAsm : public Value {
|
|||||||
|
|
||||||
InlineAsm(const FunctionType *Ty, const std::string &AsmString,
|
InlineAsm(const FunctionType *Ty, const std::string &AsmString,
|
||||||
const std::string &Constraints, bool hasSideEffects);
|
const std::string &Constraints, bool hasSideEffects);
|
||||||
virtual ~InlineAsm();
|
protected:
|
||||||
|
static void destroyThis(InlineAsm*v) {
|
||||||
|
Value::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// InlineAsm::get - Return the the specified uniqued inline asm string.
|
/// InlineAsm::get - Return the the specified uniqued inline asm string.
|
||||||
///
|
///
|
||||||
static InlineAsm *get(const FunctionType *Ty, const std::string &AsmString,
|
static InlineAsm *get(const FunctionType *Ty, const std::string &AsmString,
|
||||||
|
@ -38,14 +38,16 @@ protected:
|
|||||||
Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd)
|
Use *Ops, unsigned NumOps, BasicBlock *InsertAtEnd)
|
||||||
: Instruction(Ty, iType, Ops, NumOps, InsertAtEnd) {}
|
: Instruction(Ty, iType, Ops, NumOps, InsertAtEnd) {}
|
||||||
|
|
||||||
// Out of line virtual method, so the vtable, etc has a home.
|
|
||||||
~TerminatorInst();
|
|
||||||
|
|
||||||
/// Virtual methods - Terminators should overload these and provide inline
|
/// Virtual methods - Terminators should overload these and provide inline
|
||||||
/// overrides of non-V methods.
|
/// overrides of non-V methods.
|
||||||
virtual BasicBlock *getSuccessorV(unsigned idx) const = 0;
|
virtual BasicBlock *getSuccessorV(unsigned idx) const = 0;
|
||||||
virtual unsigned getNumSuccessorsV() const = 0;
|
virtual unsigned getNumSuccessorsV() const = 0;
|
||||||
virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0;
|
virtual void setSuccessorV(unsigned idx, BasicBlock *B) = 0;
|
||||||
|
|
||||||
|
static void destroyThis(TerminatorInst* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual Instruction *clone() const = 0;
|
virtual Instruction *clone() const = 0;
|
||||||
@ -94,10 +96,12 @@ protected:
|
|||||||
UnaryInstruction(const Type *Ty, unsigned iType, Value *V, BasicBlock *IAE)
|
UnaryInstruction(const Type *Ty, unsigned iType, Value *V, BasicBlock *IAE)
|
||||||
: Instruction(Ty, iType, &Op, 1, IAE), Op(V, this_()) {
|
: Instruction(Ty, iType, &Op, 1, IAE), Op(V, this_()) {
|
||||||
}
|
}
|
||||||
public:
|
|
||||||
// Out of line virtual method, so the vtable, etc has a home.
|
|
||||||
~UnaryInstruction();
|
|
||||||
|
|
||||||
|
static void destroyThis(UnaryInstruction* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
|
public:
|
||||||
// Transparently provide more efficient getOperand methods.
|
// Transparently provide more efficient getOperand methods.
|
||||||
Value *getOperand(unsigned i) const {
|
Value *getOperand(unsigned i) const {
|
||||||
assert(i == 0 && "getOperand() out of range!");
|
assert(i == 0 && "getOperand() out of range!");
|
||||||
@ -136,6 +140,11 @@ protected:
|
|||||||
const std::string &Name, Instruction *InsertBefore);
|
const std::string &Name, Instruction *InsertBefore);
|
||||||
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, const Type *Ty,
|
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, const Type *Ty,
|
||||||
const std::string &Name, BasicBlock *InsertAtEnd);
|
const std::string &Name, BasicBlock *InsertAtEnd);
|
||||||
|
|
||||||
|
static void destroyThis(BinaryOperator* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// Transparently provide more efficient getOperand methods.
|
/// Transparently provide more efficient getOperand methods.
|
||||||
@ -272,6 +281,12 @@ protected:
|
|||||||
: UnaryInstruction(Ty, iType, S, InsertAtEnd) {
|
: UnaryInstruction(Ty, iType, S, InsertAtEnd) {
|
||||||
setName(Name);
|
setName(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void destroyThis(CastInst* v) {
|
||||||
|
UnaryInstruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// Provides a way to construct any of the CastInst subclasses using an
|
/// Provides a way to construct any of the CastInst subclasses using an
|
||||||
/// opcode instead of the subclass's constructor. The opcode must be in the
|
/// opcode instead of the subclass's constructor. The opcode must be in the
|
||||||
@ -493,6 +508,10 @@ protected:
|
|||||||
|
|
||||||
Use Ops[2]; // CmpInst instructions always have 2 operands, optimize
|
Use Ops[2]; // CmpInst instructions always have 2 operands, optimize
|
||||||
|
|
||||||
|
static void destroyThis(CmpInst* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// Construct a compare instruction, given the opcode, the predicate and
|
/// Construct a compare instruction, given the opcode, the predicate and
|
||||||
/// the two operands. Optionally (if InstBefore is specified) insert the
|
/// the two operands. Optionally (if InstBefore is specified) insert the
|
||||||
|
@ -42,10 +42,10 @@ protected:
|
|||||||
Instruction *InsertBefore = 0);
|
Instruction *InsertBefore = 0);
|
||||||
Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
|
Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
|
||||||
BasicBlock *InsertAtEnd);
|
BasicBlock *InsertAtEnd);
|
||||||
|
|
||||||
|
static void destroyThis(Instruction*v);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
// Out of line virtual method, so the vtable, etc has a home.
|
|
||||||
~Instruction();
|
|
||||||
|
|
||||||
/// mayWriteToMemory - Return true if this instruction may modify memory.
|
/// mayWriteToMemory - Return true if this instruction may modify memory.
|
||||||
///
|
///
|
||||||
bool mayWriteToMemory() const;
|
bool mayWriteToMemory() const;
|
||||||
|
@ -47,9 +47,6 @@ protected:
|
|||||||
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align,
|
AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align,
|
||||||
const std::string &Name, BasicBlock *InsertAtEnd);
|
const std::string &Name, BasicBlock *InsertAtEnd);
|
||||||
public:
|
public:
|
||||||
// Out of line virtual method, so the vtable, etc has a home.
|
|
||||||
virtual ~AllocationInst();
|
|
||||||
|
|
||||||
/// isArrayAllocation - Return true if there is an allocation size parameter
|
/// isArrayAllocation - Return true if there is an allocation size parameter
|
||||||
/// to the allocation instruction that is not 1.
|
/// to the allocation instruction that is not 1.
|
||||||
///
|
///
|
||||||
@ -190,6 +187,11 @@ public:
|
|||||||
///
|
///
|
||||||
class FreeInst : public UnaryInstruction {
|
class FreeInst : public UnaryInstruction {
|
||||||
void AssertOK();
|
void AssertOK();
|
||||||
|
protected:
|
||||||
|
static void destroyThis(FreeInst* v) {
|
||||||
|
UnaryInstruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
explicit FreeInst(Value *Ptr, Instruction *InsertBefore = 0);
|
explicit FreeInst(Value *Ptr, Instruction *InsertBefore = 0);
|
||||||
FreeInst(Value *Ptr, BasicBlock *InsertAfter);
|
FreeInst(Value *Ptr, BasicBlock *InsertAfter);
|
||||||
@ -230,6 +232,11 @@ class LoadInst : public UnaryInstruction {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void AssertOK();
|
void AssertOK();
|
||||||
|
protected:
|
||||||
|
static void destroyThis(LoadInst* v) {
|
||||||
|
UnaryInstruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
LoadInst(Value *Ptr, const std::string &Name, Instruction *InsertBefore);
|
LoadInst(Value *Ptr, const std::string &Name, Instruction *InsertBefore);
|
||||||
LoadInst(Value *Ptr, const std::string &Name, BasicBlock *InsertAtEnd);
|
LoadInst(Value *Ptr, const std::string &Name, BasicBlock *InsertAtEnd);
|
||||||
@ -305,6 +312,11 @@ class StoreInst : public Instruction {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
void AssertOK();
|
void AssertOK();
|
||||||
|
protected:
|
||||||
|
static void destroyThis(StoreInst* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore);
|
StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore);
|
||||||
StoreInst(Value *Val, Value *Ptr, BasicBlock *InsertAtEnd);
|
StoreInst(Value *Val, Value *Ptr, BasicBlock *InsertAtEnd);
|
||||||
@ -443,6 +455,9 @@ class GetElementPtrInst : public Instruction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void destroyThis(GetElementPtrInst*v);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// Constructors - Create a getelementptr instruction with a base pointer an
|
/// Constructors - Create a getelementptr instruction with a base pointer an
|
||||||
/// list of indices. The first ctor can optionally insert before an existing
|
/// list of indices. The first ctor can optionally insert before an existing
|
||||||
@ -477,7 +492,6 @@ public:
|
|||||||
const std::string &Name = "", Instruction *InsertBefore =0);
|
const std::string &Name = "", Instruction *InsertBefore =0);
|
||||||
GetElementPtrInst(Value *Ptr, Value *Idx,
|
GetElementPtrInst(Value *Ptr, Value *Idx,
|
||||||
const std::string &Name, BasicBlock *InsertAtEnd);
|
const std::string &Name, BasicBlock *InsertAtEnd);
|
||||||
~GetElementPtrInst();
|
|
||||||
|
|
||||||
virtual GetElementPtrInst *clone() const;
|
virtual GetElementPtrInst *clone() const;
|
||||||
|
|
||||||
@ -556,6 +570,11 @@ public:
|
|||||||
/// vectors of integrals. The two operands must be the same type.
|
/// vectors of integrals. The two operands must be the same type.
|
||||||
/// @brief Represent an integer comparison operator.
|
/// @brief Represent an integer comparison operator.
|
||||||
class ICmpInst: public CmpInst {
|
class ICmpInst: public CmpInst {
|
||||||
|
protected:
|
||||||
|
static void destroyThis(ICmpInst* v) {
|
||||||
|
CmpInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// This enumeration lists the possible predicates for the ICmpInst. The
|
/// This enumeration lists the possible predicates for the ICmpInst. The
|
||||||
/// values in the range 0-31 are reserved for FCmpInst while values in the
|
/// values in the range 0-31 are reserved for FCmpInst while values in the
|
||||||
@ -712,6 +731,11 @@ public:
|
|||||||
/// vectors of floating point values. The operands must be identical types.
|
/// vectors of floating point values. The operands must be identical types.
|
||||||
/// @brief Represents a floating point comparison operator.
|
/// @brief Represents a floating point comparison operator.
|
||||||
class FCmpInst: public CmpInst {
|
class FCmpInst: public CmpInst {
|
||||||
|
protected:
|
||||||
|
static void destroyThis(FCmpInst* v) {
|
||||||
|
CmpInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// This enumeration lists the possible predicates for the FCmpInst. Values
|
/// This enumeration lists the possible predicates for the FCmpInst. Values
|
||||||
/// in the range 0-31 are reserved for FCmpInst.
|
/// in the range 0-31 are reserved for FCmpInst.
|
||||||
@ -857,6 +881,9 @@ class CallInst : public Instruction {
|
|||||||
setName(Name);
|
setName(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void destroyThis(CallInst*v);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// Construct a CallInst given a range of arguments. InputIterator
|
/// Construct a CallInst given a range of arguments. InputIterator
|
||||||
/// must be a random-access iterator pointing to contiguous storage
|
/// must be a random-access iterator pointing to contiguous storage
|
||||||
@ -897,7 +924,6 @@ public:
|
|||||||
explicit CallInst(Value *F, const std::string &Name = "",
|
explicit CallInst(Value *F, const std::string &Name = "",
|
||||||
Instruction *InsertBefore = 0);
|
Instruction *InsertBefore = 0);
|
||||||
CallInst(Value *F, const std::string &Name, BasicBlock *InsertAtEnd);
|
CallInst(Value *F, const std::string &Name, BasicBlock *InsertAtEnd);
|
||||||
~CallInst();
|
|
||||||
|
|
||||||
virtual CallInst *clone() const;
|
virtual CallInst *clone() const;
|
||||||
|
|
||||||
@ -989,6 +1015,11 @@ class SelectInst : public Instruction {
|
|||||||
: Instruction(SI.getType(), SI.getOpcode(), Ops, 3) {
|
: Instruction(SI.getType(), SI.getOpcode(), Ops, 3) {
|
||||||
init(SI.Ops[0], SI.Ops[1], SI.Ops[2]);
|
init(SI.Ops[0], SI.Ops[1], SI.Ops[2]);
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(SelectInst* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
SelectInst(Value *C, Value *S1, Value *S2, const std::string &Name = "",
|
SelectInst(Value *C, Value *S1, Value *S2, const std::string &Name = "",
|
||||||
Instruction *InsertBefore = 0)
|
Instruction *InsertBefore = 0)
|
||||||
@ -1044,6 +1075,11 @@ public:
|
|||||||
class VAArgInst : public UnaryInstruction {
|
class VAArgInst : public UnaryInstruction {
|
||||||
VAArgInst(const VAArgInst &VAA)
|
VAArgInst(const VAArgInst &VAA)
|
||||||
: UnaryInstruction(VAA.getType(), VAArg, VAA.getOperand(0)) {}
|
: UnaryInstruction(VAA.getType(), VAArg, VAA.getOperand(0)) {}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(VAArgInst* v) {
|
||||||
|
UnaryInstruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
VAArgInst(Value *List, const Type *Ty, const std::string &Name = "",
|
VAArgInst(Value *List, const Type *Ty, const std::string &Name = "",
|
||||||
Instruction *InsertBefore = 0)
|
Instruction *InsertBefore = 0)
|
||||||
@ -1083,6 +1119,11 @@ class ExtractElementInst : public Instruction {
|
|||||||
Ops[1].init(EE.Ops[1], this);
|
Ops[1].init(EE.Ops[1], this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void destroyThis(ExtractElementInst* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
ExtractElementInst(Value *Vec, Value *Idx, const std::string &Name = "",
|
ExtractElementInst(Value *Vec, Value *Idx, const std::string &Name = "",
|
||||||
Instruction *InsertBefore = 0);
|
Instruction *InsertBefore = 0);
|
||||||
@ -1130,6 +1171,11 @@ public:
|
|||||||
class InsertElementInst : public Instruction {
|
class InsertElementInst : public Instruction {
|
||||||
Use Ops[3];
|
Use Ops[3];
|
||||||
InsertElementInst(const InsertElementInst &IE);
|
InsertElementInst(const InsertElementInst &IE);
|
||||||
|
protected:
|
||||||
|
static void destroyThis(InsertElementInst* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
|
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
|
||||||
const std::string &Name = "",Instruction *InsertBefore = 0);
|
const std::string &Name = "",Instruction *InsertBefore = 0);
|
||||||
@ -1184,6 +1230,11 @@ public:
|
|||||||
class ShuffleVectorInst : public Instruction {
|
class ShuffleVectorInst : public Instruction {
|
||||||
Use Ops[3];
|
Use Ops[3];
|
||||||
ShuffleVectorInst(const ShuffleVectorInst &IE);
|
ShuffleVectorInst(const ShuffleVectorInst &IE);
|
||||||
|
protected:
|
||||||
|
static void destroyThis(ShuffleVectorInst* v) {
|
||||||
|
Instruction::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
|
ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
|
||||||
const std::string &Name = "", Instruction *InsertBefor = 0);
|
const std::string &Name = "", Instruction *InsertBefor = 0);
|
||||||
@ -1238,6 +1289,9 @@ class PHINode : public Instruction {
|
|||||||
/// the number actually in use.
|
/// the number actually in use.
|
||||||
unsigned ReservedSpace;
|
unsigned ReservedSpace;
|
||||||
PHINode(const PHINode &PN);
|
PHINode(const PHINode &PN);
|
||||||
|
protected:
|
||||||
|
static void destroyThis(PHINode*);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
explicit PHINode(const Type *Ty, const std::string &Name = "",
|
explicit PHINode(const Type *Ty, const std::string &Name = "",
|
||||||
Instruction *InsertBefore = 0)
|
Instruction *InsertBefore = 0)
|
||||||
@ -1252,8 +1306,6 @@ public:
|
|||||||
setName(Name);
|
setName(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
~PHINode();
|
|
||||||
|
|
||||||
/// reserveOperandSpace - This method can be used to avoid repeated
|
/// reserveOperandSpace - This method can be used to avoid repeated
|
||||||
/// reallocation of PHI operand lists by reserving space for the correct
|
/// reallocation of PHI operand lists by reserving space for the correct
|
||||||
/// number of operands before adding them. Unlike normal vector reserves,
|
/// number of operands before adding them. Unlike normal vector reserves,
|
||||||
@ -1522,6 +1574,9 @@ class SwitchInst : public TerminatorInst {
|
|||||||
SwitchInst(const SwitchInst &RI);
|
SwitchInst(const SwitchInst &RI);
|
||||||
void init(Value *Value, BasicBlock *Default, unsigned NumCases);
|
void init(Value *Value, BasicBlock *Default, unsigned NumCases);
|
||||||
void resizeOperands(unsigned No);
|
void resizeOperands(unsigned No);
|
||||||
|
protected:
|
||||||
|
static void destroyThis(SwitchInst*v);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// SwitchInst ctor - Create a new switch instruction, specifying a value to
|
/// SwitchInst ctor - Create a new switch instruction, specifying a value to
|
||||||
/// switch on and a default destination. The number of additional cases can
|
/// switch on and a default destination. The number of additional cases can
|
||||||
@ -1536,7 +1591,6 @@ public:
|
|||||||
/// constructor also autoinserts at the end of the specified BasicBlock.
|
/// constructor also autoinserts at the end of the specified BasicBlock.
|
||||||
SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
|
SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
|
||||||
BasicBlock *InsertAtEnd);
|
BasicBlock *InsertAtEnd);
|
||||||
~SwitchInst();
|
|
||||||
|
|
||||||
|
|
||||||
// Accessor Methods for Switch stmt
|
// Accessor Methods for Switch stmt
|
||||||
@ -1664,6 +1718,9 @@ class InvokeInst : public TerminatorInst {
|
|||||||
setName(Name);
|
setName(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void destroyThis(InvokeInst*v);
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// Construct an InvokeInst given a range of arguments.
|
/// Construct an InvokeInst given a range of arguments.
|
||||||
/// InputIterator must be a random-access iterator pointing to
|
/// InputIterator must be a random-access iterator pointing to
|
||||||
@ -1701,8 +1758,6 @@ public:
|
|||||||
typename std::iterator_traits<InputIterator>::iterator_category());
|
typename std::iterator_traits<InputIterator>::iterator_category());
|
||||||
}
|
}
|
||||||
|
|
||||||
~InvokeInst();
|
|
||||||
|
|
||||||
virtual InvokeInst *clone() const;
|
virtual InvokeInst *clone() const;
|
||||||
|
|
||||||
/// getCallingConv/setCallingConv - Get or set the calling convention of this
|
/// getCallingConv/setCallingConv - Get or set the calling convention of this
|
||||||
@ -1872,6 +1927,11 @@ class TruncInst : public CastInst {
|
|||||||
TruncInst(const TruncInst &CI)
|
TruncInst(const TruncInst &CI)
|
||||||
: CastInst(CI.getType(), Trunc, CI.getOperand(0)) {
|
: CastInst(CI.getType(), Trunc, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(TruncInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
TruncInst(
|
TruncInst(
|
||||||
@ -1912,6 +1972,11 @@ class ZExtInst : public CastInst {
|
|||||||
ZExtInst(const ZExtInst &CI)
|
ZExtInst(const ZExtInst &CI)
|
||||||
: CastInst(CI.getType(), ZExt, CI.getOperand(0)) {
|
: CastInst(CI.getType(), ZExt, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(ZExtInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
ZExtInst(
|
ZExtInst(
|
||||||
@ -1952,6 +2017,11 @@ class SExtInst : public CastInst {
|
|||||||
SExtInst(const SExtInst &CI)
|
SExtInst(const SExtInst &CI)
|
||||||
: CastInst(CI.getType(), SExt, CI.getOperand(0)) {
|
: CastInst(CI.getType(), SExt, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(SExtInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
SExtInst(
|
SExtInst(
|
||||||
@ -1991,6 +2061,11 @@ class FPTruncInst : public CastInst {
|
|||||||
FPTruncInst(const FPTruncInst &CI)
|
FPTruncInst(const FPTruncInst &CI)
|
||||||
: CastInst(CI.getType(), FPTrunc, CI.getOperand(0)) {
|
: CastInst(CI.getType(), FPTrunc, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(FPTruncInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
FPTruncInst(
|
FPTruncInst(
|
||||||
@ -2030,6 +2105,11 @@ class FPExtInst : public CastInst {
|
|||||||
FPExtInst(const FPExtInst &CI)
|
FPExtInst(const FPExtInst &CI)
|
||||||
: CastInst(CI.getType(), FPExt, CI.getOperand(0)) {
|
: CastInst(CI.getType(), FPExt, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(FPExtInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
FPExtInst(
|
FPExtInst(
|
||||||
@ -2069,6 +2149,11 @@ class UIToFPInst : public CastInst {
|
|||||||
UIToFPInst(const UIToFPInst &CI)
|
UIToFPInst(const UIToFPInst &CI)
|
||||||
: CastInst(CI.getType(), UIToFP, CI.getOperand(0)) {
|
: CastInst(CI.getType(), UIToFP, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(UIToFPInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
UIToFPInst(
|
UIToFPInst(
|
||||||
@ -2108,6 +2193,11 @@ class SIToFPInst : public CastInst {
|
|||||||
SIToFPInst(const SIToFPInst &CI)
|
SIToFPInst(const SIToFPInst &CI)
|
||||||
: CastInst(CI.getType(), SIToFP, CI.getOperand(0)) {
|
: CastInst(CI.getType(), SIToFP, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(SIToFPInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
SIToFPInst(
|
SIToFPInst(
|
||||||
@ -2147,6 +2237,11 @@ class FPToUIInst : public CastInst {
|
|||||||
FPToUIInst(const FPToUIInst &CI)
|
FPToUIInst(const FPToUIInst &CI)
|
||||||
: CastInst(CI.getType(), FPToUI, CI.getOperand(0)) {
|
: CastInst(CI.getType(), FPToUI, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(FPToUIInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
FPToUIInst(
|
FPToUIInst(
|
||||||
@ -2186,6 +2281,11 @@ class FPToSIInst : public CastInst {
|
|||||||
FPToSIInst(const FPToSIInst &CI)
|
FPToSIInst(const FPToSIInst &CI)
|
||||||
: CastInst(CI.getType(), FPToSI, CI.getOperand(0)) {
|
: CastInst(CI.getType(), FPToSI, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(FPToSIInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
FPToSIInst(
|
FPToSIInst(
|
||||||
@ -2225,6 +2325,11 @@ class IntToPtrInst : public CastInst {
|
|||||||
IntToPtrInst(const IntToPtrInst &CI)
|
IntToPtrInst(const IntToPtrInst &CI)
|
||||||
: CastInst(CI.getType(), IntToPtr, CI.getOperand(0)) {
|
: CastInst(CI.getType(), IntToPtr, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(IntToPtrInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
IntToPtrInst(
|
IntToPtrInst(
|
||||||
@ -2264,6 +2369,11 @@ class PtrToIntInst : public CastInst {
|
|||||||
PtrToIntInst(const PtrToIntInst &CI)
|
PtrToIntInst(const PtrToIntInst &CI)
|
||||||
: CastInst(CI.getType(), PtrToInt, CI.getOperand(0)) {
|
: CastInst(CI.getType(), PtrToInt, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(PtrToIntInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
PtrToIntInst(
|
PtrToIntInst(
|
||||||
@ -2303,6 +2413,11 @@ class BitCastInst : public CastInst {
|
|||||||
BitCastInst(const BitCastInst &CI)
|
BitCastInst(const BitCastInst &CI)
|
||||||
: CastInst(CI.getType(), BitCast, CI.getOperand(0)) {
|
: CastInst(CI.getType(), BitCast, CI.getOperand(0)) {
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(BitCastInst* v) {
|
||||||
|
CastInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
/// @brief Constructor with insert-before-instruction semantics
|
/// @brief Constructor with insert-before-instruction semantics
|
||||||
BitCastInst(
|
BitCastInst(
|
||||||
|
@ -38,6 +38,11 @@ namespace llvm {
|
|||||||
IntrinsicInst(); // DO NOT IMPLEMENT
|
IntrinsicInst(); // DO NOT IMPLEMENT
|
||||||
IntrinsicInst(const IntrinsicInst&); // DO NOT IMPLEMENT
|
IntrinsicInst(const IntrinsicInst&); // DO NOT IMPLEMENT
|
||||||
void operator=(const IntrinsicInst&); // DO NOT IMPLEMENT
|
void operator=(const IntrinsicInst&); // DO NOT IMPLEMENT
|
||||||
|
protected:
|
||||||
|
static void destroyThis(IntrinsicInst* v) {
|
||||||
|
CallInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// StripPointerCasts - This static method strips off any unneeded pointer
|
/// StripPointerCasts - This static method strips off any unneeded pointer
|
||||||
@ -85,6 +90,11 @@ namespace llvm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Value *StripCast(Value *C);
|
static Value *StripCast(Value *C);
|
||||||
|
protected:
|
||||||
|
static void destroyThis(DbgInfoIntrinsic* v) {
|
||||||
|
IntrinsicInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DbgStopPointInst - This represents the llvm.dbg.stoppoint instruction.
|
/// DbgStopPointInst - This represents the llvm.dbg.stoppoint instruction.
|
||||||
@ -114,6 +124,11 @@ namespace llvm {
|
|||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(DbgStopPointInst* v) {
|
||||||
|
DbgInfoIntrinsic::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DbgFuncStartInst - This represents the llvm.dbg.func.start instruction.
|
/// DbgFuncStartInst - This represents the llvm.dbg.func.start instruction.
|
||||||
@ -129,6 +144,11 @@ namespace llvm {
|
|||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(DbgFuncStartInst* v) {
|
||||||
|
DbgInfoIntrinsic::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DbgRegionStartInst - This represents the llvm.dbg.region.start
|
/// DbgRegionStartInst - This represents the llvm.dbg.region.start
|
||||||
@ -144,6 +164,11 @@ namespace llvm {
|
|||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(DbgRegionStartInst* v) {
|
||||||
|
DbgInfoIntrinsic::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// DbgRegionEndInst - This represents the llvm.dbg.region.end instruction.
|
/// DbgRegionEndInst - This represents the llvm.dbg.region.end instruction.
|
||||||
@ -175,6 +200,11 @@ namespace llvm {
|
|||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(DbgDeclareInst* v) {
|
||||||
|
DbgInfoIntrinsic::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// MemIntrinsic - This is the common base class for memset/memcpy/memmove.
|
/// MemIntrinsic - This is the common base class for memset/memcpy/memmove.
|
||||||
@ -228,6 +258,11 @@ namespace llvm {
|
|||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(MemIntrinsic* v) {
|
||||||
|
IntrinsicInst::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -259,6 +294,11 @@ namespace llvm {
|
|||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(MemCpyInst* v) {
|
||||||
|
MemIntrinsic::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// MemMoveInst - This class wraps the llvm.memmove intrinsic.
|
/// MemMoveInst - This class wraps the llvm.memmove intrinsic.
|
||||||
@ -288,6 +328,11 @@ namespace llvm {
|
|||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(MemMoveInst* v) {
|
||||||
|
MemIntrinsic::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// MemSetInst - This class wraps the llvm.memset intrinsic.
|
/// MemSetInst - This class wraps the llvm.memset intrinsic.
|
||||||
@ -312,6 +357,11 @@ namespace llvm {
|
|||||||
static inline bool classof(const Value *V) {
|
static inline bool classof(const Value *V) {
|
||||||
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
|
||||||
}
|
}
|
||||||
|
protected:
|
||||||
|
static void destroyThis(MemSetInst* v) {
|
||||||
|
MemIntrinsic::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,10 @@ protected:
|
|||||||
///
|
///
|
||||||
unsigned NumOperands;
|
unsigned NumOperands;
|
||||||
|
|
||||||
|
static void destroyThis(User*v) {
|
||||||
|
Value::destroyThis(v);
|
||||||
|
}
|
||||||
|
friend class Value;
|
||||||
public:
|
public:
|
||||||
User(const Type *Ty, unsigned vty, Use *OpList, unsigned NumOps)
|
User(const Type *Ty, unsigned vty, Use *OpList, unsigned NumOps)
|
||||||
: Value(Ty, vty), OperandList(OpList), NumOperands(NumOps) {}
|
: Value(Ty, vty), OperandList(OpList), NumOperands(NumOps) {}
|
||||||
|
@ -66,8 +66,11 @@ private:
|
|||||||
friend class SymbolTable; // Allow SymbolTable to directly poke Name.
|
friend class SymbolTable; // Allow SymbolTable to directly poke Name.
|
||||||
ValueName *Name;
|
ValueName *Name;
|
||||||
|
|
||||||
|
private:
|
||||||
void operator=(const Value &); // Do not implement
|
void operator=(const Value &); // Do not implement
|
||||||
Value(const Value &); // Do not implement
|
Value(const Value &); // Do not implement
|
||||||
|
protected:
|
||||||
|
static void destroyThis(Value*);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Value(const Type *Ty, unsigned scid);
|
Value(const Type *Ty, unsigned scid);
|
||||||
|
@ -30,31 +30,9 @@ ilist_traits<Instruction>::getSymTab(BasicBlock *BB) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DummyInst::DummyInst() : Instruction(Type::VoidTy, OtherOpsEnd, 0, 0) {
|
||||||
namespace {
|
// This should not be garbage monitored.
|
||||||
/// DummyInst - An instance of this class is used to mark the end of the
|
LeakDetector::removeGarbageObject(this);
|
||||||
/// instruction list. This is not a real instruction.
|
|
||||||
struct VISIBILITY_HIDDEN DummyInst : public Instruction {
|
|
||||||
DummyInst() : Instruction(Type::VoidTy, OtherOpsEnd, 0, 0) {
|
|
||||||
// This should not be garbage monitored.
|
|
||||||
LeakDetector::removeGarbageObject(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Instruction *clone() const {
|
|
||||||
assert(0 && "Cannot clone EOL");abort();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
const char *getOpcodeName() const { return "*end-of-list-inst*"; }
|
|
||||||
|
|
||||||
// Methods for support type inquiry through isa, cast, and dyn_cast...
|
|
||||||
static inline bool classof(const DummyInst *) { return true; }
|
|
||||||
static inline bool classof(const Instruction *I) {
|
|
||||||
return I->getOpcode() == OtherOpsEnd;
|
|
||||||
}
|
|
||||||
static inline bool classof(const Value *V) {
|
|
||||||
return isa<Instruction>(V) && classof(cast<Instruction>(V));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Instruction *ilist_traits<Instruction>::createSentinel() {
|
Instruction *ilist_traits<Instruction>::createSentinel() {
|
||||||
@ -88,10 +66,12 @@ BasicBlock::BasicBlock(const std::string &Name, Function *NewParent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BasicBlock::~BasicBlock() {
|
void BasicBlock::destroyThis(BasicBlock*v)
|
||||||
assert(getParent() == 0 && "BasicBlock still linked into the program!");
|
{
|
||||||
dropAllReferences();
|
assert(v->getParent() == 0 && "BasicBlock still linked into the program!");
|
||||||
InstList.clear();
|
v->dropAllReferences();
|
||||||
|
v->InstList.clear();
|
||||||
|
Value::destroyThis(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicBlock::setParent(Function *parent) {
|
void BasicBlock::setParent(Function *parent) {
|
||||||
|
@ -356,8 +356,9 @@ ConstantArray::ConstantArray(const ArrayType *T,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstantArray::~ConstantArray() {
|
void ConstantArray::destroyThis(ConstantArray*v) {
|
||||||
delete [] OperandList;
|
delete [] v->OperandList;
|
||||||
|
Constant::destroyThis(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstantStruct::ConstantStruct(const StructType *T,
|
ConstantStruct::ConstantStruct(const StructType *T,
|
||||||
@ -379,8 +380,9 @@ ConstantStruct::ConstantStruct(const StructType *T,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstantStruct::~ConstantStruct() {
|
void ConstantStruct::destroyThis(ConstantStruct*v) {
|
||||||
delete [] OperandList;
|
delete [] v->OperandList;
|
||||||
|
Constant::destroyThis(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -399,124 +401,67 @@ ConstantVector::ConstantVector(const VectorType *T,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConstantVector::~ConstantVector() {
|
void ConstantVector::destroyThis(ConstantVector*v) {
|
||||||
delete [] OperandList;
|
delete [] v->OperandList;
|
||||||
|
Constant::destroyThis(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We declare several classes private to this file, so use an anonymous
|
UnaryConstantExpr::UnaryConstantExpr(unsigned Opcode,
|
||||||
// namespace
|
Constant *C, const Type *Ty)
|
||||||
namespace {
|
: ConstantExpr(Ty, Opcode, &Op, 1), Op(C, this) {
|
||||||
|
}
|
||||||
|
|
||||||
/// UnaryConstantExpr - This class is private to Constants.cpp, and is used
|
SelectConstantExpr::SelectConstantExpr(Constant *C1,
|
||||||
/// behind the scenes to implement unary constant exprs.
|
Constant *C2, Constant *C3)
|
||||||
class VISIBILITY_HIDDEN UnaryConstantExpr : public ConstantExpr {
|
: ConstantExpr(C2->getType(), Instruction::Select, Ops, 3) {
|
||||||
Use Op;
|
Ops[0].init(C1, this);
|
||||||
public:
|
Ops[1].init(C2, this);
|
||||||
UnaryConstantExpr(unsigned Opcode, Constant *C, const Type *Ty)
|
Ops[2].init(C3, this);
|
||||||
: ConstantExpr(Ty, Opcode, &Op, 1), Op(C, this) {}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
/// BinaryConstantExpr - This class is private to Constants.cpp, and is used
|
ExtractElementConstantExpr::ExtractElementConstantExpr(Constant *C1,
|
||||||
/// behind the scenes to implement binary constant exprs.
|
Constant *C2)
|
||||||
class VISIBILITY_HIDDEN BinaryConstantExpr : public ConstantExpr {
|
: ConstantExpr(cast<VectorType>(C1->getType())->getElementType(),
|
||||||
Use Ops[2];
|
Instruction::ExtractElement, Ops, 2) {
|
||||||
public:
|
Ops[0].init(C1, this);
|
||||||
BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2)
|
Ops[1].init(C2, this);
|
||||||
: ConstantExpr(C1->getType(), Opcode, Ops, 2) {
|
}
|
||||||
Ops[0].init(C1, this);
|
|
||||||
Ops[1].init(C2, this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// SelectConstantExpr - This class is private to Constants.cpp, and is used
|
InsertElementConstantExpr::InsertElementConstantExpr(Constant *C1,
|
||||||
/// behind the scenes to implement select constant exprs.
|
Constant *C2,
|
||||||
class VISIBILITY_HIDDEN SelectConstantExpr : public ConstantExpr {
|
Constant *C3)
|
||||||
Use Ops[3];
|
: ConstantExpr(C1->getType(), Instruction::InsertElement, Ops, 3) {
|
||||||
public:
|
Ops[0].init(C1, this);
|
||||||
SelectConstantExpr(Constant *C1, Constant *C2, Constant *C3)
|
Ops[1].init(C2, this);
|
||||||
: ConstantExpr(C2->getType(), Instruction::Select, Ops, 3) {
|
Ops[2].init(C3, this);
|
||||||
Ops[0].init(C1, this);
|
}
|
||||||
Ops[1].init(C2, this);
|
|
||||||
Ops[2].init(C3, this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// ExtractElementConstantExpr - This class is private to
|
ShuffleVectorConstantExpr::ShuffleVectorConstantExpr(Constant *C1,
|
||||||
/// Constants.cpp, and is used behind the scenes to implement
|
Constant *C2,
|
||||||
/// extractelement constant exprs.
|
Constant *C3)
|
||||||
class VISIBILITY_HIDDEN ExtractElementConstantExpr : public ConstantExpr {
|
: ConstantExpr(C1->getType(), Instruction::ShuffleVector, Ops, 3) {
|
||||||
Use Ops[2];
|
Ops[0].init(C1, this);
|
||||||
public:
|
Ops[1].init(C2, this);
|
||||||
ExtractElementConstantExpr(Constant *C1, Constant *C2)
|
Ops[2].init(C3, this);
|
||||||
: ConstantExpr(cast<VectorType>(C1->getType())->getElementType(),
|
}
|
||||||
Instruction::ExtractElement, Ops, 2) {
|
|
||||||
Ops[0].init(C1, this);
|
|
||||||
Ops[1].init(C2, this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// InsertElementConstantExpr - This class is private to
|
CompareConstantExpr::CompareConstantExpr(unsigned opc, unsigned short pred,
|
||||||
/// Constants.cpp, and is used behind the scenes to implement
|
Constant* LHS, Constant* RHS)
|
||||||
/// insertelement constant exprs.
|
: ConstantExpr(Type::Int1Ty, opc, Ops, 2), predicate(pred) {
|
||||||
class VISIBILITY_HIDDEN InsertElementConstantExpr : public ConstantExpr {
|
OperandList[0].init(LHS, this);
|
||||||
Use Ops[3];
|
OperandList[1].init(RHS, this);
|
||||||
public:
|
}
|
||||||
InsertElementConstantExpr(Constant *C1, Constant *C2, Constant *C3)
|
|
||||||
: ConstantExpr(C1->getType(), Instruction::InsertElement,
|
|
||||||
Ops, 3) {
|
|
||||||
Ops[0].init(C1, this);
|
|
||||||
Ops[1].init(C2, this);
|
|
||||||
Ops[2].init(C3, this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// ShuffleVectorConstantExpr - This class is private to
|
|
||||||
/// Constants.cpp, and is used behind the scenes to implement
|
|
||||||
/// shufflevector constant exprs.
|
|
||||||
class VISIBILITY_HIDDEN ShuffleVectorConstantExpr : public ConstantExpr {
|
|
||||||
Use Ops[3];
|
|
||||||
public:
|
|
||||||
ShuffleVectorConstantExpr(Constant *C1, Constant *C2, Constant *C3)
|
|
||||||
: ConstantExpr(C1->getType(), Instruction::ShuffleVector,
|
|
||||||
Ops, 3) {
|
|
||||||
Ops[0].init(C1, this);
|
|
||||||
Ops[1].init(C2, this);
|
|
||||||
Ops[2].init(C3, this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// GetElementPtrConstantExpr - This class is private to Constants.cpp, and is
|
|
||||||
/// used behind the scenes to implement getelementpr constant exprs.
|
|
||||||
struct VISIBILITY_HIDDEN GetElementPtrConstantExpr : public ConstantExpr {
|
|
||||||
GetElementPtrConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
|
|
||||||
const Type *DestTy)
|
|
||||||
: ConstantExpr(DestTy, Instruction::GetElementPtr,
|
|
||||||
new Use[IdxList.size()+1], IdxList.size()+1) {
|
|
||||||
OperandList[0].init(C, this);
|
|
||||||
for (unsigned i = 0, E = IdxList.size(); i != E; ++i)
|
|
||||||
OperandList[i+1].init(IdxList[i], this);
|
|
||||||
}
|
|
||||||
~GetElementPtrConstantExpr() {
|
|
||||||
delete [] OperandList;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// CompareConstantExpr - This class is private to Constants.cpp, and is used
|
|
||||||
// behind the scenes to implement ICmp and FCmp constant expressions. This is
|
|
||||||
// needed in order to store the predicate value for these instructions.
|
|
||||||
struct VISIBILITY_HIDDEN CompareConstantExpr : public ConstantExpr {
|
|
||||||
unsigned short predicate;
|
|
||||||
Use Ops[2];
|
|
||||||
CompareConstantExpr(Instruction::OtherOps opc, unsigned short pred,
|
|
||||||
Constant* LHS, Constant* RHS)
|
|
||||||
: ConstantExpr(Type::Int1Ty, opc, Ops, 2), predicate(pred) {
|
|
||||||
OperandList[0].init(LHS, this);
|
|
||||||
OperandList[1].init(RHS, this);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end anonymous namespace
|
|
||||||
|
|
||||||
|
GetElementPtrConstantExpr::GetElementPtrConstantExpr(Constant *C,
|
||||||
|
const std::vector<Constant*>
|
||||||
|
&IdxList, const Type *DestTy)
|
||||||
|
: ConstantExpr(DestTy, Instruction::GetElementPtr,
|
||||||
|
new Use[IdxList.size()+1], IdxList.size()+1)
|
||||||
|
{
|
||||||
|
OperandList[0].init(C, this);
|
||||||
|
for (unsigned i = 0, E = IdxList.size(); i != E; ++i)
|
||||||
|
OperandList[i+1].init(IdxList[i], this);
|
||||||
|
}
|
||||||
|
|
||||||
// Utility function for determining if a ConstantExpr is a CastOp or not. This
|
// Utility function for determining if a ConstantExpr is a CastOp or not. This
|
||||||
// can't be inline because we don't want to #include Instruction.h into
|
// can't be inline because we don't want to #include Instruction.h into
|
||||||
|
@ -287,16 +287,17 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage,
|
|||||||
ParentModule->getFunctionList().push_back(this);
|
ParentModule->getFunctionList().push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Function::~Function() {
|
void Function::destroyThis(Function*v) {
|
||||||
dropAllReferences(); // After this it is safe to delete instructions.
|
v->dropAllReferences(); // After this it is safe to delete instructions.
|
||||||
|
|
||||||
// Delete all of the method arguments and unlink from symbol table...
|
// Delete all of the method arguments and unlink from symbol table...
|
||||||
ArgumentList.clear();
|
v->ArgumentList.clear();
|
||||||
delete SymTab;
|
delete v->SymTab;
|
||||||
|
|
||||||
// Drop our reference to the parameter attributes, if any.
|
// Drop our reference to the parameter attributes, if any.
|
||||||
if (ParamAttrs)
|
if (v->ParamAttrs)
|
||||||
ParamAttrs->dropRef();
|
v->ParamAttrs->dropRef();
|
||||||
|
GlobalValue::destroyThis(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Function::BuildLazyArguments() const {
|
void Function::BuildLazyArguments() const {
|
||||||
|
@ -17,12 +17,6 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// Implement the first virtual method in this class in this file so the
|
|
||||||
// InlineAsm vtable is emitted here.
|
|
||||||
InlineAsm::~InlineAsm() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// NOTE: when memoizing the function type, we have to be careful to handle the
|
// NOTE: when memoizing the function type, we have to be careful to handle the
|
||||||
// case when the type gets refined.
|
// case when the type gets refined.
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ Instruction::Instruction(const Type *ty, unsigned it, Use *Ops, unsigned NumOps,
|
|||||||
|
|
||||||
|
|
||||||
// Out of line virtual method, so the vtable, etc has a home.
|
// Out of line virtual method, so the vtable, etc has a home.
|
||||||
Instruction::~Instruction() {
|
void Instruction::destroyThis(Instruction*v) {
|
||||||
assert(Parent == 0 && "Instruction still linked in the program!");
|
assert(v->Parent == 0 && "Instruction still linked in the program!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,20 +67,6 @@ bool CallSite::onlyReadsMemory() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
// TerminatorInst Class
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
// Out of line virtual method, so the vtable, etc has a home.
|
|
||||||
TerminatorInst::~TerminatorInst() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// Out of line virtual method, so the vtable, etc has a home.
|
|
||||||
UnaryInstruction::~UnaryInstruction() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// PHINode Class
|
// PHINode Class
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -96,8 +82,9 @@ PHINode::PHINode(const PHINode &PN)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PHINode::~PHINode() {
|
void PHINode::destroyThis(PHINode*v) {
|
||||||
delete [] OperandList;
|
delete [] v->OperandList;
|
||||||
|
Instruction::destroyThis(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
// removeIncomingValue - Remove an incoming value. This is useful if a
|
// removeIncomingValue - Remove an incoming value. This is useful if a
|
||||||
@ -214,10 +201,11 @@ Value *PHINode::hasConstantValue(bool AllowNonDominatingInstruction) const {
|
|||||||
// CallInst Implementation
|
// CallInst Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
CallInst::~CallInst() {
|
void CallInst::destroyThis(CallInst*v) {
|
||||||
delete [] OperandList;
|
delete [] v->OperandList;
|
||||||
if (ParamAttrs)
|
if (v->ParamAttrs)
|
||||||
ParamAttrs->dropRef();
|
v->ParamAttrs->dropRef();
|
||||||
|
Instruction::destroyThis(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) {
|
void CallInst::init(Value *Func, Value* const *Params, unsigned NumParams) {
|
||||||
@ -406,10 +394,11 @@ bool CallInst::paramHasAttr(uint16_t i, ParameterAttributes attr) const {
|
|||||||
// InvokeInst Implementation
|
// InvokeInst Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
InvokeInst::~InvokeInst() {
|
void InvokeInst::destroyThis(InvokeInst*v) {
|
||||||
delete [] OperandList;
|
delete [] v->OperandList;
|
||||||
if (ParamAttrs)
|
if (v->ParamAttrs)
|
||||||
ParamAttrs->dropRef();
|
v->ParamAttrs->dropRef();
|
||||||
|
TerminatorInst::destroyThis(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
void InvokeInst::init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
|
||||||
@ -683,10 +672,6 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
|||||||
setName(Name);
|
setName(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Out of line virtual method, so the vtable, etc has a home.
|
|
||||||
AllocationInst::~AllocationInst() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AllocationInst::isArrayAllocation() const {
|
bool AllocationInst::isArrayAllocation() const {
|
||||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(getOperand(0)))
|
if (ConstantInt *CI = dyn_cast<ConstantInt>(getOperand(0)))
|
||||||
return CI->getZExtValue() != 1;
|
return CI->getZExtValue() != 1;
|
||||||
@ -951,8 +936,8 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
|
|||||||
setName(Name);
|
setName(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetElementPtrInst::~GetElementPtrInst() {
|
void GetElementPtrInst::destroyThis(GetElementPtrInst*v) {
|
||||||
delete[] OperandList;
|
delete[] v->OperandList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// getIndexedType - Returns the type of the element that would be loaded with
|
// getIndexedType - Returns the type of the element that would be loaded with
|
||||||
@ -2469,8 +2454,9 @@ SwitchInst::SwitchInst(const SwitchInst &SI)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SwitchInst::~SwitchInst() {
|
void SwitchInst::destroyThis(SwitchInst*v) {
|
||||||
delete [] OperandList;
|
delete [] v->OperandList;
|
||||||
|
TerminatorInst::destroyThis(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,6 +18,11 @@
|
|||||||
#include "llvm/ValueSymbolTable.h"
|
#include "llvm/ValueSymbolTable.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/LeakDetector.h"
|
#include "llvm/Support/LeakDetector.h"
|
||||||
|
#include "llvm/Constants.h"
|
||||||
|
#include "llvm/InlineAsm.h"
|
||||||
|
#include "llvm/Instructions.h"
|
||||||
|
#include "llvm/IntrinsicInst.h"
|
||||||
|
#include "llvm/InstrTypes.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -39,7 +44,233 @@ Value::Value(const Type *ty, unsigned scid)
|
|||||||
"Cannot create non-first-class values except for constants!");
|
"Cannot create non-first-class values except for constants!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Value::~Value() {
|
Value::~Value()
|
||||||
|
{
|
||||||
|
switch(SubclassID)
|
||||||
|
{
|
||||||
|
case ArgumentVal:
|
||||||
|
Argument::destroyThis(cast<Argument>(this));
|
||||||
|
break;
|
||||||
|
case BasicBlockVal:
|
||||||
|
BasicBlock::destroyThis(cast<BasicBlock>(this));
|
||||||
|
break;
|
||||||
|
case FunctionVal:
|
||||||
|
Function::destroyThis(cast<Function>(this));
|
||||||
|
break;
|
||||||
|
case GlobalAliasVal:
|
||||||
|
GlobalAlias::destroyThis(cast<GlobalAlias>(this));
|
||||||
|
break;
|
||||||
|
case GlobalVariableVal:
|
||||||
|
GlobalVariable::destroyThis(cast<GlobalVariable>(this));
|
||||||
|
break;
|
||||||
|
case UndefValueVal:
|
||||||
|
UndefValue::destroyThis(cast<UndefValue>(this));
|
||||||
|
break;
|
||||||
|
case ConstantExprVal:
|
||||||
|
{
|
||||||
|
ConstantExpr* CE = dyn_cast<ConstantExpr>(this);
|
||||||
|
if(CE->getOpcode() == Instruction::GetElementPtr)
|
||||||
|
{
|
||||||
|
GetElementPtrConstantExpr* GECE =
|
||||||
|
dyn_cast<GetElementPtrConstantExpr>(CE);
|
||||||
|
GetElementPtrConstantExpr::destroyThis(GECE);
|
||||||
|
}
|
||||||
|
else if(CE->getOpcode() == Instruction::ExtractElement)
|
||||||
|
{
|
||||||
|
ExtractElementConstantExpr* EECE =
|
||||||
|
dyn_cast<ExtractElementConstantExpr>(CE);
|
||||||
|
ExtractElementConstantExpr::destroyThis(EECE);
|
||||||
|
}
|
||||||
|
else if(CE->getOpcode() == Instruction::InsertElement)
|
||||||
|
{
|
||||||
|
InsertElementConstantExpr* IECE =
|
||||||
|
dyn_cast<InsertElementConstantExpr>(CE);
|
||||||
|
InsertElementConstantExpr::destroyThis(IECE);
|
||||||
|
}
|
||||||
|
else if(CE->getOpcode() == Instruction::Select)
|
||||||
|
{
|
||||||
|
SelectConstantExpr* SCE = dyn_cast<SelectConstantExpr>(CE);
|
||||||
|
SelectConstantExpr::destroyThis(SCE);
|
||||||
|
}
|
||||||
|
else if(CE->getOpcode() == Instruction::ShuffleVector)
|
||||||
|
{
|
||||||
|
ShuffleVectorConstantExpr* SVCE =
|
||||||
|
dyn_cast<ShuffleVectorConstantExpr>(CE);
|
||||||
|
ShuffleVectorConstantExpr::destroyThis(SVCE);
|
||||||
|
}
|
||||||
|
else if(BinaryConstantExpr* BCE = dyn_cast<BinaryConstantExpr>(this))
|
||||||
|
BinaryConstantExpr::destroyThis(BCE);
|
||||||
|
else if(UnaryConstantExpr* UCE = dyn_cast<UnaryConstantExpr>(this))
|
||||||
|
UnaryConstantExpr::destroyThis(UCE);
|
||||||
|
else if(CompareConstantExpr* CCE = dyn_cast<CompareConstantExpr>(this))
|
||||||
|
CompareConstantExpr::destroyThis(CCE);
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown ConstantExpr-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ConstantAggregateZeroVal:
|
||||||
|
ConstantAggregateZero::destroyThis(cast<ConstantAggregateZero>(this));
|
||||||
|
break;
|
||||||
|
case ConstantIntVal:
|
||||||
|
ConstantInt::destroyThis(cast<ConstantInt>(this));
|
||||||
|
break;
|
||||||
|
case ConstantFPVal:
|
||||||
|
ConstantFP::destroyThis(cast<ConstantFP>(this));
|
||||||
|
break;
|
||||||
|
case ConstantArrayVal:
|
||||||
|
ConstantArray::destroyThis(cast<ConstantArray>(this));
|
||||||
|
break;
|
||||||
|
case ConstantStructVal:
|
||||||
|
ConstantStruct::destroyThis(cast<ConstantStruct>(this));
|
||||||
|
break;
|
||||||
|
case ConstantVectorVal:
|
||||||
|
ConstantVector::destroyThis(cast<ConstantVector>(this));
|
||||||
|
break;
|
||||||
|
case ConstantPointerNullVal:
|
||||||
|
ConstantPointerNull::destroyThis(cast<ConstantPointerNull>(this));
|
||||||
|
break;
|
||||||
|
case InlineAsmVal:
|
||||||
|
InlineAsm::destroyThis(cast<InlineAsm>(this));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(this))
|
||||||
|
BinaryOperator::destroyThis(BO);
|
||||||
|
else if (CallInst *CI = dyn_cast<CallInst>(this))
|
||||||
|
{
|
||||||
|
if(IntrinsicInst* II = dyn_cast<IntrinsicInst>(this))
|
||||||
|
{
|
||||||
|
if(DbgInfoIntrinsic* DII = dyn_cast<DbgInfoIntrinsic>(this))
|
||||||
|
{
|
||||||
|
if(DbgDeclareInst* DDI = dyn_cast<DbgDeclareInst>(this))
|
||||||
|
DbgDeclareInst::destroyThis(DDI);
|
||||||
|
else if(DbgFuncStartInst* DFSI = dyn_cast<DbgFuncStartInst>(this))
|
||||||
|
DbgFuncStartInst::destroyThis(DFSI);
|
||||||
|
else if(DbgRegionEndInst* DREI = dyn_cast<DbgRegionEndInst>(this))
|
||||||
|
DbgRegionEndInst::destroyThis(DREI);
|
||||||
|
else if(DbgRegionStartInst* DRSI = dyn_cast<DbgRegionStartInst>(this))
|
||||||
|
DbgRegionStartInst::destroyThis(DRSI);
|
||||||
|
else if(DbgStopPointInst* DSPI = dyn_cast<DbgStopPointInst>(this))
|
||||||
|
DbgStopPointInst::destroyThis(DSPI);
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown DbgInfo-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
else if(MemIntrinsic* MI = dyn_cast<MemIntrinsic>(this))
|
||||||
|
{
|
||||||
|
if(MemCpyInst* MCI = dyn_cast<MemCpyInst>(this))
|
||||||
|
MemCpyInst::destroyThis(MCI);
|
||||||
|
else if(MemMoveInst* MMI = dyn_cast<MemMoveInst>(this))
|
||||||
|
MemMoveInst::destroyThis(MMI);
|
||||||
|
else if(MemSetInst* MSI = dyn_cast<MemSetInst>(this))
|
||||||
|
MemSetInst::destroyThis(MSI);
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown MemIntrinsic-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown IntrinsicInst-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown CallInst-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
else if (CmpInst *CI = dyn_cast<CmpInst>(this))
|
||||||
|
{
|
||||||
|
if (FCmpInst *FCI = dyn_cast<FCmpInst>(this))
|
||||||
|
FCmpInst::destroyThis(FCI);
|
||||||
|
else if (ICmpInst *ICI = dyn_cast<ICmpInst>(this))
|
||||||
|
ICmpInst::destroyThis(ICI);
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown CmpInst-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
else if (ExtractElementInst *EEI = dyn_cast<ExtractElementInst>(this))
|
||||||
|
ExtractElementInst::destroyThis(EEI);
|
||||||
|
else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(this))
|
||||||
|
GetElementPtrInst::destroyThis(GEP);
|
||||||
|
else if (InsertElementInst* IE = dyn_cast<InsertElementInst>(this))
|
||||||
|
InsertElementInst::destroyThis(IE);
|
||||||
|
else if (PHINode *PN = dyn_cast<PHINode>(this))
|
||||||
|
PHINode::destroyThis(PN);
|
||||||
|
else if (SelectInst *SI = dyn_cast<SelectInst>(this))
|
||||||
|
SelectInst::destroyThis(SI);
|
||||||
|
else if (ShuffleVectorInst *SVI = dyn_cast<ShuffleVectorInst>(this))
|
||||||
|
ShuffleVectorInst::destroyThis(SVI);
|
||||||
|
else if (StoreInst *SI = dyn_cast<StoreInst>(this))
|
||||||
|
StoreInst::destroyThis(SI);
|
||||||
|
else if (TerminatorInst *TI = dyn_cast<TerminatorInst>(this))
|
||||||
|
{
|
||||||
|
if (BranchInst* BI = dyn_cast<BranchInst>(this))
|
||||||
|
BranchInst::destroyThis(BI);
|
||||||
|
else if (InvokeInst* II = dyn_cast<InvokeInst>(this))
|
||||||
|
InvokeInst::destroyThis(II);
|
||||||
|
else if (ReturnInst* RI = dyn_cast<ReturnInst>(this))
|
||||||
|
ReturnInst::destroyThis(RI);
|
||||||
|
else if (SwitchInst *SI = dyn_cast<SwitchInst>(this))
|
||||||
|
SwitchInst::destroyThis(SI);
|
||||||
|
else if (UnreachableInst *UI = dyn_cast<UnreachableInst>(this))
|
||||||
|
UnreachableInst::destroyThis(UI);
|
||||||
|
else if (UnwindInst *UI = dyn_cast<UnwindInst>(this))
|
||||||
|
UnwindInst::destroyThis(UI);
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown TerminatorInst-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
else if(UnaryInstruction* UI = dyn_cast<UnaryInstruction>(this))
|
||||||
|
{
|
||||||
|
if(AllocationInst* AI = dyn_cast<AllocationInst>(this))
|
||||||
|
{
|
||||||
|
if(AllocaInst* AI = dyn_cast<AllocaInst>(this))
|
||||||
|
AllocaInst::destroyThis(AI);
|
||||||
|
else if(MallocInst* MI = dyn_cast<MallocInst>(this))
|
||||||
|
MallocInst::destroyThis(MI);
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown AllocationInst-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
else if(CastInst* CI = dyn_cast<CastInst>(this))
|
||||||
|
{
|
||||||
|
if(BitCastInst* BCI = dyn_cast<BitCastInst>(this))
|
||||||
|
BitCastInst::destroyThis(BCI);
|
||||||
|
else if(FPExtInst* FPEI = dyn_cast<FPExtInst>(this))
|
||||||
|
FPExtInst::destroyThis(FPEI);
|
||||||
|
else if(FPToSIInst* FPSII = dyn_cast<FPToSIInst>(this))
|
||||||
|
FPToSIInst::destroyThis(FPSII);
|
||||||
|
else if(FPToUIInst* FPUII = dyn_cast<FPToUIInst>(this))
|
||||||
|
FPToUIInst::destroyThis(FPUII);
|
||||||
|
else if(FPTruncInst* FPTI = dyn_cast<FPTruncInst>(this))
|
||||||
|
FPTruncInst::destroyThis(FPTI);
|
||||||
|
else if(IntToPtrInst* I2PI = dyn_cast<IntToPtrInst>(this))
|
||||||
|
IntToPtrInst::destroyThis(I2PI);
|
||||||
|
else if(PtrToIntInst* P2II = dyn_cast<PtrToIntInst>(this))
|
||||||
|
PtrToIntInst::destroyThis(P2II);
|
||||||
|
else if(SExtInst* SEI = dyn_cast<SExtInst>(this))
|
||||||
|
SExtInst::destroyThis(SEI);
|
||||||
|
else if(SIToFPInst* SIFPI = dyn_cast<SIToFPInst>(this))
|
||||||
|
SIToFPInst::destroyThis(SIFPI);
|
||||||
|
else if(TruncInst* TI = dyn_cast<TruncInst>(this))
|
||||||
|
TruncInst::destroyThis(TI);
|
||||||
|
else if(UIToFPInst* UIFPI = dyn_cast<UIToFPInst>(this))
|
||||||
|
UIToFPInst::destroyThis(UIFPI);
|
||||||
|
else if(ZExtInst* ZEI = dyn_cast<ZExtInst>(this))
|
||||||
|
ZExtInst::destroyThis(ZEI);
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown CastInst-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
else if(FreeInst* FI = dyn_cast<FreeInst>(this))
|
||||||
|
FreeInst::destroyThis(FI);
|
||||||
|
else if(LoadInst* LI = dyn_cast<LoadInst>(this))
|
||||||
|
LoadInst::destroyThis(LI);
|
||||||
|
else if(VAArgInst* VAI = dyn_cast<VAArgInst>(this))
|
||||||
|
VAArgInst::destroyThis(VAI);
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown UnaryInstruction-inherited class in ~Value.");
|
||||||
|
}
|
||||||
|
else if (DummyInst *DI = dyn_cast<DummyInst>(this))
|
||||||
|
DummyInst::destroyThis(DI);
|
||||||
|
else
|
||||||
|
assert(0 && "Unknown Instruction-inherited class in ~Value.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Value::destroyThis(Value*v)
|
||||||
|
{
|
||||||
#ifndef NDEBUG // Only in -g mode...
|
#ifndef NDEBUG // Only in -g mode...
|
||||||
// Check to make sure that there are no uses of this value that are still
|
// Check to make sure that there are no uses of this value that are still
|
||||||
// around when the value is destroyed. If there are, then we have a dangling
|
// around when the value is destroyed. If there are, then we have a dangling
|
||||||
@ -47,22 +278,22 @@ Value::~Value() {
|
|||||||
// still being referenced. The value in question should be printed as
|
// still being referenced. The value in question should be printed as
|
||||||
// a <badref>
|
// a <badref>
|
||||||
//
|
//
|
||||||
if (!use_empty()) {
|
if (!v->use_empty()) {
|
||||||
DOUT << "While deleting: " << *Ty << " %" << Name << "\n";
|
DOUT << "While deleting: " << *v->Ty << " %" << v->Name << "\n";
|
||||||
for (use_iterator I = use_begin(), E = use_end(); I != E; ++I)
|
for (use_iterator I = v->use_begin(), E = v->use_end(); I != E; ++I)
|
||||||
DOUT << "Use still stuck around after Def is destroyed:"
|
DOUT << "Use still stuck around after Def is destroyed:"
|
||||||
<< **I << "\n";
|
<< **I << "\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
assert(use_empty() && "Uses remain when a value is destroyed!");
|
assert(v->use_empty() && "Uses remain when a value is destroyed!");
|
||||||
|
|
||||||
// If this value is named, destroy the name. This should not be in a symtab
|
// If this value is named, destroy the name. This should not be in a symtab
|
||||||
// at this point.
|
// at this point.
|
||||||
if (Name)
|
if (v->Name)
|
||||||
Name->Destroy();
|
v->Name->Destroy();
|
||||||
|
|
||||||
// There should be no uses of this object anymore, remove it.
|
// There should be no uses of this object anymore, remove it.
|
||||||
LeakDetector::removeGarbageObject(this);
|
LeakDetector::removeGarbageObject(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// hasNUses - Return true if this Value has exactly N users.
|
/// hasNUses - Return true if this Value has exactly N users.
|
||||||
|
Reference in New Issue
Block a user