[PATCH] D17736: [SSP, 1/2] Refactor to support customizable stack guard load from IR level.

Tim Shen via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 21:58:58 PDT 2016


timshen updated this revision to Diff 51512.
timshen added a comment.

I looked at LLVM manual and fortunately both llvm.stackprotector and
llvm.stackprotectorcheck is required to be passed in @__stack_chk_guard.
This limited flexibility allows us to directly change stackprotectorcheck's
signature and make an auto-upgrade for it.

In long term, I'd like to keep a diamond code path:

1. An IR pass that generates IR that calls llvm.stackprotector, llvm.stackprotectorcheck and llvm.experimental_stackguardvalue.
2. Either FastISel, or SelectionDAG handles the generated IR. Their shouldn't be an "IR approach" when FastISel isn't turned on (see the comment on TLI::supportsSelectionDAGSP).
3. Optional backend lowering is supported by overriding TLI::forceLoadStackGuardNode and TLI::getStackGuardAddr.

Notice that forceLoadStackGuardNode and getStackGuardAddr serves following
different purposes:

- Some backends want to lower the global variable manually, in such case forceLoadStackGuardNode should return true and getStackGuardAddr returns the global variable (search LOAD_STACK_GUARD in lib/Target).
- Other platforms, e.g. PowerPC 64 bit wants to lower the stack guard loading completely manually, getStackGuardAddr should returns nullptr.
- For the rest forceLoadStackGuardNode returns false and getStackGuardAddr returns the global variable.


http://reviews.llvm.org/D17736

Files:
  docs/LangRef.rst
  include/llvm/IR/Intrinsics.td
  include/llvm/Target/TargetLowering.h
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  lib/CodeGen/StackProtector.cpp
  lib/CodeGen/TargetLoweringBase.cpp
  lib/IR/AutoUpgrade.cpp
  lib/Target/AArch64/AArch64ISelLowering.cpp
  lib/Target/AArch64/AArch64ISelLowering.h
  lib/Target/ARM/ARMISelLowering.cpp
  lib/Target/ARM/ARMISelLowering.h
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17736.51512.patch
Type: text/x-patch
Size: 23755 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160324/495296da/attachment-0001.bin>


More information about the llvm-commits mailing list