[all-commits] [llvm/llvm-project] dff303: [lld][LoongArch] Implement TLSDESC GD/LD to IE/LE.
Zhaoxin Yang via All-commits
all-commits at lists.llvm.org
Mon Jan 20 23:45:03 PST 2025
Branch: refs/heads/users/ylzsx/r-tlsdesc-to-iele-norelax
Home: https://github.com/llvm/llvm-project
Commit: dff3031fdb2ca3755b73e3b81e56f8008a409470
https://github.com/llvm/llvm-project/commit/dff3031fdb2ca3755b73e3b81e56f8008a409470
Author: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: 2025-01-21 (Tue, 21 Jan 2025)
Changed paths:
M lld/ELF/Arch/LoongArch.cpp
M lld/ELF/InputSection.cpp
M lld/ELF/Relocations.cpp
M lld/ELF/Relocations.h
Log Message:
-----------
[lld][LoongArch] Implement TLSDESC GD/LD to IE/LE.
Support TLSDESC to initial-exec or local-exec optimizations. Introduce a new hook
RE_LOONGARCH_RELAX_TLS_GD_TO_IE_PAGE_PC and use existing R_RELAX_TLS_GD_TO_IE_ABS
to support TLSDESC => IE, while use existing R_RELAX_TLS_GD_TO_LE to support
TLSDESC => LE.
In normal or medium code model, there are two forms of code sequences:
* pcalau12i $a0, %desc_pc_hi20(sym_desc)
* addi.d $a0, $a0, %desc_pc_lo12(sym_desc)
* ld.d $ra, $a0, %desc_ld(sym_desc)
* jirl $ra, $ra, %desc_call(sym_desc)
------
* pcaddi $a0, %desc_pcrel_20(sym_desc)
* ld.d $ra, $a0, %desc_ld(sym_desc)
* jirl $ra, $ra, %desc_call(sym_desc)
The code sequence obtained is as follows:
* pcalau12i $a0, %ie_pc_hi20(sym_ie)
* ld.[wd] $a0, $a0, %ie_pc_lo12(sym_ie)
Simplicity, whether tlsdescToIe or tlsdescToLe, we always tend to convert the preceding
instructions to NOPs, due to both forms of code sequence (corresponding to relocation
combinations: R_LARCH_TLS_DESC_PC_HI20+R_LARCH_TLS_DESC_PC_LO12 and R_LARCH_TLS_DESC_PCREL20_S2)
have same process.
FIXME: When relaxation enables, redundant NOPs can be removed. It will
be implemented in a future patch.
Note: All forms of TLSDESC code sequences should not appear interleaved in the normal,
medium or extreme code model, which compilers do not generate and lld is unsupported.
This is thanks to the guard in PostRASchedulerList.cpp in llvm.
```
Calls are not scheduling boundaries before register allocation, but
post-ra we don't gain anything by scheduling across calls since we
don't need to worry about register pressure.
```
Commit: 459e25d1a9d650ce957bba2b4aaed16a7fe56956
https://github.com/llvm/llvm-project/commit/459e25d1a9d650ce957bba2b4aaed16a7fe56956
Author: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: 2025-01-21 (Tue, 21 Jan 2025)
Changed paths:
M lld/test/ELF/loongarch-tlsdesc-pcrel20-s2.s
M lld/test/ELF/loongarch-tlsdesc.s
Log Message:
-----------
Modify loongarch-tlsdesc.s and loongarch-tlsdesc-pcrel20-s2.s
Commit: 894a97ac11c05ed59f608ceb3c8db6401464dc1c
https://github.com/llvm/llvm-project/commit/894a97ac11c05ed59f608ceb3c8db6401464dc1c
Author: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: 2025-01-21 (Tue, 21 Jan 2025)
Changed paths:
M lld/test/ELF/loongarch-relax-tlsdesc.s
Log Message:
-----------
Modify loongarch-relax-tlsdesc.s init.
Commit: 5262935fdadb981f7ad0039ed315d6570fe6f0c5
https://github.com/llvm/llvm-project/commit/5262935fdadb981f7ad0039ed315d6570fe6f0c5
Author: yangzhaoxin <yangzhaoxin at loongson.cn>
Date: 2025-01-21 (Tue, 21 Jan 2025)
Changed paths:
M lld/test/ELF/loongarch-relax-tlsdesc.s
Log Message:
-----------
Modify loongarch-relax-tlsdesc.s
Compare: https://github.com/llvm/llvm-project/compare/dff3031fdb2c%5E...5262935fdadb
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list