[PATCH] D144048: [RISCV] Add preferred function and loop alignment RISCVSubtarget. NFC
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 14 14:43:16 PST 2023
craig.topper created this revision.
craig.topper added reviewers: reames, asb, luismarques, kito-cheng.
Herald added subscribers: luke, VincentWu, vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, kristof.beyls, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.
Herald added a project: LLVM.
These seem like properties we will want to adjust based on -mtune.
Move them to subtarget like is done on ARM and AArch64. Don't add
any overrides yet.
Note there's a slight change here. We are now passing Align(1) for
preferred function alignment where we previously passed the minimum
alignment. As far as I could tell, it will be maxed with min when
it used so this should be ok.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D144048
Files:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Target/RISCV/RISCVSubtarget.h
Index: llvm/lib/Target/RISCV/RISCVSubtarget.h
===================================================================
--- llvm/lib/Target/RISCV/RISCVSubtarget.h
+++ llvm/lib/Target/RISCV/RISCVSubtarget.h
@@ -56,6 +56,9 @@
uint8_t MaxInterleaveFactor = 2;
RISCVABI::ABI TargetABI = RISCVABI::ABI_Unknown;
std::bitset<RISCV::NUM_TARGET_REGS> UserReservedRegister;
+ Align PrefFunctionAlignment;
+ Align PrefLoopAlignment;
+
RISCVFrameLowering FrameLowering;
RISCVInstrInfo InstrInfo;
RISCVRegisterInfo RegInfo;
@@ -95,6 +98,9 @@
}
bool enableMachineScheduler() const override { return true; }
+ Align getPrefFunctionAlignment() const { return PrefFunctionAlignment; }
+ Align getPrefLoopAlignment() const { return PrefLoopAlignment; }
+
/// Returns RISCV processor family.
/// Avoid this function! CPU specifics should be kept local to this class
/// and preferably modeled with SubtargetFeatures or properties in
Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -1014,7 +1014,9 @@
// Function alignments.
const Align FunctionAlignment(Subtarget.hasStdExtCOrZca() ? 2 : 4);
setMinFunctionAlignment(FunctionAlignment);
- setPrefFunctionAlignment(FunctionAlignment);
+ // Set preferred alignments.
+ setPrefFunctionAlignment(Subtarget.getPrefFunctionAlignment());
+ setPrefLoopAlignment(Subtarget.getPrefLoopAlignment());
setMinimumJumpTableEntries(5);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144048.497448.patch
Type: text/x-patch
Size: 1573 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230214/a3cd8560/attachment.bin>
More information about the llvm-commits
mailing list