We add a field IsOutlined to indicate whether a MachineFunction
is outlined and set it true for outlined functions in MachineOutliner.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
2,890 ms | x64 debian > Clang.Driver::clang-offload-bundler.c |
Event Timeline
llvm/include/llvm/CodeGen/MachineFunction.h | ||
---|---|---|
377 | If we add this property, it needs to be connected to MIR parsing and printing. |
I tried, but it seems to be hard.
We call these outlined functions as function, but they are just shared code fragments with only one basic block. There are some differences between normal functions and outlined functions:
- For outlined functions, they end with a JALR instruction (in which isReturn is false); while for normal functions, they end with a PseudoRET (in which isReturn is true). So the only basic block in outlined function is not ReturnBlock(See MachineBasicBlock::isReturnBlock()).
- For normal functions, the live-outs of ReturnBlock are callee-saved registers and return value(s)? (IIUC, correct me if I am wrong). But all defs in outlined functions should be live.
I digged into LivePhysRegs.cpp and I could't find a way to add live-outs manually.
Do the T-Head specific pseudos being expanded need to expanded as late as the other pseudos? Could you have an earlier expansion pass? I was already nervous about the short forward branch instructions being affected before. I know we determined those cases were ok.
Yes and thanks, I just tried. They can be placed in addPreEmitPass() just like MCP.
Apart from this, do you think it's still worthy marking outlined functions?
If you mean adding the IsOutlined field, I think that it's a good idea. Currently the only way to recognize if a function is outlined is to look at its name, which isn't great. The field is an improvement.
I think it needs a small MIR testcase though. :)
I thought the earlier conclusion was that the RISC-V part wasn’t needed if T-Head moves their pseudo expansion in their downstream.
Yes, let's drop the RISC-V part of this if there's not a good motivation for running MCP so late.
Remove MCP parts and add MIR test.
I didn't find a target-independent way to test this, so I add some CHECKs to existed RISCV test.
If we add this property, it needs to be connected to MIR parsing and printing.