This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
dev:crosscompiler:backend_arm:register_allocation [2018/12/18 13:17] – [Register Usage] ursgraf | dev:crosscompiler:backend_arm:register_allocation [2019/08/29 16:01] – [Parameter Passing] ursgraf | ||
---|---|---|---|
Line 3: | Line 3: | ||
===== Register Usage ===== | ===== Register Usage ===== | ||
- | Registers can be classified as // | ||
| Register | State | Use | | | Register | State | Use | | ||
| R0 | volatile | 1st. parameter, local variables, return value | | | R0 | volatile | 1st. parameter, local variables, return value | | ||
Line 14: | Line 13: | ||
| R15 | dedicated | PC | | | R15 | dedicated | PC | | ||
| D0 | dedicated| scratch register | | | D0 | dedicated| scratch register | | ||
- | | D1 | volatile | + | | D1 | dedicated| scratch register, return value | |
- | | D2-D6 | volatile | further | + | | D2-D6 | volatile | parameters, local variables | |
| D7-D10 | volatile | local variables | | | D7-D10 | volatile | local variables | | ||
| D11-D31 | nonvolatile | local variables | | | D11-D31 | nonvolatile | local variables | | ||
Line 32: | Line 31: | ||
For the translation of certain SSA instructions (e.g. of type long) further auxiliary registers are needed. They are assigned and reserved by the register allocator as well. | For the translation of certain SSA instructions (e.g. of type long) further auxiliary registers are needed. They are assigned and reserved by the register allocator as well. | ||
- | ==== Parameter Passing ==== | + | ===== Parameter Passing |
Parameters are passed in R0..R5 and D1..D6.\\ | Parameters are passed in R0..R5 and D1..D6.\\ | ||
- | In the interface // | + | In the interface // |
+ | |S0|S1|S2|S3|S4|S5|S6|S7|S8|S9|S10|S11| | ||
+ | | D0 || D1 || D2 || D3 || D4 || D5 || | ||
+ | | ^| ^^a| ^ b ^^c| ^ d ^^ | ||
- | ==== Locals on the Stack ==== | + | ===== Locals on the Stack ===== |
Most SSA instruction have 2 operands and a result. Each of them can reside on the stack. Operands must be fetched into a free register, the result must be stored onto the stack. A single SSA instruction '' | Most SSA instruction have 2 operands and a result. Each of them can reside on the stack. Operands must be fetched into a free register, the result must be stored onto the stack. A single SSA instruction '' | ||
Line 55: | Line 57: | ||
+ | When dividing numbers of type long, a large number of auxiliary registers are necessary. For these cases the register allocation is run with a reduced register set with the same reserved registers as above given above. |