Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[llvm-c] Add LLVMDWARFTypeEncoding enum and update the MacInfo and callconv enum #84456

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

edg-l
Copy link
Contributor

@edg-l edg-l commented Mar 8, 2024

I always missed that LLVMDWARFTypeEncoding had no enum.

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 8, 2024

@llvm/pr-subscribers-debuginfo

Author: Edgar (edg-l)

Changes

I always missed that LLVMDWARFTypeEncoding had no enum.


Full diff: https://github.com/llvm/llvm-project/pull/84456.diff

2 Files Affected:

  • (modified) llvm/include/llvm-c/Core.h (+52-39)
  • (modified) llvm/include/llvm-c/DebugInfo.h (+32-1)
diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h
index 09746bdaf0c94e..93f72dd1049d0f 100644
--- a/llvm/include/llvm-c/Core.h
+++ b/llvm/include/llvm-c/Core.h
@@ -211,47 +211,60 @@ typedef enum {
 } LLVMDLLStorageClass;
 
 typedef enum {
-  LLVMCCallConv             = 0,
-  LLVMFastCallConv          = 8,
-  LLVMColdCallConv          = 9,
-  LLVMGHCCallConv           = 10,
-  LLVMHiPECallConv          = 11,
-  LLVMAnyRegCallConv        = 13,
-  LLVMPreserveMostCallConv  = 14,
-  LLVMPreserveAllCallConv   = 15,
-  LLVMSwiftCallConv         = 16,
-  LLVMCXXFASTTLSCallConv    = 17,
-  LLVMX86StdcallCallConv    = 64,
-  LLVMX86FastcallCallConv   = 65,
-  LLVMARMAPCSCallConv       = 66,
-  LLVMARMAAPCSCallConv      = 67,
-  LLVMARMAAPCSVFPCallConv   = 68,
-  LLVMMSP430INTRCallConv    = 69,
-  LLVMX86ThisCallCallConv   = 70,
-  LLVMPTXKernelCallConv     = 71,
-  LLVMPTXDeviceCallConv     = 72,
-  LLVMSPIRFUNCCallConv      = 75,
-  LLVMSPIRKERNELCallConv    = 76,
-  LLVMIntelOCLBICallConv    = 77,
-  LLVMX8664SysVCallConv     = 78,
-  LLVMWin64CallConv         = 79,
+  LLVMCCallConv = 0,
+  LLVMFastCallConv = 8,
+  LLVMColdCallConv = 9,
+  LLVMGHCCallConv = 10,
+  LLVMHiPECallConv = 11,
+  LLVMAnyRegCallConv = 13,
+  LLVMPreserveMostCallConv = 14,
+  LLVMPreserveAllCallConv = 15,
+  LLVMSwiftCallConv = 16,
+  LLVMCXXFASTTLSCallConv = 17,
+  LLVMX86StdcallCallConv = 64,
+  LLVMX86FastcallCallConv = 65,
+  LLVMARMAPCSCallConv = 66,
+  LLVMARMAAPCSCallConv = 67,
+  LLVMARMAAPCSVFPCallConv = 68,
+  LLVMMSP430INTRCallConv = 69,
+  LLVMX86ThisCallCallConv = 70,
+  LLVMPTXKernelCallConv = 71,
+  LLVMPTXDeviceCallConv = 72,
+  LLVMSPIRFUNCCallConv = 75,
+  LLVMSPIRKERNELCallConv = 76,
+  LLVMIntelOCLBICallConv = 77,
+  LLVMX8664SysVCallConv = 78,
+  LLVMWin64CallConv = 79,
   LLVMX86VectorCallCallConv = 80,
-  LLVMHHVMCallConv          = 81,
-  LLVMHHVMCCallConv         = 82,
-  LLVMX86INTRCallConv       = 83,
-  LLVMAVRINTRCallConv       = 84,
-  LLVMAVRSIGNALCallConv     = 85,
-  LLVMAVRBUILTINCallConv    = 86,
-  LLVMAMDGPUVSCallConv      = 87,
-  LLVMAMDGPUGSCallConv      = 88,
-  LLVMAMDGPUPSCallConv      = 89,
-  LLVMAMDGPUCSCallConv      = 90,
-  LLVMAMDGPUKERNELCallConv  = 91,
-  LLVMX86RegCallCallConv    = 92,
-  LLVMAMDGPUHSCallConv      = 93,
+  LLVMHHVMCallConv = 81,
+  LLVMHHVMCCallConv = 82,
+  LLVMX86INTRCallConv = 83,
+  LLVMAVRINTRCallConv = 84,
+  LLVMAVRSIGNALCallConv = 85,
+  LLVMAVRBUILTINCallConv = 86,
+  LLVMAMDGPUVSCallConv = 87,
+  LLVMAMDGPUGSCallConv = 88,
+  LLVMAMDGPUPSCallConv = 89,
+  LLVMAMDGPUCSCallConv = 90,
+  LLVMAMDGPUKERNELCallConv = 91,
+  LLVMX86RegCallCallConv = 92,
+  LLVMAMDGPUHSCallConv = 93,
   LLVMMSP430BUILTINCallConv = 94,
-  LLVMAMDGPULSCallConv      = 95,
-  LLVMAMDGPUESCallConv      = 96
+  LLVMAMDGPULSCallConv = 95,
+  LLVMAMDGPUESCallConv = 96,
+  LLVMAArch64VectorCall = 97,
+  LLVMAAArch64SVEVectorCall = 98,
+  LLVMWASMEmscriptenInvoke = 99,
+  LLVMAMDGPUGfx = 100,
+  LLVMM68kINTR = 101,
+  LLVMAArch64SMEABISupportRoutinesPreserveMostFromX0 = 102,
+  LLVMAArch64SMEABISupportRoutinesPreserveMostFromX2 = 103,
+  LLVMAMDGPUCSChain = 104,
+  LLVMAMDGPUCSChainPreserve = 105,
+  LLVMM68kRTD = 106,
+  LLVMGRAAL = 107,
+  LLVMARM64ECThunkX64 = 108,
+  LLVMARM64ECThunkNative = 109
 } LLVMCallConv;
 
 typedef enum {
diff --git a/llvm/include/llvm-c/DebugInfo.h b/llvm/include/llvm-c/DebugInfo.h
index 5924294708cc35..89706a88538d28 100644
--- a/llvm/include/llvm-c/DebugInfo.h
+++ b/llvm/include/llvm-c/DebugInfo.h
@@ -186,7 +186,30 @@ typedef unsigned LLVMMetadataKind;
 
 /**
  * An LLVM DWARF type encoding.
+ * @note Values are from DW_ATE_* constants in the DWARF specification.
  */
+enum {
+  LLVMDWARFTypeEncodingAddress = 0x1,
+  LLVMDWARFTypeEncodingBoolean = 0x2,
+  LLVMDWARFTypeEncodingComplexFloat = 0x3,
+  LLVMDWARFTypeEncodingFloat = 0x4,
+  LLVMDWARFTypeEncodingSigned = 0x5,
+  LLVMDWARFTypeEncodingSignedChar = 0x6,
+  LLVMDWARFTypeEncodingUnsigned = 0x7,
+  LLVMDWARFTypeEncodingUnsignedChar = 0x8,
+  LLVMDWARFTypeEncodingImaginaryFloat = 0x9,
+  LLVMDWARFTypeEncodingPackedDecimal = 0xa,
+  LLVMDWARFTypeEncodingNumericString = 0xb,
+  LLVMDWARFTypeEncodingEdited = 0xc,
+  LLVMDWARFTypeEncodingSignedFixed = 0xd,
+  LLVMDWARFTypeEncodingUnsignedFixed = 0xe,
+  LLVMDWARFTypeEncodingDecimalFloat = 0xf,
+  LLVMDWARFTypeEncodingUTF = 0x10,
+  LLVMDWARFTypeEncodingUCS = 0x11,
+  LLVMDWARFTypeEncodingASCII = 0x12,
+  LLVMDWARFTypeEncodingLoUser = 0x80,
+  LLVMDWARFTypeEncodingHiUser = 0xff,
+};
 typedef unsigned LLVMDWARFTypeEncoding;
 
 /**
@@ -199,7 +222,15 @@ typedef enum {
   LLVMDWARFMacinfoRecordTypeMacro = 0x02,
   LLVMDWARFMacinfoRecordTypeStartFile = 0x03,
   LLVMDWARFMacinfoRecordTypeEndFile = 0x04,
-  LLVMDWARFMacinfoRecordTypeVendorExt = 0xff
+  LLVMDWARFMacinfoRecordTypeDefineStrp = 0x05,
+  LLVMDWARFMacinfoRecordTypeUndefStrp = 0x06,
+  LLVMDWARFMacinfoRecordTypeImport = 0x07,
+  LLVMDWARFMacinfoRecordTypeDefineSup = 0x08,
+  LLVMDWARFMacinfoRecordTypeUndefSup = 0x09,
+  LLVMDWARFMacinfoRecordTypeImportSup = 0x0a,
+  LLVMDWARFMacinfoRecordTypeDefineStrx = 0x0b,
+  LLVMDWARFMacinfoRecordTypeUndefStrx = 0x0c,
+  LLVMDWARFMacinfoRecordTypeVendorExt = 0xff,
 } LLVMDWARFMacinfoRecordType;
 
 /**

Copy link
Collaborator

@pogo59 pogo59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the Core.h changes are just reformatting, which should be done in its own NFC patch.
"Update some other ones" looks like just the MacInfo enum, you could say that in the patch headline.

@edg-l edg-l changed the title [llvm-c] Add LLVMDWARFTypeEncoding enum and update some other ones [llvm-c] Add LLVMDWARFTypeEncoding enum and update the MacInfo enum Mar 8, 2024
@edg-l
Copy link
Contributor Author

edg-l commented Mar 8, 2024

It looks like the Core.h changes are just reformatting, which should be done in its own NFC patch. "Update some other ones" looks like just the MacInfo enum, you could say that in the patch headline.

I added some entries, its not just reformatting.

@edg-l edg-l changed the title [llvm-c] Add LLVMDWARFTypeEncoding enum and update the MacInfo enum [llvm-c] Add LLVMDWARFTypeEncoding enum and update the MacInfo and callconv enum Mar 8, 2024
@pogo59
Copy link
Collaborator

pogo59 commented Mar 8, 2024

I added some entries, its not just reformatting.

Okay I see that now. But reformatting should still go first separately.

@edg-l
Copy link
Contributor Author

edg-l commented Mar 9, 2024

I added some entries, its not just reformatting.

Okay I see that now. But reformatting should still go first separately.

If NFC patch means a commit then i put it in its own commit, i think it should be ok now.

Copy link
Collaborator

@pogo59 pogo59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If NFC patch means a commit then i put it in its own commit, i think it should be ok now.

Yes, that works.

@@ -186,7 +186,30 @@ typedef unsigned LLVMMetadataKind;

/**
* An LLVM DWARF type encoding.
* @note Values are from DW_ATE_* constants in the DWARF specification.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't export the Dwarf.h constants directly? Seems like that would be better (DRY priniciple).

Copy link
Contributor Author

@edg-l edg-l Mar 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't, also this enum isn't there. (or idk)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at TypeKind in llvm/include/llvm/BinaryFormat/Dwarf.h. It looks like you could pull the definitions in from Dwarf.def, so we don't have to maintain them in two places.

@felipepiovezan
Copy link
Contributor

If NFC patch means a commit then i put it in its own commit, i think it should be ok now.

Note that this is not true for the github world: the commit will still get squashed upon merging, and will make history browsing difficult.
Usually NFC changes need to be in their own PR, not just their own commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants