aristanetworks / aristanetworks/purescript-backend-optimizer

Unpack TCO loops

Open
#18 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
PureScript
Stars
216
Forks
24
Avg merge
8m
Merged PRs (30d)
2

Description

It would be nice to unpack TCO loops, such that TCO arguments that are always known constructors don't need allocations. This would give us something comparable to call-pattern-specialization in the TCO pass. We essentially already do this for mutually recursive TCO bindings, as a special case.

It doesn't strictly need to be a TCO pass, as it would obviously be nice to have this even when the backend doesn't need TCO. It just seems like a straightforward extension for now.

Additionally, by doing it as part of codegen, we can avoid an explosion of specialized bindings (one for every specialization of constructors).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the TCO pass and its existing handling of mutually recursive TCO bindings, then compare that with call-pattern-specialization. Done means known constructor arguments in TCO loops avoid allocations, without creating one specialized binding per constructor specialization; consider whether the optimization can also apply when the backend does not require TCO.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.