Skip to content

Commit 69aa438

Browse files
evodius96pestctrl
authored andcommitted
[ARM] Avoid creating unwind annotations for FPSCR and FPEXC
Avoid annotating the saving of FPSCR and FPEXC for functions marked with the interrupt_save_fp attribute, even though this is done as part of frame setup. Since these are status registers, there really is no viable way of annotating this. Since these aren't GPRs or DPRs, they can't be used with .save or .vsave directives. Instead, just record that the intermediate registers r4 and r5 are saved to the stack again.
1 parent 7c9efd5 commit 69aa438

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

clang/test/CodeGen/arm-interrupt-save-fp-attr-status-regs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ void bar();
1717
__attribute__((interrupt_save_fp)) void test_generic_interrupt() {
1818
// CHECK-R: vmrs r4, fpscr
1919
// CHECK-R-NEXT: vmrs r5, fpexc
20-
// CHECK-R-NEXT: .save {fpscr, fpexc}
20+
// CHECK-R-NEXT: .save {r4, r5}
2121
// CHECK-R-NEXT: push {r4, r5}
2222
// .....
2323
// CHECK-R: pop {r4, r5}
2424
// CHECK-R-NEXT: vmsr fpscr, r4
2525
// CHECK-R-NEXT: vmsr fpexc, r5
2626

2727
// CHECK-M: vmrs r4, fpscr
28-
// CHECK-M-NEXT: .save {fpscr}
28+
// CHECK-M-NEXT: .save {r4}
2929
// CHECK-M-NEXT: push {r4}
3030
// .....
3131
// CHECK-M: pop {r4}

llvm/lib/Target/ARM/ARMAsmPrinter.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,9 +1384,10 @@ void ARMAsmPrinter::EmitUnwindingInstruction(const MachineInstr *MI) {
13841384
case ARM::VMRS:
13851385
case ARM::VMRS_FPEXC:
13861386
// If a function spills FPSCR or FPEXC, we copy the values to low
1387-
// registers before pushing them. Record the copy so we can emit the
1388-
// correct ".save" later.
1389-
AFI->EHPrologueRemappedRegs[DstReg] = SrcReg;
1387+
// registers before pushing them. However, we can't issue annotations
1388+
// for FP status registers because ".save" requires GPR registers, and
1389+
// ".vsave" requires DPR registers, so don't record the copy and simply
1390+
// emit annotations for the source registers used for the store.
13901391
break;
13911392
case ARM::tLDRpci: {
13921393
// Grab the constpool index and check, whether it corresponds to

0 commit comments

Comments
 (0)