--- Reverse-merging (from foreign repository) r74648 into '.':

U    include/llvm/LLVMContext.h
U    lib/VMCore/LLVMContext.cpp
U    lib/AsmParser/LLParser.cpp
U    lib/AsmParser/LLParser.h

Temporarily reverting r74648. It was causing massive failures in release mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74653 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2009-07-01 22:33:26 +00:00
parent 7136a6540c
commit aa3943bf63
4 changed files with 183 additions and 209 deletions

View File

@ -54,151 +54,147 @@ public:
~LLVMContext(); ~LLVMContext();
// ConstantInt accessors // ConstantInt accessors
ConstantInt* getConstantIntTrue() const; ConstantInt* getConstantIntTrue();
ConstantInt* getConstantIntFalse() const; ConstantInt* getConstantIntFalse();
ConstantInt* getConstantInt(const IntegerType* Ty, uint64_t V, ConstantInt* getConstantInt(const IntegerType* Ty, uint64_t V,
bool isSigned = false) const; bool isSigned = false);
ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V) const; ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V);
ConstantInt* getConstantInt(const APInt& V) const; ConstantInt* getConstantInt(const APInt& V);
Constant* getConstantInt(const Type* Ty, const APInt& V) const; Constant* getConstantInt(const Type* Ty, const APInt& V);
ConstantInt* getAllOnesConstantInt(const Type* Ty) const; ConstantInt* getAllOnesConstantInt(const Type* Ty);
// ConstantPointerNull accessors // ConstantPointerNull accessors
ConstantPointerNull* getConstantPointerNull(const PointerType* T) const; ConstantPointerNull* getConstantPointerNull(const PointerType* T);
// ConstantStruct accessors // ConstantStruct accessors
Constant* getConstantStruct(const StructType* T, Constant* getConstantStruct(const StructType* T,
const std::vector<Constant*>& V) const; const std::vector<Constant*>& V);
Constant* getConstantStruct(const std::vector<Constant*>& V, Constant* getConstantStruct(const std::vector<Constant*>& V,
bool Packed = false) const; bool Packed = false);
Constant* getConstantStruct(Constant* const *Vals, unsigned NumVals, Constant* getConstantStruct(Constant* const *Vals, unsigned NumVals,
bool Packed = false) const; bool Packed = false);
// ConstantAggregateZero accessors // ConstantAggregateZero accessors
ConstantAggregateZero* getConstantAggregateZero(const Type* Ty) const; ConstantAggregateZero* getConstantAggregateZero(const Type* Ty);
// ConstantArray accessors // ConstantArray accessors
Constant* getConstantArray(const ArrayType* T, Constant* getConstantArray(const ArrayType* T,
const std::vector<Constant*>& V) const; const std::vector<Constant*>& V);
Constant* getConstantArray(const ArrayType* T, Constant* const* Vals, Constant* getConstantArray(const ArrayType* T, Constant* const* Vals,
unsigned NumVals) const; unsigned NumVals);
Constant* getConstantArray(const std::string& Initializer, Constant* getConstantArray(const std::string& Initializer,
bool AddNull = false) const; bool AddNull = false);
// ConstantExpr accessors // ConstantExpr accessors
Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2) const; Constant* getConstantExpr(unsigned Opcode, Constant* C1, Constant* C2);
Constant* getConstantExprTrunc(Constant* C, const Type* Ty) const; Constant* getConstantExprTrunc(Constant* C, const Type* Ty);
Constant* getConstantExprSExt(Constant* C, const Type* Ty) const; Constant* getConstantExprSExt(Constant* C, const Type* Ty);
Constant* getConstantExprZExt(Constant* C, const Type* Ty) const; Constant* getConstantExprZExt(Constant* C, const Type* Ty);
Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty) const; Constant* getConstantExprFPTrunc(Constant* C, const Type* Ty);
Constant* getConstantExprFPExtend(Constant* C, const Type* Ty) const; Constant* getConstantExprFPExtend(Constant* C, const Type* Ty);
Constant* getConstantExprUIToFP(Constant* C, const Type* Ty) const; Constant* getConstantExprUIToFP(Constant* C, const Type* Ty);
Constant* getConstantExprSIToFP(Constant* C, const Type* Ty) const; Constant* getConstantExprSIToFP(Constant* C, const Type* Ty);
Constant* getConstantExprFPToUI(Constant* C, const Type* Ty) const; Constant* getConstantExprFPToUI(Constant* C, const Type* Ty);
Constant* getConstantExprFPToSI(Constant* C, const Type* Ty) const; Constant* getConstantExprFPToSI(Constant* C, const Type* Ty);
Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty) const; Constant* getConstantExprPtrToInt(Constant* C, const Type* Ty);
Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty) const; Constant* getConstantExprIntToPtr(Constant* C, const Type* Ty);
Constant* getConstantExprBitCast(Constant* C, const Type* Ty) const; Constant* getConstantExprBitCast(Constant* C, const Type* Ty);
Constant* getConstantExprCast(unsigned ops, Constant* C, Constant* getConstantExprCast(unsigned ops, Constant* C, const Type* Ty);
const Type* Ty) const; Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty);
Constant* getConstantExprZExtOrBitCast(Constant* C, const Type* Ty) const; Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty);
Constant* getConstantExprSExtOrBitCast(Constant* C, const Type* Ty) const; Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty);
Constant* getConstantExprTruncOrBitCast(Constant* C, const Type* Ty) const; Constant* getConstantExprPointerCast(Constant* C, const Type* Ty);
Constant* getConstantExprPointerCast(Constant* C, const Type* Ty) const;
Constant* getConstantExprIntegerCast(Constant* C, const Type* Ty, Constant* getConstantExprIntegerCast(Constant* C, const Type* Ty,
bool isSigned) const; bool isSigned);
Constant* getConstantExprFPCast(Constant* C, const Type* Ty) const; Constant* getConstantExprFPCast(Constant* C, const Type* Ty);
Constant* getConstantExprSelect(Constant* C, Constant* V1, Constant* getConstantExprSelect(Constant* C, Constant* V1, Constant* V2);
Constant* V2) const; Constant* getConstantExprAlignOf(const Type* Ty);
Constant* getConstantExprAlignOf(const Type* Ty) const;
Constant* getConstantExprCompare(unsigned short pred, Constant* getConstantExprCompare(unsigned short pred,
Constant* C1, Constant* C2) const; Constant* C1, Constant* C2);
Constant* getConstantExprNeg(Constant* C) const; Constant* getConstantExprNeg(Constant* C);
Constant* getConstantExprFNeg(Constant* C) const; Constant* getConstantExprFNeg(Constant* C);
Constant* getConstantExprNot(Constant* C) const; Constant* getConstantExprNot(Constant* C);
Constant* getConstantExprAdd(Constant* C1, Constant* C2) const; Constant* getConstantExprAdd(Constant* C1, Constant* C2);
Constant* getConstantExprFAdd(Constant* C1, Constant* C2) const; Constant* getConstantExprFAdd(Constant* C1, Constant* C2);
Constant* getConstantExprSub(Constant* C1, Constant* C2) const; Constant* getConstantExprSub(Constant* C1, Constant* C2);
Constant* getConstantExprFSub(Constant* C1, Constant* C2) const; Constant* getConstantExprFSub(Constant* C1, Constant* C2);
Constant* getConstantExprMul(Constant* C1, Constant* C2) const; Constant* getConstantExprMul(Constant* C1, Constant* C2);
Constant* getConstantExprFMul(Constant* C1, Constant* C2) const; Constant* getConstantExprFMul(Constant* C1, Constant* C2);
Constant* getConstantExprUDiv(Constant* C1, Constant* C2) const; Constant* getConstantExprUDiv(Constant* C1, Constant* C2);
Constant* getConstantExprSDiv(Constant* C1, Constant* C2) const; Constant* getConstantExprSDiv(Constant* C1, Constant* C2);
Constant* getConstantExprFDiv(Constant* C1, Constant* C2) const; Constant* getConstantExprFDiv(Constant* C1, Constant* C2);
Constant* getConstantExprURem(Constant* C1, Constant* C2) const; Constant* getConstantExprURem(Constant* C1, Constant* C2);
Constant* getConstantExprSRem(Constant* C1, Constant* C2) const; Constant* getConstantExprSRem(Constant* C1, Constant* C2);
Constant* getConstantExprFRem(Constant* C1, Constant* C2) const; Constant* getConstantExprFRem(Constant* C1, Constant* C2);
Constant* getConstantExprAnd(Constant* C1, Constant* C2) const; Constant* getConstantExprAnd(Constant* C1, Constant* C2);
Constant* getConstantExprOr(Constant* C1, Constant* C2) const; Constant* getConstantExprOr(Constant* C1, Constant* C2);
Constant* getConstantExprXor(Constant* C1, Constant* C2) const; Constant* getConstantExprXor(Constant* C1, Constant* C2);
Constant* getConstantExprICmp(unsigned short pred, Constant* LHS, Constant* getConstantExprICmp(unsigned short pred, Constant* LHS,
Constant* RHS) const; Constant* RHS);
Constant* getConstantExprFCmp(unsigned short pred, Constant* LHS, Constant* getConstantExprFCmp(unsigned short pred, Constant* LHS,
Constant* RHS) const; Constant* RHS);
Constant* getConstantExprVICmp(unsigned short pred, Constant* LHS, Constant* getConstantExprVICmp(unsigned short pred, Constant* LHS,
Constant* RHS) const; Constant* RHS);
Constant* getConstantExprVFCmp(unsigned short pred, Constant* LHS, Constant* getConstantExprVFCmp(unsigned short pred, Constant* LHS,
Constant* RHS) const; Constant* RHS);
Constant* getConstantExprShl(Constant* C1, Constant* C2) const; Constant* getConstantExprShl(Constant* C1, Constant* C2);
Constant* getConstantExprLShr(Constant* C1, Constant* C2) const; Constant* getConstantExprLShr(Constant* C1, Constant* C2);
Constant* getConstantExprAShr(Constant* C1, Constant* C2) const; Constant* getConstantExprAShr(Constant* C1, Constant* C2);
Constant* getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList, Constant* getConstantExprGetElementPtr(Constant* C, Constant* const* IdxList,
unsigned NumIdx) const; unsigned NumIdx);
Constant* getConstantExprGetElementPtr(Constant* C, Value* const* IdxList, Constant* getConstantExprGetElementPtr(Constant* C, Value* const* IdxList,
unsigned NumIdx) const; unsigned NumIdx);
Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx) const; Constant* getConstantExprExtractElement(Constant* Vec, Constant* Idx);
Constant* getConstantExprInsertElement(Constant* Vec, Constant* Elt, Constant* getConstantExprInsertElement(Constant* Vec, Constant* Elt,
Constant* Idx) const; Constant* Idx);
Constant* getConstantExprShuffleVector(Constant* V1, Constant* V2, Constant* getConstantExprShuffleVector(Constant* V1, Constant* V2,
Constant* Mask) const; Constant* Mask);
Constant* getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList, Constant* getConstantExprExtractValue(Constant* Agg, const unsigned* IdxList,
unsigned NumIdx) const; unsigned NumIdx);
Constant* getConstantExprInsertValue(Constant* Agg, Constant* Val, Constant* getConstantExprInsertValue(Constant* Agg, Constant* Val,
const unsigned* IdxList, const unsigned* IdxList,
unsigned NumIdx) const; unsigned NumIdx);
Constant* getZeroValueForNegation(const Type* Ty) const; Constant* getZeroValueForNegation(const Type* Ty);
// ConstantFP accessors // ConstantFP accessors
ConstantFP* getConstantFP(const APFloat& V) const; ConstantFP* getConstantFP(const APFloat& V);
Constant* getConstantFP(const Type* Ty, double V) const; Constant* getConstantFP(const Type* Ty, double V);
ConstantFP* getConstantFPNegativeZero(const Type* Ty) const; ConstantFP* getConstantFPNegativeZero(const Type* Ty);
// ConstantVector accessors // ConstantVector accessors
Constant* getConstantVector(const VectorType* T, Constant* getConstantVector(const VectorType* T,
const std::vector<Constant*>& V) const; const std::vector<Constant*>& V);
Constant* getConstantVector(const std::vector<Constant*>& V) const; Constant* getConstantVector(const std::vector<Constant*>& V);
Constant* getConstantVector(Constant* const* Vals, unsigned NumVals) const; Constant* getConstantVector(Constant* const* Vals, unsigned NumVals);
ConstantVector* getConstantVectorAllOnes(const VectorType* Ty) const; ConstantVector* getConstantVectorAllOnes(const VectorType* Ty);
// FunctionType accessors // FunctionType accessors
FunctionType* getFunctionType(const Type* Result, FunctionType* getFunctionType(const Type* Result,
const std::vector<const Type*>& Params, const std::vector<const Type*>& Params,
bool isVarArg) const; bool isVarArg);
// IntegerType accessors // IntegerType accessors
const IntegerType* getIntegerType(unsigned NumBits) const; const IntegerType* getIntegerType(unsigned NumBits);
// OpaqueType accessors // OpaqueType accessors
OpaqueType* getOpaqueType() const; OpaqueType* getOpaqueType();
// StructType accessors // StructType accessors
StructType* getStructType(const std::vector<const Type*>& Params, StructType* getStructType(const std::vector<const Type*>& Params,
bool isPacked = false) const; bool isPacked = false);
// ArrayType accessors // ArrayType accessors
ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements) const; ArrayType* getArrayType(const Type* ElementType, uint64_t NumElements);
// PointerType accessors // PointerType accessors
PointerType* getPointerType(const Type* ElementType, PointerType* getPointerType(const Type* ElementType, unsigned AddressSpace);
unsigned AddressSpace) const; PointerType* getPointerTypeUnqualified(const Type* ElementType);
PointerType* getPointerTypeUnqualified(const Type* ElementType) const;
// VectorType accessors // VectorType accessors
VectorType* getVectorType(const Type* ElementType, VectorType* getVectorType(const Type* ElementType, unsigned NumElements);
unsigned NumElements) const; VectorType* getVectorTypeInteger(const VectorType* VTy);
VectorType* getVectorTypeInteger(const VectorType* VTy) const; VectorType* getVectorTypeExtendedElement(const VectorType* VTy);
VectorType* getVectorTypeExtendedElement(const VectorType* VTy) const; VectorType* getVectorTypeTruncatedElement(const VectorType* VTy);
VectorType* getVectorTypeTruncatedElement(const VectorType* VTy) const;
}; };
/// FOR BACKWARDS COMPATIBILITY - Returns a global context. /// FOR BACKWARDS COMPATIBILITY - Returns a global context.

View File

@ -18,7 +18,6 @@
#include "llvm/DerivedTypes.h" #include "llvm/DerivedTypes.h"
#include "llvm/InlineAsm.h" #include "llvm/InlineAsm.h"
#include "llvm/Instructions.h" #include "llvm/Instructions.h"
#include "llvm/LLVMContext.h"
#include "llvm/MDNode.h" #include "llvm/MDNode.h"
#include "llvm/Module.h" #include "llvm/Module.h"
#include "llvm/ValueSymbolTable.h" #include "llvm/ValueSymbolTable.h"
@ -1654,11 +1653,11 @@ bool LLParser::ParseValID(ValID &ID) {
ID.Kind = ValID::t_APFloat; ID.Kind = ValID::t_APFloat;
break; break;
case lltok::kw_true: case lltok::kw_true:
ID.ConstantVal = Context.getConstantIntTrue(); ID.ConstantVal = ConstantInt::getTrue();
ID.Kind = ValID::t_Constant; ID.Kind = ValID::t_Constant;
break; break;
case lltok::kw_false: case lltok::kw_false:
ID.ConstantVal = Context.getConstantIntFalse(); ID.ConstantVal = ConstantInt::getFalse();
ID.Kind = ValID::t_Constant; ID.Kind = ValID::t_Constant;
break; break;
case lltok::kw_null: ID.Kind = ValID::t_Null; break; case lltok::kw_null: ID.Kind = ValID::t_Null; break;
@ -2038,7 +2037,7 @@ bool LLParser::ConvertGlobalValIDToValue(const Type *Ty, ValID &ID,
if (!isa<IntegerType>(Ty)) if (!isa<IntegerType>(Ty))
return Error(ID.Loc, "integer constant must have integer type"); return Error(ID.Loc, "integer constant must have integer type");
ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits()); ID.APSIntVal.extOrTrunc(Ty->getPrimitiveSizeInBits());
V = Context.getConstantInt(ID.APSIntVal); V = ConstantInt::get(ID.APSIntVal);
return false; return false;
case ValID::t_APFloat: case ValID::t_APFloat:
if (!Ty->isFloatingPoint() || if (!Ty->isFloatingPoint() ||

View File

@ -15,7 +15,6 @@
#define LLVM_ASMPARSER_LLPARSER_H #define LLVM_ASMPARSER_LLPARSER_H
#include "LLLexer.h" #include "LLLexer.h"
#include "llvm/Module.h"
#include "llvm/Type.h" #include "llvm/Type.h"
#include <map> #include <map>
@ -30,14 +29,13 @@ namespace llvm {
class GlobalValue; class GlobalValue;
class MDString; class MDString;
class MDNode; class MDNode;
class LLVMContext;
struct ValID; struct ValID;
class LLParser { class LLParser {
public: public:
typedef LLLexer::LocTy LocTy; typedef LLLexer::LocTy LocTy;
private: private:
const LLVMContext& Context;
LLLexer Lex; LLLexer Lex;
Module *M; Module *M;
@ -74,8 +72,7 @@ namespace llvm {
std::map<unsigned, std::pair<GlobalValue*, LocTy> > ForwardRefValIDs; std::map<unsigned, std::pair<GlobalValue*, LocTy> > ForwardRefValIDs;
std::vector<GlobalValue*> NumberedVals; std::vector<GlobalValue*> NumberedVals;
public: public:
LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : LLParser(MemoryBuffer *F, ParseError &Err, Module *m) : Lex(F, Err), M(m) {}
Context(M->getContext()), Lex(F, Err), M(m) {}
bool Run(); bool Run();
private: private:

View File

@ -30,438 +30,420 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl()) { }
LLVMContext::~LLVMContext() { delete pImpl; } LLVMContext::~LLVMContext() { delete pImpl; }
// ConstantInt accessors. // ConstantInt accessors.
ConstantInt* LLVMContext::getConstantIntTrue() const { ConstantInt* LLVMContext::getConstantIntTrue() {
return ConstantInt::getTrue(); return ConstantInt::getTrue();
} }
ConstantInt* LLVMContext::getConstantIntFalse() const { ConstantInt* LLVMContext::getConstantIntFalse() {
return ConstantInt::getFalse(); return ConstantInt::getFalse();
} }
ConstantInt* LLVMContext::getConstantInt(const IntegerType* Ty, uint64_t V, ConstantInt* LLVMContext::getConstantInt(const IntegerType* Ty, uint64_t V,
bool isSigned) const { bool isSigned) {
return ConstantInt::get(Ty, V, isSigned); return ConstantInt::get(Ty, V, isSigned);
} }
ConstantInt* LLVMContext::getConstantIntSigned(const IntegerType* Ty, ConstantInt* LLVMContext::getConstantIntSigned(const IntegerType* Ty,
int64_t V) const { int64_t V) {
return ConstantInt::getSigned(Ty, V); return ConstantInt::getSigned(Ty, V);
} }
ConstantInt* LLVMContext::getConstantInt(const APInt& V) const { ConstantInt* LLVMContext::getConstantInt(const APInt& V) {
return ConstantInt::get(V); return ConstantInt::get(V);
} }
Constant* LLVMContext::getConstantInt(const Type* Ty, const APInt& V) const { Constant* LLVMContext::getConstantInt(const Type* Ty, const APInt& V) {
return ConstantInt::get(Ty, V); return ConstantInt::get(Ty, V);
} }
ConstantInt* LLVMContext::getAllOnesConstantInt(const Type* Ty) const { ConstantInt* LLVMContext::getAllOnesConstantInt(const Type* Ty) {
return ConstantInt::getAllOnesValue(Ty); return ConstantInt::getAllOnesValue(Ty);
} }
// ConstantPointerNull accessors. // ConstantPointerNull accessors.
ConstantPointerNull* ConstantPointerNull* LLVMContext::getConstantPointerNull(const PointerType* T) {
LLVMContext::getConstantPointerNull(const PointerType* T) const {
return ConstantPointerNull::get(T); return ConstantPointerNull::get(T);
} }
// ConstantStruct accessors. // ConstantStruct accessors.
Constant* LLVMContext::getConstantStruct(const StructType* T, Constant* LLVMContext::getConstantStruct(const StructType* T,
const std::vector<Constant*>& V) const { const std::vector<Constant*>& V) {
return ConstantStruct::get(T, V); return ConstantStruct::get(T, V);
} }
Constant* LLVMContext::getConstantStruct(const std::vector<Constant*>& V, Constant* LLVMContext::getConstantStruct(const std::vector<Constant*>& V,
bool Packed) const { bool Packed) {
return ConstantStruct::get(V, Packed); return ConstantStruct::get(V, Packed);
} }
Constant* LLVMContext::getConstantStruct(Constant* const *Vals, Constant* LLVMContext::getConstantStruct(Constant* const *Vals,
unsigned NumVals, bool Packed) const { unsigned NumVals, bool Packed) {
return ConstantStruct::get(Vals, NumVals, Packed); return ConstantStruct::get(Vals, NumVals, Packed);
} }
// ConstantAggregateZero accessors. // ConstantAggregateZero accessors.
ConstantAggregateZero* ConstantAggregateZero* LLVMContext::getConstantAggregateZero(const Type* Ty) {
LLVMContext::getConstantAggregateZero(const Type* Ty) const {
return ConstantAggregateZero::get(Ty); return ConstantAggregateZero::get(Ty);
} }
// ConstantArray accessors. // ConstantArray accessors.
Constant* LLVMContext::getConstantArray(const ArrayType* T, Constant* LLVMContext::getConstantArray(const ArrayType* T,
const std::vector<Constant*>& V) const { const std::vector<Constant*>& V) {
return ConstantArray::get(T, V); return ConstantArray::get(T, V);
} }
Constant* LLVMContext::getConstantArray(const ArrayType* T, Constant* LLVMContext::getConstantArray(const ArrayType* T,
Constant* const* Vals, Constant* const* Vals,
unsigned NumVals) const { unsigned NumVals) {
return ConstantArray::get(T, Vals, NumVals); return ConstantArray::get(T, Vals, NumVals);
} }
Constant* LLVMContext::getConstantArray(const std::string& Initializer, Constant* LLVMContext::getConstantArray(const std::string& Initializer,
bool AddNull) const { bool AddNull) {
return ConstantArray::get(Initializer, AddNull); return ConstantArray::get(Initializer, AddNull);
} }
// ConstantExpr accessors. // ConstantExpr accessors.
Constant* LLVMContext::getConstantExpr(unsigned Opcode, Constant* C1, Constant* LLVMContext::getConstantExpr(unsigned Opcode, Constant* C1,
Constant* C2) const { Constant* C2) {
return ConstantExpr::get(Opcode, C1, C2); return ConstantExpr::get(Opcode, C1, C2);
} }
Constant* LLVMContext::getConstantExprTrunc(Constant* C, const Type* Ty) const { Constant* LLVMContext::getConstantExprTrunc(Constant* C, const Type* Ty) {
return ConstantExpr::getTrunc(C, Ty); return ConstantExpr::getTrunc(C, Ty);
} }
Constant* LLVMContext::getConstantExprSExt(Constant* C, const Type* Ty) const { Constant* LLVMContext::getConstantExprSExt(Constant* C, const Type* Ty) {
return ConstantExpr::getSExt(C, Ty); return ConstantExpr::getSExt(C, Ty);
} }
Constant* LLVMContext::getConstantExprZExt(Constant* C, const Type* Ty) const { Constant* LLVMContext::getConstantExprZExt(Constant* C, const Type* Ty) {
return ConstantExpr::getZExt(C, Ty); return ConstantExpr::getZExt(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprFPTrunc(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprFPTrunc(Constant* C, const Type* Ty) const {
return ConstantExpr::getFPTrunc(C, Ty); return ConstantExpr::getFPTrunc(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprFPExtend(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprFPExtend(Constant* C, const Type* Ty) const {
return ConstantExpr::getFPExtend(C, Ty); return ConstantExpr::getFPExtend(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprUIToFP(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprUIToFP(Constant* C, const Type* Ty) const {
return ConstantExpr::getUIToFP(C, Ty); return ConstantExpr::getUIToFP(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprSIToFP(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprSIToFP(Constant* C, const Type* Ty) const {
return ConstantExpr::getSIToFP(C, Ty); return ConstantExpr::getSIToFP(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprFPToUI(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprFPToUI(Constant* C, const Type* Ty) const {
return ConstantExpr::getFPToUI(C, Ty); return ConstantExpr::getFPToUI(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprFPToSI(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprFPToSI(Constant* C, const Type* Ty) const {
return ConstantExpr::getFPToSI(C, Ty); return ConstantExpr::getFPToSI(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprPtrToInt(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprPtrToInt(Constant* C, const Type* Ty) const {
return ConstantExpr::getPtrToInt(C, Ty); return ConstantExpr::getPtrToInt(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprIntToPtr(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprIntToPtr(Constant* C, const Type* Ty) const {
return ConstantExpr::getIntToPtr(C, Ty); return ConstantExpr::getIntToPtr(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprBitCast(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprBitCast(Constant* C, const Type* Ty) const {
return ConstantExpr::getBitCast(C, Ty); return ConstantExpr::getBitCast(C, Ty);
} }
Constant* LLVMContext::getConstantExprCast(unsigned ops, Constant* C, Constant* LLVMContext::getConstantExprCast(unsigned ops, Constant* C,
const Type* Ty) const { const Type* Ty) {
return ConstantExpr::getCast(ops, C, Ty); return ConstantExpr::getCast(ops, C, Ty);
} }
Constant* LLVMContext::getConstantExprZExtOrBitCast(Constant* C, Constant* LLVMContext::getConstantExprZExtOrBitCast(Constant* C,
const Type* Ty) const { const Type* Ty) {
return ConstantExpr::getZExtOrBitCast(C, Ty); return ConstantExpr::getZExtOrBitCast(C, Ty);
} }
Constant* LLVMContext::getConstantExprSExtOrBitCast(Constant* C, Constant* LLVMContext::getConstantExprSExtOrBitCast(Constant* C,
const Type* Ty) const { const Type* Ty) {
return ConstantExpr::getSExtOrBitCast(C, Ty); return ConstantExpr::getSExtOrBitCast(C, Ty);
} }
Constant* LLVMContext::getConstantExprTruncOrBitCast(Constant* C, Constant* LLVMContext::getConstantExprTruncOrBitCast(Constant* C,
const Type* Ty) const { const Type* Ty) {
return ConstantExpr::getTruncOrBitCast(C, Ty); return ConstantExpr::getTruncOrBitCast(C, Ty);
} }
Constant* Constant* LLVMContext::getConstantExprPointerCast(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprPointerCast(Constant* C, const Type* Ty) const {
return ConstantExpr::getPointerCast(C, Ty); return ConstantExpr::getPointerCast(C, Ty);
} }
Constant* LLVMContext::getConstantExprIntegerCast(Constant* C, const Type* Ty, Constant* LLVMContext::getConstantExprIntegerCast(Constant* C, const Type* Ty,
bool isSigned) const { bool isSigned) {
return ConstantExpr::getIntegerCast(C, Ty, isSigned); return ConstantExpr::getIntegerCast(C, Ty, isSigned);
} }
Constant* Constant* LLVMContext::getConstantExprFPCast(Constant* C, const Type* Ty) {
LLVMContext::getConstantExprFPCast(Constant* C, const Type* Ty) const {
return ConstantExpr::getFPCast(C, Ty); return ConstantExpr::getFPCast(C, Ty);
} }
Constant* LLVMContext::getConstantExprSelect(Constant* C, Constant* V1, Constant* LLVMContext::getConstantExprSelect(Constant* C, Constant* V1,
Constant* V2) const { Constant* V2) {
return ConstantExpr::getSelect(C, V1, V2); return ConstantExpr::getSelect(C, V1, V2);
} }
Constant* LLVMContext::getConstantExprAlignOf(const Type* Ty) const { Constant* LLVMContext::getConstantExprAlignOf(const Type* Ty) {
return ConstantExpr::getAlignOf(Ty); return ConstantExpr::getAlignOf(Ty);
} }
Constant* LLVMContext::getConstantExprCompare(unsigned short pred, Constant* LLVMContext::getConstantExprCompare(unsigned short pred,
Constant* C1, Constant* C2) const { Constant* C1, Constant* C2) {
return ConstantExpr::getCompare(pred, C1, C2); return ConstantExpr::getCompare(pred, C1, C2);
} }
Constant* LLVMContext::getConstantExprNeg(Constant* C) const { Constant* LLVMContext::getConstantExprNeg(Constant* C) {
return ConstantExpr::getNeg(C); return ConstantExpr::getNeg(C);
} }
Constant* LLVMContext::getConstantExprFNeg(Constant* C) const { Constant* LLVMContext::getConstantExprFNeg(Constant* C) {
return ConstantExpr::getFNeg(C); return ConstantExpr::getFNeg(C);
} }
Constant* LLVMContext::getConstantExprNot(Constant* C) const { Constant* LLVMContext::getConstantExprNot(Constant* C) {
return ConstantExpr::getNot(C); return ConstantExpr::getNot(C);
} }
Constant* LLVMContext::getConstantExprAdd(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprAdd(Constant* C1, Constant* C2) {
return ConstantExpr::getAdd(C1, C2); return ConstantExpr::getAdd(C1, C2);
} }
Constant* LLVMContext::getConstantExprFAdd(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprFAdd(Constant* C1, Constant* C2) {
return ConstantExpr::getFAdd(C1, C2); return ConstantExpr::getFAdd(C1, C2);
} }
Constant* LLVMContext::getConstantExprSub(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprSub(Constant* C1, Constant* C2) {
return ConstantExpr::getSub(C1, C2); return ConstantExpr::getSub(C1, C2);
} }
Constant* LLVMContext::getConstantExprFSub(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprFSub(Constant* C1, Constant* C2) {
return ConstantExpr::getFSub(C1, C2); return ConstantExpr::getFSub(C1, C2);
} }
Constant* LLVMContext::getConstantExprMul(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprMul(Constant* C1, Constant* C2) {
return ConstantExpr::getMul(C1, C2); return ConstantExpr::getMul(C1, C2);
} }
Constant* LLVMContext::getConstantExprFMul(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprFMul(Constant* C1, Constant* C2) {
return ConstantExpr::getFMul(C1, C2); return ConstantExpr::getFMul(C1, C2);
} }
Constant* LLVMContext::getConstantExprUDiv(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprUDiv(Constant* C1, Constant* C2) {
return ConstantExpr::getUDiv(C1, C2); return ConstantExpr::getUDiv(C1, C2);
} }
Constant* LLVMContext::getConstantExprSDiv(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprSDiv(Constant* C1, Constant* C2) {
return ConstantExpr::getSDiv(C1, C2); return ConstantExpr::getSDiv(C1, C2);
} }
Constant* LLVMContext::getConstantExprFDiv(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprFDiv(Constant* C1, Constant* C2) {
return ConstantExpr::getFDiv(C1, C2); return ConstantExpr::getFDiv(C1, C2);
} }
Constant* LLVMContext::getConstantExprURem(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprURem(Constant* C1, Constant* C2) {
return ConstantExpr::getURem(C1, C2); return ConstantExpr::getURem(C1, C2);
} }
Constant* LLVMContext::getConstantExprSRem(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprSRem(Constant* C1, Constant* C2) {
return ConstantExpr::getSRem(C1, C2); return ConstantExpr::getSRem(C1, C2);
} }
Constant* LLVMContext::getConstantExprFRem(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprFRem(Constant* C1, Constant* C2) {
return ConstantExpr::getFRem(C1, C2); return ConstantExpr::getFRem(C1, C2);
} }
Constant* LLVMContext::getConstantExprAnd(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprAnd(Constant* C1, Constant* C2) {
return ConstantExpr::getAnd(C1, C2); return ConstantExpr::getAnd(C1, C2);
} }
Constant* LLVMContext::getConstantExprOr(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprOr(Constant* C1, Constant* C2) {
return ConstantExpr::getOr(C1, C2); return ConstantExpr::getOr(C1, C2);
} }
Constant* LLVMContext::getConstantExprXor(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprXor(Constant* C1, Constant* C2) {
return ConstantExpr::getXor(C1, C2); return ConstantExpr::getXor(C1, C2);
} }
Constant* LLVMContext::getConstantExprICmp(unsigned short pred, Constant* LHS, Constant* LLVMContext::getConstantExprICmp(unsigned short pred, Constant* LHS,
Constant* RHS) const { Constant* RHS) {
return ConstantExpr::getICmp(pred, LHS, RHS); return ConstantExpr::getICmp(pred, LHS, RHS);
} }
Constant* LLVMContext::getConstantExprFCmp(unsigned short pred, Constant* LHS, Constant* LLVMContext::getConstantExprFCmp(unsigned short pred, Constant* LHS,
Constant* RHS) const { Constant* RHS) {
return ConstantExpr::getFCmp(pred, LHS, RHS); return ConstantExpr::getFCmp(pred, LHS, RHS);
} }
Constant* LLVMContext::getConstantExprVICmp(unsigned short pred, Constant* LHS, Constant* LLVMContext::getConstantExprVICmp(unsigned short pred, Constant* LHS,
Constant* RHS) const { Constant* RHS) {
return ConstantExpr::getVICmp(pred, LHS, RHS); return ConstantExpr::getVICmp(pred, LHS, RHS);
} }
Constant* LLVMContext::getConstantExprVFCmp(unsigned short pred, Constant* LHS, Constant* LLVMContext::getConstantExprVFCmp(unsigned short pred, Constant* LHS,
Constant* RHS) const { Constant* RHS) {
return ConstantExpr::getVFCmp(pred, LHS, RHS); return ConstantExpr::getVFCmp(pred, LHS, RHS);
} }
Constant* LLVMContext::getConstantExprShl(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprShl(Constant* C1, Constant* C2) {
return ConstantExpr::getShl(C1, C2); return ConstantExpr::getShl(C1, C2);
} }
Constant* LLVMContext::getConstantExprLShr(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprLShr(Constant* C1, Constant* C2) {
return ConstantExpr::getLShr(C1, C2); return ConstantExpr::getLShr(C1, C2);
} }
Constant* LLVMContext::getConstantExprAShr(Constant* C1, Constant* C2) const { Constant* LLVMContext::getConstantExprAShr(Constant* C1, Constant* C2) {
return ConstantExpr::getAShr(C1, C2); return ConstantExpr::getAShr(C1, C2);
} }
Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C, Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C,
Constant* const* IdxList, Constant* const* IdxList,
unsigned NumIdx) const { unsigned NumIdx) {
return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx);
} }
Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C, Constant* LLVMContext::getConstantExprGetElementPtr(Constant* C,
Value* const* IdxList, Value* const* IdxList,
unsigned NumIdx) const { unsigned NumIdx) {
return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx); return ConstantExpr::getGetElementPtr(C, IdxList, NumIdx);
} }
Constant* LLVMContext::getConstantExprExtractElement(Constant* Vec, Constant* LLVMContext::getConstantExprExtractElement(Constant* Vec,
Constant* Idx) const { Constant* Idx) {
return ConstantExpr::getExtractElement(Vec, Idx); return ConstantExpr::getExtractElement(Vec, Idx);
} }
Constant* LLVMContext::getConstantExprInsertElement(Constant* Vec, Constant* LLVMContext::getConstantExprInsertElement(Constant* Vec,
Constant* Elt, Constant* Elt,
Constant* Idx) const { Constant* Idx) {
return ConstantExpr::getInsertElement(Vec, Elt, Idx); return ConstantExpr::getInsertElement(Vec, Elt, Idx);
} }
Constant* LLVMContext::getConstantExprShuffleVector(Constant* V1, Constant* V2, Constant* LLVMContext::getConstantExprShuffleVector(Constant* V1, Constant* V2,
Constant* Mask) const { Constant* Mask) {
return ConstantExpr::getShuffleVector(V1, V2, Mask); return ConstantExpr::getShuffleVector(V1, V2, Mask);
} }
Constant* LLVMContext::getConstantExprExtractValue(Constant* Agg, Constant* LLVMContext::getConstantExprExtractValue(Constant* Agg,
const unsigned* IdxList, const unsigned* IdxList,
unsigned NumIdx) const { unsigned NumIdx) {
return ConstantExpr::getExtractValue(Agg, IdxList, NumIdx); return ConstantExpr::getExtractValue(Agg, IdxList, NumIdx);
} }
Constant* LLVMContext::getConstantExprInsertValue(Constant* Agg, Constant* Val, Constant* LLVMContext::getConstantExprInsertValue(Constant* Agg, Constant* Val,
const unsigned* IdxList, const unsigned* IdxList,
unsigned NumIdx) const { unsigned NumIdx) {
return ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx); return ConstantExpr::getInsertValue(Agg, Val, IdxList, NumIdx);
} }
Constant* LLVMContext::getZeroValueForNegation(const Type* Ty) const { Constant* LLVMContext::getZeroValueForNegation(const Type* Ty) {
return ConstantExpr::getZeroValueForNegationExpr(Ty); return ConstantExpr::getZeroValueForNegationExpr(Ty);
} }
// ConstantFP accessors. // ConstantFP accessors.
ConstantFP* LLVMContext::getConstantFP(const APFloat& V) const { ConstantFP* LLVMContext::getConstantFP(const APFloat& V) {
return ConstantFP::get(V); return ConstantFP::get(V);
} }
Constant* LLVMContext::getConstantFP(const Type* Ty, double V) const { Constant* LLVMContext::getConstantFP(const Type* Ty, double V) {
return ConstantFP::get(Ty, V); return ConstantFP::get(Ty, V);
} }
ConstantFP* LLVMContext::getConstantFPNegativeZero(const Type* Ty) const { ConstantFP* LLVMContext::getConstantFPNegativeZero(const Type* Ty) {
return ConstantFP::getNegativeZero(Ty); return ConstantFP::getNegativeZero(Ty);
} }
// ConstantVector accessors. // ConstantVector accessors.
Constant* LLVMContext::getConstantVector(const VectorType* T, Constant* LLVMContext::getConstantVector(const VectorType* T,
const std::vector<Constant*>& V) const { const std::vector<Constant*>& V) {
return ConstantVector::get(T, V); return ConstantVector::get(T, V);
} }
Constant* Constant* LLVMContext::getConstantVector(const std::vector<Constant*>& V) {
LLVMContext::getConstantVector(const std::vector<Constant*>& V) const {
return ConstantVector::get(V); return ConstantVector::get(V);
} }
Constant* LLVMContext::getConstantVector(Constant* const* Vals, Constant* LLVMContext::getConstantVector(Constant* const* Vals,
unsigned NumVals) const { unsigned NumVals) {
return ConstantVector::get(Vals, NumVals); return ConstantVector::get(Vals, NumVals);
} }
ConstantVector* ConstantVector* LLVMContext::getConstantVectorAllOnes(const VectorType* Ty) {
LLVMContext::getConstantVectorAllOnes(const VectorType* Ty) const {
return ConstantVector::getAllOnesValue(Ty); return ConstantVector::getAllOnesValue(Ty);
} }
// FunctionType accessors // FunctionType accessors
FunctionType* LLVMContext::getFunctionType(const Type* Result, FunctionType* LLVMContext::getFunctionType(const Type* Result,
const std::vector<const Type*>& Params, const std::vector<const Type*>& Params,
bool isVarArg) const { bool isVarArg) {
return FunctionType::get(Result, Params, isVarArg); return FunctionType::get(Result, Params, isVarArg);
} }
// IntegerType accessors // IntegerType accessors
const IntegerType* LLVMContext::getIntegerType(unsigned NumBits) const { const IntegerType* LLVMContext::getIntegerType(unsigned NumBits) {
return IntegerType::get(NumBits); return IntegerType::get(NumBits);
} }
// OpaqueType accessors // OpaqueType accessors
OpaqueType* LLVMContext::getOpaqueType() const { OpaqueType* LLVMContext::getOpaqueType() {
return OpaqueType::get(); return OpaqueType::get();
} }
// StructType accessors // StructType accessors
StructType* LLVMContext::getStructType(const std::vector<const Type*>& Params, StructType* LLVMContext::getStructType(const std::vector<const Type*>& Params,
bool isPacked) const { bool isPacked) {
return StructType::get(Params, isPacked); return StructType::get(Params, isPacked);
} }
// ArrayType accessors // ArrayType accessors
ArrayType* LLVMContext::getArrayType(const Type* ElementType, ArrayType* LLVMContext::getArrayType(const Type* ElementType,
uint64_t NumElements) const { uint64_t NumElements) {
return ArrayType::get(ElementType, NumElements); return ArrayType::get(ElementType, NumElements);
} }
// PointerType accessors // PointerType accessors
PointerType* LLVMContext::getPointerType(const Type* ElementType, PointerType* LLVMContext::getPointerType(const Type* ElementType,
unsigned AddressSpace) const { unsigned AddressSpace) {
return PointerType::get(ElementType, AddressSpace); return PointerType::get(ElementType, AddressSpace);
} }
PointerType* PointerType* LLVMContext::getPointerTypeUnqualified(const Type* ElementType) {
LLVMContext::getPointerTypeUnqualified(const Type* ElementType) const {
return PointerType::getUnqual(ElementType); return PointerType::getUnqual(ElementType);
} }
// VectorType accessors // VectorType accessors
VectorType* LLVMContext::getVectorType(const Type* ElementType, VectorType* LLVMContext::getVectorType(const Type* ElementType,
unsigned NumElements) const { unsigned NumElements) {
return VectorType::get(ElementType, NumElements); return VectorType::get(ElementType, NumElements);
} }
VectorType* LLVMContext::getVectorTypeInteger(const VectorType* VTy) const { VectorType* LLVMContext::getVectorTypeInteger(const VectorType* VTy) {
return VectorType::getInteger(VTy); return VectorType::getInteger(VTy);
} }
VectorType* VectorType* LLVMContext::getVectorTypeExtendedElement(const VectorType* VTy) {
LLVMContext::getVectorTypeExtendedElement(const VectorType* VTy) const {
return VectorType::getExtendedElementVectorType(VTy); return VectorType::getExtendedElementVectorType(VTy);
} }
VectorType* VectorType* LLVMContext::getVectorTypeTruncatedElement(const VectorType* VTy) {
LLVMContext::getVectorTypeTruncatedElement(const VectorType* VTy) const {
return VectorType::getTruncatedElementVectorType(VTy); return VectorType::getTruncatedElementVectorType(VTy);
} }