aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-29 18:54:39 +0000
committerOwen Anderson <resistor@mac.com>2009-07-29 18:54:39 +0000
commit3c4972def972f8ca44dcd0561779a12aaa6fec97 (patch)
treee46ecd68bbec4a407d573155c6513e88b02a1857
parent8a8a629844d26c24dc0147d55a32a937b14b9381 (diff)
Update for LLVM API change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77492 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGBlocks.cpp12
-rw-r--r--lib/CodeGen/CGDecl.cpp4
-rw-r--r--lib/CodeGen/CGExprConstant.cpp24
-rw-r--r--lib/CodeGen/CGObjC.cpp2
-rw-r--r--lib/CodeGen/CGObjCGNU.cpp58
-rw-r--r--lib/CodeGen/CGObjCMac.cpp62
-rw-r--r--lib/CodeGen/CodeGenModule.cpp24
7 files changed, 93 insertions, 93 deletions
diff --git a/lib/CodeGen/CGBlocks.cpp b/lib/CodeGen/CGBlocks.cpp
index 1bac84d269..da72b18787 100644
--- a/lib/CodeGen/CGBlocks.cpp
+++ b/lib/CodeGen/CGBlocks.cpp
@@ -140,7 +140,7 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
// __isa
C = CGM.getNSConcreteStackBlock();
- C = VMContext.getConstantExprBitCast(C, PtrToInt8Ty);
+ C = llvm::ConstantExpr::getBitCast(C, PtrToInt8Ty);
Elts[0] = C;
// __flags
@@ -169,7 +169,7 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
llvm::GlobalValue::InternalLinkage,
C, Name);
QualType BPT = BE->getType();
- C = VMContext.getConstantExprBitCast(C, ConvertType(BPT));
+ C = llvm::ConstantExpr::getBitCast(C, ConvertType(BPT));
return C;
}
@@ -784,7 +784,7 @@ GenerateCopyHelperFunction(bool BlockHasCopyDispose, const llvm::StructType *T,
CGF.FinishFunction();
- return VMContext.getConstantExprBitCast(Fn, PtrToInt8Ty);
+ return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
llvm::Constant *BlockFunction::
@@ -853,7 +853,7 @@ GenerateDestroyHelperFunction(bool BlockHasCopyDispose,
CGF.FinishFunction();
- return VMContext.getConstantExprBitCast(Fn, PtrToInt8Ty);
+ return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
llvm::Constant *BlockFunction::BuildCopyHelper(const llvm::StructType *T,
@@ -932,7 +932,7 @@ GeneratebyrefCopyHelperFunction(const llvm::Type *T, int flag) {
CGF.FinishFunction();
- return VMContext.getConstantExprBitCast(Fn, PtrToInt8Ty);
+ return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
llvm::Constant *
@@ -983,7 +983,7 @@ BlockFunction::GeneratebyrefDestroyHelperFunction(const llvm::Type *T,
BuildBlockRelease(V, flag);
CGF.FinishFunction();
- return VMContext.getConstantExprBitCast(Fn, PtrToInt8Ty);
+ return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
llvm::Constant *BlockFunction::BuildbyrefCopyHelper(const llvm::Type *T,
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index b8269eb30f..554c4f0b0e 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -161,7 +161,7 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) {
// Replace all uses of the old global with the new global
llvm::Constant *NewPtrForOldDecl =
- VMContext.getConstantExprBitCast(GV, OldGV->getType());
+ llvm::ConstantExpr::getBitCast(GV, OldGV->getType());
OldGV->replaceAllUsesWith(NewPtrForOldDecl);
// Erase the old global, since it is no longer used.
@@ -195,7 +195,7 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D) {
const llvm::Type *LTy = CGM.getTypes().ConvertTypeForMem(D.getType());
const llvm::Type *LPtrTy =
VMContext.getPointerType(LTy, D.getType().getAddressSpace());
- DMEntry = VMContext.getConstantExprBitCast(GV, LPtrTy);
+ DMEntry = llvm::ConstantExpr::getBitCast(GV, LPtrTy);
// Emit global variable debug descriptor for static vars.
CGDebugInfo *DI = getDebugInfo();
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index 55361f8ee0..ec873ffcd9 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -492,7 +492,7 @@ public:
do {
llvm::Constant* byteC =
llvm::ConstantInt::get(llvm::Type::Int8Ty, byte);
- Elts[i] = VMContext.getConstantExprOr(Elts[i], byteC);
+ Elts[i] = llvm::ConstantExpr::getOr(Elts[i], byteC);
++i;
V = V.lshr(curBits);
bitsToInsert -= curBits;
@@ -755,7 +755,7 @@ public:
case Expr::ObjCStringLiteralClass: {
ObjCStringLiteral* SL = cast<ObjCStringLiteral>(E);
llvm::Constant *C = CGM.getObjCRuntime().GenerateConstantString(SL);
- return VMContext.getConstantExprBitCast(C, ConvertType(E->getType()));
+ return llvm::ConstantExpr::getBitCast(C, ConvertType(E->getType()));
}
case Expr::PredefinedExprClass: {
// __func__/__FUNCTION__ -> "". __PRETTY_FUNCTION__ -> "top level".
@@ -770,7 +770,7 @@ public:
assert(CGF && "Invalid address of label expression outside function.");
unsigned id = CGF->GetIDForAddrOfLabel(cast<AddrLabelExpr>(E)->getLabel());
llvm::Constant *C = llvm::ConstantInt::get(llvm::Type::Int32Ty, id);
- return VMContext.getConstantExprIntToPtr(C, ConvertType(E->getType()));
+ return llvm::ConstantExpr::getIntToPtr(C, ConvertType(E->getType()));
}
case Expr::CallExprClass: {
CallExpr* CE = cast<CallExpr>(E);
@@ -832,28 +832,28 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
if (!Offset->isNullValue()) {
const llvm::Type *Type =
VMContext.getPointerTypeUnqual(llvm::Type::Int8Ty);
- llvm::Constant *Casted = VMContext.getConstantExprBitCast(C, Type);
- Casted = VMContext.getConstantExprGetElementPtr(Casted, &Offset, 1);
- C = VMContext.getConstantExprBitCast(Casted, C->getType());
+ llvm::Constant *Casted = llvm::ConstantExpr::getBitCast(C, Type);
+ Casted = llvm::ConstantExpr::getGetElementPtr(Casted, &Offset, 1);
+ C = llvm::ConstantExpr::getBitCast(Casted, C->getType());
}
// Convert to the appropriate type; this could be an lvalue for
// an integer.
if (isa<llvm::PointerType>(DestTy))
- return VMContext.getConstantExprBitCast(C, DestTy);
+ return llvm::ConstantExpr::getBitCast(C, DestTy);
- return VMContext.getConstantExprPtrToInt(C, DestTy);
+ return llvm::ConstantExpr::getPtrToInt(C, DestTy);
} else {
C = Offset;
// Convert to the appropriate type; this could be an lvalue for
// an integer.
if (isa<llvm::PointerType>(DestTy))
- return VMContext.getConstantExprIntToPtr(C, DestTy);
+ return llvm::ConstantExpr::getIntToPtr(C, DestTy);
// If the types don't match this should only be a truncate.
if (C->getType() != DestTy)
- return VMContext.getConstantExprTrunc(C, DestTy);
+ return llvm::ConstantExpr::getTrunc(C, DestTy);
return C;
}
@@ -864,7 +864,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
if (C->getType() == llvm::Type::Int1Ty) {
const llvm::Type *BoolTy = getTypes().ConvertTypeForMem(E->getType());
- C = VMContext.getConstantExprZExt(C, BoolTy);
+ C = llvm::ConstantExpr::getZExt(C, BoolTy);
}
return C;
}
@@ -909,7 +909,7 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
llvm::Constant* C = ConstExprEmitter(*this, CGF).Visit(const_cast<Expr*>(E));
if (C && C->getType() == llvm::Type::Int1Ty) {
const llvm::Type *BoolTy = getTypes().ConvertTypeForMem(E->getType());
- C = VMContext.getConstantExprZExt(C, BoolTy);
+ C = llvm::ConstantExpr::getZExt(C, BoolTy);
}
return C;
}
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index 677379232f..1bf07bfe9e 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -28,7 +28,7 @@ llvm::Value *CodeGenFunction::EmitObjCStringLiteral(const ObjCStringLiteral *E)
{
llvm::Constant *C = CGM.getObjCRuntime().GenerateConstantString(E);
// FIXME: This bitcast should just be made an invariant on the Runtime.
- return VMContext.getConstantExprBitCast(C, ConvertType(E->getType()));
+ return llvm::ConstantExpr::getBitCast(C, ConvertType(E->getType()));
}
/// Emit a selector.
diff --git a/lib/CodeGen/CGObjCGNU.cpp b/lib/CodeGen/CGObjCGNU.cpp
index e5161577c3..450b4cdac4 100644
--- a/lib/CodeGen/CGObjCGNU.cpp
+++ b/lib/CodeGen/CGObjCGNU.cpp
@@ -294,7 +294,7 @@ llvm::Constant *CGObjCGNU::MakeConstantString(const std::string &Str,
ConstStr = new llvm::GlobalVariable(TheModule, ConstStr->getType(), true,
llvm::GlobalValue::InternalLinkage,
ConstStr, Name);
- return VMContext.getConstantExprGetElementPtr(ConstStr, Zeros, 2);
+ return llvm::ConstantExpr::getGetElementPtr(ConstStr, Zeros, 2);
}
llvm::Constant *CGObjCGNU::MakeGlobal(const llvm::StructType *Ty,
std::vector<llvm::Constant*> &V, const std::string &Name) {
@@ -324,7 +324,7 @@ llvm::Constant *CGObjCGNU::GenerateConstantString(const ObjCStringLiteral *SL) {
VMContext.getStructType(PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
Ivars, ".objc_str");
ConstantStrings.push_back(
- VMContext.getConstantExprBitCast(ObjCStr, PtrToInt8Ty));
+ llvm::ConstantExpr::getBitCast(ObjCStr, PtrToInt8Ty));
return ObjCStr;
}
@@ -508,10 +508,10 @@ llvm::Constant *CGObjCGNU::GenerateMethodList(const std::string &ClassName,
isClassMethodList))) {
llvm::Constant *C =
CGM.GetAddrOfConstantCString(MethodSels[i].getAsString());
- Elements.push_back(VMContext.getConstantExprGetElementPtr(C, Zeros, 2));
+ Elements.push_back(llvm::ConstantExpr::getGetElementPtr(C, Zeros, 2));
Elements.push_back(
- VMContext.getConstantExprGetElementPtr(MethodTypes[i], Zeros, 2));
- Method = VMContext.getConstantExprBitCast(Method,
+ llvm::ConstantExpr::getGetElementPtr(MethodTypes[i], Zeros, 2));
+ Method = llvm::ConstantExpr::getBitCast(Method,
VMContext.getPointerTypeUnqual(IMPTy));
Elements.push_back(Method);
Methods.push_back(llvm::ConstantStruct::get(ObjCMethodTy, Elements));
@@ -563,9 +563,9 @@ llvm::Constant *CGObjCGNU::GenerateIvarList(
std::vector<llvm::Constant*> Elements;
for (unsigned int i = 0, e = IvarNames.size() ; i < e ; i++) {
Elements.clear();
- Elements.push_back( VMContext.getConstantExprGetElementPtr(IvarNames[i],
+ Elements.push_back( llvm::ConstantExpr::getGetElementPtr(IvarNames[i],
Zeros, 2));
- Elements.push_back( VMContext.getConstantExprGetElementPtr(IvarTypes[i],
+ Elements.push_back( llvm::ConstantExpr::getGetElementPtr(IvarTypes[i],
Zeros, 2));
Elements.push_back(IvarOffsets[i]);
Ivars.push_back(llvm::ConstantStruct::get(ObjCIvarTy, Elements));
@@ -623,7 +623,7 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure(
VMContext.getConstantPointerNull(PtrTy);
// Fill in the structure
std::vector<llvm::Constant*> Elements;
- Elements.push_back(VMContext.getConstantExprBitCast(MetaClass, PtrToInt8Ty));
+ Elements.push_back(llvm::ConstantExpr::getBitCast(MetaClass, PtrToInt8Ty));
Elements.push_back(SuperClass);
Elements.push_back(MakeConstantString(Name, ".class_name"));
Elements.push_back(Zero);
@@ -634,7 +634,7 @@ llvm::Constant *CGObjCGNU::GenerateClassStructure(
Elements.push_back(NullP);
Elements.push_back(NullP);
Elements.push_back(NullP);
- Elements.push_back(VMContext.getConstantExprBitCast(Protocols, PtrTy));
+ Elements.push_back(llvm::ConstantExpr::getBitCast(Protocols, PtrTy));
Elements.push_back(NullP);
// Create an instance of the structure
return MakeGlobal(ClassTy, Elements, SymbolNameForClass(Name));
@@ -652,10 +652,10 @@ llvm::Constant *CGObjCGNU::GenerateProtocolMethodList(
std::vector<llvm::Constant*> Elements;
for (unsigned int i = 0, e = MethodTypes.size() ; i < e ; i++) {
Elements.clear();
- Elements.push_back(VMContext.getConstantExprGetElementPtr(MethodNames[i],
+ Elements.push_back(llvm::ConstantExpr::getGetElementPtr(MethodNames[i],
Zeros, 2));
Elements.push_back(
- VMContext.getConstantExprGetElementPtr(MethodTypes[i], Zeros, 2));
+ llvm::ConstantExpr::getGetElementPtr(MethodTypes[i], Zeros, 2));
Methods.push_back(llvm::ConstantStruct::get(ObjCMethodDescTy, Elements));
}
llvm::ArrayType *ObjCMethodArrayTy = VMContext.getArrayType(ObjCMethodDescTy,
@@ -685,7 +685,7 @@ llvm::Constant *CGObjCGNU::GenerateProtocolList(
llvm::Constant *protocol = ExistingProtocols[*iter];
if (!protocol)
protocol = GenerateEmptyProtocol(*iter);
- llvm::Constant *Ptr = VMContext.getConstantExprBitCast(protocol,
+ llvm::Constant *Ptr = llvm::ConstantExpr::getBitCast(protocol,
PtrToInt8Ty);
Elements.push_back(Ptr);
}
@@ -727,7 +727,7 @@ llvm::Constant *CGObjCGNU::GenerateEmptyProtocol(
std::vector<llvm::Constant*> Elements;
// The isa pointer must be set to a magic number so the runtime knows it's
// the correct layout.
- Elements.push_back(VMContext.getConstantExprIntToPtr(
+ Elements.push_back(llvm::ConstantExpr::getIntToPtr(
llvm::ConstantInt::get(llvm::Type::Int32Ty, ProtocolVersion), IdTy));
Elements.push_back(MakeConstantString(ProtocolName, ".objc_protocol_name"));
Elements.push_back(ProtocolList);
@@ -782,14 +782,14 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
std::vector<llvm::Constant*> Elements;
// The isa pointer must be set to a magic number so the runtime knows it's
// the correct layout.
- Elements.push_back(VMContext.getConstantExprIntToPtr(
+ Elements.push_back(llvm::ConstantExpr::getIntToPtr(
llvm::ConstantInt::get(llvm::Type::Int32Ty, ProtocolVersion), IdTy));
Elements.push_back(MakeConstantString(ProtocolName, ".objc_protocol_name"));
Elements.push_back(ProtocolList);
Elements.push_back(InstanceMethodList);
Elements.push_back(ClassMethodList);
ExistingProtocols[ProtocolName] =
- VMContext.getConstantExprBitCast(MakeGlobal(ProtocolTy, Elements,
+ llvm::ConstantExpr::getBitCast(MakeGlobal(ProtocolTy, Elements,
".objc_protocol"), IdTy);
}
@@ -832,17 +832,17 @@ void CGObjCGNU::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
Elements.push_back(MakeConstantString(CategoryName));
Elements.push_back(MakeConstantString(ClassName));
// Instance method list
- Elements.push_back(VMContext.getConstantExprBitCast(GenerateMethodList(
+ Elements.push_back(llvm::ConstantExpr::getBitCast(GenerateMethodList(
ClassName, CategoryName, InstanceMethodSels, InstanceMethodTypes,
false), PtrTy));
// Class method list
- Elements.push_back(VMContext.getConstantExprBitCast(GenerateMethodList(
+ Elements.push_back(llvm::ConstantExpr::getBitCast(GenerateMethodList(
ClassName, CategoryName, ClassMethodSels, ClassMethodTypes, true),
PtrTy));
// Protocol list
- Elements.push_back(VMContext.getConstantExprBitCast(
+ Elements.push_back(llvm::ConstantExpr::getBitCast(
GenerateProtocolList(Protocols), PtrTy));
- Categories.push_back(VMContext.getConstantExprBitCast(
+ Categories.push_back(llvm::ConstantExpr::getBitCast(
MakeGlobal(VMContext.getStructType(PtrToInt8Ty, PtrToInt8Ty, PtrTy,
PtrTy, PtrTy, NULL), Elements), PtrTy));
}
@@ -992,17 +992,17 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {
// Resolve the class aliases, if they exist.
if (ClassPtrAlias) {
ClassPtrAlias->setAliasee(
- VMContext.getConstantExprBitCast(ClassStruct, IdTy));
+ llvm::ConstantExpr::getBitCast(ClassStruct, IdTy));
ClassPtrAlias = 0;
}
if (MetaClassPtrAlias) {
MetaClassPtrAlias->setAliasee(
- VMContext.getConstantExprBitCast(MetaClassStruct, IdTy));
+ llvm::ConstantExpr::getBitCast(MetaClassStruct, IdTy));
MetaClassPtrAlias = 0;
}
// Add class structure to list to be added to the symtab later
- ClassStruct = VMContext.getConstantExprBitCast(ClassStruct, PtrToInt8Ty);
+ ClassStruct = llvm::ConstantExpr::getBitCast(ClassStruct, PtrToInt8Ty);
Classes.push_back(ClassStruct);
}
@@ -1051,7 +1051,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
Elements.push_back(Statics);
Elements.push_back(VMContext.getNullValue(StaticsListPtrTy));
Statics = MakeGlobal(StaticsListArrayTy, Elements, ".objc_statics_ptr");
- Statics = VMContext.getConstantExprBitCast(Statics, PtrTy);
+ Statics = llvm::ConstantExpr::getBitCast(Statics, PtrTy);
}
// Array of classes, categories, and constant objects
llvm::ArrayType *ClassListTy = VMContext.getArrayType(PtrToInt8Ty,
@@ -1091,7 +1091,7 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
llvm::Constant *SelectorList = MakeGlobal(
VMContext.getArrayType(SelStructTy, Selectors.size()), Selectors,
".objc_selector_list");
- Elements.push_back(VMContext.getConstantExprBitCast(SelectorList,
+ Elements.push_back(llvm::ConstantExpr::getBitCast(SelectorList,
SelStructPtrTy));
// Now that all of the static selectors exist, create pointers to them.
@@ -1103,12 +1103,12 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
llvm::ConstantInt::get(llvm::Type::Int32Ty, index++), Zeros[0]};
llvm::Constant *SelPtr = new llvm::GlobalVariable(TheModule, SelStructPtrTy,
true, llvm::GlobalValue::InternalLinkage,
- VMContext.getConstantExprGetElementPtr(SelectorList, Idxs, 2),
+ llvm::ConstantExpr::getGetElementPtr(SelectorList, Idxs, 2),
".objc_sel_ptr");
// If selectors are defined as an opaque type, cast the pointer to this
// type.
if (isSelOpaque) {
- SelPtr = VMContext.getConstantExprBitCast(SelPtr,
+ SelPtr = llvm::ConstantExpr::getBitCast(SelPtr,
VMContext.getPointerTypeUnqual(SelectorTy));
}
(*iter).second->setAliasee(SelPtr);
@@ -1120,12 +1120,12 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() {
llvm::ConstantInt::get(llvm::Type::Int32Ty, index++), Zeros[0]};
llvm::Constant *SelPtr = new llvm::GlobalVariable(TheModule, SelStructPtrTy,
true, llvm::GlobalValue::InternalLinkage,
- VMContext.getConstantExprGetElementPtr(SelectorList, Idxs, 2),
+ llvm::ConstantExpr::getGetElementPtr(SelectorList, Idxs, 2),
".objc_sel_ptr");
// If selectors are defined as an opaque type, cast the pointer to this
// type.
if (isSelOpaque) {
- SelPtr = VMContext.getConstantExprBitCast(SelPtr,
+ SelPtr = llvm::ConstantExpr::getBitCast(SelPtr,
VMContext.getPointerTypeUnqual(SelectorTy));
}
(*iter).second->setAliasee(SelPtr);
@@ -1261,7 +1261,7 @@ void CGObjCGNU::EmitTryOrSynchronizedStmt(CodeGen::CodeGenFunction &CGF,
CGM.CreateRuntimeFunction(VMContext.getFunctionType(llvm::Type::Int32Ty,
true),
"__gnu_objc_personality_v0");
- Personality = VMContext.getConstantExprBitCast(Personality, PtrTy);
+ Personality = llvm::ConstantExpr::getBitCast(Personality, PtrTy);
std::vector<const llvm::Type*> Params;
Params.push_back(PtrTy);
llvm::Value *RethrowFn =
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 6d9f4c03e5..6628d183e5 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -718,7 +718,7 @@ public:
CGM.CreateRuntimeFunction(VMContext.getFunctionType(llvm::Type::Int32Ty,
true),
"__objc_personality_v0");
- return VMContext.getConstantExprBitCast(Personality, Int8PtrTy);
+ return llvm::ConstantExpr::getBitCast(Personality, Int8PtrTy);
}
llvm::Constant *getUnwindResumeOrRethrowFn() {
@@ -1381,7 +1381,7 @@ static llvm::Constant *getConstantGEP(llvm::LLVMContext &VMContext,
llvm::ConstantInt::get(llvm::Type::Int32Ty, idx0),
llvm::ConstantInt::get(llvm::Type::Int32Ty, idx1)
};
- return VMContext.getConstantExprGetElementPtr(C, Idxs, 2);
+ return llvm::ConstantExpr::getGetElementPtr(C, Idxs, 2);
}
/// hasObjCExceptionAttribute - Return true if this class or any super
@@ -1552,7 +1552,7 @@ CodeGen::RValue CGObjCCommonMac::EmitLegacyMessageSend(
: ObjCTypes.getSendFn(IsSuper);
}
assert(Fn && "EmitLegacyMessageSend - unknown API");
- Fn = VMContext.getConstantExprBitCast(Fn,
+ Fn = llvm::ConstantExpr::getBitCast(Fn,
VMContext.getPointerTypeUnqual(FTy));
return CGF.EmitCall(FnInfo, Fn, ActualArgs);
}
@@ -1563,7 +1563,7 @@ llvm::Value *CGObjCMac::GenerateProtocolRef(CGBuilderTy &Builder,
// resolved. Investigate. Its also wasteful to look this up over and over.
LazySymbols.insert(&CGM.getContext().Idents.get("Protocol"));
- return VMContext.getConstantExprBitCast(GetProtocolRef(PD),
+ return llvm::ConstantExpr::getBitCast(GetProtocolRef(PD),
ObjCTypes.ExternalProtocolPtrTy);
}
@@ -1777,7 +1777,7 @@ CGObjCMac::EmitProtocolList(const std::string &Name,
llvm::GlobalVariable *GV =
CreateMetadataVar(Name, Init, "__OBJC,__cat_cls_meth,regular,no_dead_strip",
4, false);
- return VMContext.getConstantExprBitCast(GV, ObjCTypes.ProtocolListPtrTy);
+ return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.ProtocolListPtrTy);
}
/*
@@ -1826,7 +1826,7 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(const std::string &Name,
"__OBJC,__property,regular,no_dead_strip",
(ObjCABI == 2) ? 8 : 4,
true);
- return VMContext.getConstantExprBitCast(GV, ObjCTypes.PropertyListPtrTy);
+ return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.PropertyListPtrTy);
}
/*
@@ -1839,7 +1839,7 @@ llvm::Constant *
CGObjCMac::GetMethodDescriptionConstant(const ObjCMethodDecl *MD) {
std::vector<llvm::Constant*> Desc(2);
Desc[0] =
- VMContext.getConstantExprBitCast(GetMethodVarName(MD->getSelector()),
+ llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()),
ObjCTypes.SelectorPtrTy);
Desc[1] = GetMethodVarType(MD);
return llvm::ConstantStruct::get(ObjCTypes.MethodDescriptionTy,
@@ -1861,7 +1861,7 @@ llvm::Constant *CGObjCMac::EmitMethodDescList(const std::string &Name,
llvm::Constant *Init = llvm::ConstantStruct::get(Values);
llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
- return VMContext.getConstantExprBitCast(GV,
+ return llvm::ConstantExpr::getBitCast(GV,
ObjCTypes.MethodDescriptionListPtrTy);
}
@@ -2026,7 +2026,7 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
LazySymbols.insert(Super->getIdentifier());
Values[ 1] =
- VMContext.getConstantExprBitCast(GetClassName(Super->getIdentifier()),
+ llvm::ConstantExpr::getBitCast(GetClassName(Super->getIdentifier()),
ObjCTypes.ClassPtrTy);
} else {
Values[ 1] = VMContext.getNullValue(ObjCTypes.ClassPtrTy);
@@ -2071,14 +2071,14 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
while (const ObjCInterfaceDecl *Super = Root->getSuperClass())
Root = Super;
Values[ 0] =
- VMContext.getConstantExprBitCast(GetClassName(Root->getIdentifier()),
+ llvm::ConstantExpr::getBitCast(GetClassName(Root->getIdentifier()),
ObjCTypes.ClassPtrTy);
// The super class for the metaclass is emitted as the name of the
// super class. The runtime fixes this up to point to the
// *metaclass* for the super class.
if (ObjCInterfaceDecl *Super = ID->getClassInterface()->getSuperClass()) {
Values[ 1] =
- VMContext.getConstantExprBitCast(GetClassName(Super->getIdentifier()),
+ llvm::ConstantExpr::getBitCast(GetClassName(Super->getIdentifier()),
ObjCTypes.ClassPtrTy);
} else {
Values[ 1] = VMContext.getNullValue(ObjCTypes.ClassPtrTy);
@@ -2242,7 +2242,7 @@ llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID,
+ ID->getNameAsString(),
Init, "__OBJC,__instance_vars,regular,no_dead_strip",
4, true);
- return VMContext.getConstantExprBitCast(GV, ObjCTypes.IvarListPtrTy);
+ return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.IvarListPtrTy);
}
/*
@@ -2270,10 +2270,10 @@ llvm::Constant *CGObjCMac::GetMethodConstant(const ObjCMethodDecl *MD) {
std::vector<llvm::Constant*> Method(3);
Method[0] =
- VMContext.getConstantExprBitCast(GetMethodVarName(MD->getSelector()),
+ llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()),
ObjCTypes.SelectorPtrTy);
Method[1] = GetMethodVarType(MD);
- Method[2] = VMContext.getConstantExprBitCast(Fn, ObjCTypes.Int8PtrTy);
+ Method[2] = llvm::ConstantExpr::getBitCast(Fn, ObjCTypes.Int8PtrTy);
return llvm::ConstantStruct::get(ObjCTypes.MethodTy, Method);
}
@@ -2293,7 +2293,7 @@ llvm::Constant *CGObjCMac::EmitMethodList(const std::string &Name,
llvm::Constant *Init = llvm::ConstantStruct::get(Values);
llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
- return VMContext.getConstantExprBitCast(GV,
+ return llvm::ConstantExpr::getBitCast(GV,
ObjCTypes.MethodListPtrTy);
}
@@ -2911,11 +2911,11 @@ llvm::Constant *CGObjCMac::EmitModuleSymbols() {
// by the list of defined categories, in a single array.
std::vector<llvm::Constant*> Symbols(NumClasses + NumCategories);
for (unsigned i=0; i<NumClasses; i++)
- Symbols[i] = VMContext.getConstantExprBitCast(DefinedClasses[i],
+ Symbols[i] = llvm::ConstantExpr::getBitCast(DefinedClasses[i],
ObjCTypes.Int8PtrTy);
for (unsigned i=0; i<NumCategories; i++)
Symbols[NumClasses + i] =
- VMContext.getConstantExprBitCast(DefinedCategories[i],
+ llvm::ConstantExpr::getBitCast(DefinedCategories[i],
ObjCTypes.Int8PtrTy);
Values[4] =
@@ -2929,7 +2929,7 @@ llvm::Constant *CGObjCMac::EmitModuleSymbols() {
CreateMetadataVar("\01L_OBJC_SYMBOLS", Init,
"__OBJC,__symbols,regular,no_dead_strip",
4, true);
- return VMContext.getConstantExprBitCast(GV, ObjCTypes.SymtabPtrTy);
+ return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.SymtabPtrTy);
}
llvm::Value *CGObjCMac::EmitClassRef(CGBuilderTy &Builder,
@@ -2940,7 +2940,7 @@ llvm::Value *CGObjCMac::EmitClassRef(CGBuilderTy &Builder,
if (!Entry) {
llvm::Constant *Casted =
- VMContext.getConstantExprBitCast(GetClassName(ID->getIdentifier()),
+ llvm::ConstantExpr::getBitCast(GetClassName(ID->getIdentifier()),
ObjCTypes.ClassPtrTy);
Entry =
CreateMetadataVar("\01L_OBJC_CLASS_REFERENCES_", Casted,
@@ -2956,7 +2956,7 @@ llvm::Value *CGObjCMac::EmitSelector(CGBuilderTy &Builder, Selector Sel) {
if (!Entry) {
llvm::Constant *Casted =
- VMContext.getConstantExprBitCast(GetMethodVarName(Sel),
+ llvm::ConstantExpr::getBitCast(GetMethodVarName(Sel),
ObjCTypes.SelectorPtrTy);
Entry =
CreateMetadataVar("\01L_OBJC_SELECTOR_REFERENCES_", Casted,
@@ -4066,7 +4066,7 @@ void CGObjCNonFragileABIMac::AddModuleClassList(const
std::vector<llvm::Constant*> Symbols(NumClasses);
for (unsigned i=0; i<NumClasses; i++)
- Symbols[i] = VMContext.getConstantExprBitCast(Container[i],
+ Symbols[i] = llvm::ConstantExpr::getBitCast(Container[i],
ObjCTypes.Int8PtrTy);
llvm::Constant* Init =
llvm::ConstantArray::get(VMContext.getArrayType(ObjCTypes.Int8PtrTy,
@@ -4443,7 +4443,7 @@ llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CGBuilderTy &Builder,
// of protocol's meta-data (not a reference to it!)
//
llvm::Constant *Init =
- VMContext.getConstantExprBitCast(GetOrEmitProtocol(PD),
+ llvm::ConstantExpr::getBitCast(GetOrEmitProtocol(PD),
ObjCTypes.ExternalProtocolPtrTy);
std::string ProtocolName("\01l_OBJC_PROTOCOL_REFERENCE_$_");
@@ -4566,10 +4566,10 @@ llvm::Constant *CGObjCNonFragileABIMac::GetMethodConstant(
std::vector<llvm::Constant*> Method(3);
Method[0] =
- VMContext.getConstantExprBitCast(GetMethodVarName(MD->getSelector()),
+ llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()),
ObjCTypes.SelectorPtrTy);
Method[1] = GetMethodVarType(MD);
- Method[2] = VMContext.getConstantExprBitCast(Fn, ObjCTypes.Int8PtrTy);
+ Method[2] = llvm::ConstantExpr::getBitCast(Fn, ObjCTypes.Int8PtrTy);
return llvm::ConstantStruct::get(ObjCTypes.MethodTy, Method);
}
@@ -4608,7 +4608,7 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList(
CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
GV->setSection(Section);
CGM.AddUsedGlobal(GV);
- return VMContext.getConstantExprBitCast(GV,
+ return llvm::ConstantExpr::getBitCast(GV,
ObjCTypes.MethodListnfABIPtrTy);
}
@@ -4735,7 +4735,7 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList(
GV->setSection("__DATA, __objc_const");
CGM.AddUsedGlobal(GV);
- return VMContext.getConstantExprBitCast(GV, ObjCTypes.IvarListnfABIPtrTy);
+ return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.IvarListnfABIPtrTy);
}
llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocolRef(
@@ -4898,7 +4898,7 @@ CGObjCNonFragileABIMac::EmitProtocolList(const std::string &Name,
// FIXME: We shouldn't need to do this lookup here, should we?
llvm::GlobalVariable *GV = CGM.getModule().getGlobalVariable(Name, true);
if (GV)
- return VMContext.getConstantExprBitCast(GV,
+ return llvm::ConstantExpr::getBitCast(GV,
ObjCTypes.ProtocolListnfABIPtrTy);
for (; begin != end; ++begin)
@@ -4926,7 +4926,7 @@ CGObjCNonFragileABIMac::EmitProtocolList(const std::string &Name,
GV->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
CGM.AddUsedGlobal(GV);
- return VMContext.getConstantExprBitCast(GV,
+ return llvm::ConstantExpr::getBitCast(GV,
ObjCTypes.ProtocolListnfABIPtrTy);
}
@@ -4941,7 +4941,7 @@ llvm::Constant *
CGObjCNonFragileABIMac::GetMethodDescriptionConstant(const ObjCMethodDecl *MD) {
std::vector<llvm::Constant*> Desc(3);
Desc[0] =
- VMContext.getConstantExprBitCast(GetMethodVarName(MD->getSelector()),
+ llvm::ConstantExpr::getBitCast(GetMethodVarName(MD->getSelector()),
ObjCTypes.SelectorPtrTy);
Desc[1] = GetMethodVarType(MD);
// Protocol methods have no implementation. So, this entry is always NULL.
@@ -5257,7 +5257,7 @@ llvm::Value *CGObjCNonFragileABIMac::EmitSelector(CGBuilderTy &Builder,
if (!Entry) {
llvm::Constant *Casted =
- VMContext.getConstantExprBitCast(GetMethodVarName(Sel),
+ llvm::ConstantExpr::getBitCast(GetMethodVarName(Sel),
ObjCTypes.SelectorPtrTy);
Entry =
new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.SelectorPtrTy, false,
@@ -5699,7 +5699,7 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceDecl *ID,
llvm::Value *VTableIdx = llvm::ConstantInt::get(llvm::Type::Int32Ty, 2);
std::vector<llvm::Constant*> Values(3);
- Values[0] = VMContext.getConstantExprGetElementPtr(VTableGV, &VTableIdx, 1);
+ Values[0] = llvm::ConstantExpr::getGetElementPtr(VTableGV, &VTableIdx, 1);
Values[1] = GetClassName(ID->getIdentifier());
Values[2] = GetClassGlobal(ClassName);
llvm::Constant *Init =
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 91b071eb53..bdc0876cdb 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -212,7 +212,7 @@ void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) {
std::vector<llvm::Constant*> S;
S.push_back(
llvm::ConstantInt::get(llvm::Type::Int32Ty, I->second, false));
- S.push_back(VMContext.getConstantExprBitCast(I->first, CtorPFTy));
+ S.push_back(llvm::ConstantExpr::getBitCast(I->first, CtorPFTy));
Ctors.push_back(llvm::ConstantStruct::get(CtorStructTy, S));
}
@@ -425,7 +425,7 @@ void CodeGenModule::EmitLLVMUsed() {
UsedArray.resize(LLVMUsed.size());
for (unsigned i = 0, e = LLVMUsed.size(); i != e; ++i) {
UsedArray[i] =
- VMContext.getConstantExprBitCast(cast<llvm::Constant>(&*LLVMUsed[i]),
+ llvm::ConstantExpr::getBitCast(cast<llvm::Constant>(&*LLVMUsed[i]),
i8PTy);
}
@@ -502,9 +502,9 @@ llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV,
// Create the ConstantStruct for the global annotation.
llvm::Constant *Fields[4] = {
- VMContext.getConstantExprBitCast(GV, SBP),
- VMContext.getConstantExprBitCast(annoGV, SBP),
- VMContext.getConstantExprBitCast(unitGV, SBP),
+ llvm::ConstantExpr::getBitCast(GV, SBP),
+ llvm::ConstantExpr::getBitCast(annoGV, SBP),
+ llvm::ConstantExpr::getBitCast(unitGV, SBP),
llvm::ConstantInt::get(llvm::Type::Int32Ty, LineNo)
};
return llvm::ConstantStruct::get(Fields, 4, false);
@@ -621,7 +621,7 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMFunction(const char *MangledName,
// Make sure the result is of the correct type.
const llvm::Type *PTy = VMContext.getPointerTypeUnqual(Ty);
- return VMContext.getConstantExprBitCast(Entry, PTy);
+ return llvm::ConstantExpr::getBitCast(Entry, PTy);
}
// This is the first use or definition of a mangled name. If there is a
@@ -700,7 +700,7 @@ llvm::Constant *CodeGenModule::GetOrCreateLLVMGlobal(const char *MangledName,
return Entry;
// Make sure the result is of the correct type.
- return VMContext.getConstantExprBitCast(Entry, Ty);
+ return llvm::ConstantExpr::getBitCast(Entry, Ty);
}
// This is the first use or definition of a mangled name. If there is a
@@ -848,7 +848,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
// Replace all uses of the old global with the new global
llvm::Constant *NewPtrForOldDecl =
- VMContext.getConstantExprBitCast(GV, Entry->getType());
+ llvm::ConstantExpr::getBitCast(GV, Entry->getType());
Entry->replaceAllUsesWith(NewPtrForOldDecl);
// Erase the old global, since it is no longer used.
@@ -1018,7 +1018,7 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) {
// Replace uses of F with the Function we will endow with a body.
if (!Entry->use_empty()) {
llvm::Constant *NewPtrForOldDecl =
- VMContext.getConstantExprBitCast(NewFn, Entry->getType());
+ llvm::ConstantExpr::getBitCast(NewFn, Entry->getType());
Entry->replaceAllUsesWith(NewPtrForOldDecl);
}
@@ -1086,7 +1086,7 @@ void CodeGenModule::EmitAliasDefinition(const ValueDecl *D) {
//
// Remove it and replace uses of it with the alias.
- Entry->replaceAllUsesWith(VMContext.getConstantExprBitCast(GA,
+ Entry->replaceAllUsesWith(llvm::ConstantExpr::getBitCast(GA,
Entry->getType()));
Entry->eraseFromParent();
}
@@ -1271,7 +1271,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
"__CFConstantStringClassReference");
// Decay array -> ptr
CFConstantStringClassRef =
- VMContext.getConstantExprGetElementPtr(GV, Zeros, 2);
+ llvm::ConstantExpr::getGetElementPtr(GV, Zeros, 2);
}
QualType CFTy = getContext().getCFConstantStringType();
@@ -1331,7 +1331,7 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) {
GV->setAlignment(Align);
}
appendFieldAndPadding(*this, Fields, CurField, NextField,
- VMContext.getConstantExprGetElementPtr(GV, Zeros, 2),
+ llvm::ConstantExpr::getGetElementPtr(GV, Zeros, 2),
CFRD, STy);
// String length.