[PATCH] D109371: [RISCV][RFC] Add LLVM support for RISC-V overlay system

Edward Jones via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 7 09:57:09 PDT 2021


edward-jones created this revision.
Herald added subscribers: ormris, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, simoncook, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, steven_wu, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, haicheng, johnrusso, rbar, asb, hiraditya, eraman.
edward-jones requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

This is the LLVM component of a change to add support for a proposed 'overlay' system for RISC-V to LLVM.

This adds two new function attributes to LLVM, 'overlay-call' and "overlay-data". These functions are used to mark functions and data which must be accessed indirectly through the overlay engine.

For global data marked as 'overlay-data' this change causes a different relocation types to be used when accessing the data. Instead of calculating the address of the data, these relocations calculate the value of the 'token' representing the data in the overlay engine.

For functions marked as 'overlay-call' a similar change occur - a 'token' is used instead of the function address for any references to an 'overlay-call' function, however there is also some additional complexity when handling 'overlay-call':

- Both calls to an 'overlay-call' function *or* from an 'overlay-call' function must go indirectly through the overlay engine.

- Calls into the overlay engine use a different calling convention. The entry point to the engine is in `x31`, and the token value for the target is stored to `x30`.

An additional change made here is to reserve a number of registers for exclusive used by the overlay engine.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109371

Files:
  llvm/include/llvm/BinaryFormat/ELFRelocs/RISCV.def
  llvm/include/llvm/MC/MCExpr.h
  llvm/lib/Analysis/InlineCost.cpp
  llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/MC/MCExpr.cpp
  llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVFixupKinds.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.h
  llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.h
  llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
  llvm/lib/Target/RISCV/RISCVInstrInfo.td
  llvm/lib/Target/RISCV/RISCVMCInstLower.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/test/CodeGen/RISCV/ovlcall-fncall.ll
  llvm/test/CodeGen/RISCV/ovlcall-memcpy.ll
  llvm/test/CodeGen/RISCV/ovlcall-sections.ll
  llvm/test/MC/RISCV/option-invalid.s
  llvm/test/MC/RISCV/ovlcall-pseudos.s
  llvm/test/MC/RISCV/ovlplt-hi-lo.s
  llvm/test/Transforms/Inline/RISCV/lit.local.cfg
  llvm/test/Transforms/Inline/RISCV/riscv-overlaycall.ll
  llvm/test/Transforms/Inline/RISCV/riscv-overlaycallee.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109371.371109.patch
Type: text/x-patch
Size: 52387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210907/89325775/attachment-0001.bin>


More information about the llvm-commits mailing list