Splitting builtin support between the IR and the backend
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 338
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
As per the title, I think it would be paramount to split the builtins support between the backend and the middleend, the reason that I propose this is fourfold:
- By splitting the support to the middleend initially, we will be able to optimize the register usage for individual uses, preventing the expensive calling convention setups for fastcall.
- Depending on the architecture, if there is no instruction-level support, we could theoretically insert an IR-level block for what we want to do and have the optimizer work with that.
- Some builtins are platform specific, if we mark those builtins in the middle-end we can spit them out and say "Not supported for this platform" and error out because of it
- Continuing with 4, when there IS a platform specific builtin, we can optimize how we get into a valid state for it and execute the individual instruction, allowing us to support sse intrinsics without having expensive move-arounds (related to #304 in a way).
This is a rather hefty issue so I definitely think this belongs sometime after milestone 4, possibly after milestone 5.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating how builtin support is currently divided between the compiler's middle-end and backend; the issue does not name specific files or tests. Define the IR boundary for builtins, including register usage and platform-specific support, before changing implementation. Done means backend and middle-end responsibilities are separated, unsupported platform builtins are rejected, and supported instruction-level paths avoid unnecessary calling-convention setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100