Skip to content

Commit 141270c

Browse files
evodius96Benson Chu
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 aa84337 commit 141270c

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
@@ -1382,9 +1382,10 @@ void ARMAsmPrinter::EmitUnwindingInstruction(const MachineInstr *MI) {
13821382
case ARM::VMRS:
13831383
case ARM::VMRS_FPEXC:
13841384
// If a function spills FPSCR or FPEXC, we copy the values to low
1385-
// registers before pushing them. Record the copy so we can emit the
1386-
// correct ".save" later.
1387-
AFI->EHPrologueRemappedRegs[DstReg] = SrcReg;
1385+
// registers before pushing them. However, we can't issue annotations
1386+
// for FP status registers because ".save" requires GPR registers, and
1387+
// ".vsave" requires DPR registers, so don't record the copy and simply
1388+
// emit annotations for the source registers used for the store.
13881389
break;
13891390
case ARM::tLDRpci: {
13901391
// Grab the constpool index and check, whether it corresponds to

0 commit comments

Comments
 (0)