зеркало из https://github.com/microsoft/clang-1.git
Update to match mainline ConstantStruct::get API change. Also, use
ConvertType on InitListExprs as they are being converted. This is needed for a forthcoming patch, and improves the IR generated anyway (see additional type names in testcases). This patch also converts a bunch of std::vector's in CGObjCMac to use C arrays. There are a ton more that should be converted as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133413 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
8cc2491239
Коммит
c5cbb909e8
|
@ -95,9 +95,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM,
|
||||||
else
|
else
|
||||||
elements.push_back(llvm::Constant::getNullValue(i8p));
|
elements.push_back(llvm::Constant::getNullValue(i8p));
|
||||||
|
|
||||||
llvm::Constant *init =
|
llvm::Constant *init = llvm::ConstantStruct::getAnon(elements);
|
||||||
llvm::ConstantStruct::get(CGM.getLLVMContext(), elements.data(),
|
|
||||||
elements.size(), false);
|
|
||||||
|
|
||||||
llvm::GlobalVariable *global =
|
llvm::GlobalVariable *global =
|
||||||
new llvm::GlobalVariable(CGM.getModule(), init->getType(), true,
|
new llvm::GlobalVariable(CGM.getModule(), init->getType(), true,
|
||||||
|
@ -851,9 +849,7 @@ static llvm::Constant *buildGlobalBlock(CodeGenModule &CGM,
|
||||||
// Descriptor
|
// Descriptor
|
||||||
fields[4] = buildBlockDescriptor(CGM, blockInfo);
|
fields[4] = buildBlockDescriptor(CGM, blockInfo);
|
||||||
|
|
||||||
llvm::Constant *init =
|
llvm::Constant *init = llvm::ConstantStruct::getAnon(fields);
|
||||||
llvm::ConstantStruct::get(CGM.getLLVMContext(), fields, BlockHeaderSize,
|
|
||||||
/*packed*/ false);
|
|
||||||
|
|
||||||
llvm::GlobalVariable *literal =
|
llvm::GlobalVariable *literal =
|
||||||
new llvm::GlobalVariable(CGM.getModule(),
|
new llvm::GlobalVariable(CGM.getModule(),
|
||||||
|
|
|
@ -433,9 +433,19 @@ llvm::Constant *ConstStructBuilder::
|
||||||
if (!Builder.Build(ILE))
|
if (!Builder.Build(ILE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// Pick the type to use. If the type is layout identical to the ConvertType
|
||||||
|
// type then use it, otherwise use whatever the builder produced for us.
|
||||||
|
const llvm::StructType *STy =
|
||||||
|
llvm::ConstantStruct::getTypeForElements(CGM.getLLVMContext(),
|
||||||
|
Builder.Elements,Builder.Packed);
|
||||||
|
const llvm::Type *ILETy = CGM.getTypes().ConvertType(ILE->getType());
|
||||||
|
if (const llvm::StructType *ILESTy = dyn_cast<llvm::StructType>(ILETy)) {
|
||||||
|
if (ILESTy->isLayoutIdentical(STy))
|
||||||
|
STy = ILESTy;
|
||||||
|
}
|
||||||
|
|
||||||
llvm::Constant *Result =
|
llvm::Constant *Result =
|
||||||
llvm::ConstantStruct::get(CGM.getLLVMContext(),
|
llvm::ConstantStruct::get(STy, Builder.Elements);
|
||||||
Builder.Elements, Builder.Packed);
|
|
||||||
|
|
||||||
assert(Builder.NextFieldOffsetInChars.RoundUpToAlignment(
|
assert(Builder.NextFieldOffsetInChars.RoundUpToAlignment(
|
||||||
Builder.getAlignment(Result)) ==
|
Builder.getAlignment(Result)) ==
|
||||||
|
@ -988,7 +998,10 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
|
||||||
Result.Val.getComplexIntImag());
|
Result.Val.getComplexIntImag());
|
||||||
|
|
||||||
// FIXME: the target may want to specify that this is packed.
|
// FIXME: the target may want to specify that this is packed.
|
||||||
return llvm::ConstantStruct::get(VMContext, Complex, 2, false);
|
llvm::StructType *STy = llvm::StructType::get(Complex[0]->getType(),
|
||||||
|
Complex[1]->getType(),
|
||||||
|
NULL);
|
||||||
|
return llvm::ConstantStruct::get(STy, Complex);
|
||||||
}
|
}
|
||||||
case APValue::Float:
|
case APValue::Float:
|
||||||
return llvm::ConstantFP::get(VMContext, Result.Val.getFloat());
|
return llvm::ConstantFP::get(VMContext, Result.Val.getFloat());
|
||||||
|
@ -1001,7 +1014,10 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E,
|
||||||
Result.Val.getComplexFloatImag());
|
Result.Val.getComplexFloatImag());
|
||||||
|
|
||||||
// FIXME: the target may want to specify that this is packed.
|
// FIXME: the target may want to specify that this is packed.
|
||||||
return llvm::ConstantStruct::get(VMContext, Complex, 2, false);
|
llvm::StructType *STy = llvm::StructType::get(Complex[0]->getType(),
|
||||||
|
Complex[1]->getType(),
|
||||||
|
NULL);
|
||||||
|
return llvm::ConstantStruct::get(STy, Complex);
|
||||||
}
|
}
|
||||||
case APValue::Vector: {
|
case APValue::Vector: {
|
||||||
llvm::SmallVector<llvm::Constant *, 4> Inits;
|
llvm::SmallVector<llvm::Constant *, 4> Inits;
|
||||||
|
|
|
@ -1573,7 +1573,7 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
|
||||||
{llvm::ConstantInt::get(IntTy, Properties.size()), NULLPtr, PropertyArray};
|
{llvm::ConstantInt::get(IntTy, Properties.size()), NULLPtr, PropertyArray};
|
||||||
|
|
||||||
llvm::Constant *PropertyListInit =
|
llvm::Constant *PropertyListInit =
|
||||||
llvm::ConstantStruct::get(VMContext, PropertyListInitFields, 3, false);
|
llvm::ConstantStruct::getAnon(PropertyListInitFields);
|
||||||
llvm::Constant *PropertyList = new llvm::GlobalVariable(TheModule,
|
llvm::Constant *PropertyList = new llvm::GlobalVariable(TheModule,
|
||||||
PropertyListInit->getType(), false, llvm::GlobalValue::InternalLinkage,
|
PropertyListInit->getType(), false, llvm::GlobalValue::InternalLinkage,
|
||||||
PropertyListInit, ".objc_property_list");
|
PropertyListInit, ".objc_property_list");
|
||||||
|
@ -1586,7 +1586,7 @@ void CGObjCGNU::GenerateProtocol(const ObjCProtocolDecl *PD) {
|
||||||
OptionalPropertyArray };
|
OptionalPropertyArray };
|
||||||
|
|
||||||
llvm::Constant *OptionalPropertyListInit =
|
llvm::Constant *OptionalPropertyListInit =
|
||||||
llvm::ConstantStruct::get(VMContext, OptionalPropertyListInitFields, 3, false);
|
llvm::ConstantStruct::getAnon(OptionalPropertyListInitFields);
|
||||||
llvm::Constant *OptionalPropertyList = new llvm::GlobalVariable(TheModule,
|
llvm::Constant *OptionalPropertyList = new llvm::GlobalVariable(TheModule,
|
||||||
OptionalPropertyListInit->getType(), false,
|
OptionalPropertyListInit->getType(), false,
|
||||||
llvm::GlobalValue::InternalLinkage, OptionalPropertyListInit,
|
llvm::GlobalValue::InternalLinkage, OptionalPropertyListInit,
|
||||||
|
@ -1788,7 +1788,7 @@ llvm::Constant *CGObjCGNU::GeneratePropertyList(const ObjCImplementationDecl *OI
|
||||||
{llvm::ConstantInt::get(IntTy, Properties.size()), NULLPtr, PropertyArray};
|
{llvm::ConstantInt::get(IntTy, Properties.size()), NULLPtr, PropertyArray};
|
||||||
|
|
||||||
llvm::Constant *PropertyListInit =
|
llvm::Constant *PropertyListInit =
|
||||||
llvm::ConstantStruct::get(VMContext, PropertyListInitFields, 3, false);
|
llvm::ConstantStruct::getAnon(PropertyListInitFields);
|
||||||
return new llvm::GlobalVariable(TheModule, PropertyListInit->getType(), false,
|
return new llvm::GlobalVariable(TheModule, PropertyListInit->getType(), false,
|
||||||
llvm::GlobalValue::InternalLinkage, PropertyListInit,
|
llvm::GlobalValue::InternalLinkage, PropertyListInit,
|
||||||
".objc_property_list");
|
".objc_property_list");
|
||||||
|
|
|
@ -1880,7 +1880,7 @@ CGObjCMac::EmitProtocolList(llvm::Twine Name,
|
||||||
// This list is null terminated.
|
// This list is null terminated.
|
||||||
ProtocolRefs.push_back(llvm::Constant::getNullValue(ObjCTypes.ProtocolPtrTy));
|
ProtocolRefs.push_back(llvm::Constant::getNullValue(ObjCTypes.ProtocolPtrTy));
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(3);
|
llvm::Constant *Values[3];
|
||||||
// This field is only used by the runtime.
|
// This field is only used by the runtime.
|
||||||
Values[0] = llvm::Constant::getNullValue(ObjCTypes.ProtocolListPtrTy);
|
Values[0] = llvm::Constant::getNullValue(ObjCTypes.ProtocolListPtrTy);
|
||||||
Values[1] = llvm::ConstantInt::get(ObjCTypes.LongTy,
|
Values[1] = llvm::ConstantInt::get(ObjCTypes.LongTy,
|
||||||
|
@ -1890,7 +1890,7 @@ CGObjCMac::EmitProtocolList(llvm::Twine Name,
|
||||||
ProtocolRefs.size()),
|
ProtocolRefs.size()),
|
||||||
ProtocolRefs);
|
ProtocolRefs);
|
||||||
|
|
||||||
llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values, false);
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
|
||||||
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);
|
||||||
|
@ -1964,13 +1964,13 @@ llvm::Constant *CGObjCCommonMac::EmitPropertyList(llvm::Twine Name,
|
||||||
|
|
||||||
unsigned PropertySize =
|
unsigned PropertySize =
|
||||||
CGM.getTargetData().getTypeAllocSize(ObjCTypes.PropertyTy);
|
CGM.getTargetData().getTypeAllocSize(ObjCTypes.PropertyTy);
|
||||||
std::vector<llvm::Constant*> Values(3);
|
llvm::Constant *Values[3];
|
||||||
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, PropertySize);
|
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, PropertySize);
|
||||||
Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Properties.size());
|
Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Properties.size());
|
||||||
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.PropertyTy,
|
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.PropertyTy,
|
||||||
Properties.size());
|
Properties.size());
|
||||||
Values[2] = llvm::ConstantArray::get(AT, Properties);
|
Values[2] = llvm::ConstantArray::get(AT, Properties);
|
||||||
llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values, false);
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
|
||||||
|
|
||||||
llvm::GlobalVariable *GV =
|
llvm::GlobalVariable *GV =
|
||||||
CreateMetadataVar(Name, Init,
|
CreateMetadataVar(Name, Init,
|
||||||
|
@ -2008,12 +2008,12 @@ llvm::Constant *CGObjCMac::EmitMethodDescList(llvm::Twine Name,
|
||||||
if (Methods.empty())
|
if (Methods.empty())
|
||||||
return llvm::Constant::getNullValue(ObjCTypes.MethodDescriptionListPtrTy);
|
return llvm::Constant::getNullValue(ObjCTypes.MethodDescriptionListPtrTy);
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(2);
|
llvm::Constant *Values[2];
|
||||||
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
|
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
|
||||||
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodDescriptionTy,
|
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodDescriptionTy,
|
||||||
Methods.size());
|
Methods.size());
|
||||||
Values[1] = llvm::ConstantArray::get(AT, Methods);
|
Values[1] = llvm::ConstantArray::get(AT, Methods);
|
||||||
llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values, false);
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
|
||||||
|
|
||||||
llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
|
llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
|
||||||
return llvm::ConstantExpr::getBitCast(GV,
|
return llvm::ConstantExpr::getBitCast(GV,
|
||||||
|
@ -2058,7 +2058,7 @@ void CGObjCMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) {
|
||||||
ClassMethods.push_back(GetMethodConstant(*i));
|
ClassMethods.push_back(GetMethodConstant(*i));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(7);
|
llvm::Constant *Values[7];
|
||||||
Values[0] = GetClassName(OCD->getIdentifier());
|
Values[0] = GetClassName(OCD->getIdentifier());
|
||||||
Values[1] = GetClassName(Interface->getIdentifier());
|
Values[1] = GetClassName(Interface->getIdentifier());
|
||||||
LazySymbols.insert(Interface->getIdentifier());
|
LazySymbols.insert(Interface->getIdentifier());
|
||||||
|
@ -2180,7 +2180,7 @@ void CGObjCMac::GenerateClass(const ObjCImplementationDecl *ID) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(12);
|
llvm::Constant *Values[12];
|
||||||
Values[ 0] = EmitMetaClass(ID, Protocols, ClassMethods);
|
Values[ 0] = EmitMetaClass(ID, Protocols, ClassMethods);
|
||||||
if (ObjCInterfaceDecl *Super = Interface->getSuperClass()) {
|
if (ObjCInterfaceDecl *Super = Interface->getSuperClass()) {
|
||||||
// Record a reference to the super class.
|
// Record a reference to the super class.
|
||||||
|
@ -2239,7 +2239,7 @@ llvm::Constant *CGObjCMac::EmitMetaClass(const ObjCImplementationDecl *ID,
|
||||||
if (ID->getClassInterface()->getVisibility() == HiddenVisibility)
|
if (ID->getClassInterface()->getVisibility() == HiddenVisibility)
|
||||||
Flags |= eClassFlags_Hidden;
|
Flags |= eClassFlags_Hidden;
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(12);
|
llvm::Constant *Values[12];
|
||||||
// The isa for the metaclass is the root of the hierarchy.
|
// The isa for the metaclass is the root of the hierarchy.
|
||||||
const ObjCInterfaceDecl *Root = ID->getClassInterface();
|
const ObjCInterfaceDecl *Root = ID->getClassInterface();
|
||||||
while (const ObjCInterfaceDecl *Super = Root->getSuperClass())
|
while (const ObjCInterfaceDecl *Super = Root->getSuperClass())
|
||||||
|
@ -2353,7 +2353,7 @@ CGObjCMac::EmitClassExtension(const ObjCImplementationDecl *ID) {
|
||||||
uint64_t Size =
|
uint64_t Size =
|
||||||
CGM.getTargetData().getTypeAllocSize(ObjCTypes.ClassExtensionTy);
|
CGM.getTargetData().getTypeAllocSize(ObjCTypes.ClassExtensionTy);
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(3);
|
llvm::Constant *Values[3];
|
||||||
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
|
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
|
||||||
Values[1] = BuildIvarLayout(ID, false);
|
Values[1] = BuildIvarLayout(ID, false);
|
||||||
Values[2] = EmitPropertyList("\01l_OBJC_$_PROP_LIST_" + ID->getName(),
|
Values[2] = EmitPropertyList("\01l_OBJC_$_PROP_LIST_" + ID->getName(),
|
||||||
|
@ -2416,12 +2416,12 @@ llvm::Constant *CGObjCMac::EmitIvarList(const ObjCImplementationDecl *ID,
|
||||||
if (Ivars.empty())
|
if (Ivars.empty())
|
||||||
return llvm::Constant::getNullValue(ObjCTypes.IvarListPtrTy);
|
return llvm::Constant::getNullValue(ObjCTypes.IvarListPtrTy);
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(2);
|
llvm::Constant *Values[2];
|
||||||
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size());
|
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size());
|
||||||
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarTy,
|
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarTy,
|
||||||
Ivars.size());
|
Ivars.size());
|
||||||
Values[1] = llvm::ConstantArray::get(AT, Ivars);
|
Values[1] = llvm::ConstantArray::get(AT, Ivars);
|
||||||
llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values, false);
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
|
||||||
|
|
||||||
llvm::GlobalVariable *GV;
|
llvm::GlobalVariable *GV;
|
||||||
if (ForClass)
|
if (ForClass)
|
||||||
|
@ -2473,17 +2473,16 @@ llvm::Constant *CGObjCMac::EmitMethodList(llvm::Twine Name,
|
||||||
if (Methods.empty())
|
if (Methods.empty())
|
||||||
return llvm::Constant::getNullValue(ObjCTypes.MethodListPtrTy);
|
return llvm::Constant::getNullValue(ObjCTypes.MethodListPtrTy);
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(3);
|
llvm::Constant *Values[3];
|
||||||
Values[0] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy);
|
Values[0] = llvm::Constant::getNullValue(ObjCTypes.Int8PtrTy);
|
||||||
Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
|
Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Methods.size());
|
||||||
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
|
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
|
||||||
Methods.size());
|
Methods.size());
|
||||||
Values[2] = llvm::ConstantArray::get(AT, Methods);
|
Values[2] = llvm::ConstantArray::get(AT, Methods);
|
||||||
llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values, false);
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
|
||||||
|
|
||||||
llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
|
llvm::GlobalVariable *GV = CreateMetadataVar(Name, Init, Section, 4, true);
|
||||||
return llvm::ConstantExpr::getBitCast(GV,
|
return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.MethodListPtrTy);
|
||||||
ObjCTypes.MethodListPtrTy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Function *CGObjCCommonMac::GenerateMethod(const ObjCMethodDecl *OMD,
|
llvm::Function *CGObjCCommonMac::GenerateMethod(const ObjCMethodDecl *OMD,
|
||||||
|
@ -3444,7 +3443,7 @@ llvm::Constant *CGObjCMac::EmitModuleSymbols() {
|
||||||
if (!NumClasses && !NumCategories)
|
if (!NumClasses && !NumCategories)
|
||||||
return llvm::Constant::getNullValue(ObjCTypes.SymtabPtrTy);
|
return llvm::Constant::getNullValue(ObjCTypes.SymtabPtrTy);
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(5);
|
llvm::Constant *Values[5];
|
||||||
Values[0] = llvm::ConstantInt::get(ObjCTypes.LongTy, 0);
|
Values[0] = llvm::ConstantInt::get(ObjCTypes.LongTy, 0);
|
||||||
Values[1] = llvm::Constant::getNullValue(ObjCTypes.SelectorPtrTy);
|
Values[1] = llvm::Constant::getNullValue(ObjCTypes.SelectorPtrTy);
|
||||||
Values[2] = llvm::ConstantInt::get(ObjCTypes.ShortTy, NumClasses);
|
Values[2] = llvm::ConstantInt::get(ObjCTypes.ShortTy, NumClasses);
|
||||||
|
@ -3466,7 +3465,7 @@ llvm::Constant *CGObjCMac::EmitModuleSymbols() {
|
||||||
NumClasses + NumCategories),
|
NumClasses + NumCategories),
|
||||||
Symbols);
|
Symbols);
|
||||||
|
|
||||||
llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values, false);
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
|
||||||
|
|
||||||
llvm::GlobalVariable *GV =
|
llvm::GlobalVariable *GV =
|
||||||
CreateMetadataVar("\01L_OBJC_SYMBOLS", Init,
|
CreateMetadataVar("\01L_OBJC_SYMBOLS", Init,
|
||||||
|
@ -5180,7 +5179,7 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList(llvm::Twine Name,
|
||||||
if (Methods.empty())
|
if (Methods.empty())
|
||||||
return llvm::Constant::getNullValue(ObjCTypes.MethodListnfABIPtrTy);
|
return llvm::Constant::getNullValue(ObjCTypes.MethodListnfABIPtrTy);
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(3);
|
llvm::Constant *Values[3];
|
||||||
// sizeof(struct _objc_method)
|
// sizeof(struct _objc_method)
|
||||||
unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.MethodTy);
|
unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.MethodTy);
|
||||||
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
|
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
|
||||||
|
@ -5189,19 +5188,15 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitMethodList(llvm::Twine Name,
|
||||||
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
|
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.MethodTy,
|
||||||
Methods.size());
|
Methods.size());
|
||||||
Values[2] = llvm::ConstantArray::get(AT, Methods);
|
Values[2] = llvm::ConstantArray::get(AT, Methods);
|
||||||
llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values, false);
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
|
||||||
|
|
||||||
llvm::GlobalVariable *GV =
|
llvm::GlobalVariable *GV =
|
||||||
new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
|
new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
|
||||||
llvm::GlobalValue::InternalLinkage,
|
llvm::GlobalValue::InternalLinkage, Init, Name);
|
||||||
Init,
|
GV->setAlignment(CGM.getTargetData().getABITypeAlignment(Init->getType()));
|
||||||
Name);
|
|
||||||
GV->setAlignment(
|
|
||||||
CGM.getTargetData().getABITypeAlignment(Init->getType()));
|
|
||||||
GV->setSection(Section);
|
GV->setSection(Section);
|
||||||
CGM.AddUsedGlobal(GV);
|
CGM.AddUsedGlobal(GV);
|
||||||
return llvm::ConstantExpr::getBitCast(GV,
|
return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.MethodListnfABIPtrTy);
|
||||||
ObjCTypes.MethodListnfABIPtrTy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ObjCIvarOffsetVariable - Returns the ivar offset variable for
|
/// ObjCIvarOffsetVariable - Returns the ivar offset variable for
|
||||||
|
@ -5304,14 +5299,15 @@ llvm::Constant *CGObjCNonFragileABIMac::EmitIvarList(
|
||||||
// Return null for empty list.
|
// Return null for empty list.
|
||||||
if (Ivars.empty())
|
if (Ivars.empty())
|
||||||
return llvm::Constant::getNullValue(ObjCTypes.IvarListnfABIPtrTy);
|
return llvm::Constant::getNullValue(ObjCTypes.IvarListnfABIPtrTy);
|
||||||
std::vector<llvm::Constant*> Values(3);
|
|
||||||
|
llvm::Constant *Values[3];
|
||||||
unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.IvarnfABITy);
|
unsigned Size = CGM.getTargetData().getTypeAllocSize(ObjCTypes.IvarnfABITy);
|
||||||
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
|
Values[0] = llvm::ConstantInt::get(ObjCTypes.IntTy, Size);
|
||||||
Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size());
|
Values[1] = llvm::ConstantInt::get(ObjCTypes.IntTy, Ivars.size());
|
||||||
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarnfABITy,
|
llvm::ArrayType *AT = llvm::ArrayType::get(ObjCTypes.IvarnfABITy,
|
||||||
Ivars.size());
|
Ivars.size());
|
||||||
Values[2] = llvm::ConstantArray::get(AT, Ivars);
|
Values[2] = llvm::ConstantArray::get(AT, Ivars);
|
||||||
llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values, false);
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
|
||||||
const char *Prefix = "\01l_OBJC_$_INSTANCE_VARIABLES_";
|
const char *Prefix = "\01l_OBJC_$_INSTANCE_VARIABLES_";
|
||||||
llvm::GlobalVariable *GV =
|
llvm::GlobalVariable *GV =
|
||||||
new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
|
new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
|
||||||
|
@ -5497,7 +5493,7 @@ CGObjCNonFragileABIMac::EmitProtocolList(llvm::Twine Name,
|
||||||
ProtocolRefs.push_back(llvm::Constant::getNullValue(
|
ProtocolRefs.push_back(llvm::Constant::getNullValue(
|
||||||
ObjCTypes.ProtocolnfABIPtrTy));
|
ObjCTypes.ProtocolnfABIPtrTy));
|
||||||
|
|
||||||
std::vector<llvm::Constant*> Values(2);
|
llvm::Constant *Values[2];
|
||||||
Values[0] =
|
Values[0] =
|
||||||
llvm::ConstantInt::get(ObjCTypes.LongTy, ProtocolRefs.size() - 1);
|
llvm::ConstantInt::get(ObjCTypes.LongTy, ProtocolRefs.size() - 1);
|
||||||
Values[1] =
|
Values[1] =
|
||||||
|
@ -5506,11 +5502,10 @@ CGObjCNonFragileABIMac::EmitProtocolList(llvm::Twine Name,
|
||||||
ProtocolRefs.size()),
|
ProtocolRefs.size()),
|
||||||
ProtocolRefs);
|
ProtocolRefs);
|
||||||
|
|
||||||
llvm::Constant *Init = llvm::ConstantStruct::get(VMContext, Values, false);
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Values);
|
||||||
GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
|
GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false,
|
||||||
llvm::GlobalValue::InternalLinkage,
|
llvm::GlobalValue::InternalLinkage,
|
||||||
Init,
|
Init, Name);
|
||||||
Name);
|
|
||||||
GV->setSection("__DATA, __objc_const");
|
GV->setSection("__DATA, __objc_const");
|
||||||
GV->setAlignment(
|
GV->setAlignment(
|
||||||
CGM.getTargetData().getABITypeAlignment(Init->getType()));
|
CGM.getTargetData().getABITypeAlignment(Init->getType()));
|
||||||
|
@ -5660,8 +5655,7 @@ CGObjCNonFragileABIMac::EmitVTableMessageSend(CodeGenFunction &CGF,
|
||||||
if (!messageRef) {
|
if (!messageRef) {
|
||||||
// Build the message ref structure.
|
// Build the message ref structure.
|
||||||
llvm::Constant *values[] = { fn, GetMethodVarName(selector) };
|
llvm::Constant *values[] = { fn, GetMethodVarName(selector) };
|
||||||
llvm::Constant *init =
|
llvm::Constant *init = llvm::ConstantStruct::getAnon(values);
|
||||||
llvm::ConstantStruct::get(VMContext, values, 2, false);
|
|
||||||
messageRef = new llvm::GlobalVariable(CGM.getModule(),
|
messageRef = new llvm::GlobalVariable(CGM.getModule(),
|
||||||
init->getType(),
|
init->getType(),
|
||||||
/*constant*/ false,
|
/*constant*/ false,
|
||||||
|
|
|
@ -658,9 +658,7 @@ llvm::Constant *RTTIBuilder::BuildTypeInfo(QualType Ty, bool Force) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Constant *Init =
|
llvm::Constant *Init = llvm::ConstantStruct::getAnon(Fields);
|
||||||
llvm::ConstantStruct::get(VMContext, &Fields[0], Fields.size(),
|
|
||||||
/*Packed=*/false);
|
|
||||||
|
|
||||||
llvm::GlobalVariable *GV =
|
llvm::GlobalVariable *GV =
|
||||||
new llvm::GlobalVariable(CGM.getModule(), Init->getType(),
|
new llvm::GlobalVariable(CGM.getModule(), Init->getType(),
|
||||||
|
|
|
@ -353,7 +353,7 @@ void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) {
|
||||||
llvm::Type *CtorPFTy = llvm::PointerType::getUnqual(CtorFTy);
|
llvm::Type *CtorPFTy = llvm::PointerType::getUnqual(CtorFTy);
|
||||||
|
|
||||||
// Get the type of a ctor entry, { i32, void ()* }.
|
// Get the type of a ctor entry, { i32, void ()* }.
|
||||||
llvm::StructType* CtorStructTy =
|
llvm::StructType *CtorStructTy =
|
||||||
llvm::StructType::get(llvm::Type::getInt32Ty(VMContext),
|
llvm::StructType::get(llvm::Type::getInt32Ty(VMContext),
|
||||||
llvm::PointerType::getUnqual(CtorFTy), NULL);
|
llvm::PointerType::getUnqual(CtorFTy), NULL);
|
||||||
|
|
||||||
|
@ -676,7 +676,7 @@ llvm::Constant *CodeGenModule::EmitAnnotateAttr(llvm::GlobalValue *GV,
|
||||||
llvm::ConstantExpr::getBitCast(unitGV, SBP),
|
llvm::ConstantExpr::getBitCast(unitGV, SBP),
|
||||||
llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), LineNo)
|
llvm::ConstantInt::get(llvm::Type::getInt32Ty(VMContext), LineNo)
|
||||||
};
|
};
|
||||||
return llvm::ConstantStruct::get(VMContext, Fields, 4, false);
|
return llvm::ConstantStruct::getAnon(Fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {
|
bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {
|
||||||
|
|
|
@ -472,8 +472,7 @@ ItaniumCXXABI::EmitMemberPointerConversion(llvm::Constant *C,
|
||||||
else
|
else
|
||||||
Values[1] = llvm::ConstantExpr::getAdd(CS->getOperand(1), Offset);
|
Values[1] = llvm::ConstantExpr::getAdd(CS->getOperand(1), Offset);
|
||||||
|
|
||||||
return llvm::ConstantStruct::get(CGM.getLLVMContext(), Values, 2,
|
return llvm::ConstantStruct::get(CS->getType(), Values);
|
||||||
/*Packed=*/false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -488,8 +487,7 @@ ItaniumCXXABI::EmitNullMemberPointer(const MemberPointerType *MPT) {
|
||||||
|
|
||||||
llvm::Constant *Zero = llvm::ConstantInt::get(ptrdiff_t, 0);
|
llvm::Constant *Zero = llvm::ConstantInt::get(ptrdiff_t, 0);
|
||||||
llvm::Constant *Values[2] = { Zero, Zero };
|
llvm::Constant *Values[2] = { Zero, Zero };
|
||||||
return llvm::ConstantStruct::get(CGM.getLLVMContext(), Values, 2,
|
return llvm::ConstantStruct::getAnon(Values);
|
||||||
/*Packed=*/false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Constant *
|
llvm::Constant *
|
||||||
|
@ -554,8 +552,7 @@ llvm::Constant *ItaniumCXXABI::EmitMemberPointer(const CXXMethodDecl *MD) {
|
||||||
MemPtr[1] = llvm::ConstantInt::get(ptrdiff_t, 0);
|
MemPtr[1] = llvm::ConstantInt::get(ptrdiff_t, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return llvm::ConstantStruct::get(CGM.getLLVMContext(),
|
return llvm::ConstantStruct::getAnon(MemPtr);
|
||||||
MemPtr, 2, /*Packed=*/false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The comparison algorithm is pretty easy: the member pointers are
|
/// The comparison algorithm is pretty easy: the member pointers are
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// CHECK: @t5 = weak global i32 2
|
// CHECK: @t5 = weak global i32 2
|
||||||
int t5 __attribute__((weak)) = 2;
|
int t5 __attribute__((weak)) = 2;
|
||||||
|
|
||||||
// CHECK: @t13 = global %0 zeroinitializer, section "SECT"
|
// CHECK: @t13 = global %struct.s0 zeroinitializer, section "SECT"
|
||||||
struct s0 { int x; };
|
struct s0 { int x; };
|
||||||
struct s0 t13 __attribute__((section("SECT"))) = { 0 };
|
struct s0 t13 __attribute__((section("SECT"))) = { 0 };
|
||||||
|
|
||||||
|
|
|
@ -52,14 +52,14 @@ int g9 = (2 + 3i) * (5 + 7i) != (-11 + 29i);
|
||||||
int g10 = (2.0 + 3.0i) * (5.0 + 7.0i) != (-11.0 + 29.0i);
|
int g10 = (2.0 + 3.0i) * (5.0 + 7.0i) != (-11.0 + 29.0i);
|
||||||
|
|
||||||
// PR5108
|
// PR5108
|
||||||
// CHECK: @gv1 = global %4 <{ i32 0, i8 7 }>, align 1
|
// CHECK: @gv1 = global %struct.anon <{ i32 0, i8 7 }>, align 1
|
||||||
struct {
|
struct {
|
||||||
unsigned long a;
|
unsigned long a;
|
||||||
unsigned long b:3;
|
unsigned long b:3;
|
||||||
} __attribute__((__packed__)) gv1 = { .a = 0x0, .b = 7, };
|
} __attribute__((__packed__)) gv1 = { .a = 0x0, .b = 7, };
|
||||||
|
|
||||||
// PR5118
|
// PR5118
|
||||||
// CHECK: @gv2 = global %5 <{ i8 1, i8* null }>, align 1
|
// CHECK: @gv2 = global %4 <{ i8 1, i8* null }>, align 1
|
||||||
struct {
|
struct {
|
||||||
unsigned char a;
|
unsigned char a;
|
||||||
char *b;
|
char *b;
|
||||||
|
|
|
@ -8,10 +8,10 @@ struct foo {
|
||||||
// CHECK: @u = global %union.anon zeroinitializer
|
// CHECK: @u = global %union.anon zeroinitializer
|
||||||
union { int i; float f; } u = { };
|
union { int i; float f; } u = { };
|
||||||
|
|
||||||
// CHECK: @u2 = global %1 { i32 0, [4 x i8] undef }
|
// CHECK: @u2 = global %2 { i32 0, [4 x i8] undef }
|
||||||
union { int i; double f; } u2 = { };
|
union { int i; double f; } u2 = { };
|
||||||
|
|
||||||
// CHECK: @u3 = global %2 zeroinitializer
|
// CHECK: @u3 = global %3 zeroinitializer
|
||||||
union { double f; int i; } u3 = { };
|
union { double f; int i; } u3 = { };
|
||||||
|
|
||||||
// CHECK: @b = global [2 x i32] [i32 0, i32 22]
|
// CHECK: @b = global [2 x i32] [i32 0, i32 22]
|
||||||
|
@ -39,11 +39,11 @@ struct ds ds0 = { { { .a = 0 } } };
|
||||||
struct ds ds1 = { { .a = 1 } };
|
struct ds ds1 = { { .a = 1 } };
|
||||||
struct ds ds2 = { { .b = 1 } };
|
struct ds ds2 = { { .b = 1 } };
|
||||||
struct ds ds3 = { .a = 0 };
|
struct ds ds3 = { .a = 0 };
|
||||||
// CHECK: @ds4 = global %3 { %4 { %struct.anon zeroinitializer, i16 0, %struct.anon { i16 1 } } }
|
// CHECK: @ds4 = global %struct.ds { %1 { %struct.anon zeroinitializer, i16 0, %struct.anon { i16 1 } } }
|
||||||
struct ds ds4 = { .c = 1 };
|
struct ds ds4 = { .c = 1 };
|
||||||
struct ds ds5 = { { { .a = 0 } }, .b = 1 };
|
struct ds ds5 = { { { .a = 0 } }, .b = 1 };
|
||||||
struct ds ds6 = { { .a = 0, .b = 1 } };
|
struct ds ds6 = { { .a = 0, .b = 1 } };
|
||||||
// CHECK: @ds7 = global %3 { %4 { %struct.anon { i16 2 }, i16 3, %struct.anon zeroinitializer } }
|
// CHECK: @ds7 = global %struct.ds { %1 { %struct.anon { i16 2 }, i16 3, %struct.anon zeroinitializer } }
|
||||||
struct ds ds7 = {
|
struct ds ds7 = {
|
||||||
{ {
|
{ {
|
||||||
.a = 1
|
.a = 1
|
||||||
|
|
|
@ -27,12 +27,12 @@ struct ManyFields {
|
||||||
int f;
|
int f;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK: global %0 { i32 1, i32 2, i32 0, i8 0, i32 0, i32 0 }
|
// CHECK: global %struct.ManyFields { i32 1, i32 2, i32 0, i8 0, i32 0, i32 0 }
|
||||||
struct ManyFields FewInits = {1, 2};
|
struct ManyFields FewInits = {1, 2};
|
||||||
|
|
||||||
|
|
||||||
// PR6766
|
// PR6766
|
||||||
// CHECK: @l = global %1 { [24 x i8] c"f\00\00\00o\00\00\00o\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 1 }
|
// CHECK: @l = global %0 { [24 x i8] c"f\00\00\00o\00\00\00o\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00", i32 1 }
|
||||||
typedef __WCHAR_TYPE__ wchar_t;
|
typedef __WCHAR_TYPE__ wchar_t;
|
||||||
struct K {
|
struct K {
|
||||||
wchar_t L[6];
|
wchar_t L[6];
|
||||||
|
|
|
@ -10,7 +10,7 @@ void f();
|
||||||
void (&fr)() = f;
|
void (&fr)() = f;
|
||||||
|
|
||||||
struct S { int& a; };
|
struct S { int& a; };
|
||||||
// CHECK: @s = global %0 { i32* @a }
|
// CHECK: @s = global %struct.S { i32* @a }
|
||||||
S s = { a };
|
S s = { a };
|
||||||
|
|
||||||
// PR5581
|
// PR5581
|
||||||
|
@ -21,7 +21,7 @@ public:
|
||||||
unsigned f;
|
unsigned f;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK: @_ZN6PR55812g0E = global %1 { i32 1 }
|
// CHECK: @_ZN6PR55812g0E = global %"class.PR5581::C" { i32 1 }
|
||||||
C g0 = { C::e1 };
|
C g0 = { C::e1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче