[all-commits] [llvm/llvm-project] 00786d: [LoongArch] Support CodeModel::Large codegen

WÁNG Xuěruì via All-commits all-commits at lists.llvm.org
Wed Jun 21 01:42:56 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 00786d3a5f229b11a41dcbc4c6081edeaa7ee5b7
      https://github.com/llvm/llvm-project/commit/00786d3a5f229b11a41dcbc4c6081edeaa7ee5b7
  Author: WANG Xuerui <git at xen0n.name>
  Date:   2023-06-21 (Wed, 21 Jun 2023)

  Changed paths:
    M llvm/lib/Target/LoongArch/LoongArchExpandPseudoInsts.cpp
    M llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
    M llvm/lib/Target/LoongArch/LoongArchISelLowering.h
    M llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
    M llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
    M llvm/lib/Target/LoongArch/LoongArchTargetMachine.cpp
    M llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchBaseInfo.h
    A llvm/test/CodeGen/LoongArch/code-models.ll
    R llvm/test/CodeGen/LoongArch/codemodel-medium.ll
    M llvm/test/CodeGen/LoongArch/global-address.ll
    M llvm/test/CodeGen/LoongArch/tls-models.ll

  Log Message:
  -----------
  [LoongArch] Support CodeModel::Large codegen

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.

Reviewed By: SixWeining

Differential Revision: https://reviews.llvm.org/D150522




More information about the All-commits mailing list