diff options
author | Reid Kleckner <rnk@google.com> | 2016-06-08 20:34:29 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-06-08 20:34:29 +0000 |
commit | de3d8b500f536bf091844a3fa5afa0848981f8ee (patch) | |
tree | c523ec40adfa362f0d1cdd6f4da60702180d4263 /llvm/lib/Support/Dwarf.cpp | |
parent | 384d0f219d92b327a3a38ca613257dbf5e0911f1 (diff) | |
download | bcm5719-llvm-de3d8b500f536bf091844a3fa5afa0848981f8ee.tar.gz bcm5719-llvm-de3d8b500f536bf091844a3fa5afa0848981f8ee.zip |
[DebugInfo] Add calling convention support for DWARF and CodeView
Summary:
Now DISubroutineType has a 'cc' field which should be a DW_CC_ enum. If
it is present and non-zero, the backend will emit it as a
DW_AT_calling_convention attribute. On the CodeView side, we translate
it to the appropriate enum for the LF_PROCEDURE record.
I added a new LLVM vendor specific enum to the list of DWARF calling
conventions. DWARF does not appear to attempt to standardize these, so I
assume it's OK to do this until we coordinate with GCC on how to emit
vectorcall convention functions.
Reviewers: dexonsmith, majnemer, aaboud, amccarth
Subscribers: mehdi_amini, llvm-commits
Differential Revision: http://reviews.llvm.org/D21114
llvm-svn: 272197
Diffstat (limited to 'llvm/lib/Support/Dwarf.cpp')
-rw-r--r-- | llvm/lib/Support/Dwarf.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/llvm/lib/Support/Dwarf.cpp b/llvm/lib/Support/Dwarf.cpp index 7d722567173..230a3dafe62 100644 --- a/llvm/lib/Support/Dwarf.cpp +++ b/llvm/lib/Support/Dwarf.cpp @@ -384,23 +384,22 @@ const char *llvm::dwarf::CaseString(unsigned Case) { return nullptr; } -const char *llvm::dwarf::ConventionString(unsigned Convention) { - switch (Convention) { - case DW_CC_normal: return "DW_CC_normal"; - case DW_CC_program: return "DW_CC_program"; - case DW_CC_nocall: return "DW_CC_nocall"; - case DW_CC_lo_user: return "DW_CC_lo_user"; - case DW_CC_hi_user: return "DW_CC_hi_user"; - case DW_CC_GNU_borland_fastcall_i386: return "DW_CC_GNU_borland_fastcall_i386"; - case DW_CC_BORLAND_safecall: return "DW_CC_BORLAND_safecall"; - case DW_CC_BORLAND_stdcall: return "DW_CC_BORLAND_stdcall"; - case DW_CC_BORLAND_pascal: return "DW_CC_BORLAND_pascal"; - case DW_CC_BORLAND_msfastcall: return "DW_CC_BORLAND_msfastcall"; - case DW_CC_BORLAND_msreturn: return "DW_CC_BORLAND_msreturn"; - case DW_CC_BORLAND_thiscall: return "DW_CC_BORLAND_thiscall"; - case DW_CC_BORLAND_fastcall: return "DW_CC_BORLAND_fastcall"; +const char *llvm::dwarf::ConventionString(unsigned CC) { + switch (CC) { + default: + return nullptr; +#define HANDLE_DW_CC(ID, NAME) \ + case DW_CC_##NAME: \ + return "DW_CC_" #NAME; +#include "llvm/Support/Dwarf.def" } - return nullptr; +} + +unsigned llvm::dwarf::getCallingConvention(StringRef CCString) { + return StringSwitch<unsigned>(CCString) +#define HANDLE_DW_CC(ID, NAME) .Case("DW_CC_" #NAME, DW_CC_##NAME) +#include "llvm/Support/Dwarf.def" + .Default(0); } const char *llvm::dwarf::InlineCodeString(unsigned Code) { |