Index: bindings/go/llvm/DIBuilderBindings.h =================================================================== --- bindings/go/llvm/DIBuilderBindings.h +++ bindings/go/llvm/DIBuilderBindings.h @@ -71,13 +71,13 @@ LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef D, const char *Name, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, unsigned Encoding); LLVMMetadataRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef D, LLVMMetadataRef PointeeType, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, const char *Name); LLVMMetadataRef @@ -87,24 +87,24 @@ LLVMMetadataRef LLVMDIBuilderCreateStructType( LLVMDIBuilderRef D, LLVMMetadataRef Scope, const char *Name, LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom, + DIAlignment AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom, LLVMMetadataRef ElementTypes); LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType( LLVMDIBuilderRef D, unsigned Tag, const char *Name, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, unsigned RuntimeLang, - uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags); + uint64_t SizeInBits, DIAlignment AlignInBits, unsigned Flags); LLVMMetadataRef LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef D, LLVMMetadataRef Scope, const char *Name, LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, + DIAlignment AlignInBits, uint64_t OffsetInBits, unsigned Flags, LLVMMetadataRef Ty); LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef D, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, LLVMMetadataRef ElementType, LLVMMetadataRef Subscripts); Index: bindings/go/llvm/DIBuilderBindings.cpp =================================================================== --- bindings/go/llvm/DIBuilderBindings.cpp +++ bindings/go/llvm/DIBuilderBindings.cpp @@ -107,7 +107,7 @@ LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Dref, const char *Name, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, unsigned Encoding) { DIBuilder *D = unwrap(Dref); return wrap(D->createBasicType(Name, SizeInBits, AlignInBits, Encoding)); @@ -116,7 +116,7 @@ LLVMMetadataRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef Dref, LLVMMetadataRef PointeeType, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, const char *Name) { DIBuilder *D = unwrap(Dref); return wrap(D->createPointerType(unwrap(PointeeType), SizeInBits, @@ -134,7 +134,7 @@ LLVMMetadataRef LLVMDIBuilderCreateStructType( LLVMDIBuilderRef Dref, LLVMMetadataRef Scope, const char *Name, LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom, + DIAlignment AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom, LLVMMetadataRef ElementTypes) { DIBuilder *D = unwrap(Dref); return wrap(D->createStructType( @@ -147,7 +147,7 @@ LLVMMetadataRef LLVMDIBuilderCreateReplaceableCompositeType( LLVMDIBuilderRef Dref, unsigned Tag, const char *Name, LLVMMetadataRef Scope, LLVMMetadataRef File, unsigned Line, - unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits, + unsigned RuntimeLang, uint64_t SizeInBits, DIAlignment AlignInBits, unsigned Flags) { DIBuilder *D = unwrap(Dref); return wrap(D->createReplaceableCompositeType( @@ -160,7 +160,7 @@ LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef Dref, LLVMMetadataRef Scope, const char *Name, LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, + DIAlignment AlignInBits, uint64_t OffsetInBits, unsigned Flags, LLVMMetadataRef Ty) { DIBuilder *D = unwrap(Dref); return wrap(D->createMemberType( @@ -171,7 +171,7 @@ LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Dref, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, LLVMMetadataRef ElementType, LLVMMetadataRef Subscripts) { DIBuilder *D = unwrap(Dref); Index: bindings/go/llvm/dibuilder.go =================================================================== --- bindings/go/llvm/dibuilder.go +++ bindings/go/llvm/dibuilder.go @@ -277,7 +277,7 @@ type DIBasicType struct { Name string SizeInBits uint64 - AlignInBits uint64 + AlignInBits uint32 Encoding DwarfTypeEncoding } @@ -289,7 +289,7 @@ d.ref, name, C.uint64_t(t.SizeInBits), - C.uint64_t(t.AlignInBits), + C.uint32_t(t.AlignInBits), C.unsigned(t.Encoding), ) return Metadata{C: result} @@ -299,7 +299,7 @@ type DIPointerType struct { Pointee Metadata SizeInBits uint64 - AlignInBits uint64 // optional + AlignInBits uint32 // optional Name string // optional } @@ -311,7 +311,7 @@ d.ref, t.Pointee.C, C.uint64_t(t.SizeInBits), - C.uint64_t(t.AlignInBits), + C.uint32_t(t.AlignInBits), name, ) return Metadata{C: result} @@ -340,7 +340,7 @@ File Metadata Line int SizeInBits uint64 - AlignInBits uint64 + AlignInBits uint32 Flags int DerivedFrom Metadata Elements []Metadata @@ -358,7 +358,7 @@ t.File.C, C.unsigned(t.Line), C.uint64_t(t.SizeInBits), - C.uint64_t(t.AlignInBits), + C.uint32_t(t.AlignInBits), C.unsigned(t.Flags), t.DerivedFrom.C, elements.C, @@ -375,7 +375,7 @@ Line int RuntimeLang int SizeInBits uint64 - AlignInBits uint64 + AlignInBits uint32 Flags int } @@ -392,7 +392,7 @@ C.unsigned(t.Line), C.unsigned(t.RuntimeLang), C.uint64_t(t.SizeInBits), - C.uint64_t(t.AlignInBits), + C.uint32_t(t.AlignInBits), C.unsigned(t.Flags), ) return Metadata{C: result} @@ -404,7 +404,7 @@ File Metadata Line int SizeInBits uint64 - AlignInBits uint64 + AlignInBits uint32 OffsetInBits uint64 Flags int Type Metadata @@ -421,7 +421,7 @@ t.File.C, C.unsigned(t.Line), C.uint64_t(t.SizeInBits), - C.uint64_t(t.AlignInBits), + C.uint32_t(t.AlignInBits), C.uint64_t(t.OffsetInBits), C.unsigned(t.Flags), t.Type.C, @@ -438,7 +438,7 @@ // DIArrayType holds the values for creating array type debug metadata. type DIArrayType struct { SizeInBits uint64 - AlignInBits uint64 + AlignInBits uint32 ElementType Metadata Subscripts []DISubrange } @@ -453,7 +453,7 @@ result := C.LLVMDIBuilderCreateArrayType( d.ref, C.uint64_t(t.SizeInBits), - C.uint64_t(t.AlignInBits), + C.uint32_t(t.AlignInBits), t.ElementType.C, subscripts.C, ) Index: include/llvm/IR/DIBuilder.h =================================================================== --- include/llvm/IR/DIBuilder.h +++ include/llvm/IR/DIBuilder.h @@ -123,7 +123,7 @@ /// \param AlignInBits Type alignment. /// \param Encoding DWARF encoding code, e.g. dwarf::DW_ATE_float. DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Encoding); + DIAlignment AlignInBits, unsigned Encoding); /// Create debugging information entry for a qualified /// type, e.g. 'const int'. @@ -137,7 +137,7 @@ /// \param AlignInBits Alignment. (optional) /// \param Name Pointer type name. (optional) DIDerivedType *createPointerType(DIType *PointeeTy, uint64_t SizeInBits, - uint64_t AlignInBits = 0, + DIAlignment AlignInBits = 0, StringRef Name = ""); /// Create debugging information entry for a pointer to member. @@ -147,14 +147,14 @@ /// \param Class Type for which this pointer points to members of. DIDerivedType * createMemberPointerType(DIType *PointeeTy, DIType *Class, - uint64_t SizeInBits, uint64_t AlignInBits = 0, + uint64_t SizeInBits, DIAlignment AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagZero); /// Create debugging information entry for a c++ /// style reference or rvalue reference type. DIDerivedType *createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits = 0, - uint64_t AlignInBits = 0); + DIAlignment AlignInBits = 0); /// Create debugging information entry for a typedef. /// \param Ty Original type. @@ -191,7 +191,8 @@ /// \param Ty Parent type. DIDerivedType *createMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, + DIAlignment AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty); @@ -208,7 +209,7 @@ /// \param Ty Parent type. DIDerivedType *createBitFieldMemberType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty); /// Create debugging information entry for a @@ -237,7 +238,7 @@ /// \param Ty Parent type. /// \param PropertyNode Property associated with this ivar. DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, MDNode *PropertyNode); @@ -274,7 +275,7 @@ /// \param UniqueIdentifier A unique identifier for the class. DICompositeType *createClassType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, DIType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr, StringRef UniqueIdentifier = ""); @@ -292,7 +293,7 @@ /// \param UniqueIdentifier A unique identifier for the struct. DICompositeType *createStructType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags, + uint64_t SizeInBits, DIAlignment AlignInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0, DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = ""); @@ -309,7 +310,8 @@ /// \param UniqueIdentifier A unique identifier for the union. DICompositeType *createUnionType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, + DIAlignment AlignInBits, DINode::DIFlags Flags, DINodeArray Elements, unsigned RunTimeLang = 0, @@ -359,7 +361,7 @@ /// \param AlignInBits Alignment. /// \param Ty Element type. /// \param Subscripts Subscripts. - DICompositeType *createArrayType(uint64_t Size, uint64_t AlignInBits, + DICompositeType *createArrayType(uint64_t Size, DIAlignment AlignInBits, DIType *Ty, DINodeArray Subscripts); /// Create debugging information entry for a vector type. @@ -367,7 +369,7 @@ /// \param AlignInBits Alignment. /// \param Ty Element type. /// \param Subscripts Subscripts. - DICompositeType *createVectorType(uint64_t Size, uint64_t AlignInBits, + DICompositeType *createVectorType(uint64_t Size, DIAlignment AlignInBits, DIType *Ty, DINodeArray Subscripts); /// Create debugging information entry for an @@ -383,7 +385,7 @@ /// \param UniqueIdentifier A unique identifier for the enum. DICompositeType *createEnumerationType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements, + uint64_t SizeInBits, DIAlignment AlignInBits, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier = ""); /// Create subroutine type. @@ -416,14 +418,15 @@ DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang = 0, uint64_t SizeInBits = 0, - uint64_t AlignInBits = 0, + DIAlignment AlignInBits = 0, StringRef UniqueIdentifier = ""); /// Create a temporary forward-declared type. DICompositeType *createReplaceableCompositeType( unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang = 0, uint64_t SizeInBits = 0, - uint64_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl, + DIAlignment AlignInBits = 0, + DINode::DIFlags Flags = DINode::FlagFwdDecl, StringRef UniqueIdentifier = ""); /// Retain DIScope* in a module even if it is not referenced Index: include/llvm/IR/DebugInfoMetadata.h =================================================================== --- include/llvm/IR/DebugInfoMetadata.h +++ include/llvm/IR/DebugInfoMetadata.h @@ -504,6 +504,8 @@ return ""; } +typedef uint32_t DIAlignment; + /// \brief Base class for types. /// /// TODO: Remove the hardcoded name and context, since many types don't use @@ -513,19 +515,19 @@ unsigned Line; DIFlags Flags; uint64_t SizeInBits; - uint64_t AlignInBits; + DIAlignment AlignInBits; uint64_t OffsetInBits; protected: DIType(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, - unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits, + unsigned Line, uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, ArrayRef Ops) : DIScope(C, ID, Storage, Tag, Ops) { init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags); } ~DIType() = default; - void init(unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits, + void init(unsigned Line, uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags) { this->Line = Line; this->Flags = Flags; @@ -536,7 +538,7 @@ /// Change fields in place. void mutate(unsigned Tag, unsigned Line, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags) { + DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags) { assert(isDistinct() && "Only distinct nodes can mutate"); setTag(Tag); init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags); @@ -614,7 +616,7 @@ unsigned Encoding; DIBasicType(LLVMContext &C, StorageType Storage, unsigned Tag, - uint64_t SizeInBits, uint64_t AlignInBits, unsigned Encoding, + uint64_t SizeInBits, DIAlignment AlignInBits, unsigned Encoding, ArrayRef Ops) : DIType(C, DIBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0, FlagZero, Ops), @@ -623,14 +625,14 @@ static DIBasicType *getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Encoding, + DIAlignment AlignInBits, unsigned Encoding, StorageType Storage, bool ShouldCreate = true) { return getImpl(Context, Tag, getCanonicalMDString(Context, Name), SizeInBits, AlignInBits, Encoding, Storage, ShouldCreate); } static DIBasicType *getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Encoding, + DIAlignment AlignInBits, unsigned Encoding, StorageType Storage, bool ShouldCreate = true); TempDIBasicType cloneImpl() const { @@ -643,11 +645,11 @@ (Tag, Name, 0, 0, 0)) DEFINE_MDNODE_GET(DIBasicType, (unsigned Tag, StringRef Name, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Encoding), + DIAlignment AlignInBits, unsigned Encoding), (Tag, Name, SizeInBits, AlignInBits, Encoding)) DEFINE_MDNODE_GET(DIBasicType, (unsigned Tag, MDString *Name, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Encoding), + DIAlignment AlignInBits, unsigned Encoding), (Tag, Name, SizeInBits, AlignInBits, Encoding)) TempDIBasicType clone() const { return cloneImpl(); } @@ -670,7 +672,7 @@ friend class MDNode; DIDerivedType(LLVMContext &C, StorageType Storage, unsigned Tag, - unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits, + unsigned Line, uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, ArrayRef Ops) : DIType(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags, Ops) {} @@ -679,7 +681,7 @@ static DIDerivedType *getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, DIFile *File, unsigned Line, DIScopeRef Scope, DITypeRef BaseType, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *ExtraData, StorageType Storage, bool ShouldCreate = true) { @@ -690,7 +692,7 @@ static DIDerivedType *getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *ExtraData, StorageType Storage, bool ShouldCreate = true); @@ -706,7 +708,7 @@ DEFINE_MDNODE_GET(DIDerivedType, (unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *ExtraData = nullptr), (Tag, Name, File, Line, Scope, BaseType, SizeInBits, @@ -714,8 +716,8 @@ DEFINE_MDNODE_GET(DIDerivedType, (unsigned Tag, StringRef Name, DIFile *File, unsigned Line, DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, - Metadata *ExtraData = nullptr), + DIAlignment AlignInBits, uint64_t OffsetInBits, + DIFlags Flags, Metadata *ExtraData = nullptr), (Tag, Name, File, Line, Scope, BaseType, SizeInBits, AlignInBits, OffsetInBits, Flags, ExtraData)) @@ -775,7 +777,7 @@ DICompositeType(LLVMContext &C, StorageType Storage, unsigned Tag, unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, + DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, ArrayRef Ops) : DIType(C, DICompositeTypeKind, Storage, Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags, Ops), @@ -784,8 +786,8 @@ /// Change fields in place. void mutate(unsigned Tag, unsigned Line, unsigned RuntimeLang, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, - DIFlags Flags) { + uint64_t SizeInBits, DIAlignment AlignInBits, + uint64_t OffsetInBits, DIFlags Flags) { assert(isDistinct() && "Only distinct nodes can mutate"); assert(getRawIdentifier() && "Only ODR-uniqued nodes should mutate"); this->RuntimeLang = RuntimeLang; @@ -795,7 +797,7 @@ static DICompositeType * getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, Metadata *File, unsigned Line, DIScopeRef Scope, DITypeRef BaseType, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, DINodeArray Elements, unsigned RuntimeLang, DITypeRef VTableHolder, DITemplateParameterArray TemplateParams, StringRef Identifier, StorageType Storage, bool ShouldCreate = true) { @@ -808,7 +810,7 @@ static DICompositeType * getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams, MDString *Identifier, StorageType Storage, bool ShouldCreate = true); @@ -825,8 +827,8 @@ DEFINE_MDNODE_GET(DICompositeType, (unsigned Tag, StringRef Name, DIFile *File, unsigned Line, DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, - DINodeArray Elements, unsigned RuntimeLang, + DIAlignment AlignInBits, uint64_t OffsetInBits, + DIFlags Flags, DINodeArray Elements, unsigned RuntimeLang, DITypeRef VTableHolder, DITemplateParameterArray TemplateParams = nullptr, StringRef Identifier = ""), @@ -836,7 +838,7 @@ DEFINE_MDNODE_GET(DICompositeType, (unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams = nullptr, @@ -857,7 +859,7 @@ static DICompositeType * getODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, - Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits, + Metadata *BaseType, uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams); @@ -876,7 +878,7 @@ static DICompositeType * buildODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, - Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits, + Metadata *BaseType, uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams); Index: lib/AsmParser/LLParser.cpp =================================================================== --- lib/AsmParser/LLParser.cpp +++ lib/AsmParser/LLParser.cpp @@ -3865,7 +3865,7 @@ OPTIONAL(tag, DwarfTagField, (dwarf::DW_TAG_base_type)); \ OPTIONAL(name, MDStringField, ); \ OPTIONAL(size, MDUnsignedField, (0, UINT64_MAX)); \ - OPTIONAL(align, MDUnsignedField, (0, UINT64_MAX)); \ + OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX)); \ OPTIONAL(encoding, DwarfAttEncodingField, ); PARSE_MD_FIELDS(); #undef VISIT_MD_FIELDS @@ -3888,7 +3888,7 @@ OPTIONAL(scope, MDField, ); \ REQUIRED(baseType, MDField, ); \ OPTIONAL(size, MDUnsignedField, (0, UINT64_MAX)); \ - OPTIONAL(align, MDUnsignedField, (0, UINT64_MAX)); \ + OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX)); \ OPTIONAL(offset, MDUnsignedField, (0, UINT64_MAX)); \ OPTIONAL(flags, DIFlagField, ); \ OPTIONAL(extraData, MDField, ); @@ -3911,7 +3911,7 @@ OPTIONAL(scope, MDField, ); \ OPTIONAL(baseType, MDField, ); \ OPTIONAL(size, MDUnsignedField, (0, UINT64_MAX)); \ - OPTIONAL(align, MDUnsignedField, (0, UINT64_MAX)); \ + OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX)); \ OPTIONAL(offset, MDUnsignedField, (0, UINT64_MAX)); \ OPTIONAL(flags, DIFlagField, ); \ OPTIONAL(elements, MDField, ); \ Index: lib/Bitcode/Reader/BitcodeReader.cpp =================================================================== --- lib/Bitcode/Reader/BitcodeReader.cpp +++ lib/Bitcode/Reader/BitcodeReader.cpp @@ -2497,7 +2497,7 @@ Metadata *Scope = getDITypeRefOrNull(Record[5]); Metadata *BaseType = getDITypeRefOrNull(Record[6]); uint64_t SizeInBits = Record[7]; - uint64_t AlignInBits = Record[8]; + DIAlignment AlignInBits = Record[8]; uint64_t OffsetInBits = Record[9]; DINode::DIFlags Flags = static_cast(Record[10]); Metadata *Elements = getMDOrNull(Record[11]); Index: lib/CodeGen/AsmPrinter/DwarfUnit.cpp =================================================================== --- lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1404,8 +1404,9 @@ addUInt(MemberDie, dwarf::DW_AT_bit_size, None, Size); uint64_t Offset = DT->getOffsetInBits(); - uint64_t Align = DT->getAlignInBits() ? DT->getAlignInBits() : FieldSize; - uint64_t AlignMask = ~(Align - 1); + DIAlignment Align = DT->getAlignInBits() ? DT->getAlignInBits() + : FieldSize; + DIAlignment AlignMask = ~(Align - 1); // The bits from the start of the storage unit to the start of the field. uint64_t StartBitOffset = Offset - (Offset & AlignMask); // The byte offset of the field's aligned storage unit inside the struct. Index: lib/IR/DIBuilder.cpp =================================================================== --- lib/IR/DIBuilder.cpp +++ lib/IR/DIBuilder.cpp @@ -195,7 +195,7 @@ } DIBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, unsigned Encoding) { assert(!Name.empty() && "Unable to create type without name"); return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits, @@ -209,7 +209,7 @@ DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, StringRef Name) { // FIXME: Why is there a name here? return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name, @@ -220,7 +220,7 @@ DIDerivedType *DIBuilder::createMemberPointerType(DIType *PointeeTy, DIType *Base, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, DINode::DIFlags Flags) { return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "", nullptr, 0, nullptr, PointeeTy, SizeInBits, @@ -229,7 +229,7 @@ DIDerivedType *DIBuilder::createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits, - uint64_t AlignInBits) { + DIAlignment AlignInBits) { assert(RTy && "Unable to create reference type"); return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy, SizeInBits, AlignInBits, 0, DINode::FlagZero); @@ -261,7 +261,7 @@ DIDerivedType *DIBuilder::createMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, - uint64_t AlignInBits, + DIAlignment AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty) { return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File, @@ -277,7 +277,7 @@ DIDerivedType *DIBuilder::createBitFieldMemberType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty) { Flags |= DINode::FlagBitField; return DIDerivedType::get( @@ -299,7 +299,7 @@ DIDerivedType * DIBuilder::createObjCIVar(StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, MDNode *PropertyNode) { return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File, @@ -357,7 +357,7 @@ DICompositeType *DIBuilder::createClassType( DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) { assert((!Context || isa(Context)) && @@ -374,7 +374,7 @@ DICompositeType *DIBuilder::createStructType( DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags, + uint64_t SizeInBits, DIAlignment AlignInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang, DIType *VTableHolder, StringRef UniqueIdentifier) { auto *R = DICompositeType::get( @@ -387,7 +387,7 @@ DICompositeType *DIBuilder::createUnionType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags, + uint64_t SizeInBits, DIAlignment AlignInBits, DINode::DIFlags Flags, DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) { auto *R = DICompositeType::get( VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber, @@ -413,7 +413,7 @@ DICompositeType *DIBuilder::createEnumerationType( DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, - uint64_t SizeInBits, uint64_t AlignInBits, DINodeArray Elements, + uint64_t SizeInBits, DIAlignment AlignInBits, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier) { auto *CTy = DICompositeType::get( VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber, @@ -424,7 +424,8 @@ return CTy; } -DICompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits, +DICompositeType *DIBuilder::createArrayType(uint64_t Size, + DIAlignment AlignInBits, DIType *Ty, DINodeArray Subscripts) { auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", @@ -435,7 +436,8 @@ } DICompositeType *DIBuilder::createVectorType(uint64_t Size, - uint64_t AlignInBits, DIType *Ty, + DIAlignment AlignInBits, + DIType *Ty, DINodeArray Subscripts) { auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "", nullptr, 0, nullptr, Ty, Size, AlignInBits, 0, @@ -479,7 +481,7 @@ DICompositeType * DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang, - uint64_t SizeInBits, uint64_t AlignInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, StringRef UniqueIdentifier) { // FIXME: Define in terms of createReplaceableForwardDecl() by calling // replaceWithUniqued(). @@ -493,7 +495,7 @@ DICompositeType *DIBuilder::createReplaceableCompositeType( unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, - unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits, + unsigned RuntimeLang, uint64_t SizeInBits, DIAlignment AlignInBits, DINode::DIFlags Flags, StringRef UniqueIdentifier) { auto *RetTy = DICompositeType::getTemporary( Index: lib/IR/DebugInfoMetadata.cpp =================================================================== --- lib/IR/DebugInfoMetadata.cpp +++ lib/IR/DebugInfoMetadata.cpp @@ -227,7 +227,7 @@ DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Encoding, + DIAlignment AlignInBits, unsigned Encoding, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); DEFINE_GETIMPL_LOOKUP(DIBasicType, @@ -240,7 +240,7 @@ DIDerivedType *DIDerivedType::getImpl( LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, + DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *ExtraData, StorageType Storage, bool ShouldCreate) { assert(isCanonical(Name) && "Expected canonical MDString"); DEFINE_GETIMPL_LOOKUP(DIDerivedType, @@ -255,7 +255,7 @@ DICompositeType *DICompositeType::getImpl( LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, + DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams, MDString *Identifier, StorageType Storage, bool ShouldCreate) { @@ -276,7 +276,7 @@ DICompositeType *DICompositeType::buildODRType( LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams) { assert(!Identifier.getString().empty() && "Expected valid identifier"); @@ -310,7 +310,7 @@ DICompositeType *DICompositeType::getODRType( LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, - uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits, + uint64_t SizeInBits, DIAlignment AlignInBits, uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams) { assert(!Identifier.getString().empty() && "Expected valid identifier"); Index: lib/IR/LLVMContextImpl.h =================================================================== --- lib/IR/LLVMContextImpl.h +++ lib/IR/LLVMContextImpl.h @@ -319,11 +319,11 @@ unsigned Tag; MDString *Name; uint64_t SizeInBits; - uint64_t AlignInBits; + DIAlignment AlignInBits; unsigned Encoding; MDNodeKeyImpl(unsigned Tag, MDString *Name, uint64_t SizeInBits, - uint64_t AlignInBits, unsigned Encoding) + DIAlignment AlignInBits, unsigned Encoding) : Tag(Tag), Name(Name), SizeInBits(SizeInBits), AlignInBits(AlignInBits), Encoding(Encoding) {} MDNodeKeyImpl(const DIBasicType *N) @@ -349,14 +349,14 @@ Metadata *Scope; Metadata *BaseType; uint64_t SizeInBits; - uint64_t AlignInBits; + DIAlignment AlignInBits; uint64_t OffsetInBits; unsigned Flags; Metadata *ExtraData; MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, + DIAlignment AlignInBits, uint64_t OffsetInBits, unsigned Flags, Metadata *ExtraData) : Tag(Tag), Name(Name), File(File), Line(Line), Scope(Scope), BaseType(BaseType), SizeInBits(SizeInBits), AlignInBits(AlignInBits), @@ -430,7 +430,7 @@ Metadata *Scope; Metadata *BaseType; uint64_t SizeInBits; - uint64_t AlignInBits; + DIAlignment AlignInBits; uint64_t OffsetInBits; unsigned Flags; Metadata *Elements; @@ -441,7 +441,7 @@ MDNodeKeyImpl(unsigned Tag, MDString *Name, Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits, - uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, + DIAlignment AlignInBits, uint64_t OffsetInBits, unsigned Flags, Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder, Metadata *TemplateParams, MDString *Identifier) Index: test/Assembler/ditype-large-values.ll =================================================================== --- test/Assembler/ditype-large-values.ll +++ test/Assembler/ditype-large-values.ll @@ -4,9 +4,9 @@ ; CHECK: !named = !{!0, !1, !2} !named = !{!0, !1, !2} -; CHECK: !0 = !DIBasicType(name: "name", size: 18446744073709551615, align: 18446744073709551614, encoding: DW_ATE_unsigned_char) -; CHECK-NEXT: !1 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !0, size: 18446744073709551615, align: 18446744073709551614, offset: 18446744073709551613) -; CHECK-NEXT: !2 = !DICompositeType(tag: DW_TAG_array_type, baseType: !0, size: 18446744073709551615, align: 18446744073709551614, offset: 18446744073709551613) -!0 = !DIBasicType(tag: DW_TAG_base_type, name: "name", size: 18446744073709551615, align: 18446744073709551614, encoding: DW_ATE_unsigned_char) -!1 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !0, size: 18446744073709551615, align: 18446744073709551614, offset: 18446744073709551613) -!2 = !DICompositeType(tag: DW_TAG_array_type, baseType: !0, size: 18446744073709551615, align: 18446744073709551614, offset: 18446744073709551613) +; CHECK: !0 = !DIBasicType(name: "name", size: 18446744073709551615, align: 4294967294, encoding: DW_ATE_unsigned_char) +; CHECK-NEXT: !1 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !0, size: 18446744073709551615, align: 4294967294, offset: 18446744073709551613) +; CHECK-NEXT: !2 = !DICompositeType(tag: DW_TAG_array_type, baseType: !0, size: 18446744073709551615, align: 4294967294, offset: 18446744073709551613) +!0 = !DIBasicType(tag: DW_TAG_base_type, name: "name", size: 18446744073709551615, align: 4294967294, encoding: DW_ATE_unsigned_char) +!1 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !0, size: 18446744073709551615, align: 4294967294, offset: 18446744073709551613) +!2 = !DICompositeType(tag: DW_TAG_array_type, baseType: !0, size: 18446744073709551615, align: 4294967294, offset: 18446744073709551613) Index: unittests/IR/MetadataTest.cpp =================================================================== --- unittests/IR/MetadataTest.cpp +++ unittests/IR/MetadataTest.cpp @@ -997,9 +997,9 @@ TEST_F(DIBasicTypeTest, getWithLargeValues) { auto *N = DIBasicType::get(Context, dwarf::DW_TAG_base_type, "special", - UINT64_MAX, UINT64_MAX - 1, 7); + UINT64_MAX, UINT32_MAX - 1, 7); EXPECT_EQ(UINT64_MAX, N->getSizeInBits()); - EXPECT_EQ(UINT64_MAX - 1, N->getAlignInBits()); + EXPECT_EQ(UINT32_MAX - 1, N->getAlignInBits()); } TEST_F(DIBasicTypeTest, getUnspecified) { @@ -1121,9 +1121,9 @@ auto *N = DIDerivedType::get( Context, dwarf::DW_TAG_pointer_type, "something", File, 1, Scope, - BaseType, UINT64_MAX, UINT64_MAX - 1, UINT64_MAX - 2, Flags, ExtraData); + BaseType, UINT64_MAX, UINT32_MAX - 1, UINT64_MAX - 2, Flags, ExtraData); EXPECT_EQ(UINT64_MAX, N->getSizeInBits()); - EXPECT_EQ(UINT64_MAX - 1, N->getAlignInBits()); + EXPECT_EQ(UINT32_MAX - 1, N->getAlignInBits()); EXPECT_EQ(UINT64_MAX - 2, N->getOffsetInBits()); } @@ -1137,7 +1137,7 @@ DIScope *Scope = getSubprogram(); DIType *BaseType = getCompositeType(); uint64_t SizeInBits = 2; - uint64_t AlignInBits = 3; + DIAlignment AlignInBits = 3; uint64_t OffsetInBits = 4; DINode::DIFlags Flags = static_cast(5); MDTuple *Elements = getTuple(); @@ -1257,7 +1257,7 @@ DIScope *Scope = getSubprogram(); DIType *BaseType = getCompositeType(); uint64_t SizeInBits = UINT64_MAX; - uint64_t AlignInBits = UINT64_MAX - 1; + DIAlignment AlignInBits = UINT32_MAX - 1; uint64_t OffsetInBits = UINT64_MAX - 2; DINode::DIFlags Flags = static_cast(5); MDTuple *Elements = getTuple(); @@ -1283,7 +1283,7 @@ DIScope *Scope = getSubprogram(); DIType *BaseType = getCompositeType(); uint64_t SizeInBits = 2; - uint64_t AlignInBits = 3; + DIAlignment AlignInBits = 3; uint64_t OffsetInBits = 4; DINode::DIFlags Flags = static_cast(5); unsigned RuntimeLang = 6;