summaryrefslogtreecommitdiffstats
path: root/include/llvm/Constants.h
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2008-04-06 20:25:17 +0000
committerGabor Greif <ggreif@gmail.com>2008-04-06 20:25:17 +0000
commit051a950000e21935165db56695e35bade668193b (patch)
tree76db4bc690c153a1cfbd2989849c3b1d95500390 /include/llvm/Constants.h
parentd963ab1f58adb6daa028533ff3285841d7e45f80 (diff)
downloadexternal_llvm-051a950000e21935165db56695e35bade668193b.zip
external_llvm-051a950000e21935165db56695e35bade668193b.tar.gz
external_llvm-051a950000e21935165db56695e35bade668193b.tar.bz2
API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods for Users that have a potentially variable number of Uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49277 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Constants.h')
-rw-r--r--include/llvm/Constants.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index f71c655..13df601 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -43,9 +43,15 @@ struct ConvertConstantType;
/// @brief Class for constant integers.
class ConstantInt : public Constant {
static ConstantInt *TheTrueVal, *TheFalseVal;
+ void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT
ConstantInt(const IntegerType *Ty, const APInt& V);
APInt Val;
+protected:
+ // allocate space for exactly zero operands
+ void *operator new(size_t s) {
+ return User::operator new(s, 0);
+ }
public:
/// Return the constant as an APInt value reference. This allows clients to
/// obtain a copy of the value, with all its precision in tact.
@@ -215,9 +221,15 @@ private:
///
class ConstantFP : public Constant {
APFloat Val;
+ void *operator new(size_t, unsigned);// DO NOT IMPLEMENT
ConstantFP(const ConstantFP &); // DO NOT IMPLEMENT
protected:
ConstantFP(const Type *Ty, const APFloat& V);
+protected:
+ // allocate space for exactly zero operands
+ void *operator new(size_t s) {
+ return User::operator new(s, 0);
+ }
public:
/// get() - Static factory methods - Return objects of the specified value
static ConstantFP *get(const Type *Ty, const APFloat& V);
@@ -262,10 +274,16 @@ public:
///
class ConstantAggregateZero : public Constant {
friend struct ConstantCreator<ConstantAggregateZero, Type, char>;
+ void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
ConstantAggregateZero(const ConstantAggregateZero &); // DO NOT IMPLEMENT
protected:
explicit ConstantAggregateZero(const Type *Ty)
: Constant(Ty, ConstantAggregateZeroVal, 0, 0) {}
+protected:
+ // allocate space for exactly zero operands
+ void *operator new(size_t s) {
+ return User::operator new(s, 0);
+ }
public:
/// get() - static factory method for creating a null aggregate. It is
/// illegal to call this method with a non-aggregate type.
@@ -457,14 +475,19 @@ public:
///
class ConstantPointerNull : public Constant {
friend struct ConstantCreator<ConstantPointerNull, PointerType, char>;
+ void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
ConstantPointerNull(const ConstantPointerNull &); // DO NOT IMPLEMENT
protected:
explicit ConstantPointerNull(const PointerType *T)
: Constant(reinterpret_cast<const Type*>(T),
Value::ConstantPointerNullVal, 0, 0) {}
+protected:
+ // allocate space for exactly zero operands
+ void *operator new(size_t s) {
+ return User::operator new(s, 0);
+ }
public:
-
/// get() - Static factory methods - Return objects of the specified value
static ConstantPointerNull *get(const PointerType *T);
@@ -706,9 +729,15 @@ public:
///
class UndefValue : public Constant {
friend struct ConstantCreator<UndefValue, Type, char>;
+ void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
UndefValue(const UndefValue &); // DO NOT IMPLEMENT
protected:
explicit UndefValue(const Type *T) : Constant(T, UndefValueVal, 0, 0) {}
+protected:
+ // allocate space for exactly zero operands
+ void *operator new(size_t s) {
+ return User::operator new(s, 0);
+ }
public:
/// get() - Static factory methods - Return an 'undef' object of the specified
/// type.