# How do you represent 3 address codes?

## How do you represent 3 address codes?

1. Implementation of Three Address Code – There are 3 representations of three address code namely.
2. Quadruple – It is structure with consist of 4 fields namely op, arg1, arg2 and result.
3. Triples –
4. Indirect Triples –

What are the various addressing modes used during code generation?

• integer indexed by a register.
• immediate constant.

What is the cost of the instruction LD R1 * 100 R2?

The instruction LD R1,*100(R2) loads into register R1 the value given by contents(contents(100+contents(R2))). The cost is three because the constant 100 is stored in the word following the instruction.

### What is the difference between quadruples and indirect triples?

Thus, quadruple representation is easier to work with when using an optimizing compiler, which entails a lot of code movement. Indirect triple representation presents no such problems, because a separate list of pointers to the triple structure is maintained.

When we use quadruples as three address representation conditional and unconditional jumps put the target label in?

Quadruple Representation : Unconditional and conditional jump statements are represented by placing the target labels in the result field. For example, a quadruple representation of the three-address code for the statement x = (a + b) * – c/d is shown in Table 6.1.

What is addressing mode and types?

Addressing Modes– The term addressing modes refers to the way in which the operand of an instruction is specified. The addressing mode specifies a rule for interpreting or modifying the address field of the instruction before the operand is actually executed.

## What are different issues in code generation?

In the code generation phase, various issues can arises:

• Input to the code generator.
• Target program.
• Memory management.
• Instruction selection.
• Register allocation.
• Evaluation order.

Why we use basic blocks for three address set of instructions?

Basic Block is a set of statements which always executes one after other, in a sequence. The first task is to partition a sequence of three-address code into basic blocks. A new basic block is begun with the first instruction and instructions are added until a jump or a label is met.

Why are quadruples preferred over triples in an optimizing compiler?

Answer: Quadruples are preferred over triples in an optimizing compiler as instructions are often found to move around in it.

### What are the representations of three address code?

There are 3 representations of three address code namely. Quadruple. Triples. Indirect Triples. 1. Quadruple –. It is structure with consist of 4 fields namely op, arg1, arg2 and result. op denotes the operator and arg1 and arg2 denotes the two operands and result is used to store the result of the expression.

How many fields are there in a quadruple?

Quadruples The quadruples have four fields to implement the three address code. The field of quadruples contains the name of the operator, the first source operand, the second source operand and the result respectively.

How many operands are in three address code?

Three-address code is an intermediate code. It is used by the optimizing compilers. In three-address code, the given expression is broken down into several separate instructions. These instructions can easily translate into assembly language. Each Three address code instruction has at most three operands.

## How is three address code implemented in a compiler?

In compiler design, Three Address Code is implemented as a record with address fields. Representations used are-Quadruples, Triples and Indirect Triples. Problems On Quadruples, Triples and Indirect Triples.