Intermediate code formulas
Intermediate code generation. 5 formulas for GATE CS Compiler Design, each with when to use it. Each is explained in the topic notes.
IAE Academy: Intermediate code generation formulas (GATE CS)
All 5 Intermediate code formulas
INSTRUCTION AND TEMPORARY COUNT FOR AN ASSIGNMENT
For where has operator occurrences and nothing is shared. The scheme gives each operator a new temporary (temporaries are never reused) and then copies the last one to . With a DAG, replace by the number of operator nodes in the DAG.
ONE-DIMENSIONAL ARRAY ADDRESS
is the width of one element in bytes and is the lower bound of the index. For a 0-based array the term is just .
TWO-DIMENSIONAL ARRAY ADDRESS, ROW-MAJOR
is the number of columns, and are the lower bounds. Row-major is the default for C-style arrays unless stated otherwise.
TWO-DIMENSIONAL ARRAY ADDRESS, COLUMN-MAJOR
is the number of rows. Use this only when the question says the layout is column-major.
ASSIGNMENTS IN SSA FORM
Each original assignment gets exactly one new name, and each is one more assignment. Since each SSA name is assigned once, this is also the number of names created by assignments and -functions. Variables that are only read and never assigned (inputs) keep their names and are not counted.
Where this was asked: 2024 (1), 2025 (1). See the 2 previous-year questions on Intermediate code. This shows what was asked, not what will be asked.