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