Is there any compiler IR paradigms other than Three Address Code and Static Single Assignment (SSA) Form?

cs.stackexchange https://cs.stackexchange.com/questions/129870

  •  29-09-2020
  •  | 
  •  

Question

Specifically, I have tried boiling down the operations of a VM into the smallest possible standardized units and arrived at this:

allocate_stack(size)
fetch(offset_from_stack_pointer)
store(offset_from_stack_pointer)
call(index)

So you might have:

allocate_stack 6
fetch -2
store 0
fetch -1
store 1
call 72

Basically, the allocate_stack would tell you how much space you are allocating for fields in the stack. Then the fetch would queue up something relative to the stack to be stored (or fetch_a would fetch an absolute address). Then store would store the fetched value in the space relative to the stack (or store_a for absolute position). And finally, call <index> would call that specific function.

So basically these are 2-address codes instead of 3-address codes. Does anything like this exist out there where they've expanded upon the idea to find compiler optimizations and such, like 3-address-code and SSA form? If not like this, does anything else exist outside of 3-address-code and SSA form?

Was it helpful?

Solution

This is an extremely common approach to designing abstract machines for non-imperative languages. See, for example, the G machine or the WAM (which uses the same technique for heap allocation).

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top