[PATCH] D150522: [LoongArch] Support CodeModel::Large codegen

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 14 04:26:21 PDT 2023


xen0n created this revision.
xen0n added reviewers: SixWeining, wangleiat, XiaodongLoong, xry111, benshi001.
Herald added a subscriber: hiraditya.
Herald added a project: All.
xen0n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This is intended to behave like GCC's `-mcmodel=extreme`.

Technically the true GCC equivalent would be `-mcmodel=large` which is
not yet implemented there, and we probably do not want to take the
"Large" name until things settle in GCC side, but:

- LLVM does not have a `CodeModel::Extreme`, and it seems too early to have such a variant added just for enabling LoongArch; and
- `CodeModel::Small` is already being used for GCC `-mcmodel=normal` which is already a case of divergent naming.

Regarding the codegen, loads/stores immediately after a PC-relative
large address load (that ends with something like `add.d $addr, $addr,
$tmp`) should get merged with the addition into corresponding `ldx/stx`
ops, but is currently not done. This is because pseudo-instructions are
expanded after instruction selection, and is best fixed with a separate
change.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150522

Files:
  llvm/lib/Target/LoongArch/LoongArchExpandPseudoInsts.cpp
  llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
  llvm/lib/Target/LoongArch/LoongArchISelLowering.h
  llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
  llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
  llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.h
  llvm/test/CodeGen/LoongArch/code-models.ll
  llvm/test/CodeGen/LoongArch/codemodel-medium.ll
  llvm/test/CodeGen/LoongArch/global-address.ll
  llvm/test/CodeGen/LoongArch/tls-models.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150522.521990.patch
Type: text/x-patch
Size: 37304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230514/2966efa0/attachment.bin>


More information about the llvm-commits mailing list