ConstantAggregateZero(const ConstantAggregateZero &); // DO NOT IMPLEMENT
protected:
ConstantAggregateZero(const Type *Ty)
- : Constant(Ty, ConstantAggregateZeroVal) {}
+ : Constant(Ty, ConstantAggregateZeroVal, 0, 0) {}
public:
/// get() - static factory method for creating a null aggregate. It is
/// illegal to call this method with a non-aggregate type.
ConstantArray(const ConstantArray &); // DO NOT IMPLEMENT
protected:
ConstantArray(const ArrayType *T, const std::vector<Constant*> &Val);
+ ~ConstantArray();
public:
/// get() - Static factory methods - Return objects of the specified value
static Constant *get(const ArrayType *T, const std::vector<Constant*> &);
ConstantStruct(const ConstantStruct &); // DO NOT IMPLEMENT
protected:
ConstantStruct(const StructType *T, const std::vector<Constant*> &Val);
+ ~ConstantStruct();
public:
/// get() - Static factory methods - Return objects of the specified value
///
ConstantPacked(const ConstantPacked &); // DO NOT IMPLEMENT
protected:
ConstantPacked(const PackedType *T, const std::vector<Constant*> &Val);
+ ~ConstantPacked();
public:
/// get() - Static factory methods - Return objects of the specified value
static Constant *get(const PackedType *T, const std::vector<Constant*> &);
ConstantPointerNull(const ConstantPointerNull &); // DO NOT IMPLEMENT
protected:
ConstantPointerNull(const PointerType *T)
- : Constant(reinterpret_cast<const Type*>(T)) {}
+ : Constant(reinterpret_cast<const Type*>(T),
+ Value::SimpleConstantVal, 0, 0) {}
public:
friend struct ConvertConstantType<ConstantExpr, Type>;
protected:
- // Cast creation ctor
- ConstantExpr(unsigned Opcode, Constant *C, const Type *Ty);
- // Binary/Shift instruction creation ctor
- ConstantExpr(unsigned Opcode, Constant *C1, Constant *C2);
+ ConstantExpr(const Type *Ty, unsigned Opcode, Use *Ops, unsigned NumOps)
+ : Constant(Ty, ConstantExprVal, Ops, NumOps), iType(Opcode) {}
+
// Select instruction creation ctor
ConstantExpr(Constant *C, Constant *V1, Constant *V2);
// GEP instruction creation ctor
friend struct ConstantCreator<UndefValue, Type, char>;
UndefValue(const UndefValue &); // DO NOT IMPLEMENT
protected:
- UndefValue(const Type *T) : Constant(T, UndefValueVal) {}
+ UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {}
public:
/// get() - Static factory methods - Return an 'undef' object of the specified
/// type.
GhostLinkage // Stand-in functions for streaming fns from BC files
};
protected:
- GlobalValue(const Type *Ty, ValueTy vty, LinkageTypes linkage,
- const std::string &name = "")
- : Constant(Ty, vty, name), Linkage(linkage), Parent(0) { }
+ GlobalValue(const Type *Ty, ValueTy vty, Use *Ops, unsigned NumOps,
+ LinkageTypes linkage, const std::string &name = "")
+ : Constant(Ty, vty, Ops, NumOps, name), Linkage(linkage), Parent(0) { }
LinkageTypes Linkage; // The linkage of this global
Module *Parent;
void setPrev(GlobalVariable *N) { Prev = N; }
bool isConstantGlobal; // Is this a global constant?
+ Use Initializer;
+
public:
/// GlobalVariable ctor - If a parent module is specified, the global is
/// automatically inserted into the end of the specified modules global list.
/// global variable is defined in some other translation unit, and is thus
/// externally defined here.
///
- virtual bool isExternal() const { return Operands.empty(); }
+ virtual bool isExternal() const { return getNumOperands() == 0; }
/// hasInitializer - Unless a global variable isExternal(), it has an
/// initializer. The initializer for the global variable/constant is held by
- /// Operands[0] if an initializer is specified.
+ /// Initializer if an initializer is specified.
///
inline bool hasInitializer() const { return !isExternal(); }
///
inline Constant *getInitializer() const {
assert(hasInitializer() && "GV doesn't have initializer!");
- return reinterpret_cast<Constant*>(Operands[0].get());
+ return reinterpret_cast<Constant*>(Initializer.get());
}
inline Constant *getInitializer() {
assert(hasInitializer() && "GV doesn't have initializer!");
- return reinterpret_cast<Constant*>(Operands[0].get());
+ return reinterpret_cast<Constant*>(Initializer.get());
}
inline void setInitializer(Constant *CPV) {
if (CPV == 0) {
- if (hasInitializer()) Operands.pop_back();
+ if (hasInitializer()) {
+ Initializer.set(0);
+ NumOperands = 0;
+ }
} else {
- if (!hasInitializer()) Operands.push_back(Use(0, this));
- Operands[0] = reinterpret_cast<Value*>(CPV);
+ if (!hasInitializer())
+ NumOperands = 1;
+ Initializer.set(CPV);
}
}
friend class SymbolTableListTraits<Instruction, BasicBlock, Function,
ilist_traits<Instruction> >;
void setParent(BasicBlock *P);
- void init();
private:
// FIXME: This is a dirty hack. Setcc instructions shouldn't encode the CC
void setOpcode(unsigned NewOpcode);
friend class BinaryOperator;
protected:
- Instruction(const Type *Ty, unsigned iType, const std::string &Name = "",
+ Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
+ const std::string &Name = "",
Instruction *InsertBefore = 0);
- Instruction(const Type *Ty, unsigned iType, const std::string &Name,
- BasicBlock *InsertAtEnd);
+ Instruction(const Type *Ty, unsigned iType, Use *Ops, unsigned NumOps,
+ const std::string &Name, BasicBlock *InsertAtEnd);
public:
~Instruction() {