[PATCH] D42356: [AArch64] Implement dynamic stack probing for windows

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 06:15:33 PST 2018


aemerson added inline comments.


================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:7452
+
+  SDValue Callee = DAG.getTargetExternalSymbol("__chkstk", PtrVT, 0);
+
----------------
mstorsjo wrote:
> aemerson wrote:
> > Unfortunately it seems we need to pass a const char* to this because of lifetime issues at codegen. Do you have any ideas on how to do this better?
> I don't think I'm following what the issue is here? Right now I'm passing "__chkstk" as a const char* here. Do you mean further, if refactoring this into a form that also suits darwin, with a different function name? In that case, the method providing the function name could probably just return const char* as well, instead of e.g. a StringRef.
Sorry I didn't word that right. I meant that when I tried to use the getStackProbingSymbol hook from TargetLowering it returns a StringRef, so I had to hard code the string in this function as a short term solution. It's ok if we only need it for one platform, but it would be nice to have it configurable by the specific platform.


================
Comment at: test/CodeGen/AArch64/win64_vararg.ll:171
+; CHECK: sub     x20, x8, x15, lsl #4
 ; CHECK: mov     sp, x20
 ; CHECK: ldur    x21, [x29, #-40]
----------------
mstorsjo wrote:
> This form produces the pattern of "mov x8, sp; sub x20, x8, x15, lsl #4; mov sp x20", when it could just as well do "sub sp, sp, x15, lsl #4; mov x20, sp" - however I didn't manage to make the code in AArch64ISelLowering do that - any hints?
> 
> The version I did in D41131 for the fixed stack parts use BuildMI(MBB, MBBI, DL, TII->get(AArch64::SUBXrx64), AArch64::SP).addReg(AArch64::SP, RegState::Kill).addReg(AArch64::X15, RegState::Kill).addImm(AArch64_AM::getArithExtendImm(AArch64_AM::UXTX, 4)) - which achieves exactly what I want.
I don't know of any way to do that without using getCopyFromReg, not to say there definitely isn't a better way.


Repository:
  rL LLVM

https://reviews.llvm.org/D42356





More information about the llvm-commits mailing list