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

[EVM] Initial support of EVM dependencies #708

Merged
merged 4 commits into from
Oct 9, 2024

Conversation

PavelKopyl
Copy link
Contributor

[EVM] Adding LLVMLinkEVM C-API.
Please, note this is a temporary patch. It adds initial support
of dependencies, but it doesn't work in a general case.
A full solution will be more sophisticated and will likely be
implemented on the FE driver side without a need of the LLD usage.

[LLD] Adding EVM architecture to LLD.

[EVM] Adding datasize/dataoffset intrinsics.
This includes:
- datasize/dataoffset intrinsics
- EVM specific ELF relocations

Code Review Checklist

Purpose

Ticket Number

Requirements

  • Have the requirements been met?
  • Have stakeholder(s) approved the change?

Implementation

  • Does this code change accomplish what it is supposed to do?
  • Can this solution be simplified?
  • Does this change add unwanted compile-time or run-time dependencies?
  • Could an additional framework, API, library, or service improve the solution?
  • Could we reuse part of LLVM instead of implementing the patch or a part of it?
  • Is the code at the right abstraction level?
  • Is the code modular enough?
  • Can a better solution be found in terms of maintainability, readability, performance, or security?
  • Does similar functionality already exist in the codebase? If yes, why isn’t it reused?
  • Are there any best practices, design patterns or language-specific patterns that could substantially improve this code?

Logic Errors and Bugs

  • Can you think of any use case in which the
    code does not behave as intended?
  • Can you think of any inputs or external events
    that could break the code?

Error Handling and Logging

  • Is error handling done the correct way?
  • Should any logging or debugging information
    be added or removed?
  • Are error messages user-friendly?
  • Are there enough log events and are they
    written in a way that allows for easy
    debugging?

Maintainability

  • Is the code easy to read?
  • Is the code not repeated (DRY Principle)?
  • Is the code method/class not too long?

Dependencies

  • Were updates to documentation, configuration, or readme files made as required by this change?
  • Are there any potential impacts on other parts of the system or backward compatibility?

Security

  • Does the code introduce any security vulnerabilities?

Performance

  • Do you think this code change decreases
    system performance?
  • Do you see any potential to improve the
    performance of the code significantly?

Testing and Testability

  • Is the code testable?
  • Have automated tests been added, or have related ones been updated to cover the change?
    • For changes to mutable state
  • Do tests reasonably cover the code change (unit/integration/system tests)?
    • Line Coverage
    • Region Coverage
    • Branch Coverage
  • Are there some test cases, input or edge cases
    that should be tested in addition?

Readability

  • Is the code easy to understand?
  • Which parts were confusing to you and why?
  • Can the readability of the code be improved by
    smaller methods?
  • Can the readability of the code be improved by
    different function, method or variable names?
  • Is the code located in the right
    file/folder/package?
  • Do you think certain methods should be
    restructured to have a more intuitive control
    flow?
  • Is the data flow understandable?
  • Are there redundant or outdated comments?
  • Could some comments convey the message
    better?
  • Would more comments make the code more
    understandable?
  • Could some comments be removed by making the code itself more readable?
  • Is there any commented-out code?
  • Have you run a spelling and grammar checker?

Documentation

  • Is there sufficient documentation?
  • Is the ReadMe.md file up to date?

Best Practices

  • Follow Single Responsibility principle?
  • Are different errors handled correctly?
  • Are errors and warnings logged?
  • Magic values avoided?
  • No unnecessary comments?
  • Minimal nesting used?

Experts' Opinion

  • Do you think a specific expert, like a security
    expert or a usability expert, should look over
    the code before it can be accepted?
  • Will this code change impact different teams, and should they review the change as well?

@PavelKopyl PavelKopyl marked this pull request as draft September 27, 2024 16:24
@PavelKopyl PavelKopyl force-pushed the kpv-evm-initial-dependencies-support branch from c1e4c1d to 9938491 Compare September 27, 2024 16:24
Copy link

github-actions bot commented Sep 27, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 790c8b952ea226533bb97e90a79bbeb2fe6f7451 af0db84461189b49160b05010c884afdb8dead92 -- llvm/lib/Target/EVM/EVMTargetObjectFile.cpp llvm/lib/Target/EVM/EVMTargetObjectFile.h llvm/include/llvm/BinaryFormat/ELF.h llvm/include/llvm/MC/MCExpr.h llvm/lib/BinaryFormat/ELF.cpp llvm/lib/MC/ELFObjectWriter.cpp llvm/lib/MC/MCExpr.cpp llvm/lib/MC/MCObjectFileInfo.cpp llvm/lib/Object/ELF.cpp llvm/lib/Target/EVM/EVMISelLowering.cpp llvm/lib/Target/EVM/EVMISelLowering.h llvm/lib/Target/EVM/EVMMCInstLower.cpp llvm/lib/Target/EVM/EVMTargetMachine.cpp llvm/lib/Target/EVM/MCTargetDesc/EVMAsmBackend.cpp llvm/lib/Target/EVM/MCTargetDesc/EVMELFObjectWriter.cpp llvm/lib/Target/EVM/MCTargetDesc/EVMFixupKinds.h llvm/lib/Target/EVM/MCTargetDesc/EVMMCCodeEmitter.cpp llvm/tools/llvm-readobj/ELFDumper.cpp
View the diff from clang-format here.
diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h
index 69190fa960..b2a9a403f0 100644
--- a/llvm/include/llvm/BinaryFormat/ELF.h
+++ b/llvm/include/llvm/BinaryFormat/ELF.h
@@ -321,10 +321,10 @@ enum {
   EM_CSKY = 252,          // C-SKY 32-bit processor
   EM_LOONGARCH = 258,     // LoongArch
   // EraVM local begin
-  EM_ERAVM = 260,         // EraVM
+  EM_ERAVM = 260, // EraVM
   // EraVM local end
   // EVM local begin
-  EM_EVM = 261            // EVM
+  EM_EVM = 261 // EVM
   // EVM local end
 };
 
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 4645f5794d..ad63b1432a 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -399,147 +399,147 @@ StringRef MCSymbolRefExpr::getVariantKindName(VariantKind Kind) {
 MCSymbolRefExpr::VariantKind
 MCSymbolRefExpr::getVariantKindForName(StringRef Name) {
   return StringSwitch<VariantKind>(Name.lower())
-    .Case("dtprel", VK_DTPREL)
-    .Case("dtpoff", VK_DTPOFF)
-    .Case("got", VK_GOT)
-    .Case("gotoff", VK_GOTOFF)
-    .Case("gotrel", VK_GOTREL)
-    .Case("pcrel", VK_PCREL)
-    .Case("gotpcrel", VK_GOTPCREL)
-    .Case("gotpcrel_norelax", VK_GOTPCREL_NORELAX)
-    .Case("gottpoff", VK_GOTTPOFF)
-    .Case("indntpoff", VK_INDNTPOFF)
-    .Case("ntpoff", VK_NTPOFF)
-    .Case("gotntpoff", VK_GOTNTPOFF)
-    .Case("plt", VK_PLT)
-    .Case("tlscall", VK_TLSCALL)
-    .Case("tlsdesc", VK_TLSDESC)
-    .Case("tlsgd", VK_TLSGD)
-    .Case("tlsld", VK_TLSLD)
-    .Case("tlsldm", VK_TLSLDM)
-    .Case("tpoff", VK_TPOFF)
-    .Case("tprel", VK_TPREL)
-    .Case("tlvp", VK_TLVP)
-    .Case("tlvppage", VK_TLVPPAGE)
-    .Case("tlvppageoff", VK_TLVPPAGEOFF)
-    .Case("page", VK_PAGE)
-    .Case("pageoff", VK_PAGEOFF)
-    .Case("gotpage", VK_GOTPAGE)
-    .Case("gotpageoff", VK_GOTPAGEOFF)
-    .Case("imgrel", VK_COFF_IMGREL32)
-    .Case("secrel32", VK_SECREL)
-    .Case("size", VK_SIZE)
-    .Case("abs8", VK_X86_ABS8)
-    .Case("pltoff", VK_X86_PLTOFF)
-    .Case("l", VK_PPC_LO)
-    .Case("h", VK_PPC_HI)
-    .Case("ha", VK_PPC_HA)
-    .Case("high", VK_PPC_HIGH)
-    .Case("higha", VK_PPC_HIGHA)
-    .Case("higher", VK_PPC_HIGHER)
-    .Case("highera", VK_PPC_HIGHERA)
-    .Case("highest", VK_PPC_HIGHEST)
-    .Case("highesta", VK_PPC_HIGHESTA)
-    .Case("got@l", VK_PPC_GOT_LO)
-    .Case("got@h", VK_PPC_GOT_HI)
-    .Case("got@ha", VK_PPC_GOT_HA)
-    .Case("local", VK_PPC_LOCAL)
-    .Case("tocbase", VK_PPC_TOCBASE)
-    .Case("toc", VK_PPC_TOC)
-    .Case("toc@l", VK_PPC_TOC_LO)
-    .Case("toc@h", VK_PPC_TOC_HI)
-    .Case("toc@ha", VK_PPC_TOC_HA)
-    .Case("u", VK_PPC_U)
-    .Case("l", VK_PPC_L)
-    .Case("tls", VK_PPC_TLS)
-    .Case("dtpmod", VK_PPC_DTPMOD)
-    .Case("tprel@l", VK_PPC_TPREL_LO)
-    .Case("tprel@h", VK_PPC_TPREL_HI)
-    .Case("tprel@ha", VK_PPC_TPREL_HA)
-    .Case("tprel@high", VK_PPC_TPREL_HIGH)
-    .Case("tprel@higha", VK_PPC_TPREL_HIGHA)
-    .Case("tprel@higher", VK_PPC_TPREL_HIGHER)
-    .Case("tprel@highera", VK_PPC_TPREL_HIGHERA)
-    .Case("tprel@highest", VK_PPC_TPREL_HIGHEST)
-    .Case("tprel@highesta", VK_PPC_TPREL_HIGHESTA)
-    .Case("dtprel@l", VK_PPC_DTPREL_LO)
-    .Case("dtprel@h", VK_PPC_DTPREL_HI)
-    .Case("dtprel@ha", VK_PPC_DTPREL_HA)
-    .Case("dtprel@high", VK_PPC_DTPREL_HIGH)
-    .Case("dtprel@higha", VK_PPC_DTPREL_HIGHA)
-    .Case("dtprel@higher", VK_PPC_DTPREL_HIGHER)
-    .Case("dtprel@highera", VK_PPC_DTPREL_HIGHERA)
-    .Case("dtprel@highest", VK_PPC_DTPREL_HIGHEST)
-    .Case("dtprel@highesta", VK_PPC_DTPREL_HIGHESTA)
-    .Case("got@tprel", VK_PPC_GOT_TPREL)
-    .Case("got@tprel@l", VK_PPC_GOT_TPREL_LO)
-    .Case("got@tprel@h", VK_PPC_GOT_TPREL_HI)
-    .Case("got@tprel@ha", VK_PPC_GOT_TPREL_HA)
-    .Case("got@dtprel", VK_PPC_GOT_DTPREL)
-    .Case("got@dtprel@l", VK_PPC_GOT_DTPREL_LO)
-    .Case("got@dtprel@h", VK_PPC_GOT_DTPREL_HI)
-    .Case("got@dtprel@ha", VK_PPC_GOT_DTPREL_HA)
-    .Case("got@tlsgd", VK_PPC_GOT_TLSGD)
-    .Case("got@tlsgd@l", VK_PPC_GOT_TLSGD_LO)
-    .Case("got@tlsgd@h", VK_PPC_GOT_TLSGD_HI)
-    .Case("got@tlsgd@ha", VK_PPC_GOT_TLSGD_HA)
-    .Case("got@tlsld", VK_PPC_GOT_TLSLD)
-    .Case("got@tlsld@l", VK_PPC_GOT_TLSLD_LO)
-    .Case("got@tlsld@h", VK_PPC_GOT_TLSLD_HI)
-    .Case("got@tlsld@ha", VK_PPC_GOT_TLSLD_HA)
-    .Case("got@pcrel", VK_PPC_GOT_PCREL)
-    .Case("got@tlsgd@pcrel", VK_PPC_GOT_TLSGD_PCREL)
-    .Case("got@tlsld@pcrel", VK_PPC_GOT_TLSLD_PCREL)
-    .Case("got@tprel@pcrel", VK_PPC_GOT_TPREL_PCREL)
-    .Case("tls@pcrel", VK_PPC_TLS_PCREL)
-    .Case("notoc", VK_PPC_NOTOC)
-    .Case("gdgot", VK_Hexagon_GD_GOT)
-    .Case("gdplt", VK_Hexagon_GD_PLT)
-    .Case("iegot", VK_Hexagon_IE_GOT)
-    .Case("ie", VK_Hexagon_IE)
-    .Case("ldgot", VK_Hexagon_LD_GOT)
-    .Case("ldplt", VK_Hexagon_LD_PLT)
-    .Case("none", VK_ARM_NONE)
-    .Case("got_prel", VK_ARM_GOT_PREL)
-    .Case("target1", VK_ARM_TARGET1)
-    .Case("target2", VK_ARM_TARGET2)
-    .Case("prel31", VK_ARM_PREL31)
-    .Case("sbrel", VK_ARM_SBREL)
-    .Case("tlsldo", VK_ARM_TLSLDO)
-    .Case("lo8", VK_AVR_LO8)
-    .Case("hi8", VK_AVR_HI8)
-    .Case("hlo8", VK_AVR_HLO8)
-    .Case("typeindex", VK_WASM_TYPEINDEX)
-    .Case("tbrel", VK_WASM_TBREL)
-    .Case("mbrel", VK_WASM_MBREL)
-    .Case("tlsrel", VK_WASM_TLSREL)
-    .Case("got@tls", VK_WASM_GOT_TLS)
-    .Case("funcindex", VK_WASM_FUNCINDEX)
-    .Case("gotpcrel32@lo", VK_AMDGPU_GOTPCREL32_LO)
-    .Case("gotpcrel32@hi", VK_AMDGPU_GOTPCREL32_HI)
-    .Case("rel32@lo", VK_AMDGPU_REL32_LO)
-    .Case("rel32@hi", VK_AMDGPU_REL32_HI)
-    .Case("rel64", VK_AMDGPU_REL64)
-    .Case("abs32@lo", VK_AMDGPU_ABS32_LO)
-    .Case("abs32@hi", VK_AMDGPU_ABS32_HI)
-    .Case("hi", VK_VE_HI32)
-    .Case("lo", VK_VE_LO32)
-    .Case("pc_hi", VK_VE_PC_HI32)
-    .Case("pc_lo", VK_VE_PC_LO32)
-    .Case("got_hi", VK_VE_GOT_HI32)
-    .Case("got_lo", VK_VE_GOT_LO32)
-    .Case("gotoff_hi", VK_VE_GOTOFF_HI32)
-    .Case("gotoff_lo", VK_VE_GOTOFF_LO32)
-    .Case("plt_hi", VK_VE_PLT_HI32)
-    .Case("plt_lo", VK_VE_PLT_LO32)
-    .Case("tls_gd_hi", VK_VE_TLS_GD_HI32)
-    .Case("tls_gd_lo", VK_VE_TLS_GD_LO32)
-    .Case("tpoff_hi", VK_VE_TPOFF_HI32)
-    .Case("tpoff_lo", VK_VE_TPOFF_LO32)
-    // EVM local begin
-    .Case("evm_data", VK_EVM_DATA)
-    // EVM local end
-    .Default(VK_Invalid);
+      .Case("dtprel", VK_DTPREL)
+      .Case("dtpoff", VK_DTPOFF)
+      .Case("got", VK_GOT)
+      .Case("gotoff", VK_GOTOFF)
+      .Case("gotrel", VK_GOTREL)
+      .Case("pcrel", VK_PCREL)
+      .Case("gotpcrel", VK_GOTPCREL)
+      .Case("gotpcrel_norelax", VK_GOTPCREL_NORELAX)
+      .Case("gottpoff", VK_GOTTPOFF)
+      .Case("indntpoff", VK_INDNTPOFF)
+      .Case("ntpoff", VK_NTPOFF)
+      .Case("gotntpoff", VK_GOTNTPOFF)
+      .Case("plt", VK_PLT)
+      .Case("tlscall", VK_TLSCALL)
+      .Case("tlsdesc", VK_TLSDESC)
+      .Case("tlsgd", VK_TLSGD)
+      .Case("tlsld", VK_TLSLD)
+      .Case("tlsldm", VK_TLSLDM)
+      .Case("tpoff", VK_TPOFF)
+      .Case("tprel", VK_TPREL)
+      .Case("tlvp", VK_TLVP)
+      .Case("tlvppage", VK_TLVPPAGE)
+      .Case("tlvppageoff", VK_TLVPPAGEOFF)
+      .Case("page", VK_PAGE)
+      .Case("pageoff", VK_PAGEOFF)
+      .Case("gotpage", VK_GOTPAGE)
+      .Case("gotpageoff", VK_GOTPAGEOFF)
+      .Case("imgrel", VK_COFF_IMGREL32)
+      .Case("secrel32", VK_SECREL)
+      .Case("size", VK_SIZE)
+      .Case("abs8", VK_X86_ABS8)
+      .Case("pltoff", VK_X86_PLTOFF)
+      .Case("l", VK_PPC_LO)
+      .Case("h", VK_PPC_HI)
+      .Case("ha", VK_PPC_HA)
+      .Case("high", VK_PPC_HIGH)
+      .Case("higha", VK_PPC_HIGHA)
+      .Case("higher", VK_PPC_HIGHER)
+      .Case("highera", VK_PPC_HIGHERA)
+      .Case("highest", VK_PPC_HIGHEST)
+      .Case("highesta", VK_PPC_HIGHESTA)
+      .Case("got@l", VK_PPC_GOT_LO)
+      .Case("got@h", VK_PPC_GOT_HI)
+      .Case("got@ha", VK_PPC_GOT_HA)
+      .Case("local", VK_PPC_LOCAL)
+      .Case("tocbase", VK_PPC_TOCBASE)
+      .Case("toc", VK_PPC_TOC)
+      .Case("toc@l", VK_PPC_TOC_LO)
+      .Case("toc@h", VK_PPC_TOC_HI)
+      .Case("toc@ha", VK_PPC_TOC_HA)
+      .Case("u", VK_PPC_U)
+      .Case("l", VK_PPC_L)
+      .Case("tls", VK_PPC_TLS)
+      .Case("dtpmod", VK_PPC_DTPMOD)
+      .Case("tprel@l", VK_PPC_TPREL_LO)
+      .Case("tprel@h", VK_PPC_TPREL_HI)
+      .Case("tprel@ha", VK_PPC_TPREL_HA)
+      .Case("tprel@high", VK_PPC_TPREL_HIGH)
+      .Case("tprel@higha", VK_PPC_TPREL_HIGHA)
+      .Case("tprel@higher", VK_PPC_TPREL_HIGHER)
+      .Case("tprel@highera", VK_PPC_TPREL_HIGHERA)
+      .Case("tprel@highest", VK_PPC_TPREL_HIGHEST)
+      .Case("tprel@highesta", VK_PPC_TPREL_HIGHESTA)
+      .Case("dtprel@l", VK_PPC_DTPREL_LO)
+      .Case("dtprel@h", VK_PPC_DTPREL_HI)
+      .Case("dtprel@ha", VK_PPC_DTPREL_HA)
+      .Case("dtprel@high", VK_PPC_DTPREL_HIGH)
+      .Case("dtprel@higha", VK_PPC_DTPREL_HIGHA)
+      .Case("dtprel@higher", VK_PPC_DTPREL_HIGHER)
+      .Case("dtprel@highera", VK_PPC_DTPREL_HIGHERA)
+      .Case("dtprel@highest", VK_PPC_DTPREL_HIGHEST)
+      .Case("dtprel@highesta", VK_PPC_DTPREL_HIGHESTA)
+      .Case("got@tprel", VK_PPC_GOT_TPREL)
+      .Case("got@tprel@l", VK_PPC_GOT_TPREL_LO)
+      .Case("got@tprel@h", VK_PPC_GOT_TPREL_HI)
+      .Case("got@tprel@ha", VK_PPC_GOT_TPREL_HA)
+      .Case("got@dtprel", VK_PPC_GOT_DTPREL)
+      .Case("got@dtprel@l", VK_PPC_GOT_DTPREL_LO)
+      .Case("got@dtprel@h", VK_PPC_GOT_DTPREL_HI)
+      .Case("got@dtprel@ha", VK_PPC_GOT_DTPREL_HA)
+      .Case("got@tlsgd", VK_PPC_GOT_TLSGD)
+      .Case("got@tlsgd@l", VK_PPC_GOT_TLSGD_LO)
+      .Case("got@tlsgd@h", VK_PPC_GOT_TLSGD_HI)
+      .Case("got@tlsgd@ha", VK_PPC_GOT_TLSGD_HA)
+      .Case("got@tlsld", VK_PPC_GOT_TLSLD)
+      .Case("got@tlsld@l", VK_PPC_GOT_TLSLD_LO)
+      .Case("got@tlsld@h", VK_PPC_GOT_TLSLD_HI)
+      .Case("got@tlsld@ha", VK_PPC_GOT_TLSLD_HA)
+      .Case("got@pcrel", VK_PPC_GOT_PCREL)
+      .Case("got@tlsgd@pcrel", VK_PPC_GOT_TLSGD_PCREL)
+      .Case("got@tlsld@pcrel", VK_PPC_GOT_TLSLD_PCREL)
+      .Case("got@tprel@pcrel", VK_PPC_GOT_TPREL_PCREL)
+      .Case("tls@pcrel", VK_PPC_TLS_PCREL)
+      .Case("notoc", VK_PPC_NOTOC)
+      .Case("gdgot", VK_Hexagon_GD_GOT)
+      .Case("gdplt", VK_Hexagon_GD_PLT)
+      .Case("iegot", VK_Hexagon_IE_GOT)
+      .Case("ie", VK_Hexagon_IE)
+      .Case("ldgot", VK_Hexagon_LD_GOT)
+      .Case("ldplt", VK_Hexagon_LD_PLT)
+      .Case("none", VK_ARM_NONE)
+      .Case("got_prel", VK_ARM_GOT_PREL)
+      .Case("target1", VK_ARM_TARGET1)
+      .Case("target2", VK_ARM_TARGET2)
+      .Case("prel31", VK_ARM_PREL31)
+      .Case("sbrel", VK_ARM_SBREL)
+      .Case("tlsldo", VK_ARM_TLSLDO)
+      .Case("lo8", VK_AVR_LO8)
+      .Case("hi8", VK_AVR_HI8)
+      .Case("hlo8", VK_AVR_HLO8)
+      .Case("typeindex", VK_WASM_TYPEINDEX)
+      .Case("tbrel", VK_WASM_TBREL)
+      .Case("mbrel", VK_WASM_MBREL)
+      .Case("tlsrel", VK_WASM_TLSREL)
+      .Case("got@tls", VK_WASM_GOT_TLS)
+      .Case("funcindex", VK_WASM_FUNCINDEX)
+      .Case("gotpcrel32@lo", VK_AMDGPU_GOTPCREL32_LO)
+      .Case("gotpcrel32@hi", VK_AMDGPU_GOTPCREL32_HI)
+      .Case("rel32@lo", VK_AMDGPU_REL32_LO)
+      .Case("rel32@hi", VK_AMDGPU_REL32_HI)
+      .Case("rel64", VK_AMDGPU_REL64)
+      .Case("abs32@lo", VK_AMDGPU_ABS32_LO)
+      .Case("abs32@hi", VK_AMDGPU_ABS32_HI)
+      .Case("hi", VK_VE_HI32)
+      .Case("lo", VK_VE_LO32)
+      .Case("pc_hi", VK_VE_PC_HI32)
+      .Case("pc_lo", VK_VE_PC_LO32)
+      .Case("got_hi", VK_VE_GOT_HI32)
+      .Case("got_lo", VK_VE_GOT_LO32)
+      .Case("gotoff_hi", VK_VE_GOTOFF_HI32)
+      .Case("gotoff_lo", VK_VE_GOTOFF_LO32)
+      .Case("plt_hi", VK_VE_PLT_HI32)
+      .Case("plt_lo", VK_VE_PLT_LO32)
+      .Case("tls_gd_hi", VK_VE_TLS_GD_HI32)
+      .Case("tls_gd_lo", VK_VE_TLS_GD_LO32)
+      .Case("tpoff_hi", VK_VE_TPOFF_HI32)
+      .Case("tpoff_lo", VK_VE_TPOFF_LO32)
+      // EVM local begin
+      .Case("evm_data", VK_EVM_DATA)
+      // EVM local end
+      .Default(VK_Invalid);
 }
 
 /* *** */
diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp
index 2f6fa9d475..9c371e85d0 100644
--- a/llvm/lib/Object/ELF.cpp
+++ b/llvm/lib/Object/ELF.cpp
@@ -185,7 +185,7 @@ StringRef llvm::object::getELFRelocationTypeName(uint32_t Machine,
   case ELF::EM_ERAVM:
     switch (Type) {
 #include "llvm/BinaryFormat/ELFRelocs/EraVM.def"
-  default:
+    default:
       break;
     }
     break;
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 714bb10de3..abb7c5d80e 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -1094,176 +1094,159 @@ const EnumEntry<unsigned> C6000ElfOSABI[] = {
 };
 
 const EnumEntry<unsigned> ElfMachineType[] = {
-  ENUM_ENT(EM_NONE,          "None"),
-  ENUM_ENT(EM_M32,           "WE32100"),
-  ENUM_ENT(EM_SPARC,         "Sparc"),
-  ENUM_ENT(EM_386,           "Intel 80386"),
-  ENUM_ENT(EM_68K,           "MC68000"),
-  ENUM_ENT(EM_88K,           "MC88000"),
-  ENUM_ENT(EM_IAMCU,         "EM_IAMCU"),
-  ENUM_ENT(EM_860,           "Intel 80860"),
-  ENUM_ENT(EM_MIPS,          "MIPS R3000"),
-  ENUM_ENT(EM_S370,          "IBM System/370"),
-  ENUM_ENT(EM_MIPS_RS3_LE,   "MIPS R3000 little-endian"),
-  ENUM_ENT(EM_PARISC,        "HPPA"),
-  ENUM_ENT(EM_VPP500,        "Fujitsu VPP500"),
-  ENUM_ENT(EM_SPARC32PLUS,   "Sparc v8+"),
-  ENUM_ENT(EM_960,           "Intel 80960"),
-  ENUM_ENT(EM_PPC,           "PowerPC"),
-  ENUM_ENT(EM_PPC64,         "PowerPC64"),
-  ENUM_ENT(EM_S390,          "IBM S/390"),
-  ENUM_ENT(EM_SPU,           "SPU"),
-  ENUM_ENT(EM_V800,          "NEC V800 series"),
-  ENUM_ENT(EM_FR20,          "Fujistsu FR20"),
-  ENUM_ENT(EM_RH32,          "TRW RH-32"),
-  ENUM_ENT(EM_RCE,           "Motorola RCE"),
-  ENUM_ENT(EM_ARM,           "ARM"),
-  ENUM_ENT(EM_ALPHA,         "EM_ALPHA"),
-  ENUM_ENT(EM_SH,            "Hitachi SH"),
-  ENUM_ENT(EM_SPARCV9,       "Sparc v9"),
-  ENUM_ENT(EM_TRICORE,       "Siemens Tricore"),
-  ENUM_ENT(EM_ARC,           "ARC"),
-  ENUM_ENT(EM_H8_300,        "Hitachi H8/300"),
-  ENUM_ENT(EM_H8_300H,       "Hitachi H8/300H"),
-  ENUM_ENT(EM_H8S,           "Hitachi H8S"),
-  ENUM_ENT(EM_H8_500,        "Hitachi H8/500"),
-  ENUM_ENT(EM_IA_64,         "Intel IA-64"),
-  ENUM_ENT(EM_MIPS_X,        "Stanford MIPS-X"),
-  ENUM_ENT(EM_COLDFIRE,      "Motorola Coldfire"),
-  ENUM_ENT(EM_68HC12,        "Motorola MC68HC12 Microcontroller"),
-  ENUM_ENT(EM_MMA,           "Fujitsu Multimedia Accelerator"),
-  ENUM_ENT(EM_PCP,           "Siemens PCP"),
-  ENUM_ENT(EM_NCPU,          "Sony nCPU embedded RISC processor"),
-  ENUM_ENT(EM_NDR1,          "Denso NDR1 microprocesspr"),
-  ENUM_ENT(EM_STARCORE,      "Motorola Star*Core processor"),
-  ENUM_ENT(EM_ME16,          "Toyota ME16 processor"),
-  ENUM_ENT(EM_ST100,         "STMicroelectronics ST100 processor"),
-  ENUM_ENT(EM_TINYJ,         "Advanced Logic Corp. TinyJ embedded processor"),
-  ENUM_ENT(EM_X86_64,        "Advanced Micro Devices X86-64"),
-  ENUM_ENT(EM_PDSP,          "Sony DSP processor"),
-  ENUM_ENT(EM_PDP10,         "Digital Equipment Corp. PDP-10"),
-  ENUM_ENT(EM_PDP11,         "Digital Equipment Corp. PDP-11"),
-  ENUM_ENT(EM_FX66,          "Siemens FX66 microcontroller"),
-  ENUM_ENT(EM_ST9PLUS,       "STMicroelectronics ST9+ 8/16 bit microcontroller"),
-  ENUM_ENT(EM_ST7,           "STMicroelectronics ST7 8-bit microcontroller"),
-  ENUM_ENT(EM_68HC16,        "Motorola MC68HC16 Microcontroller"),
-  ENUM_ENT(EM_68HC11,        "Motorola MC68HC11 Microcontroller"),
-  ENUM_ENT(EM_68HC08,        "Motorola MC68HC08 Microcontroller"),
-  ENUM_ENT(EM_68HC05,        "Motorola MC68HC05 Microcontroller"),
-  ENUM_ENT(EM_SVX,           "Silicon Graphics SVx"),
-  ENUM_ENT(EM_ST19,          "STMicroelectronics ST19 8-bit microcontroller"),
-  ENUM_ENT(EM_VAX,           "Digital VAX"),
-  ENUM_ENT(EM_CRIS,          "Axis Communications 32-bit embedded processor"),
-  ENUM_ENT(EM_JAVELIN,       "Infineon Technologies 32-bit embedded cpu"),
-  ENUM_ENT(EM_FIREPATH,      "Element 14 64-bit DSP processor"),
-  ENUM_ENT(EM_ZSP,           "LSI Logic's 16-bit DSP processor"),
-  ENUM_ENT(EM_MMIX,          "Donald Knuth's educational 64-bit processor"),
-  ENUM_ENT(EM_HUANY,         "Harvard Universitys's machine-independent object format"),
-  ENUM_ENT(EM_PRISM,         "Vitesse Prism"),
-  ENUM_ENT(EM_AVR,           "Atmel AVR 8-bit microcontroller"),
-  ENUM_ENT(EM_FR30,          "Fujitsu FR30"),
-  ENUM_ENT(EM_D10V,          "Mitsubishi D10V"),
-  ENUM_ENT(EM_D30V,          "Mitsubishi D30V"),
-  ENUM_ENT(EM_V850,          "NEC v850"),
-  ENUM_ENT(EM_M32R,          "Renesas M32R (formerly Mitsubishi M32r)"),
-  ENUM_ENT(EM_MN10300,       "Matsushita MN10300"),
-  ENUM_ENT(EM_MN10200,       "Matsushita MN10200"),
-  ENUM_ENT(EM_PJ,            "picoJava"),
-  ENUM_ENT(EM_OPENRISC,      "OpenRISC 32-bit embedded processor"),
-  ENUM_ENT(EM_ARC_COMPACT,   "EM_ARC_COMPACT"),
-  ENUM_ENT(EM_XTENSA,        "Tensilica Xtensa Processor"),
-  ENUM_ENT(EM_VIDEOCORE,     "Alphamosaic VideoCore processor"),
-  ENUM_ENT(EM_TMM_GPP,       "Thompson Multimedia General Purpose Processor"),
-  ENUM_ENT(EM_NS32K,         "National Semiconductor 32000 series"),
-  ENUM_ENT(EM_TPC,           "Tenor Network TPC processor"),
-  ENUM_ENT(EM_SNP1K,         "EM_SNP1K"),
-  ENUM_ENT(EM_ST200,         "STMicroelectronics ST200 microcontroller"),
-  ENUM_ENT(EM_IP2K,          "Ubicom IP2xxx 8-bit microcontrollers"),
-  ENUM_ENT(EM_MAX,           "MAX Processor"),
-  ENUM_ENT(EM_CR,            "National Semiconductor CompactRISC"),
-  ENUM_ENT(EM_F2MC16,        "Fujitsu F2MC16"),
-  ENUM_ENT(EM_MSP430,        "Texas Instruments msp430 microcontroller"),
-  ENUM_ENT(EM_BLACKFIN,      "Analog Devices Blackfin"),
-  ENUM_ENT(EM_SE_C33,        "S1C33 Family of Seiko Epson processors"),
-  ENUM_ENT(EM_SEP,           "Sharp embedded microprocessor"),
-  ENUM_ENT(EM_ARCA,          "Arca RISC microprocessor"),
-  ENUM_ENT(EM_UNICORE,       "Unicore"),
-  ENUM_ENT(EM_EXCESS,        "eXcess 16/32/64-bit configurable embedded CPU"),
-  ENUM_ENT(EM_DXP,           "Icera Semiconductor Inc. Deep Execution Processor"),
-  ENUM_ENT(EM_ALTERA_NIOS2,  "Altera Nios"),
-  ENUM_ENT(EM_CRX,           "National Semiconductor CRX microprocessor"),
-  ENUM_ENT(EM_XGATE,         "Motorola XGATE embedded processor"),
-  ENUM_ENT(EM_C166,          "Infineon Technologies xc16x"),
-  ENUM_ENT(EM_M16C,          "Renesas M16C"),
-  ENUM_ENT(EM_DSPIC30F,      "Microchip Technology dsPIC30F Digital Signal Controller"),
-  ENUM_ENT(EM_CE,            "Freescale Communication Engine RISC core"),
-  ENUM_ENT(EM_M32C,          "Renesas M32C"),
-  ENUM_ENT(EM_TSK3000,       "Altium TSK3000 core"),
-  ENUM_ENT(EM_RS08,          "Freescale RS08 embedded processor"),
-  ENUM_ENT(EM_SHARC,         "EM_SHARC"),
-  ENUM_ENT(EM_ECOG2,         "Cyan Technology eCOG2 microprocessor"),
-  ENUM_ENT(EM_SCORE7,        "SUNPLUS S+Core"),
-  ENUM_ENT(EM_DSP24,         "New Japan Radio (NJR) 24-bit DSP Processor"),
-  ENUM_ENT(EM_VIDEOCORE3,    "Broadcom VideoCore III processor"),
-  ENUM_ENT(EM_LATTICEMICO32, "Lattice Mico32"),
-  ENUM_ENT(EM_SE_C17,        "Seiko Epson C17 family"),
-  ENUM_ENT(EM_TI_C6000,      "Texas Instruments TMS320C6000 DSP family"),
-  ENUM_ENT(EM_TI_C2000,      "Texas Instruments TMS320C2000 DSP family"),
-  ENUM_ENT(EM_TI_C5500,      "Texas Instruments TMS320C55x DSP family"),
-  ENUM_ENT(EM_MMDSP_PLUS,    "STMicroelectronics 64bit VLIW Data Signal Processor"),
-  ENUM_ENT(EM_CYPRESS_M8C,   "Cypress M8C microprocessor"),
-  ENUM_ENT(EM_R32C,          "Renesas R32C series microprocessors"),
-  ENUM_ENT(EM_TRIMEDIA,      "NXP Semiconductors TriMedia architecture family"),
-  ENUM_ENT(EM_HEXAGON,       "Qualcomm Hexagon"),
-  ENUM_ENT(EM_8051,          "Intel 8051 and variants"),
-  ENUM_ENT(EM_STXP7X,        "STMicroelectronics STxP7x family"),
-  ENUM_ENT(EM_NDS32,         "Andes Technology compact code size embedded RISC processor family"),
-  ENUM_ENT(EM_ECOG1,         "Cyan Technology eCOG1 microprocessor"),
-  // FIXME: Following EM_ECOG1X definitions is dead code since EM_ECOG1X has
-  //        an identical number to EM_ECOG1.
-  ENUM_ENT(EM_ECOG1X,        "Cyan Technology eCOG1X family"),
-  ENUM_ENT(EM_MAXQ30,        "Dallas Semiconductor MAXQ30 Core microcontrollers"),
-  ENUM_ENT(EM_XIMO16,        "New Japan Radio (NJR) 16-bit DSP Processor"),
-  ENUM_ENT(EM_MANIK,         "M2000 Reconfigurable RISC Microprocessor"),
-  ENUM_ENT(EM_CRAYNV2,       "Cray Inc. NV2 vector architecture"),
-  ENUM_ENT(EM_RX,            "Renesas RX"),
-  ENUM_ENT(EM_METAG,         "Imagination Technologies Meta processor architecture"),
-  ENUM_ENT(EM_MCST_ELBRUS,   "MCST Elbrus general purpose hardware architecture"),
-  ENUM_ENT(EM_ECOG16,        "Cyan Technology eCOG16 family"),
-  ENUM_ENT(EM_CR16,          "National Semiconductor CompactRISC 16-bit processor"),
-  ENUM_ENT(EM_ETPU,          "Freescale Extended Time Processing Unit"),
-  ENUM_ENT(EM_SLE9X,         "Infineon Technologies SLE9X core"),
-  ENUM_ENT(EM_L10M,          "EM_L10M"),
-  ENUM_ENT(EM_K10M,          "EM_K10M"),
-  ENUM_ENT(EM_AARCH64,       "AArch64"),
-  ENUM_ENT(EM_AVR32,         "Atmel Corporation 32-bit microprocessor family"),
-  ENUM_ENT(EM_STM8,          "STMicroeletronics STM8 8-bit microcontroller"),
-  ENUM_ENT(EM_TILE64,        "Tilera TILE64 multicore architecture family"),
-  ENUM_ENT(EM_TILEPRO,       "Tilera TILEPro multicore architecture family"),
-  ENUM_ENT(EM_MICROBLAZE,    "Xilinx MicroBlaze 32-bit RISC soft processor core"),
-  ENUM_ENT(EM_CUDA,          "NVIDIA CUDA architecture"),
-  ENUM_ENT(EM_TILEGX,        "Tilera TILE-Gx multicore architecture family"),
-  ENUM_ENT(EM_CLOUDSHIELD,   "EM_CLOUDSHIELD"),
-  ENUM_ENT(EM_COREA_1ST,     "EM_COREA_1ST"),
-  ENUM_ENT(EM_COREA_2ND,     "EM_COREA_2ND"),
-  ENUM_ENT(EM_ARC_COMPACT2,  "EM_ARC_COMPACT2"),
-  ENUM_ENT(EM_OPEN8,         "EM_OPEN8"),
-  ENUM_ENT(EM_RL78,          "Renesas RL78"),
-  ENUM_ENT(EM_VIDEOCORE5,    "Broadcom VideoCore V processor"),
-  ENUM_ENT(EM_78KOR,         "EM_78KOR"),
-  ENUM_ENT(EM_56800EX,       "EM_56800EX"),
-  ENUM_ENT(EM_AMDGPU,        "EM_AMDGPU"),
-  ENUM_ENT(EM_RISCV,         "RISC-V"),
-  ENUM_ENT(EM_LANAI,         "EM_LANAI"),
-  ENUM_ENT(EM_BPF,           "EM_BPF"),
-  ENUM_ENT(EM_VE,            "NEC SX-Aurora Vector Engine"),
-  ENUM_ENT(EM_LOONGARCH,     "LoongArch"),
-  // EraVM local begin
-  ENUM_ENT(EM_ERAVM,         "EraVM"),
-  // EraVM local end
-  // EVM local begin
-  ENUM_ENT(EM_EVM,           "EVM"),
-  // EVM local end
+    ENUM_ENT(EM_NONE, "None"), ENUM_ENT(EM_M32, "WE32100"),
+    ENUM_ENT(EM_SPARC, "Sparc"), ENUM_ENT(EM_386, "Intel 80386"),
+    ENUM_ENT(EM_68K, "MC68000"), ENUM_ENT(EM_88K, "MC88000"),
+    ENUM_ENT(EM_IAMCU, "EM_IAMCU"), ENUM_ENT(EM_860, "Intel 80860"),
+    ENUM_ENT(EM_MIPS, "MIPS R3000"), ENUM_ENT(EM_S370, "IBM System/370"),
+    ENUM_ENT(EM_MIPS_RS3_LE, "MIPS R3000 little-endian"),
+    ENUM_ENT(EM_PARISC, "HPPA"), ENUM_ENT(EM_VPP500, "Fujitsu VPP500"),
+    ENUM_ENT(EM_SPARC32PLUS, "Sparc v8+"), ENUM_ENT(EM_960, "Intel 80960"),
+    ENUM_ENT(EM_PPC, "PowerPC"), ENUM_ENT(EM_PPC64, "PowerPC64"),
+    ENUM_ENT(EM_S390, "IBM S/390"), ENUM_ENT(EM_SPU, "SPU"),
+    ENUM_ENT(EM_V800, "NEC V800 series"), ENUM_ENT(EM_FR20, "Fujistsu FR20"),
+    ENUM_ENT(EM_RH32, "TRW RH-32"), ENUM_ENT(EM_RCE, "Motorola RCE"),
+    ENUM_ENT(EM_ARM, "ARM"), ENUM_ENT(EM_ALPHA, "EM_ALPHA"),
+    ENUM_ENT(EM_SH, "Hitachi SH"), ENUM_ENT(EM_SPARCV9, "Sparc v9"),
+    ENUM_ENT(EM_TRICORE, "Siemens Tricore"), ENUM_ENT(EM_ARC, "ARC"),
+    ENUM_ENT(EM_H8_300, "Hitachi H8/300"),
+    ENUM_ENT(EM_H8_300H, "Hitachi H8/300H"), ENUM_ENT(EM_H8S, "Hitachi H8S"),
+    ENUM_ENT(EM_H8_500, "Hitachi H8/500"), ENUM_ENT(EM_IA_64, "Intel IA-64"),
+    ENUM_ENT(EM_MIPS_X, "Stanford MIPS-X"),
+    ENUM_ENT(EM_COLDFIRE, "Motorola Coldfire"),
+    ENUM_ENT(EM_68HC12, "Motorola MC68HC12 Microcontroller"),
+    ENUM_ENT(EM_MMA, "Fujitsu Multimedia Accelerator"),
+    ENUM_ENT(EM_PCP, "Siemens PCP"),
+    ENUM_ENT(EM_NCPU, "Sony nCPU embedded RISC processor"),
+    ENUM_ENT(EM_NDR1, "Denso NDR1 microprocesspr"),
+    ENUM_ENT(EM_STARCORE, "Motorola Star*Core processor"),
+    ENUM_ENT(EM_ME16, "Toyota ME16 processor"),
+    ENUM_ENT(EM_ST100, "STMicroelectronics ST100 processor"),
+    ENUM_ENT(EM_TINYJ, "Advanced Logic Corp. TinyJ embedded processor"),
+    ENUM_ENT(EM_X86_64, "Advanced Micro Devices X86-64"),
+    ENUM_ENT(EM_PDSP, "Sony DSP processor"),
+    ENUM_ENT(EM_PDP10, "Digital Equipment Corp. PDP-10"),
+    ENUM_ENT(EM_PDP11, "Digital Equipment Corp. PDP-11"),
+    ENUM_ENT(EM_FX66, "Siemens FX66 microcontroller"),
+    ENUM_ENT(EM_ST9PLUS, "STMicroelectronics ST9+ 8/16 bit microcontroller"),
+    ENUM_ENT(EM_ST7, "STMicroelectronics ST7 8-bit microcontroller"),
+    ENUM_ENT(EM_68HC16, "Motorola MC68HC16 Microcontroller"),
+    ENUM_ENT(EM_68HC11, "Motorola MC68HC11 Microcontroller"),
+    ENUM_ENT(EM_68HC08, "Motorola MC68HC08 Microcontroller"),
+    ENUM_ENT(EM_68HC05, "Motorola MC68HC05 Microcontroller"),
+    ENUM_ENT(EM_SVX, "Silicon Graphics SVx"),
+    ENUM_ENT(EM_ST19, "STMicroelectronics ST19 8-bit microcontroller"),
+    ENUM_ENT(EM_VAX, "Digital VAX"),
+    ENUM_ENT(EM_CRIS, "Axis Communications 32-bit embedded processor"),
+    ENUM_ENT(EM_JAVELIN, "Infineon Technologies 32-bit embedded cpu"),
+    ENUM_ENT(EM_FIREPATH, "Element 14 64-bit DSP processor"),
+    ENUM_ENT(EM_ZSP, "LSI Logic's 16-bit DSP processor"),
+    ENUM_ENT(EM_MMIX, "Donald Knuth's educational 64-bit processor"),
+    ENUM_ENT(EM_HUANY,
+             "Harvard Universitys's machine-independent object format"),
+    ENUM_ENT(EM_PRISM, "Vitesse Prism"),
+    ENUM_ENT(EM_AVR, "Atmel AVR 8-bit microcontroller"),
+    ENUM_ENT(EM_FR30, "Fujitsu FR30"), ENUM_ENT(EM_D10V, "Mitsubishi D10V"),
+    ENUM_ENT(EM_D30V, "Mitsubishi D30V"), ENUM_ENT(EM_V850, "NEC v850"),
+    ENUM_ENT(EM_M32R, "Renesas M32R (formerly Mitsubishi M32r)"),
+    ENUM_ENT(EM_MN10300, "Matsushita MN10300"),
+    ENUM_ENT(EM_MN10200, "Matsushita MN10200"), ENUM_ENT(EM_PJ, "picoJava"),
+    ENUM_ENT(EM_OPENRISC, "OpenRISC 32-bit embedded processor"),
+    ENUM_ENT(EM_ARC_COMPACT, "EM_ARC_COMPACT"),
+    ENUM_ENT(EM_XTENSA, "Tensilica Xtensa Processor"),
+    ENUM_ENT(EM_VIDEOCORE, "Alphamosaic VideoCore processor"),
+    ENUM_ENT(EM_TMM_GPP, "Thompson Multimedia General Purpose Processor"),
+    ENUM_ENT(EM_NS32K, "National Semiconductor 32000 series"),
+    ENUM_ENT(EM_TPC, "Tenor Network TPC processor"),
+    ENUM_ENT(EM_SNP1K, "EM_SNP1K"),
+    ENUM_ENT(EM_ST200, "STMicroelectronics ST200 microcontroller"),
+    ENUM_ENT(EM_IP2K, "Ubicom IP2xxx 8-bit microcontrollers"),
+    ENUM_ENT(EM_MAX, "MAX Processor"),
+    ENUM_ENT(EM_CR, "National Semiconductor CompactRISC"),
+    ENUM_ENT(EM_F2MC16, "Fujitsu F2MC16"),
+    ENUM_ENT(EM_MSP430, "Texas Instruments msp430 microcontroller"),
+    ENUM_ENT(EM_BLACKFIN, "Analog Devices Blackfin"),
+    ENUM_ENT(EM_SE_C33, "S1C33 Family of Seiko Epson processors"),
+    ENUM_ENT(EM_SEP, "Sharp embedded microprocessor"),
+    ENUM_ENT(EM_ARCA, "Arca RISC microprocessor"),
+    ENUM_ENT(EM_UNICORE, "Unicore"),
+    ENUM_ENT(EM_EXCESS, "eXcess 16/32/64-bit configurable embedded CPU"),
+    ENUM_ENT(EM_DXP, "Icera Semiconductor Inc. Deep Execution Processor"),
+    ENUM_ENT(EM_ALTERA_NIOS2, "Altera Nios"),
+    ENUM_ENT(EM_CRX, "National Semiconductor CRX microprocessor"),
+    ENUM_ENT(EM_XGATE, "Motorola XGATE embedded processor"),
+    ENUM_ENT(EM_C166, "Infineon Technologies xc16x"),
+    ENUM_ENT(EM_M16C, "Renesas M16C"),
+    ENUM_ENT(EM_DSPIC30F,
+             "Microchip Technology dsPIC30F Digital Signal Controller"),
+    ENUM_ENT(EM_CE, "Freescale Communication Engine RISC core"),
+    ENUM_ENT(EM_M32C, "Renesas M32C"),
+    ENUM_ENT(EM_TSK3000, "Altium TSK3000 core"),
+    ENUM_ENT(EM_RS08, "Freescale RS08 embedded processor"),
+    ENUM_ENT(EM_SHARC, "EM_SHARC"),
+    ENUM_ENT(EM_ECOG2, "Cyan Technology eCOG2 microprocessor"),
+    ENUM_ENT(EM_SCORE7, "SUNPLUS S+Core"),
+    ENUM_ENT(EM_DSP24, "New Japan Radio (NJR) 24-bit DSP Processor"),
+    ENUM_ENT(EM_VIDEOCORE3, "Broadcom VideoCore III processor"),
+    ENUM_ENT(EM_LATTICEMICO32, "Lattice Mico32"),
+    ENUM_ENT(EM_SE_C17, "Seiko Epson C17 family"),
+    ENUM_ENT(EM_TI_C6000, "Texas Instruments TMS320C6000 DSP family"),
+    ENUM_ENT(EM_TI_C2000, "Texas Instruments TMS320C2000 DSP family"),
+    ENUM_ENT(EM_TI_C5500, "Texas Instruments TMS320C55x DSP family"),
+    ENUM_ENT(EM_MMDSP_PLUS,
+             "STMicroelectronics 64bit VLIW Data Signal Processor"),
+    ENUM_ENT(EM_CYPRESS_M8C, "Cypress M8C microprocessor"),
+    ENUM_ENT(EM_R32C, "Renesas R32C series microprocessors"),
+    ENUM_ENT(EM_TRIMEDIA, "NXP Semiconductors TriMedia architecture family"),
+    ENUM_ENT(EM_HEXAGON, "Qualcomm Hexagon"),
+    ENUM_ENT(EM_8051, "Intel 8051 and variants"),
+    ENUM_ENT(EM_STXP7X, "STMicroelectronics STxP7x family"),
+    ENUM_ENT(
+        EM_NDS32,
+        "Andes Technology compact code size embedded RISC processor family"),
+    ENUM_ENT(EM_ECOG1, "Cyan Technology eCOG1 microprocessor"),
+    // FIXME: Following EM_ECOG1X definitions is dead code since EM_ECOG1X has
+    //        an identical number to EM_ECOG1.
+    ENUM_ENT(EM_ECOG1X, "Cyan Technology eCOG1X family"),
+    ENUM_ENT(EM_MAXQ30, "Dallas Semiconductor MAXQ30 Core microcontrollers"),
+    ENUM_ENT(EM_XIMO16, "New Japan Radio (NJR) 16-bit DSP Processor"),
+    ENUM_ENT(EM_MANIK, "M2000 Reconfigurable RISC Microprocessor"),
+    ENUM_ENT(EM_CRAYNV2, "Cray Inc. NV2 vector architecture"),
+    ENUM_ENT(EM_RX, "Renesas RX"),
+    ENUM_ENT(EM_METAG, "Imagination Technologies Meta processor architecture"),
+    ENUM_ENT(EM_MCST_ELBRUS,
+             "MCST Elbrus general purpose hardware architecture"),
+    ENUM_ENT(EM_ECOG16, "Cyan Technology eCOG16 family"),
+    ENUM_ENT(EM_CR16, "National Semiconductor CompactRISC 16-bit processor"),
+    ENUM_ENT(EM_ETPU, "Freescale Extended Time Processing Unit"),
+    ENUM_ENT(EM_SLE9X, "Infineon Technologies SLE9X core"),
+    ENUM_ENT(EM_L10M, "EM_L10M"), ENUM_ENT(EM_K10M, "EM_K10M"),
+    ENUM_ENT(EM_AARCH64, "AArch64"),
+    ENUM_ENT(EM_AVR32, "Atmel Corporation 32-bit microprocessor family"),
+    ENUM_ENT(EM_STM8, "STMicroeletronics STM8 8-bit microcontroller"),
+    ENUM_ENT(EM_TILE64, "Tilera TILE64 multicore architecture family"),
+    ENUM_ENT(EM_TILEPRO, "Tilera TILEPro multicore architecture family"),
+    ENUM_ENT(EM_MICROBLAZE,
+             "Xilinx MicroBlaze 32-bit RISC soft processor core"),
+    ENUM_ENT(EM_CUDA, "NVIDIA CUDA architecture"),
+    ENUM_ENT(EM_TILEGX, "Tilera TILE-Gx multicore architecture family"),
+    ENUM_ENT(EM_CLOUDSHIELD, "EM_CLOUDSHIELD"),
+    ENUM_ENT(EM_COREA_1ST, "EM_COREA_1ST"),
+    ENUM_ENT(EM_COREA_2ND, "EM_COREA_2ND"),
+    ENUM_ENT(EM_ARC_COMPACT2, "EM_ARC_COMPACT2"),
+    ENUM_ENT(EM_OPEN8, "EM_OPEN8"), ENUM_ENT(EM_RL78, "Renesas RL78"),
+    ENUM_ENT(EM_VIDEOCORE5, "Broadcom VideoCore V processor"),
+    ENUM_ENT(EM_78KOR, "EM_78KOR"), ENUM_ENT(EM_56800EX, "EM_56800EX"),
+    ENUM_ENT(EM_AMDGPU, "EM_AMDGPU"), ENUM_ENT(EM_RISCV, "RISC-V"),
+    ENUM_ENT(EM_LANAI, "EM_LANAI"), ENUM_ENT(EM_BPF, "EM_BPF"),
+    ENUM_ENT(EM_VE, "NEC SX-Aurora Vector Engine"),
+    ENUM_ENT(EM_LOONGARCH, "LoongArch"),
+    // EraVM local begin
+    ENUM_ENT(EM_ERAVM, "EraVM"),
+    // EraVM local end
+    // EVM local begin
+    ENUM_ENT(EM_EVM, "EVM"),
+    // EVM local end
 };
 
 const EnumEntry<unsigned> ElfSymbolBindings[] = {

Copy link

github-actions bot commented Sep 27, 2024

╔═╡ Size (-%) ╞════════════════╡ All M3B3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════════════╡ All M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════════════╡ All M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════════════╡ All MzB3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════════════╡ All MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════════════╡ All MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞═════╡ EVMInterpreter M3B3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                                 NaN ║
╠═╡ Cycles (-%) ╞═══╡ EVMInterpreter M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞═════╡ EVMInterpreter M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs/gas ╞══════╡ EVMInterpreter M3B3 ╞═╣
║ ADD                                38.750 ║
║ MUL                                23.250 ║
║ SUB                                38.750 ║
║ DIV                                25.650 ║
║ SDIV                               41.250 ║
║ MOD                                25.650 ║
║ SMOD                               38.850 ║
║ ADDMOD                             20.656 ║
║ MULMOD                             23.656 ║
║ EXP                                 7.138 ║
║ SIGNEXTEND                         24.450 ║
║ LT                                 42.750 ║
║ GT                                 42.750 ║
║ SLT                                64.750 ║
║ SGT                                64.750 ║
║ EQ                                 42.750 ║
║ ISZERO                             36.417 ║
║ AND                                38.750 ║
║ OR                                 38.750 ║
║ XOR                                38.750 ║
║ NOT                                32.417 ║
║ BYTE                               46.750 ║
║ SHL                                42.750 ║
║ SHR                                42.750 ║
║ SAR                                60.750 ║
║ SGT                                64.750 ║
║ SHA3                               26.326 ║
║ ADDRESS                            47.812 ║
║ BALANCE                            39.241 ║
║ ORIGIN                           1354.750 ║
║ CALLER                             47.812 ║
║ CALLVALUE                          47.812 ║
║ CALLDATALOAD                       34.750 ║
║ CALLDATASIZE                       48.125 ║
║ CALLDATACOPY                       49.492 ║
║ CODESIZE                           48.625 ║
║ CODECOPY                           60.487 ║
║ GASPRICE                         1351.562 ║
║ EXTCODESIZE                         3.725 ║
║ EXTCODECOPY                         3.793 ║
║ RETURNDATASIZE                     46.500 ║
║ RETURNDATACOPY                     43.222 ║
║ EXTCODEHASH                         4.914 ║
║ BLOCKHASH                         240.419 ║
║ COINBASE                         1351.750 ║
║ TIMESTAMP                        1345.750 ║
║ NUMBER                           1345.750 ║
║ PREVRANDAO                       1345.750 ║
║ GASLIMIT                         1351.750 ║
║ CHAINID                          1339.750 ║
║ SELFBALANCE                       640.500 ║
║ BASEFEE                          1345.750 ║
║ POP                                38.625 ║
║ MLOAD                              51.590 ║
║ MSTORE                             55.248 ║
║ MSTORE8                            64.716 ║
║ SLOAD                              20.708 ║
║ SSTORE                              4.659 ║
║ JUMP                               17.000 ║
║ JUMPI                              16.727 ║
║ PC                                 48.312 ║
║ MSIZE                              54.812 ║
║ GAS                                45.312 ║
║ JUMPDEST                           65.625 ║
║ PUSH0                              45.312 ║
║ PUSH1                              41.958 ║
║ PUSH2                              47.375 ║
║ PUSH4                              50.208 ║
║ PUSH5                              51.625 ║
║ PUSH6                              53.042 ║
║ PUSH7                              54.458 ║
║ PUSH8                              55.875 ║
║ PUSH9                              57.292 ║
║ PUSH10                             58.708 ║
║ PUSH11                             60.125 ║
║ PUSH12                             61.542 ║
║ PUSH13                             62.958 ║
║ PUSH14                             64.375 ║
║ PUSH15                             65.792 ║
║ PUSH16                             67.208 ║
║ PUSH17                             68.625 ║
║ PUSH18                             70.042 ║
║ PUSH19                             71.458 ║
║ PUSH20                             72.875 ║
║ PUSH21                             74.292 ║
║ PUSH22                             75.708 ║
║ PUSH23                             77.125 ║
║ PUSH24                             78.542 ║
║ PUSH25                             79.958 ║
║ PUSH26                             81.375 ║
║ PUSH27                             82.792 ║
║ PUSH28                             84.208 ║
║ PUSH29                             85.625 ║
║ PUSH30                             87.042 ║
║ PUSH31                             88.458 ║
║ PUSH32                             87.875 ║
║ DUP1                               34.417 ║
║ DUP2                               36.417 ║
║ DUP3                               36.417 ║
║ DUP4                               36.417 ║
║ DUP5                               36.417 ║
║ DUP6                               36.417 ║
║ DUP7                               36.417 ║
║ DUP8                               36.417 ║
║ DUP9                               36.417 ║
║ DUP10                              36.417 ║
║ DUP11                              36.417 ║
║ DUP12                              36.417 ║
║ DUP13                              36.417 ║
║ DUP14                              36.417 ║
║ DUP15                              36.417 ║
║ DUP16                              36.417 ║
║ SWAP1                              41.083 ║
║ SWAP2                              41.083 ║
║ SWAP3                              41.083 ║
║ SWAP4                              41.083 ║
║ SWAP5                              41.083 ║
║ SWAP6                              41.083 ║
║ SWAP7                              41.083 ║
║ SWAP8                              41.083 ║
║ SWAP9                              41.083 ║
║ SWAP10                             41.083 ║
║ SWAP11                             41.083 ║
║ SWAP12                             41.083 ║
║ SWAP13                             41.083 ║
║ SWAP14                             41.083 ║
║ SWAP15                             41.083 ║
║ SWAP16                             41.083 ║
║ CALL                               36.191 ║
║ STATICCALL                         35.235 ║
║ DELEGATECALL                       34.275 ║
║ CREATE                              4.082 ║
║ CREATE2                             5.558 ║
║ RETURN                              1.000 ║
║ REVERT                              1.000 ║
╠═╡ Ergs/gas (-%) ╞═╡ EVMInterpreter M3B3 ╞═╣
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞═════╡ EVMInterpreter MzB3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                                 NaN ║
╠═╡ Cycles (-%) ╞═══╡ EVMInterpreter MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞═════╡ EVMInterpreter MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════╡ Precompiles M3B3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════╡ Precompiles M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════╡ Precompiles M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════╡ Precompiles MzB3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════╡ Precompiles MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════╡ Precompiles MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞══════════╡ Real life M3B3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞════════╡ Real life M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞══════════╡ Real life M3B3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞══════════╡ Real life MzB3 ╞═╗
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞════════╡ Real life MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞══════════╡ Real life MzB3 ╞═╣
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

@PavelKopyl PavelKopyl force-pushed the kpv-evm-initial-dependencies-support branch 2 times, most recently from 9df4450 to afef89a Compare October 1, 2024 09:52
@PavelKopyl PavelKopyl requested a review from akiramenai October 1, 2024 09:55
@PavelKopyl PavelKopyl marked this pull request as ready for review October 1, 2024 09:55
Copy link
Collaborator

@akiramenai akiramenai left a comment

Choose a reason for hiding this comment

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

I requested changes mostly because of a missing test. The rest are nitpicks.
Could we also use infinitives in the commit titles and avoid dots at the end?
I also recommend elaborating that the last change is required because EVM marks jump locations, so terminator instructions aren't adjacent. To make it a bit more EVM-novice friendly.

lld/ELF/Arch/EVM.cpp Outdated Show resolved Hide resolved
lld/ELF/Arch/EVM.cpp Show resolved Hide resolved
lld/include/lld-c/LLDAsLibraryC.h Outdated Show resolved Hide resolved
lld/include/lld-c/LLDAsLibraryC.h Outdated Show resolved Hide resolved
lld/lld-c/LLDAsLibraryC.cpp Outdated Show resolved Hide resolved
lld/lld-c/LLDAsLibraryC.cpp Outdated Show resolved Hide resolved
lld/lld-c/LLDAsLibraryC.cpp Outdated Show resolved Hide resolved
llvm/lib/Target/EVM/EVMAsmPrinter.cpp Outdated Show resolved Hide resolved
llvm/lib/Target/EVM/EVMAsmPrinter.cpp Show resolved Hide resolved
llvm/lib/Target/EVM/MCTargetDesc/EVMAsmBackend.cpp Outdated Show resolved Hide resolved
@PavelKopyl PavelKopyl force-pushed the kpv-evm-initial-dependencies-support branch 5 times, most recently from c25b493 to f632350 Compare October 7, 2024 13:28
Copy link
Collaborator

@akiramenai akiramenai left a comment

Choose a reason for hiding this comment

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

LGTM, except for nitpicks.

lld/ELF/Arch/EVM.cpp Outdated Show resolved Hide resolved
lld/ELF/Arch/EVM.cpp Outdated Show resolved Hide resolved
lld/ELF/Arch/EVM.cpp Outdated Show resolved Hide resolved
llvm/lib/Target/EVM/EVMInstrInfo.cpp Outdated Show resolved Hide resolved
llvm/lib/Target/EVM/EVMMCInstLower.cpp Outdated Show resolved Hide resolved
llvm/lib/Target/EVM/EVMStackify.cpp Show resolved Hide resolved
llvm/lib/Target/EVM/EVMTargetObjectFile.cpp Outdated Show resolved Hide resolved
@PavelKopyl PavelKopyl force-pushed the kpv-evm-initial-dependencies-support branch from f632350 to bc1a860 Compare October 7, 2024 17:49
@PavelKopyl PavelKopyl changed the title Initial support EVM of dependencies Initial support of EVM dependencies Oct 7, 2024
@PavelKopyl PavelKopyl requested a review from hedgar2017 October 8, 2024 14:22
llvm/tools/llvm-readobj/ELFDumper.cpp Outdated Show resolved Hide resolved
llvm/test/CodeGen/EVM/fallthrough.mir Show resolved Hide resolved
This includes:
 - datasize/dataoffset intrinsics
 - EVM specific ELF relocations
Please, note this is a temporary patch. It adds initial support
of dependencies, but it doesn't work in a general case.
A full solution will be more sophisticated and will likely be
implemented on the FE driver side without a need of the LLD usage.
@PavelKopyl PavelKopyl changed the title Initial support of EVM dependencies [EVM]Initial support of EVM dependencies Oct 9, 2024
@PavelKopyl PavelKopyl force-pushed the kpv-evm-initial-dependencies-support branch from bc1a860 to 6b0864d Compare October 9, 2024 10:32
@hedgar2017 hedgar2017 changed the title [EVM]Initial support of EVM dependencies [EVM] Initial support of EVM dependencies Oct 9, 2024
…ve valid MIR

This change moves the place where normal instructions are replaced with their
'stack' counterparts from the EVMMCInstLower to the EVMStackify pass. This
ensures we have a valid MIR after each pass.
This change also contains some updates in how labels are represented and
resolved in the BE.
@PavelKopyl PavelKopyl force-pushed the kpv-evm-initial-dependencies-support branch from 6b0864d to 590c40e Compare October 9, 2024 14:47
@PavelKopyl PavelKopyl merged commit 3cc01e9 into main Oct 9, 2024
4 checks passed
@PavelKopyl PavelKopyl deleted the kpv-evm-initial-dependencies-support branch October 9, 2024 14:47
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.

3 participants