On books, articles, slides and tutorials about intermediate representation used in compilers, the Three Address Code (TAC) is a common one. My question is about the following examples of TAC
t0 = a
t1 = a + b
a = t2
In this example, we have three lines with two variables: a and b; and three temporaries: t0, t1 and t2. When converting such TACs to MIPS assembly, for instance, the first and last one could easily be something like the following:
lw t0, sp, a.offset
sw t2, sp, a.offset
But I must admit that I have no idea on how to translate the middle TAC since MIPS (and many other RISC processors) doesn't have an instruction capable of fetching two memory operands at the same time.
So my questions are: (1) how one would translate such TAC to a RISC instruction and; (2) why such TAC is commonly used when so many processors nowadays are RISC based ones? Is it a legacy from the time when processors used to be more CISC based and allowed multiple fetchs from memory?
OR
Maybe I have a wrong interpretation of what variable means on such TACs. If so, how should I interpret such variables in TACs?