[PATCH] D23986: [XRay] Detect and emit sleds for sibling/tail calls

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 03:23:50 PDT 2016


dberris created this revision.
dberris added reviewers: echristo, rSerge, majnemer.
dberris added a subscriber: llvm-commits.
Herald added subscribers: dberris, mehdi_amini.

This change promotes the 'isTailCall(...)' member function to
TargetInstrInfo as a query interface for determining on a per-target
basis whether a given MachineInstr is a tail call instruction. We build
upon this in the XRay instrumentation pass to emit special sleds for
tail call optimisations, where we emit the correct kind of sled.

The tail call sleds look like a mix between the function entry and
function exit sleds. Form-wise, the sled comes before the "jmp"
instruction that implements the tail call similar to how we do it for
the function entry sled. Functionally, because we know this is a tail
call, it behaves much like an exit sled -- i.e. at runtime we may use
the exit trampolines instead of a different kind of trampoline.

A follow-up change to recognise these sleds will be done in compiler-rt,
so that we can start intercepting these initially as exits, but also
have the option to have different log entries to more accurately reflect
that this is actually a tail call.

https://reviews.llvm.org/D23986

Files:
  include/llvm/Target/Target.td
  include/llvm/Target/TargetInstrInfo.h
  include/llvm/Target/TargetOpcodes.def
  lib/CodeGen/XRayInstrumentation.cpp
  lib/Target/Hexagon/HexagonInstrInfo.h
  lib/Target/X86/X86InstrInfo.cpp
  lib/Target/X86/X86InstrInfo.h
  lib/Target/X86/X86MCInstLower.cpp
  test/CodeGen/X86/xray-tail-call-sled.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23986.69550.patch
Type: text/x-patch
Size: 9086 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160829/8f8b6b62/attachment.bin>


More information about the llvm-commits mailing list