[PATCH] D137495: [LoongArch] Add GHC Calling Convention
Lin Runze via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 7 00:39:51 PST 2022
lrzlin added a comment.
In D137495#3911433 <https://reviews.llvm.org/D137495#3911433>, @wangleiat wrote:
> In D137495#3911248 <https://reviews.llvm.org/D137495#3911248>, @lrzlin wrote:
>
>> @wangleiat
>> I have consulted the RISC-V codemodel here, which `CodeModel::Small` is represented by `addi (lui %hi(sym)) %lo(sym)`, using for accessing the first 2GiB of address space, I think it could be implemented in LoongArch also, or LoongArch have a different codemodel here?
>
> RISC-V only distinguishes when `relocation-model=static` is specified, but it is not required on LoongArch. On LoongArch, regardless of `relocation-model=everything`, it is sufficient to use pc-relative instructions.
Without the `isPositionIndepent()` and code-model check, original `getAddr()` will map the `PseudoLA_GOT` pattern in GHC calling convention (in `ghc-cc.ll`), which is obviously incorrect (should be `LA_PCREL`). In case that all relocation-models are sufficient to use pc-relative instructions, both `CodeModel=Small` and `CodeModel=Medium` could keep being `LA_PCREL`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137495/new/
https://reviews.llvm.org/D137495
More information about the llvm-commits
mailing list