//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CONSTPOOLVALS_H
-#define LLVM_CONSTPOOLVALS_H
+#ifndef LLVM_CONSTANT_VALS_H
+#define LLVM_CONSTANT_VALS_H
#include "llvm/User.h"
#include "Support/DataTypes.h"
// Specialize setName to handle symbol table majik...
virtual void setName(const std::string &name, SymbolTable *ST = 0);
- virtual std::string getStrValue() const = 0;
-
// Static constructor to get a '0' constant of arbitrary type...
- static Constant *getNullConstant(const Type *Ty);
+ static Constant *getNullValue(const Type *Ty);
// isNullValue - Return true if this is the value that would be returned by
- // getNullConstant.
+ // getNullValue.
virtual bool isNullValue() const = 0;
+ virtual void print(std::ostream &O) const;
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Constant *) { return true; }
static inline bool classof(const Value *V) {
// inverted - Return the opposite value of the current value.
inline ConstantBool *inverted() const { return (this==True) ? False : True; }
- virtual std::string getStrValue() const;
inline bool getValue() const { return Val; }
// isNullValue - Return true if this is the value that would be returned by
- // getNullConstant.
+ // getNullValue.
virtual bool isNullValue() const { return this == False; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static ConstantInt *get(const Type *Ty, unsigned char V);
// isNullValue - Return true if this is the value that would be returned by
- // getNullConstant.
+ // getNullValue.
virtual bool isNullValue() const { return Val.Unsigned == 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
public:
static ConstantSInt *get(const Type *Ty, int64_t V);
- virtual std::string getStrValue() const;
-
static bool isValueValidForType(const Type *Ty, int64_t V);
inline int64_t getValue() const { return Val.Signed; }
public:
static ConstantUInt *get(const Type *Ty, uint64_t V);
- virtual std::string getStrValue() const;
-
static bool isValueValidForType(const Type *Ty, uint64_t V);
inline uint64_t getValue() const { return Val.Unsigned; }
public:
static ConstantFP *get(const Type *Ty, double V);
- virtual std::string getStrValue() const;
-
static bool isValueValidForType(const Type *Ty, double V);
inline double getValue() const { return Val; }
// isNullValue - Return true if this is the value that would be returned by
- // getNullConstant.
+ // getNullValue.
virtual bool isNullValue() const { return Val == 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static ConstantArray *get(const ArrayType *T, const std::vector<Constant*> &);
static ConstantArray *get(const std::string &Initializer);
- virtual std::string getStrValue() const;
inline const ArrayType *getType() const {
return (ArrayType*)Value::getType();
}
inline const std::vector<Use> &getValues() const { return Operands; }
// isNullValue - Return true if this is the value that would be returned by
- // getNullConstant.
+ // getNullValue.
virtual bool isNullValue() const { return false; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
static ConstantStruct *get(const StructType *T,
const std::vector<Constant*> &V);
- virtual std::string getStrValue() const;
inline const StructType *getType() const {
return (StructType*)Value::getType();
}
inline const std::vector<Use> &getValues() const { return Operands; }
// isNullValue - Return true if this is the value that would be returned by
- // getNullConstant.
+ // getNullValue.
virtual bool isNullValue() const { return false; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
inline ConstantPointer(const PointerType *T) : Constant((const Type*)T){}
~ConstantPointer() {}
public:
- virtual std::string getStrValue() const = 0;
inline const PointerType *getType() const {
return (PointerType*)Value::getType();
}
// isNullValue - Return true if this is the value that would be returned by
- // getNullConstant.
+ // getNullValue.
virtual bool isNullValue() const { return false; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
inline ConstantPointerNull(const PointerType *T) : ConstantPointer(T) {}
inline ~ConstantPointerNull() {}
public:
- virtual std::string getStrValue() const;
static ConstantPointerNull *get(const PointerType *T);
// isNullValue - Return true if this is the value that would be returned by
- // getNullConstant.
+ // getNullValue.
virtual bool isNullValue() const { return true; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
public:
static ConstantPointerRef *get(GlobalValue *GV);
- virtual std::string getStrValue() const;
-
const GlobalValue *getValue() const {
return cast<GlobalValue>(Operands[0].get());
}