JKTKops / JKTKops/cspim

TAC / MIPS too closely coupled

Open
#2 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Haskell
Stars
5
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Due to the TAC IR's requirement of understanding register allocation, it is very tightly coupled to the `MIPS.Reg` and `MIPS.FReg` data types, through `MemLoc`. By making some sort of `RegRep` class it should be possible to decouple these.

Instances of such a class would almost certainly need to also satisfy `(Enum, Bounded)`. It would need to be possible to determine if there are unused registers of a particular type (caller saved, callee saved) given a list of such registers currently in use. It would also probably be necessary to know if the target language distinguishes between floating point and regular registers (use case for an Associated Type Family?).

Of course all of this is just to be able to re-use optimizations on the IR for other target languages; so it may be sufficient to determine the target language before entering into the compilation pipeline, create some kind of `TargetInfo` structure describing the properties of the target language, and use this (possibly combined with a `RegRep` class) in the optimizer to help increase modularity further.

This is a very long-term goal, I think, since cspim is focused on, well, Spim, for now. This will probably entail a large refactor in the future.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.