Skip to content

Commit b8f68b1

Browse files
committed
Address comments
1 parent ef4e45f commit b8f68b1

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

llvm/docs/RISCVUsage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Supported
183183
.. _riscv-rve-note:
184184

185185
``E``
186-
Support of RV32E/RV64E and ilp32e/lp64e ABIs are experimental. To be compatible with the implementation of ilp32e in GCC, we don't use aligned registers to pass variadic arguments and set stack alignment to 4-bytes for types with length of 2*XLEN.
186+
Support of RV32E/RV64E and ilp32e/lp64e ABIs are experimental. To be compatible with the implementation of ilp32e in GCC, we don't use aligned registers to pass variadic arguments. Furthermore, we set the stack alignment to 4 bytes for types with length of 2*XLEN.
187187

188188
.. _riscv-scalar-crypto-note1:
189189

llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ void RISCVTargetStreamer::setTargetABI(RISCVABI::ABI ABI) {
5151
void RISCVTargetStreamer::emitTargetAttributes(const MCSubtargetInfo &STI,
5252
bool EmitStackAlign) {
5353
if (EmitStackAlign) {
54-
if (STI.hasFeature(RISCV::FeatureRVE))
55-
emitAttribute(RISCVAttrs::STACK_ALIGN, STI.hasFeature(RISCV::Feature32Bit)
56-
? RISCVAttrs::ALIGN_4
57-
: RISCVAttrs::ALIGN_8);
54+
if (TargetABI == RISCVABI::ABI_ILP32E)
55+
emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_4);
56+
else if (TargetABI == RISCVABI::ABI_LP64E)
57+
emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_8);
5858
else
5959
emitAttribute(RISCVAttrs::STACK_ALIGN, RISCVAttrs::ALIGN_16);
6060
}

llvm/lib/Target/RISCV/RISCVCallingConv.td

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ def CSR_XLEN_F64_Interrupt: CalleeSavedRegs<(add CSR_Interrupt,
4242
(sequence "F%u_D", 0, 31))>;
4343

4444
// Same as CSR_Interrupt, but excluding X16-X31.
45-
def CSR_Interrupt_RVE : CalleeSavedRegs<(add X1, (sequence "X%u", 5, 15))>;
45+
def CSR_Interrupt_RVE : CalleeSavedRegs<(sub CSR_Interrupt,
46+
(sequence "X%u", 16, 31))>;
4647

4748
// Same as CSR_XLEN_F32_Interrupt, but excluding X16-X31.
48-
def CSR_XLEN_F32_Interrupt_RVE: CalleeSavedRegs<(add CSR_Interrupt_RVE,
49-
(sequence "F%u_F", 0, 31))>;
49+
def CSR_XLEN_F32_Interrupt_RVE: CalleeSavedRegs<(sub CSR_XLEN_F32_Interrupt,
50+
(sequence "X%u", 16, 31))>;
5051

5152
// Same as CSR_XLEN_F64_Interrupt, but excluding X16-X31.
52-
def CSR_XLEN_F64_Interrupt_RVE: CalleeSavedRegs<(add CSR_Interrupt_RVE,
53-
(sequence "F%u_D", 0, 31))>;
53+
def CSR_XLEN_F64_Interrupt_RVE: CalleeSavedRegs<(sub CSR_XLEN_F64_Interrupt,
54+
(sequence "X%u", 16, 31))>;

llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,13 @@ RISCVRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
8888
}
8989

9090
BitVector RISCVRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
91-
const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
9291
const RISCVFrameLowering *TFI = getFrameLowering(MF);
9392
BitVector Reserved(getNumRegs());
9493
auto &Subtarget = MF.getSubtarget<RISCVSubtarget>();
9594

9695
// Mark any registers requested to be reserved as such
9796
for (size_t Reg = 0; Reg < getNumRegs(); Reg++) {
98-
if (STI.isRegisterReservedByUser(Reg))
97+
if (Subtarget.isRegisterReservedByUser(Reg))
9998
markSuperRegs(Reserved, Reg);
10099
}
101100

@@ -116,7 +115,7 @@ BitVector RISCVRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
116115
markSuperRegs(Reserved, RISCV::DUMMY_REG_PAIR_WITH_X0);
117116

118117
// There are only 16 GPRs for RVE.
119-
if (STI.isRVE())
118+
if (Subtarget.isRVE())
120119
for (MCPhysReg Reg = RISCV::X16; Reg <= RISCV::X31; Reg++)
121120
markSuperRegs(Reserved, Reg);
122121

0 commit comments

Comments
 (0)