Splitting BB pre SelectionDAG

Hi everyone,
I’m faily new to LLVM, I’m working on a new backend.

In my backend, one of the requirements is to split a BB on every call, I considered putting some kind of pseudo instruction using the TargetLowering::LowerCall function.

Before going said path, I was wondering if there is some way to split the BB before the SelectionDAG is generated, this way the call instruction would be last in the SelectionDAG would be last and won’t get deleted during the combining stage.

Thanks in advance, Liad.

You can’t/shouldn’t do this before SelectionDAG, since an operation could be legalized using a call when there was no call present in the original IR. Additionally, you would still need to separate the code you emit for the call setup sequence.