1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Add some new methods to forward to

llvm-svn: 8852
This commit is contained in:
Chris Lattner 2003-10-05 00:13:28 +00:00
parent def80d731a
commit cb5dd5ba25

View File

@ -17,6 +17,9 @@ class PointerType;
template<class ConstantClass, class TypeClass, class ValType> template<class ConstantClass, class TypeClass, class ValType>
struct ConstantCreator; struct ConstantCreator;
template<class ConstantClass, class TypeClass>
struct ConvertConstantType;
//===--------------------------------------------------------------------------- //===---------------------------------------------------------------------------
/// ConstantIntegral - Shared superclass of boolean and integer constants. /// ConstantIntegral - Shared superclass of boolean and integer constants.
@ -482,6 +485,7 @@ class ConstantExpr : public Constant {
unsigned iType; // Operation type (an Instruction opcode) unsigned iType; // Operation type (an Instruction opcode)
friend struct ConstantCreator<ConstantExpr,Type, friend struct ConstantCreator<ConstantExpr,Type,
std::pair<unsigned, std::vector<Constant*> > >; std::pair<unsigned, std::vector<Constant*> > >;
friend struct ConvertConstantType<ConstantExpr, Type>;
protected: protected:
// Cast creation ctor // Cast creation ctor
@ -492,6 +496,15 @@ protected:
ConstantExpr(Constant *C, const std::vector<Constant*> &IdxList, ConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
const Type *DestTy); const Type *DestTy);
// These private methods are used by the type resolution code to create
// ConstantExprs in intermediate forms.
static Constant *getTy(const Type *Ty, unsigned Opcode,
Constant *C1, Constant *C2);
static Constant *getShiftTy(const Type *Ty,
unsigned Opcode, Constant *C1, Constant *C2);
static Constant *getGetElementPtrTy(const Type *Ty, Constant *C,
const std::vector<Constant*> &IdxList);
public: public:
// Static methods to construct a ConstantExpr of different kinds. Note that // Static methods to construct a ConstantExpr of different kinds. Note that
// these methods may return a object that is not an instance of the // these methods may return a object that is not an instance of the
@ -499,15 +512,23 @@ public:
// expression into something simpler if possible. // expression into something simpler if possible.
/// Cast constant expr /// Cast constant expr
///
static Constant *getCast(Constant *C, const Type *Ty); static Constant *getCast(Constant *C, const Type *Ty);
/// Binary constant expr - Use with binary operators... /// Binary constant expr - Use with binary operators...
static Constant *get(unsigned Opcode, Constant *C1, Constant *C2); ///
static Constant *get(unsigned Opcode, Constant *C1, Constant *C2) {
return getTy(C1->getType(), Opcode, C1, C2);
}
/// getShift - Return a shift left or shift right constant expr /// getShift - Return a shift left or shift right constant expr
static Constant *getShift(unsigned Opcode, Constant *C1, Constant *C2); ///
static Constant *getShift(unsigned Opcode, Constant *C1, Constant *C2) {
return getShiftTy(C1->getType(), Opcode, C1, C2);
}
/// Getelementptr form... /// Getelementptr form...
///
static Constant *getGetElementPtr(Constant *C, static Constant *getGetElementPtr(Constant *C,
const std::vector<Constant*> &IdxList); const std::vector<Constant*> &IdxList);