This is an archive of the discontinued LLVM Phabricator instance.

[ISel] Emit DBG CALLSITE/CALLSITEPARAM instrs
AbandonedPublic

Authored by djtodoro on Feb 11 2019, 3:41 AM.

Details

Summary

This implements general algorithm that recognize copy instruction which forward function arguments to next function call.
Algorithm iterates thorough call sequence nodes and extracts all CopyToReg nodes. They are later mapped to COPY instructions that forward argument value to next function call. It tries to match copied source value with list of function input argument node list. If it manages to match such CopyToReg reg node it considers it as SDNode that transfer argument. Such verification is needed in order to dispatch target depended call sequence CopyToReg nodes that do not transfer argument value. Such cases can be found for example when we have variadic function, or for architectures that require additional register loading in order to perform function call by their ABI. First version of this feature tracks only parameters that are transferred through register location.
The other way, which could avoid this matching, would be to lower this implementation to the target depended level where call sequence is been generated.
After we have match those nodes, we just insert them in ISel representation of call sites and leave it for InstrEmitter to emit them as DBG_CALLSITE and DBG_CALLSITEPARAM.

For DBG_CALLSITE first argument is bool value that represents whether represented call is tail call or not. Next argument is provided as register location for indirect calls if call is indirect. And the last argument is reference to call site metadata. Following DBG_CALLSITEPARAM instruction is attached as a bundle to previous one. Its first argument is register used to transfer argument to another function call frame. Second operand is reference to call site parameter metadata. Next arguments represent location that is loaded into parameter transferring register. We have location, offset and expression over that location. Just to mention that some of the arguments data might be extracted differently but for the sake of simplicity we chose to hold call related information at one place.

Authors: @asowda, @NikolaPrica, @djtodoro, @ivanbaev

Diff Detail