aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-01 21:57:44 +0000
committerOwen Anderson <resistor@mac.com>2009-07-01 21:57:44 +0000
commit2e0a96963bd4ff57dde49985b438847bad93e1f9 (patch)
treecf56feb86a0b5d7ab724b0d5bd9878505ce20440 /include/llvm
parent8f9cd69edef54e3d1871bbed82d8d67ee93acc42 (diff)
downloadexternal_llvm-2e0a96963bd4ff57dde49985b438847bad93e1f9.zip
external_llvm-2e0a96963bd4ff57dde49985b438847bad93e1f9.tar.gz
external_llvm-2e0a96963bd4ff57dde49985b438847bad93e1f9.tar.bz2
Convert LLParser to use LLVMContext for creating constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74648 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/LLVMContext.h182
1 files changed, 93 insertions, 89 deletions
diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h
index f0c2200..d338e0d 100644
--- a/include/llvm/LLVMContext.h
+++ b/include/llvm/LLVMContext.h
@@ -54,147 +54,151 @@ public:
~LLVMContext();
// ConstantInt accessors
- ConstantInt* getConstantIntTrue();
- ConstantInt* getConstantIntFalse();
+ ConstantInt* getConstantIntTrue() const;
+ ConstantInt* getConstantIntFalse() const;
ConstantInt* getConstantInt(const IntegerType* Ty, uint64_t V,
- bool isSigned = false);
- ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V);
- ConstantInt* getConstantInt(const APInt& V);
- Constant* getConstantInt(const Type* Ty, const APInt& V);
- ConstantInt* getAllOnesConstantInt(const Type* Ty);
+ bool isSigned = false) const;
+ ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V) const;
+ ConstantInt* getConstantInt(const APInt& V) const;
+ Constant* getConstantInt(const Type* Ty, const APInt& V) const;
+ ConstantInt* getAllOnesConstantInt(const Type* Ty) const;
// ConstantPointerNull accessors
- ConstantPointerNull* getConstantPointerNull(const PointerType* T);
+ ConstantPointerNull* getConstantPointerNull(const PointerType* T) const;
// ConstantStruct accessors
Constant* getConstantStruct(const StructType* T,
- const std::vector<Constant*>& V);
+ const std::vector<Constant*>& V) const;
Constant* getConstantStruct(const std::vector<Constant*>& V,
- bool Packed = false);
+ bool Packed = false) const;
Constant* getConstantStruct(Constant* const *Vals, unsigned NumVals,
- bool Packed = false);
+ bool Packed = false) const;
// ConstantAggregateZero accessors
- ConstantAggregateZero* getConstantAggregateZero(const Type* Ty);
+ ConstantAggregateZero* getConstantAggregateZero(const Type* Ty) const;
// ConstantArray accessors
Constant* getConstantArray(const ArrayType* T,
- const std::vector<Constant*>& V);
+ const std::vector<Constant*>& V) const;
Constant* getConstantArray(const ArrayType* T, Constant* const* Vals,
- unsigned NumVals);
+ unsigned NumVals) const;
Constant* getConstantArray(const std::string& Initializer,
- bool AddNull = false);
+ bool AddNull = false) const;
// ConstantExpr accessors
- Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2);
- Constant* getConstantExprTrunc(Constant* C, const Type* Ty);
- Constant* getConstantExprSExt(Constant* C, const Type* Ty);
- Constant* getConstantExprZExt(Constant* C, const Type* Ty);
- Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty);
- Constant* getConstantExprFPExtend(Constant* C, const Type* Ty);
- Constant* getConstantExprUIToFP(Constant* C, const Type* Ty);
- Constant* getConstantExprSIToFP(Constant* C, const Type* Ty);
- Constant* getConstantExprFPToUI(Constant* C, const Type* Ty);
- Constant* getConstantExprFPToSI(Constant* C, const Type* Ty);
- Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty);
- Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty);
- Constant* getConstantExprBitCast(Constant* C, const Type* Ty);
- Constant* getConstantExprCast(unsigned ops, Constant* C, const Type* Ty);
- Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty);
- Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty);
- Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty);
- Constant* getConstantExprPointerCast(Constant* C, const Type* Ty);
+ Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2) const;
+ Constant* getConstantExprTrunc(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprSExt(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprZExt(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprFPExtend(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprUIToFP(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprSIToFP(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprFPToUI(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprFPToSI(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprBitCast(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprCast(unsigned ops, Constant* C,
+ const Type* Ty) const;
+ Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprPointerCast(Constant* C, const Type* Ty) const;
Constant* getConstantExprIntegerCast(Constant* C, const Type* Ty,
- bool isSigned);
- Constant* getConstantExprFPCast(Constant* C, const Type* Ty);
- Constant* getConstantExprSelect(Constant* C, Constant* V1, Constant* V2);
- Constant* getConstantExprAlignOf(const Type* Ty);
+ bool isSigned) const;
+ Constant* getConstantExprFPCast(Constant* C, const Type* Ty) const;
+ Constant* getConstantExprSelect(Constant* C, Constant* V1,
+ Constant* V2) const;
+ Constant* getConstantExprAlignOf(const Type* Ty) const;
Constant* getConstantExprCompare(unsigned short pred,
- Constant* C1, Constant* C2);
- Constant* getConstantExprNeg(Constant* C);
- Constant* getConstantExprFNeg(Constant* C);
- Constant* getConstantExprNot(Constant* C);
- Constant* getConstantExprAdd(Constant* C1, Constant* C2);
- Constant* getConstantExprFAdd(Constant* C1, Constant* C2);
- Constant* getConstantExprSub(Constant* C1, Constant* C2);
- Constant* getConstantExprFSub(Constant* C1, Constant* C2);
- Constant* getConstantExprMul(Constant* C1, Constant* C2);
- Constant* getConstantExprFMul(Constant* C1, Constant* C2);
- Constant* getConstantExprUDiv(Constant* C1, Constant* C2);
- Constant* getConstantExprSDiv(Constant* C1, Constant* C2);
- Constant* getConstantExprFDiv(Constant* C1, Constant* C2);
- Constant* getConstantExprURem(Constant* C1, Constant* C2);
- Constant* getConstantExprSRem(Constant* C1, Constant* C2);
- Constant* getConstantExprFRem(Constant* C1, Constant* C2);
- Constant* getConstantExprAnd(Constant* C1, Constant* C2);
- Constant* getConstantExprOr(Constant* C1, Constant* C2);
- Constant* getConstantExprXor(Constant* C1, Constant* C2);
+ Constant* C1, Constant* C2) const;
+ Constant* getConstantExprNeg(Constant* C) const;
+ Constant* getConstantExprFNeg(Constant* C) const;
+ Constant* getConstantExprNot(Constant* C) const;
+ Constant* getConstantExprAdd(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprFAdd(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprSub(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprFSub(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprMul(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprFMul(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprUDiv(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprSDiv(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprFDiv(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprURem(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprSRem(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprFRem(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprAnd(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprOr(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprXor(Constant* C1, Constant* C2) const;
Constant* getConstantExprICmp(unsigned short pred, Constant* LHS,
- Constant* RHS);
+ Constant* RHS) const;
Constant* getConstantExprFCmp(unsigned short pred, Constant* LHS,
- Constant* RHS);
+ Constant* RHS) const;
Constant* getConstantExprVICmp(unsigned short pred, Constant* LHS,
- Constant* RHS);
+ Constant* RHS) const;
Constant* getConstantExprVFCmp(unsigned short pred, Constant* LHS,
- Constant* RHS);
- Constant* getConstantExprShl(Constant* C1, Constant* C2);
- Constant* getConstantExprLShr(Constant* C1, Constant* C2);
- Constant* getConstantExprAShr(Constant* C1, Constant* C2);
+ Constant* RHS) const;
+ Constant* getConstantExprShl(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprLShr(Constant* C1, Constant* C2) const;
+ Constant* getConstantExprAShr(Constant* C1, Constant* C2) const;
Constant* getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList,
- unsigned NumIdx);
+ unsigned NumIdx) const;
Constant* getConstantExprGetElementPtr(Constant* C, Value* const* IdxList,
- unsigned NumIdx);
- Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx);
+ unsigned NumIdx) const;
+ Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx) const;
Constant* getConstantExprInsertElement(Constant* Vec, Constant* Elt,
- Constant* Idx);
+ Constant* Idx) const;
Constant* getConstantExprShuffleVector(Constant* V1, Constant* V2,
- Constant* Mask);
+ Constant* Mask) const;
Constant* getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList,
- unsigned NumIdx);
+ unsigned NumIdx) const;
Constant* getConstantExprInsertValue(Constant* Agg, Constant* Val,
const unsigned* IdxList,
- unsigned NumIdx);
- Constant* getZeroValueForNegation(const Type* Ty);
+ unsigned NumIdx) const;
+ Constant* getZeroValueForNegation(const Type* Ty) const;
// ConstantFP accessors
- ConstantFP* getConstantFP(const APFloat& V);
- Constant* getConstantFP(const Type* Ty, double V);
- ConstantFP* getConstantFPNegativeZero(const Type* Ty);
+ ConstantFP* getConstantFP(const APFloat& V) const;
+ Constant* getConstantFP(const Type* Ty, double V) const;
+ ConstantFP* getConstantFPNegativeZero(const Type* Ty) const;
// ConstantVector accessors
Constant* getConstantVector(const VectorType* T,
- const std::vector<Constant*>& V);
- Constant* getConstantVector(const std::vector<Constant*>& V);
- Constant* getConstantVector(Constant* const* Vals, unsigned NumVals);
- ConstantVector* getConstantVectorAllOnes(const VectorType* Ty);
+ const std::vector<Constant*>& V) const;
+ Constant* getConstantVector(const std::vector<Constant*>& V) const;
+ Constant* getConstantVector(Constant* const* Vals, unsigned NumVals) const;
+ ConstantVector* getConstantVectorAllOnes(const VectorType* Ty) const;
// FunctionType accessors
FunctionType* getFunctionType(const Type* Result,
const std::vector<const Type*>& Params,
- bool isVarArg);
+ bool isVarArg) const;
// IntegerType accessors
- const IntegerType* getIntegerType(unsigned NumBits);
+ const IntegerType* getIntegerType(unsigned NumBits) const;
// OpaqueType accessors
- OpaqueType* getOpaqueType();
+ OpaqueType* getOpaqueType() const;
// StructType accessors
StructType* getStructType(const std::vector<const Type*>& Params,
- bool isPacked = false);
+ bool isPacked = false) const;
// ArrayType accessors
- ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements);
+ ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements) const;
// PointerType accessors
- PointerType* getPointerType(const Type* ElementType, unsigned AddressSpace);
- PointerType* getPointerTypeUnqualified(const Type* ElementType);
+ PointerType* getPointerType(const Type* ElementType,
+ unsigned AddressSpace) const;
+ PointerType* getPointerTypeUnqualified(const Type* ElementType) const;
// VectorType accessors
- VectorType* getVectorType(const Type* ElementType, unsigned NumElements);
- VectorType* getVectorTypeInteger(const VectorType* VTy);
- VectorType* getVectorTypeExtendedElement(const VectorType* VTy);
- VectorType* getVectorTypeTruncatedElement(const VectorType* VTy);
+ VectorType* getVectorType(const Type* ElementType,
+ unsigned NumElements) const;
+ VectorType* getVectorTypeInteger(const VectorType* VTy) const;
+ VectorType* getVectorTypeExtendedElement(const VectorType* VTy) const;
+ VectorType* getVectorTypeTruncatedElement(const VectorType* VTy) const;
};
/// FOR BACKWARDS COMPATIBILITY - Returns a global context.