Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Handle instruction lowering without intermediate variables #7

Open
maxgillett opened this issue Apr 9, 2023 · 0 comments
Open

Handle instruction lowering without intermediate variables #7

maxgillett opened this issue Apr 9, 2023 · 0 comments

Comments

@maxgillett
Copy link
Member

We do not currently support the lowering of an instruction in which the virtual register storing its destination operand is used directly by a subsequent instruction, without first being stored in the stack (see the difference between the two examples below).

%6:anygpr(p0) = G_FRAME_INDEX %stack.2
%7:anygpr(s32) = G_LOAD %2(p0) :: (dereferenceable load (s32) from %ir.3)
%8:anygpr(s32) = G_LOAD %3(p0) :: (dereferenceable load (s32) from %ir.4)
%9:anygpr(s32) = nsw G_MUL %7, %8
G_STORE %9(s32), %6(p0) :: (store (s32) into %ir.5)
%10:anygpr(s32) = G_LOAD %6(p0) :: (dereferenceable load (s32) from %ir.5)
%12:anygpr(s32) = nsw G_ADD %10, %11
%7:anygpr(s32) = G_LOAD %2(p0) :: (dereferenceable load (s32) from %ir.3)
%8:anygpr(s32) = G_LOAD %3(p0) :: (dereferenceable load (s32) from %ir.4)
%9:anygpr(s32) = nsw G_MUL %7, %8
%11:anygpr(s32) = nsw G_ADD %9, %10

As we do not have physical registers, to support this we will need to store the intermediate result (e.g. %9 in the second example) in the stack. We should do this statically, and reuse stack items.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant