Skip to content

Commit

Permalink
DebugInfo: change alignment type from uint64_t to uint32_t to save sp…
Browse files Browse the repository at this point in the history
…ace.

In futher patches we shall have alignment field added to DIVariable family
and switching from uint64_t to uint32_t will save 4 bytes per variable.

Differential Revision: https://reviews.llvm.org/D25620



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284482 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Victor Leschuk committed Oct 18, 2016
1 parent 05fe9f3 commit 58be60c
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 116 deletions.
12 changes: 6 additions & 6 deletions bindings/go/llvm/DIBuilderBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Dref,
const char *Name,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint32_t AlignInBits,
unsigned Encoding) {
DIBuilder *D = unwrap(Dref);
return wrap(D->createBasicType(Name, SizeInBits, AlignInBits, Encoding));
Expand All @@ -116,7 +116,7 @@ LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Dref,
LLVMMetadataRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef Dref,
LLVMMetadataRef PointeeType,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint32_t AlignInBits,
const char *Name) {
DIBuilder *D = unwrap(Dref);
return wrap(D->createPointerType(unwrap<DIType>(PointeeType), SizeInBits,
Expand All @@ -134,7 +134,7 @@ LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Dref, LLVMMetadataRef File,
LLVMMetadataRef LLVMDIBuilderCreateStructType(
LLVMDIBuilderRef Dref, LLVMMetadataRef Scope, const char *Name,
LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits,
uint64_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom,
uint32_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom,
LLVMMetadataRef ElementTypes) {
DIBuilder *D = unwrap(Dref);
return wrap(D->createStructType(
Expand All @@ -147,7 +147,7 @@ LLVMMetadataRef LLVMDIBuilderCreateStructType(
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, uint32_t AlignInBits,
unsigned Flags) {
DIBuilder *D = unwrap(Dref);
return wrap(D->createReplaceableCompositeType(
Expand All @@ -160,7 +160,7 @@ LLVMMetadataRef
LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef Dref, LLVMMetadataRef Scope,
const char *Name, LLVMMetadataRef File,
unsigned Line, uint64_t SizeInBits,
uint64_t AlignInBits, uint64_t OffsetInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
unsigned Flags, LLVMMetadataRef Ty) {
DIBuilder *D = unwrap(Dref);
return wrap(D->createMemberType(
Expand All @@ -171,7 +171,7 @@ LLVMDIBuilderCreateMemberType(LLVMDIBuilderRef Dref, LLVMMetadataRef Scope,

LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef Dref,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint32_t AlignInBits,
LLVMMetadataRef ElementType,
LLVMMetadataRef Subscripts) {
DIBuilder *D = unwrap(Dref);
Expand Down
12 changes: 6 additions & 6 deletions bindings/go/llvm/DIBuilderBindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef D,
const char *Name,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint32_t AlignInBits,
unsigned Encoding);

LLVMMetadataRef LLVMDIBuilderCreatePointerType(LLVMDIBuilderRef D,
LLVMMetadataRef PointeeType,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint32_t AlignInBits,
const char *Name);

LLVMMetadataRef
Expand All @@ -87,24 +87,24 @@ LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef D, LLVMMetadataRef File,
LLVMMetadataRef LLVMDIBuilderCreateStructType(
LLVMDIBuilderRef D, LLVMMetadataRef Scope, const char *Name,
LLVMMetadataRef File, unsigned Line, uint64_t SizeInBits,
uint64_t AlignInBits, unsigned Flags, LLVMMetadataRef DerivedFrom,
uint32_t 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, uint32_t 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,
uint32_t AlignInBits, uint64_t OffsetInBits,
unsigned Flags, LLVMMetadataRef Ty);

LLVMMetadataRef LLVMDIBuilderCreateArrayType(LLVMDIBuilderRef D,
uint64_t SizeInBits,
uint64_t AlignInBits,
uint32_t AlignInBits,
LLVMMetadataRef ElementType,
LLVMMetadataRef Subscripts);

Expand Down
24 changes: 12 additions & 12 deletions bindings/go/llvm/dibuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ func (d *DIBuilder) CreateParameterVariable(scope Metadata, v DIParameterVariabl
type DIBasicType struct {
Name string
SizeInBits uint64
AlignInBits uint64
AlignInBits uint32
Encoding DwarfTypeEncoding
}

Expand All @@ -289,7 +289,7 @@ func (d *DIBuilder) CreateBasicType(t DIBasicType) Metadata {
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}
Expand All @@ -299,7 +299,7 @@ func (d *DIBuilder) CreateBasicType(t DIBasicType) Metadata {
type DIPointerType struct {
Pointee Metadata
SizeInBits uint64
AlignInBits uint64 // optional
AlignInBits uint32 // optional
Name string // optional
}

Expand All @@ -311,7 +311,7 @@ func (d *DIBuilder) CreatePointerType(t DIPointerType) Metadata {
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}
Expand Down Expand Up @@ -340,7 +340,7 @@ type DIStructType struct {
File Metadata
Line int
SizeInBits uint64
AlignInBits uint64
AlignInBits uint32
Flags int
DerivedFrom Metadata
Elements []Metadata
Expand All @@ -358,7 +358,7 @@ func (d *DIBuilder) CreateStructType(scope Metadata, t DIStructType) Metadata {
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,
Expand All @@ -375,7 +375,7 @@ type DIReplaceableCompositeType struct {
Line int
RuntimeLang int
SizeInBits uint64
AlignInBits uint64
AlignInBits uint32
Flags int
}

Expand All @@ -392,7 +392,7 @@ func (d *DIBuilder) CreateReplaceableCompositeType(scope Metadata, t DIReplaceab
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}
Expand All @@ -404,7 +404,7 @@ type DIMemberType struct {
File Metadata
Line int
SizeInBits uint64
AlignInBits uint64
AlignInBits uint32
OffsetInBits uint64
Flags int
Type Metadata
Expand All @@ -421,7 +421,7 @@ func (d *DIBuilder) CreateMemberType(scope Metadata, t DIMemberType) Metadata {
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,
Expand All @@ -438,7 +438,7 @@ type DISubrange struct {
// DIArrayType holds the values for creating array type debug metadata.
type DIArrayType struct {
SizeInBits uint64
AlignInBits uint64
AlignInBits uint32
ElementType Metadata
Subscripts []DISubrange
}
Expand All @@ -453,7 +453,7 @@ func (d *DIBuilder) CreateArrayType(t DIArrayType) Metadata {
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,
)
Expand Down
31 changes: 16 additions & 15 deletions include/llvm/IR/DIBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace llvm {
/// \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);
uint32_t AlignInBits, unsigned Encoding);

/// Create debugging information entry for a qualified
/// type, e.g. 'const int'.
Expand All @@ -137,7 +137,7 @@ namespace llvm {
/// \param AlignInBits Alignment. (optional)
/// \param Name Pointer type name. (optional)
DIDerivedType *createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
uint64_t AlignInBits = 0,
uint32_t AlignInBits = 0,
StringRef Name = "");

/// Create debugging information entry for a pointer to member.
Expand All @@ -147,14 +147,14 @@ namespace llvm {
/// \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, uint32_t 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);
uint32_t AlignInBits = 0);

/// Create debugging information entry for a typedef.
/// \param Ty Original type.
Expand Down Expand Up @@ -191,7 +191,8 @@ namespace llvm {
/// \param Ty Parent type.
DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
DIFile *File, unsigned LineNo,
uint64_t SizeInBits, uint64_t AlignInBits,
uint64_t SizeInBits,
uint32_t AlignInBits,
uint64_t OffsetInBits,
DINode::DIFlags Flags, DIType *Ty);

Expand All @@ -208,7 +209,7 @@ namespace llvm {
/// \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, uint32_t AlignInBits, uint64_t OffsetInBits,
uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty);

/// Create debugging information entry for a
Expand Down Expand Up @@ -237,7 +238,7 @@ namespace llvm {
/// \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, uint32_t AlignInBits,
uint64_t OffsetInBits, DINode::DIFlags Flags,
DIType *Ty, MDNode *PropertyNode);

Expand Down Expand Up @@ -274,7 +275,7 @@ namespace llvm {
/// \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, uint32_t AlignInBits, uint64_t OffsetInBits,
DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
DIType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
StringRef UniqueIdentifier = "");
Expand All @@ -292,7 +293,7 @@ namespace llvm {
/// \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, uint32_t AlignInBits, DINode::DIFlags Flags,
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");

Expand All @@ -309,7 +310,7 @@ namespace llvm {
/// \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, uint32_t AlignInBits,
DINode::DIFlags Flags,
DINodeArray Elements,
unsigned RunTimeLang = 0,
Expand Down Expand Up @@ -359,15 +360,15 @@ namespace llvm {
/// \param AlignInBits Alignment.
/// \param Ty Element type.
/// \param Subscripts Subscripts.
DICompositeType *createArrayType(uint64_t Size, uint64_t AlignInBits,
DICompositeType *createArrayType(uint64_t Size, uint32_t AlignInBits,
DIType *Ty, DINodeArray Subscripts);

/// Create debugging information entry for a vector type.
/// \param Size Array size.
/// \param AlignInBits Alignment.
/// \param Ty Element type.
/// \param Subscripts Subscripts.
DICompositeType *createVectorType(uint64_t Size, uint64_t AlignInBits,
DICompositeType *createVectorType(uint64_t Size, uint32_t AlignInBits,
DIType *Ty, DINodeArray Subscripts);

/// Create debugging information entry for an
Expand All @@ -383,7 +384,7 @@ namespace llvm {
/// \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, uint32_t AlignInBits, DINodeArray Elements,
DIType *UnderlyingType, StringRef UniqueIdentifier = "");

/// Create subroutine type.
Expand Down Expand Up @@ -416,14 +417,14 @@ namespace llvm {
DIScope *Scope, DIFile *F, unsigned Line,
unsigned RuntimeLang = 0,
uint64_t SizeInBits = 0,
uint64_t AlignInBits = 0,
uint32_t 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,
uint32_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
StringRef UniqueIdentifier = "");

/// Retain DIScope* in a module even if it is not referenced
Expand Down
Loading

0 comments on commit 58be60c

Please sign in to comment.