// __isa
C = CGM.getNSConcreteStackBlock();
- C = VMContext.getConstantExprBitCast(C, PtrToInt8Ty);
+ C = llvm::ConstantExpr::getBitCast(C, PtrToInt8Ty);
Elts[0] = C;
// __flags
llvm::GlobalValue::InternalLinkage,
C, Name);
QualType BPT = BE->getType();
- C = VMContext.getConstantExprBitCast(C, ConvertType(BPT));
+ C = llvm::ConstantExpr::getBitCast(C, ConvertType(BPT));
return C;
}
CGF.FinishFunction();
- return VMContext.getConstantExprBitCast(Fn, PtrToInt8Ty);
+ return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
llvm::Constant *BlockFunction::
CGF.FinishFunction();
- return VMContext.getConstantExprBitCast(Fn, PtrToInt8Ty);
+ return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
llvm::Constant *BlockFunction::BuildCopyHelper(const llvm::StructType *T,
CGF.FinishFunction();
- return VMContext.getConstantExprBitCast(Fn, PtrToInt8Ty);
+ return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
llvm::Constant *
BuildBlockRelease(V, flag);
CGF.FinishFunction();
- return VMContext.getConstantExprBitCast(Fn, PtrToInt8Ty);
+ return llvm::ConstantExpr::getBitCast(Fn, PtrToInt8Ty);
}
llvm::Constant *BlockFunction::BuildbyrefCopyHelper(const llvm::Type *T,
// 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.
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();
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;
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".
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);
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;
}
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;
}
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;
}
{
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.
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) {
VMContext.getStructType(PtrToInt8Ty, PtrToInt8Ty, IntTy, NULL),
Ivars, ".objc_str");
ConstantStrings.push_back(
- VMContext.getConstantExprBitCast(ObjCStr, PtrToInt8Ty));
+ llvm::ConstantExpr::getBitCast(ObjCStr, PtrToInt8Ty));
return ObjCStr;
}
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));
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));
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);
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));
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,
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);
}
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);
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);
}
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));
}
// 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);
}
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,
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.
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);
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);
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 =
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() {
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
: 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);
}
// 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);
}
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);
}
/*
"__OBJC,__property,regular,no_dead_strip",
(ObjCABI == 2) ? 8 : 4,
true);
- return VMContext.getConstantExprBitCast(GV, ObjCTypes.PropertyListPtrTy);
+ return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.PropertyListPtrTy);
}
/*
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,
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);
}
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);
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);
+ 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);
}
/*
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);
}
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);
}
// 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] =
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,
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,
if (!Entry) {
llvm::Constant *Casted =
- VMContext.getConstantExprBitCast(GetMethodVarName(Sel),
+ llvm::ConstantExpr::getBitCast(GetMethodVarName(Sel),
ObjCTypes.SelectorPtrTy);
Entry =
CreateMetadataVar("\01L_OBJC_SELECTOR_REFERENCES_", Casted,
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,
// 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_$_");
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);
}
CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
GV->setSection(Section);
CGM.AddUsedGlobal(GV);
- return VMContext.getConstantExprBitCast(GV,
+ return llvm::ConstantExpr::getBitCast(GV,
ObjCTypes.MethodListnfABIPtrTy);
}
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(
// 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)
GV->setAlignment(
CGM.getTargetData().getPrefTypeAlignment(Init->getType()));
CGM.AddUsedGlobal(GV);
- return VMContext.getConstantExprBitCast(GV,
+ return llvm::ConstantExpr::getBitCast(GV,
ObjCTypes.ProtocolListnfABIPtrTy);
}
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.
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,
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 =
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));
}
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);
}
// 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);
// 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
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
// 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.
// 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);
}
//
// 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();
}
"__CFConstantStringClassReference");
// Decay array -> ptr
CFConstantStringClassRef =
- VMContext.getConstantExprGetElementPtr(GV, Zeros, 2);
+ llvm::ConstantExpr::getGetElementPtr(GV, Zeros, 2);
}
QualType CFTy = getContext().getCFConstantStringType();
GV->setAlignment(Align);
}
appendFieldAndPadding(*this, Fields, CurField, NextField,
- VMContext.getConstantExprGetElementPtr(GV, Zeros, 2),
+ llvm::ConstantExpr::getGetElementPtr(GV, Zeros, 2),
CFRD, STy);
// String length.