[PATCH] D53540: [COFF, ARM64] Implement support for SEH extensions __try/__except

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 23 11:02:13 PDT 2018


mgrang added inline comments.


================
Comment at: lib/Target/AArch64/AArch64AsmPrinter.cpp:571
+    MCInst TmpInst;
+    TmpInst.setOpcode(AArch64::MOVKXi);
+    TmpInst.addOperand(MCOperand::createReg(MI->getOperand(0).getReg()));
----------------
I see that X86 generates LEA to calculate the address of the .L label. AArch64 does not have a similar instruction. I tried to use ADRP + ADD but that requires either a GlobalSymbol or an ExternalSymbol type. However, the .L label is of type MCSymbol.

So I generate a MOVK x1, #.Lfoo. The problem is that MOVK takes an unsigned immediate. The .L label here represents offset from FP. This works if the offset is positive. But for negative offsets we should generate a MOVN. However, I am not sure how to detect negative immediate without first generating a MOV.

Any suggestions?


================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:2731-2732
+  MCSymbol *OffsetSym =
+      MF.getMMI().getContext().getOrCreateParentFrameOffsetSymbol(
+          GlobalValue::dropLLVMManglingEscape(Fn->getName()));
+  SDValue OffsetSymVal = DAG.getMCSymbol(OffsetSym, PtrVT);
----------------
rnk wrote:
> Yeah, this was a great hack. :)
I am not really familiar with this piece of code. Could you please comment on whether this should work for AArch64?


================
Comment at: lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp:219
   case AArch64::fixup_aarch64_movw:
-    Ctx.reportError(Fixup.getLoc(),
-                    "no resolvable MOVZ/MOVK fixups supported yet");
-    return Value;
+    // 16-bit immediate. Assumed unsigned.
+    return Value & 0xffff;
----------------
As I commented above, we assume a non-negative immediate.


https://reviews.llvm.org/D53540





More information about the llvm-commits mailing list