Because of gp = sdata_start_address + 0x800, gp with signed twelve-bit offset could covert most of the small data section. Linker relaxation could transfer the multiple data accessing instructions to a gp base with signed twelve-bit offset instruction.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Target/RISCV/RISCVTargetObjectFile.cpp | ||
---|---|---|
33 | It seems we force a default value (4 or 8) even when the threshold flag is off (value is 0)? |
lib/Target/RISCV/RISCVTargetObjectFile.cpp | ||
---|---|---|
33 | Hi Ana, |
Correct the default small data limitation to 8 bytes for RV32 and RV64.
Setting the limitation to 0 for PIC.
The test case didn' add the testing line for PIC because we don't support pic yet, it will trigger "Unable to lowerGlobalAddress" error message.
lib/Target/RISCV/RISCVTargetObjectFile.cpp | ||
---|---|---|
97 | Here the flag value is overwritten by the module setting, so how can we use the flag? |
lib/Target/RISCV/RISCVTargetObjectFile.cpp | ||
---|---|---|
97 | We probably could remove riscv-ssection-threshold flag because front end won't pass the flag and emit the threshold by module flag. |
Remove riscv-ssection-threshold flag because front end will pass the threshold by module flag.
lib/Target/RISCV/RISCVTargetObjectFile.cpp | ||
---|---|---|
17 | We can put it in RISCVELFTargetObjectFile just like SmallDataSection and SmallBSSSection |
Many thanks for this. I've added some minor formatting and comment phrasing nits, but otherwise this is looking good to me.
lib/CodeGen/AsmPrinter/AsmPrinter.cpp | ||
---|---|---|
260 | clang-format prefers const_cast<TargetLoweringObjectFile &> | |
lib/Target/RISCV/RISCVTargetObjectFile.cpp | ||
91 | Style: should be auto &MFE : ModuleFlags | |
test/CodeGen/RISCV/sdata-limit-0.ll | ||
7 | "so we expect no data will be put in sbss or sdata." | |
test/CodeGen/RISCV/sdata-limit-4.ll | ||
7 | "@v will be put in sbss, but @r won't be put in sdata" | |
test/CodeGen/RISCV/sdata-limit-8.ll | ||
7 | "@v will be put in sbss and @r will be put in sdata" | |
test/CodeGen/RISCV/sdata-local-sym.ll | ||
8 | "@v will b put in sbss and @r will be put in sdata" |
clang-format prefers const_cast<TargetLoweringObjectFile &>