summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-05-31 16:33:26 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-05-31 16:33:26 +0000
commit90aba024c539cd214f2e124890355246db431104 (patch)
tree95009ea6c2d2f436d937fc19db0179139c0be434 /llvm/lib
parentf0f53b86d9aff13b245a16cbf6822f356c0e65bc (diff)
downloadbcm5719-llvm-90aba024c539cd214f2e124890355246db431104.tar.gz
bcm5719-llvm-90aba024c539cd214f2e124890355246db431104.zip
[MC] Fallback on DWARF when generating compact unwind on AArch64
Instead of asserting when using the def_cfa directive with a register different from fp, fallback on DWARF. Easily triggered with: .cfi_def_cfa x1, 32; rdar://40249694 Differential Revision: https://reviews.llvm.org/D47593 llvm-svn: 333667
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
index 998a5ef3ceb..c39111478f0 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
@@ -455,9 +455,17 @@ public:
return CU::UNWIND_ARM64_MODE_DWARF;
case MCCFIInstruction::OpDefCfa: {
// Defines a frame pointer.
- assert(getXRegFromWReg(MRI.getLLVMRegNum(Inst.getRegister(), true)) ==
- AArch64::FP &&
- "Invalid frame pointer!");
+ unsigned XReg =
+ getXRegFromWReg(MRI.getLLVMRegNum(Inst.getRegister(), true));
+
+ // Other CFA registers than FP are not supported by compact unwind.
+ // Fallback on DWARF.
+ // FIXME: When opt-remarks are supported in MC, add a remark to notify
+ // the user.
+ if (XReg != AArch64::FP)
+ return CU::UNWIND_ARM64_MODE_DWARF;
+
+ assert(XReg == AArch64::FP && "Invalid frame pointer!");
assert(i + 2 < e && "Insufficient CFI instructions to define a frame!");
const MCCFIInstruction &LRPush = Instrs[++i];
OpenPOWER on IntegriCloud