summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <efriedma@codeaurora.org>2018-10-30 19:24:51 +0000
committerEli Friedman <efriedma@codeaurora.org>2018-10-30 19:24:51 +0000
commit93d0129b78ca6b9b84ad0af1e2e42b9d3d92754c (patch)
tree25c7346ae3800a5b4ef3dadc0badda6bd7ae169f
parent1f786b8d959e4d54e4c61254dcecb9ab8112851e (diff)
downloadbcm5719-llvm-93d0129b78ca6b9b84ad0af1e2e42b9d3d92754c.tar.gz
bcm5719-llvm-93d0129b78ca6b9b84ad0af1e2e42b9d3d92754c.zip
[AArch64] [Windows] SEH opcodes should be scheduling boundaries.
Prevents the post-RA scheduler from modifying the prologue sequences emitting by frame lowering. This is roughly similar to what we do for other targets: TargetInstrInfo::isSchedulingBoundary checks isPosition(), which checks for CFI_INSTRUCTION. isSEHInstruction is taken from D50288; it'll land with whatever patch lands first. Differential Revision: https://reviews.llvm.org/D53851 llvm-svn: 345634
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstrInfo.cpp34
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstrInfo.h7
-rw-r--r--llvm/test/CodeGen/AArch64/wineh1.mir2
-rw-r--r--llvm/test/CodeGen/AArch64/wineh2.mir2
-rw-r--r--llvm/test/CodeGen/AArch64/wineh3.mir2
-rw-r--r--llvm/test/CodeGen/AArch64/wineh4.mir2
-rw-r--r--llvm/test/CodeGen/AArch64/wineh5.mir2
-rw-r--r--llvm/test/CodeGen/AArch64/wineh6.mir2
-rw-r--r--llvm/test/CodeGen/AArch64/wineh7.mir2
9 files changed, 48 insertions, 7 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index 503bda08a9c..4953892ed4a 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -1085,6 +1085,32 @@ bool AArch64InstrInfo::isFalkorShiftExtFast(const MachineInstr &MI) const {
}
}
+bool AArch64InstrInfo::isSEHInstruction(const MachineInstr &MI) {
+ unsigned Opc = MI.getOpcode();
+ switch (Opc) {
+ default:
+ return false;
+ case AArch64::SEH_StackAlloc:
+ case AArch64::SEH_SaveFPLR:
+ case AArch64::SEH_SaveFPLR_X:
+ case AArch64::SEH_SaveReg:
+ case AArch64::SEH_SaveReg_X:
+ case AArch64::SEH_SaveRegP:
+ case AArch64::SEH_SaveRegP_X:
+ case AArch64::SEH_SaveFReg:
+ case AArch64::SEH_SaveFReg_X:
+ case AArch64::SEH_SaveFRegP:
+ case AArch64::SEH_SaveFRegP_X:
+ case AArch64::SEH_SetFP:
+ case AArch64::SEH_AddFP:
+ case AArch64::SEH_Nop:
+ case AArch64::SEH_PrologEnd:
+ case AArch64::SEH_EpilogStart:
+ case AArch64::SEH_EpilogEnd:
+ return true;
+ }
+}
+
bool AArch64InstrInfo::isCoalescableExtInstr(const MachineInstr &MI,
unsigned &SrcReg, unsigned &DstReg,
unsigned &SubIdx) const {
@@ -1137,6 +1163,14 @@ bool AArch64InstrInfo::areMemAccessesTriviallyDisjoint(
return false;
}
+bool AArch64InstrInfo::isSchedulingBoundary(const MachineInstr &MI,
+ const MachineBasicBlock *MBB,
+ const MachineFunction &MF) const {
+ if (TargetInstrInfo::isSchedulingBoundary(MI, MBB, MF))
+ return true;
+ return isSEHInstruction(MI);
+}
+
/// analyzeCompare - For a comparison instruction, return the source registers
/// in SrcReg and SrcReg2, and the value it compares against in CmpValue.
/// Return true if the comparison instruction can be analyzed.
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.h b/llvm/lib/Target/AArch64/AArch64InstrInfo.h
index 05721336df7..e8e93e64200 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.h
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.h
@@ -189,6 +189,10 @@ public:
unsigned FalseReg) const override;
void getNoop(MCInst &NopInst) const override;
+ bool isSchedulingBoundary(const MachineInstr &MI,
+ const MachineBasicBlock *MBB,
+ const MachineFunction &MF) const override;
+
/// analyzeCompare - For a comparison instruction, return the source registers
/// in SrcReg and SrcReg2, and the value it compares against in CmpValue.
/// Return true if the comparison instruction can be analyzed.
@@ -262,6 +266,9 @@ public:
/// Returns true if the instruction has a shift by immediate that can be
/// executed in one cycle less.
bool isFalkorShiftExtFast(const MachineInstr &MI) const;
+ /// Return true if the instructions is a SEH instruciton used for unwinding
+ /// on Windows.
+ static bool isSEHInstruction(const MachineInstr &MI);
private:
/// Sets the offsets on outlined instructions in \p MBB which use SP
diff --git a/llvm/test/CodeGen/AArch64/wineh1.mir b/llvm/test/CodeGen/AArch64/wineh1.mir
index 6df9c638e65..c89daf1ce22 100644
--- a/llvm/test/CodeGen/AArch64/wineh1.mir
+++ b/llvm/test/CodeGen/AArch64/wineh1.mir
@@ -1,4 +1,4 @@
-# RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog -filetype=obj -disable-post-ra \
+# RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog -filetype=obj \
# RUN: | llvm-readobj -unwind | FileCheck %s
# This test case checks the basic validity of the .xdata section. It's
# documented at:
diff --git a/llvm/test/CodeGen/AArch64/wineh2.mir b/llvm/test/CodeGen/AArch64/wineh2.mir
index 29b20963444..e2c31fd56ce 100644
--- a/llvm/test/CodeGen/AArch64/wineh2.mir
+++ b/llvm/test/CodeGen/AArch64/wineh2.mir
@@ -1,5 +1,5 @@
# RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog \
-# RUN: -disable-post-ra -filetype=obj | llvm-readobj -unwind | FileCheck %s
+# RUN: -filetype=obj | llvm-readobj -unwind | FileCheck %s
# Test that the pre/post increment save of a flating point register is correct.
# CHECK: ExceptionData {
diff --git a/llvm/test/CodeGen/AArch64/wineh3.mir b/llvm/test/CodeGen/AArch64/wineh3.mir
index 6d54430cfc5..ffca6c157a3 100644
--- a/llvm/test/CodeGen/AArch64/wineh3.mir
+++ b/llvm/test/CodeGen/AArch64/wineh3.mir
@@ -1,5 +1,5 @@
# RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog \
-# RUN: -disable-post-ra -filetype=obj | llvm-readobj -unwind | FileCheck %s
+# RUN: -filetype=obj | llvm-readobj -unwind | FileCheck %s
# Test that the register pairing of both general purpose and floating point
# registers is correctly saved in the .xdata section, as well as the pre/post
# increment of floating point register pairs.
diff --git a/llvm/test/CodeGen/AArch64/wineh4.mir b/llvm/test/CodeGen/AArch64/wineh4.mir
index 39a0d7ec694..4d4cc892c2e 100644
--- a/llvm/test/CodeGen/AArch64/wineh4.mir
+++ b/llvm/test/CodeGen/AArch64/wineh4.mir
@@ -1,5 +1,5 @@
# RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog \
-# RUN: -disable-branch-fold -disable-post-ra -filetype=obj \
+# RUN: -disable-branch-fold -filetype=obj \
# RUN: | llvm-readobj -unwind | FileCheck %s
# Check that multiple epilgoues are correctly placed in .xdata.
diff --git a/llvm/test/CodeGen/AArch64/wineh5.mir b/llvm/test/CodeGen/AArch64/wineh5.mir
index f1fa6d4d47b..c47bad5d290 100644
--- a/llvm/test/CodeGen/AArch64/wineh5.mir
+++ b/llvm/test/CodeGen/AArch64/wineh5.mir
@@ -1,5 +1,5 @@
# RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog \
-# RUN: -disable-post-ra -filetype=obj | llvm-readobj -unwind | FileCheck %s
+# RUN: -filetype=obj | llvm-readobj -unwind | FileCheck %s
# Check that that the large stack allocation is correctly represented in .xdata.
diff --git a/llvm/test/CodeGen/AArch64/wineh6.mir b/llvm/test/CodeGen/AArch64/wineh6.mir
index 08db6656980..fd1f9ece3a6 100644
--- a/llvm/test/CodeGen/AArch64/wineh6.mir
+++ b/llvm/test/CodeGen/AArch64/wineh6.mir
@@ -1,5 +1,5 @@
# RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog \
-# RUN: -disable-post-ra -filetype=obj | llvm-readobj -unwind | FileCheck %s
+# RUN: -filetype=obj | llvm-readobj -unwind | FileCheck %s
# Check save_fplr_x, set_fp, alloc_s
# CHECK: ExceptionData {
diff --git a/llvm/test/CodeGen/AArch64/wineh7.mir b/llvm/test/CodeGen/AArch64/wineh7.mir
index 60094539297..547c622a704 100644
--- a/llvm/test/CodeGen/AArch64/wineh7.mir
+++ b/llvm/test/CodeGen/AArch64/wineh7.mir
@@ -1,5 +1,5 @@
# RUN: llc -o - %s -mtriple=aarch64-windows -start-after=prologepilog \
-# RUN: -filetype=obj -disable-post-ra | llvm-readobj -unwind | FileCheck %s
+# RUN: -filetype=obj | llvm-readobj -unwind | FileCheck %s
# Check AddFP
# CHECK: ExceptionData {
OpenPOWER on IntegriCloud