Skip to content

Commit 9467409

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 c1bc16d commit 9467409

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

0 commit comments

Comments
 (0)