[llvm-commits] CVS: llvm/include/llvm/Constants.h GlobalValue.h GlobalVariable.h
Chris Lattner
lattner at cs.uiuc.edu
Fri Jan 28 16:33:13 PST 2005
Changes in directory llvm/include/llvm:
Constants.h updated: 1.66 -> 1.67
GlobalValue.h updated: 1.20 -> 1.21
GlobalVariable.h updated: 1.29 -> 1.30
---
Log message:
Adjust to changes in the User class.
---
Diffs of the changes: (+26 -17)
Constants.h | 17 ++++++++++-------
GlobalValue.h | 6 +++---
GlobalVariable.h | 20 +++++++++++++-------
3 files changed, 26 insertions(+), 17 deletions(-)
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.66 llvm/include/llvm/Constants.h:1.67
--- llvm/include/llvm/Constants.h:1.66 Mon Dec 13 13:48:47 2004
+++ llvm/include/llvm/Constants.h Fri Jan 28 18:32:29 2005
@@ -319,7 +319,7 @@
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.
@@ -351,6 +351,7 @@
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*> &);
@@ -399,6 +400,7 @@
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
///
@@ -439,6 +441,7 @@
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*> &);
@@ -476,7 +479,8 @@
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:
@@ -518,10 +522,9 @@
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
@@ -642,7 +645,7 @@
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.
Index: llvm/include/llvm/GlobalValue.h
diff -u llvm/include/llvm/GlobalValue.h:1.20 llvm/include/llvm/GlobalValue.h:1.21
--- llvm/include/llvm/GlobalValue.h:1.20 Mon Nov 15 17:20:19 2004
+++ llvm/include/llvm/GlobalValue.h Fri Jan 28 18:32:30 2005
@@ -36,9 +36,9 @@
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;
Index: llvm/include/llvm/GlobalVariable.h
diff -u llvm/include/llvm/GlobalVariable.h:1.29 llvm/include/llvm/GlobalVariable.h:1.30
--- llvm/include/llvm/GlobalVariable.h:1.29 Mon Oct 11 17:21:13 2004
+++ llvm/include/llvm/GlobalVariable.h Fri Jan 28 18:32:30 2005
@@ -41,6 +41,8 @@
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.
@@ -56,11 +58,11 @@
/// 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(); }
@@ -70,18 +72,22 @@
///
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);
}
}
More information about the llvm-commits
mailing list