Code

What are the issues in design of a code generator. Explain in detail?

What are the issues in design of a code generator. Explain in detail?
  1. What is code generator in compiler design?
  2. What is the main purpose of code generator?
  3. What does a target code generator do explain the various forms of a target program that a target code generator can produce?
  4. What is peephole optimization explain its characteristics?
  5. How many primary task are there in code generator?
  6. Which function is used by code generator to determine the status of available registers and the location of name values?
  7. What is the target machine model of the code generator?
  8. What are the One Pass code generation methods explain any one?
  9. What is next use information and simple code generator?
  10. How we can optimize target code?
  11. Why is the code optimizations are carried out on the intermediate code?
  12. Why is intermediate code important?
  13. What is register allocation issues in compiler design?
  14. How many variables can a register hold?
  15. What is peephole in compiler design?
  16. Is peep hole one word or two?
  17. What is meant by back patching?

What is code generator in compiler design?

Code generator decides what values to keep in the registers. Also, it decides the registers to be used to keep these values. Ordering of instructions : At last, the code generator decides the order in which the instruction will be executed. It creates schedules for instructions to execute them.

What is the main purpose of code generator?

In computing, code generation is the process by which a compiler's code generator converts some intermediate representation of source code into a form (e.g., machine code) that can be readily executed by a machine.

What does a target code generator do explain the various forms of a target program that a target code generator can produce?

Target code generation deals with assembly language to convert optimized code into machine understandable format. Target code can be machine readable code or assembly code. Each line in optimized code may map to one or more lines in machine (or) assembly code, hence there is a 1:N mapping associated with them .

What is peephole optimization explain its characteristics?

A simple but effective technique for improving the target code is peephole optimization, a method for trying to improving the performance of the target program by examining a short sequence of target instructions (called thepeephole) and replacing these instructions by a shorter or faster sequence, whenever possible.

How many primary task are there in code generator?

In qphix-codegen, we consider three primary objects: instructions, addresses, and vector registers. These are defined in the instructions.

Which function is used by code generator to determine the status of available registers and the location of name values?

Explanation: Code generator uses getReg function to determine the status of available registers and the location of name values.

What is the target machine model of the code generator?

The target computer is a type of byte-addressable machine. It has 4 bytes to a word. The target machine has n general purpose registers, R0, R1,...., Rn-1.

What are the One Pass code generation methods explain any one?

In the one pass compiler, when the line source is processed, it is scanned and the token is extracted. Then the syntax of each line is analyzed and the tree structure is build. After the semantic part, the code is generated. The same process is repeated for each line of code until the entire program is compiled.

What is next use information and simple code generator?

29.4 Next-Use Information.

Next-use information is needed for dead-code elimination and register allocation. Next-use is computed by a backward scan of a basic block. The next-use information will indicate the statement number at which a particular variable that is defined in the current position will be reused.

How we can optimize target code?

Optimizing the target code is done by the compiler. Usage of registers,select and move instructions is part of optimization involved in the target code.

Why is the code optimizations are carried out on the intermediate code?

Explanation: Code optimizations are carried out on the intermediate code because program analysis is more accurate on intermediate code than on machine code.

Why is intermediate code important?

The intermediate code keeps the analysis portion same for all the compilers that's why it doesn't need a full compiler for every unique machine. Intermediate code generator receives input from its predecessor phase and semantic analyzer phase. It takes input in the form of an annotated syntax tree.

What is register allocation issues in compiler design?

In compiler optimization, register allocation is the process of assigning local automatic variables and expression results to a limited number of processor registers.

How many variables can a register hold?

5) There is no limit on number of register variables in a C program, but the point is compiler may put some variables in register and some not.

What is peephole in compiler design?

Peephole optimization is a type of Code Optimization performed on a small part of the code. It is performed on the very small set of instructions in a segment of code. The small set of instructions or small part of code on which peephole optimization is performed is known as peephole or window.

Is peep hole one word or two?

a small hole or opening through which to peep or look, as in a door.

What is meant by back patching?

Back patching usually refers to the process of resolving forward branches that have been planted in the code, e.g. at 'if' statements, when the value of the target becomes known, e.g. when the closing brace or matching 'else' is encountered.

Why does an animal need to adapt to their environment?
All organisms need to adapt to their habitat to be able to survive. This means adapting to be able to survive the climatic conditions of the ecosystem...
What wildlife is found in Western Europe?
The mammal fauna of the ecoregion is mostly composed of species widespread throughout Europe: red deer (Cervus elaphus), fallow deer (Dama dama), Roe ...
What happend wen you rubbed the chromatophorses?
These freckles are called chromatophores. They are made of tiny sacs of color that can be stretched by muscles that are controlled by nerves coming fr...