[Integration][Go] Runtime LLVM support - #71
Conversation
|
Hello @zhouguangyuan0718 👋 Thank you for submitting a Pull Request (PR) to the LLVM Project. Since this is your first PR, here are a few useful links covering our main contribution policies and review practices.
Please reply to this message to confirm that you have read these policies, especially the LLVM AI Tool Use Policy, and that any AI tool usage has been noted in the PR description. Frequently asked questionsHow do I add reviewers? This PR will be automatically labeled, and the relevant teams will be notified. For some parts of the project, reviewers may also be added automatically. You can also add reviewers manually using the Reviewers section on this page. If you cannot use that section, it is probably because you do not have write permissions for the repository. In that case, you can request a review by tagging reviewers in a comment using What if there are no comments? If you have not received any comments on your PR after a week, you can request a review by pinging the PR with a comment such as “Ping”. The common courtesy ping rate is once a week. Please remember that you are asking for volunteer time from other developers. Are any special GitHub settings required to contribute to LLVM? We only require contributors to have a public email address associated with their GitHub commits, see this section of LLVM Developer Policy for details. If you have questions, feel free to leave a comment on this PR, or ask on LLVM Discord or LLVM Discourse. Thank you, |
c6f6af2 to
9743f08
Compare
9a95a71 to
c7d9623
Compare
Emit native Go stack checks by default for GoObj functions and use go-nosplit as the sole opt-out. Lower the morestack slow path as a raw ABI0 call rather than a statepoint. Give every Go function an independent entry-argument STACKMAP. Serialize it as map zero, derive map-zero transitions from the CFG-aware PCSP stream, and retain ordinary statepoint maps at live callsites. Preserve complete ABI register homes for stack-growth retries while omitting unused, potentially poison incoming pointers from the entry GC bitmap.
c7d9623 to
e544ba5
Compare
## Summary - keep R14 and XMM15 reserved under both Go calling conventions and retain the shared Go preserved-register model - repair ABIInternal reserved state in a late X86 machine pass after register allocation, frame lowering, and scheduling - identify direct ABI0 callees solely through the `<ABI0>` symbol suffix; statepoints use their existing calling-convention operand - leave late special calls outside the ordinary ABI transition path: morestack resumes through `gogo`, and write-barrier thunks use their dedicated ABIInternal clobber contract - keep SP-relative Go locals while preserving ABI-specific fixed incoming argument homes - emit native-compatible symbol-free x86 TLS relocations for the R14 reload ## Design R14 and XMM15 are fixed reserved registers rather than ordinary caller-saved or callee-saved allocation resources. The transition repair therefore does not participate in SelectionDAG lowering and does not require a target pseudo or a distinct ABI0 register mask. The `x86-go-abi` pre-emit pass scans finalized MachineInstr calls. For an ordinary Go call, `<ABI0>` is the only ABI0 identity. It inserts `XORPS XMM15, XMM15` and a TLS reload of R14 before ABI0-to-ABIInternal calls or after ABIInternal-to-ABI0 calls. Calls inserted late without the ordinary Go call mask are intentionally ignored. This matches native Go behavior for split-stack morestack calls and write-barrier thunks. ## Stack position This is the X86 ABI-boundary layer on top of merged #73 and merged #77. #71 remains the temporary cross-repository integration and payload PR until this PR is merged. ## Testing - independent Release plus assertions build of `llc` and `FileCheck` - focused LLVM lit validation: 7 of 7 passed - verified normal calls, statepoints, stack-return statepoints, GoObj relocations, stack growth, PCSP CFG handling, and ABI symbol naming - verified pass timing: no repair at finalize-isel or immediately before `x86-go-abi`; repair appears only after the late pass - verified native-special behavior: no repair is inserted after morestack or write-barrier calls
Purpose
This PR is the integration and revision-bound payload anchor for dependent Go PR llvm#128. The implementation is split into three review layers in dependency order:
#75 has been folded into #73 and closed. Please review functional diffs in #73 and #76. This PR intentionally keeps the combined head based on
llvm23.1.master, because the payload publisher accepts only main-base PRs and dependent Go CI is pinned to this PR head.Integrated behavior
go-nosplitis the sole target-level exception to stack growth and emits no morestack prologueruntime.morestack*is an ordinary ABI0 call, with no dedicated statepoint or GoObj name recognitionTesting
Local validation of the rewritten stack:
llcbuild for X86 and AArch64The new head now needs revision-bound payload publication and dependent Go joint CI.