nrdmn / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
0 stars 1 forks source link

STM8 registers #5

Open tyalie opened 6 months ago

tyalie commented 6 months ago

[!NOTE] I know that there's a branch called stm8-register and this one is called stm8-registers. When we created the stm8-register branch, I don't think we very ready to actually separate every feature in their own branch as the fundamental structure was missing and we did not knew enough. But that has changed, so I'll try again

This PR tracks what the title says. This is for implementing / feature complete the STM8RegisterInfo class and the accompanying STM8RegisterInfo.td file.

The current status is that there are a few TODOs in these two files that still need to be looked at / two functions that need to be fully implemented. I'll track the TODOs here too.

TODOs

are the chosen reg classes sensible?

This is a TODO mostly to remind us that this can be easily modified if necessary. The current register classes chosen mostly orient themselves according how the AVR backend does it, but it could also mean that it doesn't fit for STM8.

We will probably discover problems here only over time as we implement other aspects of the backend - so I expect this to be open for a long time.

is R_PCHL necessary?

This is a register that joins the PC High and Low register into a single 16bit reg. The description from the previously TODO also applies here. We need to figure this out over a longer time period.

STM8RegisterInfo::getPointerRegClass

Every backend must override this method. For other targets this might be quite easy, but several comments in the LLVM codebase suggests that this can be instruction depended. In some cases that could mean that this depends on the addressing mode we're operating in. Currently just the PC reg class was chosen.

STM8RegisterInfo::eliminateFrameIndex

Yeah no clue for now. I haven't rly took the time to look into it yet