aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/ConstantsScanner.h8
-rw-r--r--include/llvm/Analysis/Expressions.h12
-rw-r--r--include/llvm/Analysis/InstForest.h12
-rw-r--r--include/llvm/Analysis/ModuleAnalyzer.h1
-rw-r--r--include/llvm/Assembly/CachedWriter.h2
-rw-r--r--include/llvm/Assembly/Writer.h6
-rw-r--r--include/llvm/BasicBlock.h10
-rw-r--r--include/llvm/CodeGen/InstrForest.h6
-rw-r--r--include/llvm/CodeGen/InstrSelection.h1
-rw-r--r--include/llvm/CodeGen/InstrSelectionSupport.h4
-rw-r--r--include/llvm/CodeGen/MachineInstr.h6
-rw-r--r--include/llvm/ConstantHandling.h106
-rw-r--r--include/llvm/Constants.h (renamed from include/llvm/ConstPoolVals.h)218
-rw-r--r--include/llvm/GlobalVariable.h18
-rw-r--r--include/llvm/Module.h12
-rw-r--r--include/llvm/SymbolTable.h4
-rw-r--r--include/llvm/Target/MachineInstrInfo.h2
-rw-r--r--include/llvm/Target/TargetData.h2
-rw-r--r--include/llvm/Target/TargetInstrInfo.h2
-rw-r--r--include/llvm/Transforms/IPO/ConstantMerge.h4
-rw-r--r--include/llvm/Value.h8
-rw-r--r--include/llvm/iMemory.h2
-rw-r--r--include/llvm/iTerminators.h12
23 files changed, 228 insertions, 230 deletions
diff --git a/include/llvm/Analysis/ConstantsScanner.h b/include/llvm/Analysis/ConstantsScanner.h
index 4c86834d21..ebe85e8e7d 100644
--- a/include/llvm/Analysis/ConstantsScanner.h
+++ b/include/llvm/Analysis/ConstantsScanner.h
@@ -12,10 +12,10 @@
#include "llvm/Method.h"
#include "llvm/Instruction.h"
#include <iterator>
-class ConstPoolVal;
+class Constant;
class constant_iterator
- : public std::forward_iterator<const ConstPoolVal, ptrdiff_t> {
+ : public std::forward_iterator<const Constant, ptrdiff_t> {
Method::inst_const_iterator InstI; // Method instruction iterator
unsigned OpIdx; // Operand index
@@ -24,7 +24,7 @@ class constant_iterator
inline bool isAtConstant() const {
assert(!InstI.atEnd() && OpIdx < InstI->getNumOperands() &&
"isAtConstant called with invalid arguments!");
- return isa<ConstPoolVal>(InstI->getOperand(OpIdx));
+ return isa<Constant>(InstI->getOperand(OpIdx));
}
public:
@@ -45,7 +45,7 @@ public:
inline pointer operator*() const {
assert(isAtConstant() && "Dereferenced an iterator at the end!");
- return cast<ConstPoolVal>(InstI->getOperand(OpIdx));
+ return cast<Constant>(InstI->getOperand(OpIdx));
}
inline pointer operator->() const { return operator*(); }
diff --git a/include/llvm/Analysis/Expressions.h b/include/llvm/Analysis/Expressions.h
index 9ddd5863b5..f64f8f14f8 100644
--- a/include/llvm/Analysis/Expressions.h
+++ b/include/llvm/Analysis/Expressions.h
@@ -13,7 +13,7 @@
#include <assert.h>
class Type;
class Value;
-class ConstPoolInt;
+class ConstantInt;
namespace analysis {
@@ -35,16 +35,16 @@ struct ExprType {
ScaledLinear, // Expr is scaled linear exp, Value is Scale*Var+Offset
} ExprTy;
- const ConstPoolInt *Offset; // Offset of expr, or null if 0
- Value *Var; // Var referenced, if Linear or above (null if 0)
- const ConstPoolInt *Scale; // Scale of var if ScaledLinear expr (null if 1)
+ const ConstantInt *Offset; // Offset of expr, or null if 0
+ Value *Var; // Var referenced, if Linear or above (null if 0)
+ const ConstantInt *Scale; // Scale of var if ScaledLinear expr (null if 1)
- inline ExprType(const ConstPoolInt *CPV = 0) {
+ inline ExprType(const ConstantInt *CPV = 0) {
Offset = CPV; Var = 0; Scale = 0;
ExprTy = Constant;
}
ExprType(Value *Val); // Create a linear or constant expression
- ExprType(const ConstPoolInt *scale, Value *var, const ConstPoolInt *offset);
+ ExprType(const ConstantInt *scale, Value *var, const ConstantInt *offset);
// If this expression has an intrinsic type, return it. If it is zero, return
// the specified type.
diff --git a/include/llvm/Analysis/InstForest.h b/include/llvm/Analysis/InstForest.h
index 497bb46188..e8ab0aae08 100644
--- a/include/llvm/Analysis/InstForest.h
+++ b/include/llvm/Analysis/InstForest.h
@@ -73,11 +73,11 @@ public:
inline bool isTemporary() const { return getNodeType() == TemporaryNode; }
// Accessors for different node types...
- inline ConstPoolVal *getConstant() {
- return cast<ConstPoolVal>(getValue());
+ inline Constant *getConstant() {
+ return cast<Constant>(getValue());
}
- inline const ConstPoolVal *getConstant() const {
- return cast<const ConstPoolVal>(getValue());
+ inline const Constant *getConstant() const {
+ return cast<const Constant>(getValue());
}
inline BasicBlock *getBasicBlock() {
return cast<BasicBlock>(getValue());
@@ -230,10 +230,10 @@ InstTreeNode<Payload>::InstTreeNode(InstForest<Payload> &IF, Value *V,
getTreeData().first.first = V; // Save tree node
if (!isa<Instruction>(V)) {
- assert((isa<ConstPoolVal>(V) || isa<BasicBlock>(V) ||
+ assert((isa<Constant>(V) || isa<BasicBlock>(V) ||
isa<MethodArgument>(V) || isa<GlobalVariable>(V)) &&
"Unrecognized value type for InstForest Partition!");
- if (isa<ConstPoolVal>(V))
+ if (isa<Constant>(V))
getTreeData().first.second = ConstNode;
else if (isa<BasicBlock>(V))
getTreeData().first.second = BasicBlockNode;
diff --git a/include/llvm/Analysis/ModuleAnalyzer.h b/include/llvm/Analysis/ModuleAnalyzer.h
index ecda28ed72..a0baa8a7dd 100644
--- a/include/llvm/Analysis/ModuleAnalyzer.h
+++ b/include/llvm/Analysis/ModuleAnalyzer.h
@@ -16,7 +16,6 @@ class Module;
class Method;
class BasicBlock;
class Instruction;
-class ConstPoolVal;
class MethodType;
class MethodArgument;
diff --git a/include/llvm/Assembly/CachedWriter.h b/include/llvm/Assembly/CachedWriter.h
index af1b246fa6..b5171b4097 100644
--- a/include/llvm/Assembly/CachedWriter.h
+++ b/include/llvm/Assembly/CachedWriter.h
@@ -53,7 +53,7 @@ public:
inline CachedWriter &operator<<(const Instruction *X) {
return *this << (const Value*)X;
}
- inline CachedWriter &operator<<(const ConstPoolVal *X) {
+ inline CachedWriter &operator<<(const Constant *X) {
return *this << (const Value*)X;
}
inline CachedWriter &operator<<(const Type *X) {
diff --git a/include/llvm/Assembly/Writer.h b/include/llvm/Assembly/Writer.h
index 1db5cd3689..02c9fd0cc1 100644
--- a/include/llvm/Assembly/Writer.h
+++ b/include/llvm/Assembly/Writer.h
@@ -35,7 +35,7 @@ void WriteToAssembly(const GlobalVariable *G, ostream &o);
void WriteToAssembly(const Method *Method, ostream &o);
void WriteToAssembly(const BasicBlock *BB, ostream &o);
void WriteToAssembly(const Instruction *In, ostream &o);
-void WriteToAssembly(const ConstPoolVal *V, ostream &o);
+void WriteToAssembly(const Constant *V, ostream &o);
// WriteTypeSymbolic - This attempts to write the specified type as a symbolic
// type, iff there is an entry in the modules symbol table for the specified
@@ -86,7 +86,7 @@ inline ostream &operator<<(ostream &o, const Instruction *I) {
WriteToAssembly(I, o); return o;
}
-inline ostream &operator<<(ostream &o, const ConstPoolVal *I) {
+inline ostream &operator<<(ostream &o, const Constant *I) {
WriteToAssembly(I, o); return o;
}
@@ -99,7 +99,7 @@ inline ostream &operator<<(ostream &o, const Type *T) {
inline ostream &operator<<(ostream &o, const Value *I) {
switch (I->getValueType()) {
case Value::TypeVal: return o << cast<const Type>(I);
- case Value::ConstantVal: WriteToAssembly(cast<ConstPoolVal>(I) , o); break;
+ case Value::ConstantVal: WriteToAssembly(cast<Constant>(I) , o); break;
case Value::MethodArgumentVal: return o << I->getType() << " "<< I->getName();
case Value::InstructionVal:WriteToAssembly(cast<Instruction>(I) , o); break;
case Value::BasicBlockVal: WriteToAssembly(cast<BasicBlock>(I) , o); break;
diff --git a/include/llvm/BasicBlock.h b/include/llvm/BasicBlock.h
index df9447fb09..50de364f3e 100644
--- a/include/llvm/BasicBlock.h
+++ b/include/llvm/BasicBlock.h
@@ -115,12 +115,12 @@ public:
return V->getValueType() == Value::BasicBlockVal;
}
- // hasConstantPoolReferences() - This predicate is true if there is a
+ // hasConstantReferences() - This predicate is true if there is a
// reference to this basic block in the constant pool for this method. For
// example, if a block is reached through a switch table, that table resides
// in the constant pool, and the basic block is reference from it.
//
- bool hasConstantPoolReferences() const;
+ bool hasConstantReferences() const;
// dropAllReferences() - This function causes all the subinstructions to "let
// go" of all references that they are maintaining. This allows one to
@@ -165,7 +165,7 @@ public:
public:
typedef PredIterator<_Ptr,_USE_iterator> _Self;
- inline void advancePastConstPool() {
+ inline void advancePastConstants() {
// TODO: This is bad
// Loop to ignore constant pool references
while (It != BB->use_end() && !isa<TerminatorInst>(*It))
@@ -173,7 +173,7 @@ public:
}
inline PredIterator(_Ptr *bb) : BB(bb), It(bb->use_begin()) {
- advancePastConstPool();
+ advancePastConstants();
}
inline PredIterator(_Ptr *bb, bool) : BB(bb), It(bb->use_end()) {}
@@ -186,7 +186,7 @@ public:
inline pointer *operator->() const { return &(operator*()); }
inline _Self& operator++() { // Preincrement
- ++It; advancePastConstPool();
+ ++It; advancePastConstants();
return *this;
}
diff --git a/include/llvm/CodeGen/InstrForest.h b/include/llvm/CodeGen/InstrForest.h
index e7bd3ad145..aa101f934d 100644
--- a/include/llvm/CodeGen/InstrForest.h
+++ b/include/llvm/CodeGen/InstrForest.h
@@ -30,7 +30,7 @@
#include <hash_map>
#include <hash_set>
-class ConstPoolVal;
+class Constant;
class BasicBlock;
class Method;
class InstrTreeNode;
@@ -205,11 +205,11 @@ protected:
class ConstantNode : public InstrTreeNode {
public:
- ConstantNode(ConstPoolVal *constVal)
+ ConstantNode(Constant *constVal)
: InstrTreeNode(NTConstNode, (Value*)constVal) {
opLabel = ConstantNodeOp;
}
- ConstPoolVal *getConstVal() const { return (ConstPoolVal*) val;}
+ Constant *getConstVal() const { return (Constant*) val;}
protected:
virtual void dumpNode(int indent) const;
};
diff --git a/include/llvm/CodeGen/InstrSelection.h b/include/llvm/CodeGen/InstrSelection.h
index 1f68e38dd5..27e3ebe553 100644
--- a/include/llvm/CodeGen/InstrSelection.h
+++ b/include/llvm/CodeGen/InstrSelection.h
@@ -19,7 +19,6 @@ class InstrForest;
class MachineInstr;
class InstructionNode;
class TmpInstruction;
-class ConstPoolVal;
class TargetMachine;
diff --git a/include/llvm/CodeGen/InstrSelectionSupport.h b/include/llvm/CodeGen/InstrSelectionSupport.h
index 7d11e206b5..90b3af713d 100644
--- a/include/llvm/CodeGen/InstrSelectionSupport.h
+++ b/include/llvm/CodeGen/InstrSelectionSupport.h
@@ -21,7 +21,7 @@ class InstrForest;
class MachineInstr;
class InstructionNode;
class TmpInstruction;
-class ConstPoolVal;
+class Constant;
class TargetMachine;
//************************ Exported Functions ******************************/
@@ -54,7 +54,7 @@ int64_t GetConstantValueAsSignedInt (const Value *V,
//---------------------------------------------------------------------------
Value* FoldGetElemChain (const InstructionNode* getElemInstrNode,
- vector<ConstPoolVal*>& chainIdxVec);
+ vector<Constant*>& chainIdxVec);
//------------------------------------------------------------------------
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index a20431848e..7c347a43ca 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -529,7 +529,7 @@ private:
unsigned currentOptionalArgsSize;
unsigned maxOptionalArgsSize;
unsigned currentTmpValuesSize;
- hash_set<const ConstPoolVal*> constantsForConstPool;
+ hash_set<const Constant*> constantsForConstPool;
hash_map<const Value*, int> offsets;
// hash_map<const Value*, int> offsetsFromSP;
@@ -572,7 +572,7 @@ public:
inline unsigned getMaxOptionalArgsSize() const { return maxOptionalArgsSize;}
inline unsigned getCurrentOptionalArgsSize() const
{ return currentOptionalArgsSize;}
- inline const hash_set<const ConstPoolVal*>&
+ inline const hash_set<const Constant*>&
getConstantPoolValues() const {return constantsForConstPool;}
//
@@ -580,7 +580,7 @@ public:
//
void initializeFrameLayout (const TargetMachine& target);
- void addToConstantPool (const ConstPoolVal* constVal)
+ void addToConstantPool (const Constant* constVal)
{ constantsForConstPool.insert(constVal); }
inline void markAsLeafMethod() { compiledAsLeaf = true; }
diff --git a/include/llvm/ConstantHandling.h b/include/llvm/ConstantHandling.h
index 72632ee5df..bd59780ef2 100644
--- a/include/llvm/ConstantHandling.h
+++ b/include/llvm/ConstantHandling.h
@@ -5,10 +5,10 @@
//
// Unfortunately we can't overload operators on pointer types (like this:)
//
-// inline bool operator==(const ConstPoolVal *V1, const ConstPoolVal *V2)
+// inline bool operator==(const Constant *V1, const Constant *V2)
//
// so we must make due with references, even though it leads to some butt ugly
-// looking code downstream. *sigh* (ex: ConstPoolVal *Result = *V1 + *v2; )
+// looking code downstream. *sigh* (ex: Constant *Result = *V1 + *v2; )
//
//===----------------------------------------------------------------------===//
//
@@ -33,7 +33,7 @@
#ifndef LLVM_OPT_CONSTANTHANDLING_H
#define LLVM_OPT_CONSTANTHANDLING_H
-#include "llvm/ConstPoolVals.h"
+#include "llvm/ConstantVals.h"
#include "llvm/Instruction.h"
#include "llvm/Type.h"
class PointerType;
@@ -44,15 +44,15 @@ namespace opt {
// Implement == and != directly...
//===----------------------------------------------------------------------===//
-inline ConstPoolBool *operator==(const ConstPoolVal &V1,
- const ConstPoolVal &V2) {
+inline ConstantBool *operator==(const Constant &V1,
+ const Constant &V2) {
assert(V1.getType() == V2.getType() && "Constant types must be identical!");
- return ConstPoolBool::get(&V1 == &V2);
+ return ConstantBool::get(&V1 == &V2);
}
-inline ConstPoolBool *operator!=(const ConstPoolVal &V1,
- const ConstPoolVal &V2) {
- return ConstPoolBool::get(&V1 != &V2);
+inline ConstantBool *operator!=(const Constant &V1,
+ const Constant &V2) {
+ return ConstantBool::get(&V1 != &V2);
}
//===----------------------------------------------------------------------===//
@@ -66,35 +66,35 @@ public:
static AnnotationID AID; // AnnotationID for this class
// Unary Operators...
- virtual ConstPoolVal *op_not(const ConstPoolVal *V) const = 0;
+ virtual Constant *op_not(const Constant *V) const = 0;
// Binary Operators...
- virtual ConstPoolVal *add(const ConstPoolVal *V1,
- const ConstPoolVal *V2) const = 0;
- virtual ConstPoolVal *sub(const ConstPoolVal *V1,
- const ConstPoolVal *V2) const = 0;
- virtual ConstPoolVal *mul(const ConstPoolVal *V1,
- const ConstPoolVal *V2) const = 0;
+ virtual Constant *add(const Constant *V1,
+ const Constant *V2) const = 0;
+ virtual Constant *sub(const Constant *V1,
+ const Constant *V2) const = 0;
+ virtual Constant *mul(const Constant *V1,
+ const Constant *V2) const = 0;
- virtual ConstPoolBool *lessthan(const ConstPoolVal *V1,
- const ConstPoolVal *V2) const = 0;
+ virtual ConstantBool *lessthan(const Constant *V1,
+ const Constant *V2) const = 0;
// Casting operators. ick
- virtual ConstPoolBool *castToBool (const ConstPoolVal *V) const = 0;
- virtual ConstPoolSInt *castToSByte (const ConstPoolVal *V) const = 0;
- virtual ConstPoolUInt *castToUByte (const ConstPoolVal *V) const = 0;
- virtual ConstPoolSInt *castToShort (const ConstPoolVal *V) const = 0;
- virtual ConstPoolUInt *castToUShort(const ConstPoolVal *V) const = 0;
- virtual ConstPoolSInt *castToInt (const ConstPoolVal *V) const = 0;
- virtual ConstPoolUInt *castToUInt (const ConstPoolVal *V) const = 0;
- virtual ConstPoolSInt *castToLong (const ConstPoolVal *V) const = 0;
- virtual ConstPoolUInt *castToULong (const ConstPoolVal *V) const = 0;
- virtual ConstPoolFP *castToFloat (const ConstPoolVal *V) const = 0;
- virtual ConstPoolFP *castToDouble(const ConstPoolVal *V) const = 0;
- virtual ConstPoolPointer *castToPointer(const ConstPoolVal *V,
- const PointerType *Ty) const = 0;
-
- inline ConstPoolVal *castTo(const ConstPoolVal *V, const Type *Ty) const {
+ virtual ConstantBool *castToBool (const Constant *V) const = 0;
+ virtual ConstantSInt *castToSByte (const Constant *V) const = 0;
+ virtual ConstantUInt *castToUByte (const Constant *V) const = 0;
+ virtual ConstantSInt *castToShort (const Constant *V) const = 0;
+ virtual ConstantUInt *castToUShort(const Constant *V) const = 0;
+ virtual ConstantSInt *castToInt (const Constant *V) const = 0;
+ virtual ConstantUInt *castToUInt (const Constant *V) const = 0;
+ virtual ConstantSInt *castToLong (const Constant *V) const = 0;
+ virtual ConstantUInt *castToULong (const Constant *V) const = 0;
+ virtual ConstantFP *castToFloat (const Constant *V) const = 0;
+ virtual ConstantFP *castToDouble(const Constant *V) const = 0;
+ virtual ConstantPointer *castToPointer(const Constant *V,
+ const PointerType *Ty) const = 0;
+
+ inline Constant *castTo(const Constant *V, const Type *Ty) const {
switch (Ty->getPrimitiveID()) {
case Type::BoolTyID: return castToBool(V);
case Type::UByteTyID: return castToUByte(V);
@@ -116,7 +116,7 @@ public:
// we just want to make sure to hit the cache instead of doing it indirectly,
// if possible...
//
- static inline ConstRules *get(const ConstPoolVal &V) {
+ static inline ConstRules *get(const Constant &V) {
return (ConstRules*)V.getType()->getOrCreateAnnotation(AID);
}
private :
@@ -127,29 +127,29 @@ private :
};
-inline ConstPoolVal *operator!(const ConstPoolVal &V) {
+inline Constant *operator!(const Constant &V) {
return ConstRules::get(V)->op_not(&V);
}
-inline ConstPoolVal *operator+(const ConstPoolVal &V1, const ConstPoolVal &V2) {
+inline Constant *operator+(const Constant &V1, const Constant &V2) {
assert(V1.getType() == V2.getType() && "Constant types must be identical!");
return ConstRules::get(V1)->add(&V1, &V2);
}
-inline ConstPoolVal *operator-(const ConstPoolVal &V1, const ConstPoolVal &V2) {
+inline Constant *operator-(const Constant &V1, const Constant &V2) {
assert(V1.getType() == V2.getType() && "Constant types must be identical!");
return ConstRules::get(V1)->sub(&V1, &V2);
}
-inline ConstPoolVal *operator*(const ConstPoolVal &V1, const ConstPoolVal &V2) {
+inline Constant *operator*(const Constant &V1, const Constant &V2) {
assert(V1.getType() == V2.getType() && "Constant types must be identical!");
return ConstRules::get(V1)->mul(&V1, &V2);
}
-inline ConstPoolBool *operator<(const ConstPoolVal &V1,
- const ConstPoolVal &V2) {
+inline ConstantBool *operator<(const Constant &V1,
+ const Constant &V2) {
assert(V1.getType() == V2.getType() && "Constant types must be identical!");
return ConstRules::get(V1)->lessthan(&V1, &V2);
}
@@ -159,18 +159,18 @@ inline ConstPoolBool *operator<(const ConstPoolVal &V1,
// Implement 'derived' operators based on what we already have...
//===----------------------------------------------------------------------===//
-inline ConstPoolBool *operator>(const ConstPoolVal &V1,
- const ConstPoolVal &V2) {
+inline ConstantBool *operator>(const Constant &V1,
+ const Constant &V2) {
return V2 < V1;
}
-inline ConstPoolBool *operator>=(const ConstPoolVal &V1,
- const ConstPoolVal &V2) {
+inline ConstantBool *operator>=(const Constant &V1,
+ const Constant &V2) {
return (V1 < V2)->inverted(); // !(V1 < V2)
}
-inline ConstPoolBool *operator<=(const ConstPoolVal &V1,
- const ConstPoolVal &V2) {
+inline ConstantBool *operator<=(const Constant &V1,
+ const Constant &V2) {
return (V1 > V2)->inverted(); // !(V1 > V2)
}
@@ -179,13 +179,13 @@ inline ConstPoolBool *operator<=(const ConstPoolVal &V1,
// Implement higher level instruction folding type instructions
//===----------------------------------------------------------------------===//
-inline ConstPoolVal *ConstantFoldCastInstruction(const ConstPoolVal *V,
- const Type *DestTy) {
+inline Constant *ConstantFoldCastInstruction(const Constant *V,
+ const Type *DestTy) {
return ConstRules::get(*V)->castTo(V, DestTy);
}
-inline ConstPoolVal *ConstantFoldUnaryInstruction(unsigned Opcode,
- const ConstPoolVal *V) {
+inline Constant *ConstantFoldUnaryInstruction(unsigned Opcode,
+ const Constant *V) {
switch (Opcode) {
case Instruction::Not: return !*V;
// TODO: Handle get element ptr instruction here in the future? GEP null?
@@ -193,9 +193,9 @@ inline ConstPoolVal *ConstantFoldUnaryInstruction(unsigned Opcode,
return 0;
}
-inline ConstPoolVal *ConstantFoldBinaryInstruction(unsigned Opcode,
- const ConstPoolVal *V1,
- const ConstPoolVal *V2) {
+inline Constant *ConstantFoldBinaryInstruction(unsigned Opcode,
+ const Constant *V1,
+ const Constant *V2) {
switch (Opcode) {
case Instruction::Add: return *V1 + *V2;
case Instruction::Sub: return *V1 - *V2;
diff --git a/include/llvm/ConstPoolVals.h b/include/llvm/Constants.h
index c1348294c6..08fc8b369b 100644
--- a/include/llvm/ConstPoolVals.h
+++ b/include/llvm/Constants.h
@@ -1,6 +1,6 @@
-//===-- llvm/ConstPoolVals.h - Constant Value nodes --------------*- C++ -*--=//
+//===-- llvm/ConstantVals.h - Constant Value nodes ---------------*- C++ -*--=//
//
-// This file contains the declarations for the ConstPoolVal class and all of
+// This file contains the declarations for the Constant class and all of
// its subclasses, which represent the different type of constant pool values
//
//===----------------------------------------------------------------------===//
@@ -16,13 +16,13 @@ class StructType;
class PointerType;
//===----------------------------------------------------------------------===//
-// ConstPoolVal Class
+// Constant Class
//===----------------------------------------------------------------------===//
-class ConstPoolVal : public User {
+class Constant : public User {
protected:
- inline ConstPoolVal(const Type *Ty) : User(Ty, Value::ConstantVal) {}
- ~ConstPoolVal() {}
+ inline Constant(const Type *Ty) : User(Ty, Value::ConstantVal) {}
+ ~Constant() {}
// destroyConstant - Called if some element of this constant is no longer
// valid. At this point only other constants may be on the use_list for this
@@ -41,14 +41,14 @@ public:
virtual string getStrValue() const = 0;
// Static constructor to get a '0' constant of arbitrary type...
- static ConstPoolVal *getNullConstant(const Type *Ty);
+ static Constant *getNullConstant(const Type *Ty);
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const = 0;
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ConstPoolVal *) { return true; }
+ static inline bool classof(const Constant *) { return true; }
static inline bool classof(const Value *V) {
return V->getValueType() == Value::ConstantVal;
}
@@ -61,22 +61,22 @@ public:
//===----------------------------------------------------------------------===//
//===---------------------------------------------------------------------------
-// ConstPoolBool - Boolean Values
+// ConstantBool - Boolean Values
//
-class ConstPoolBool : public ConstPoolVal {
+class ConstantBool : public Constant {
bool Val;
- ConstPoolBool(const ConstPoolBool &); // DO NOT IMPLEMENT
- ConstPoolBool(bool V);
- ~ConstPoolBool() {}
+ ConstantBool(const ConstantBool &); // DO NOT IMPLEMENT
+ ConstantBool(bool V);
+ ~ConstantBool() {}
public:
- static ConstPoolBool *True, *False; // The True & False values
+ static ConstantBool *True, *False; // The True & False values
// Factory objects - Return objects of the specified value
- static ConstPoolBool *get(bool Value) { return Value ? True : False; }
- static ConstPoolBool *get(const Type *Ty, bool Value) { return get(Value); }
+ static ConstantBool *get(bool Value) { return Value ? True : False; }
+ static ConstantBool *get(const Type *Ty, bool Value) { return get(Value); }
// inverted - Return the opposite value of the current value.
- inline ConstPoolBool *inverted() const { return (this==True) ? False : True; }
+ inline ConstantBool *inverted() const { return (this==True) ? False : True; }
virtual string getStrValue() const;
inline bool getValue() const { return Val; }
@@ -86,29 +86,29 @@ public:
virtual bool isNullValue() const { return this == False; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ConstPoolBool *) { return true; }
- static bool classof(const ConstPoolVal *CPV) {
+ static inline bool classof(const ConstantBool *) { return true; }
+ static bool classof(const Constant *CPV) {
return (CPV == True) | (CPV == False);
}
static inline bool classof(const Value *V) {
- return isa<ConstPoolVal>(V) && classof(cast<ConstPoolVal>(V));
+ return isa<Constant>(V) && classof(cast<Constant>(V));
}
};
//===---------------------------------------------------------------------------
-// ConstPoolInt - Superclass of ConstPoolSInt & ConstPoolUInt, to make dealing
+// ConstantInt - Superclass of ConstantSInt & ConstantUInt, to make dealing
// with integral constants easier.
//
-class ConstPoolInt : public ConstPoolVal {
+class ConstantInt : public Constant {
protected:
union {
int64_t Signed;
uint64_t Unsigned;
} Val;
- ConstPoolInt(const ConstPoolInt &); // DO NOT IMPLEMENT
- ConstPoolInt(const Type *Ty, uint64_t V);
- ~ConstPoolInt() {}
+ ConstantInt(const ConstantInt &); // DO NOT IMPLEMENT
+ ConstantInt(const Type *Ty, uint64_t V);
+ ~ConstantInt() {}
public:
// equalsInt - Provide a helper method that can be used to determine if the
// constant contained within is equal to a constant. This only works for very
@@ -120,34 +120,34 @@ public:
return Val.Unsigned == V;
}
- // ConstPoolInt::get static method: return a constant pool int with the
+ // ConstantInt::get static method: return a constant pool int with the
// specified value. as above, we work only with very small values here.
//
- static ConstPoolInt *get(const Type *Ty, unsigned char V);
+ static ConstantInt *get(const Type *Ty, unsigned char V);
// isNullValue - Return true if this is the value that would be returned by
// getNullConstant.
virtual bool isNullValue() const { return Val.Unsigned == 0; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ConstPoolInt *) { return true; }
- static bool classof(const ConstPoolVal *CPV); // defined in CPV.cpp
+ static inline bool classof(const ConstantInt *) { return true; }
+ static bool classof(const Constant *CPV); // defined in CPV.cpp
static inline bool classof(const Value *V) {
- return isa<ConstPoolVal>(V) && classof(cast<ConstPoolVal>(V));
+ return isa<Constant>(V) && classof(cast<Constant>(V));
}
};
//===---------------------------------------------------------------------------
-// ConstPoolSInt - Signed Integer Values [sbyte, short, int, long]
+// ConstantSInt - Signed Integer Values [sbyte, short, int, long]
//
-class ConstPoolSInt : public ConstPoolInt {
- ConstPoolSInt(const ConstPoolSInt &); // DO NOT IMPLEMENT
+class ConstantSInt : public ConstantInt {
+ ConstantSInt(const ConstantSInt &); // DO NOT IMPLEMENT
protected:
- ConstPoolSInt(const Type *Ty, int64_t V);
- ~ConstPoolSInt() {}
+ ConstantSInt(const Type *Ty, int64_t V);
+ ~ConstantSInt() {}
public:
- static ConstPoolSInt *get(const Type *Ty, int64_t V);
+ static ConstantSInt *get(const Type *Ty, int64_t V);
virtual string getStrValue() const;
@@ -155,23 +155,23 @@ public:
inline int64_t getValue() const { return Val.Signed; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ConstPoolSInt *) { return true; }
- static bool classof(const ConstPoolVal *CPV); // defined in CPV.cpp
+ static inline bool classof(const ConstantSInt *) { return true; }
+ static bool classof(const Constant *CPV); // defined in CPV.cpp
static inline bool classof(const Value *V) {
- return isa<ConstPoolVal>(V) && classof(cast<ConstPoolVal>(V));
+ return isa<Constant>(V) && classof(cast<Constant>(V));
}
};
//===---------------------------------------------------------------------------
-// ConstPoolUInt - Unsigned Integer Values [ubyte, ushort, uint, ulong]
+// ConstantUInt - Unsigned Integer Values [ubyte, ushort, uint, ulong]
//
-class ConstPoolUInt : public ConstPoolInt {
- ConstPoolUInt(const ConstPoolUInt &); // DO NOT IMPLEMENT
+class ConstantUInt : public ConstantInt {
+ ConstantUInt(const ConstantUInt &); // DO NOT IMPLEMENT
protected:
- ConstPoolUInt(const Type *Ty, uint64_t V);
- ~ConstPoolUInt() {}
+ ConstantUInt(const Type *Ty, uint64_t V);
+ ~ConstantUInt() {}
public:
- static ConstPoolUInt *get(const Type *Ty, uint64_t V);
+ static ConstantUInt *get(const Type *Ty, uint64_t V);
virtual string getStrValue() const;
@@ -179,25 +179,25 @@ public:
inline uint64_t getValue() const { return Val.Unsigned; }
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const ConstPoolUInt *) { return true; }
- static bool classof(const ConstPoolVal *CPV); // defined in CPV.cpp
+ static inline bool classof(const ConstantUInt *) { return true; }
+ static bool classof(const Constant *CPV); // defined in CPV.cpp
static inline bool classof(const Value *V) {
- return isa<ConstPoolVal>(V) && classof(cast<ConstPoolVal>(V));
+ return isa<Constant>(V) && classof(cast<Constant>(V));
}
};
//===---------------------------------------------------------------------------
-// ConstPoolFP - Floating Point Values [float, double]
+// ConstantFP - Floating Point Values [float, double]
//
-class ConstPoolFP : public ConstPoolVal {