CBSE BOARD X, asked by Anonymous, 1 year ago

Write a short note on Issues in the design of a code generator ????

Answers

Answered by Anonymous
13

The following issue arises during the code generation phase:

Input to code generator –

The input to code generator is the intermediate code generated by the front end, along with information in the symbol table that determines the run-time addresses of the data-objects denoted by the names in the intermediate representation. Intermediate codes may be represented mostly in quadruples, triples, indirect triples, Postfix notation, syntax trees, DAG’s etc. Assume that they are free from all of syntactic and state semantic errors, the necessary type checking has taken place and the type-conversion operators have been inserted wherever necessary.

Target program –

Target program is the output of the code generator. The output may be absolute machine language, relocatable machine language, assembly language.

Absolute machine language as an output has advantages that it can be placed in a fixed memory location and can be immediately executed.

Relocatable machine language as an output allows subprograms and subroutines to be compiled separately. Relocatable object modules can be linked together and loaded by linking loader.

Assembly language as an output makes the code generation easier. We can generate symbolic instructions and use macro-facilities of assembler in generating code.

Memory Management –

Mapping the names in the source program to addresses of data objects is done by the front end and the code generator. A name in the three address statement refers to the symbol table entry for name. Then from the symbol table entry, a relative address can be determined for the name.

Instruction selection –

Selecting best instructions will improve the efficiency of the program. It includes the instructions that should be complete and uniform. Instruction speeds and machine idioms also plays a major role when efficiency is considered.But if we do not care about the efficiency of the target program then instruction selection is straight-forward.

#Hope it helps u✨

Answered by Anonymous
6

The following issue arises during the code generation phase:

Input to code generator – ...

✔✔Target program – ...

✔✔Memory Management – ...

✔✔Instruction selection – ...

✔✔Register allocation issues – ...

✔✔Evaluation order – ...

✔✔Approaches to code generation issues: Code generator must always generate the correct code.

Similar questions