Which of the following is a machine dependent optimization?

Which of the following is a machine dependent optimization?

4 Answers. Machine Independent optimization: Loop optimization, Redundancy elimination, folding, Strength reduction, Deadlock elimination. Machine Dependent optimization: Register allocation, Use of addressing modes, Peephole optimization.

What is machine dependent and independent code optimization?

Machine-independent optimization phase tries to improve the intermediate code to obtain a better output. Machine-dependent optimization is done after generation of the target code which is transformed according to target machine architecture. This involves CPU registers and may have absolute memory references.

What are the 3 areas of code optimization?

A code optimizing process must follow the three rules given below: The output code must not, in any way, change the meaning of the program….Basic block identification

  • First statement of a program.
  • Statements that are target of any branch (conditional/unconditional).
  • Statements that follow any branch statement.

What are machine dependent codes?

The kernel is divided into two major parts: the machine-independent code and the machine-dependent code. The former is shared among the ports, is entirely in C, and contains the algorithms and data structures that do not depend on the architecture on which the kernel is running.

What is machine dependent optimization?

Machine Dependent Optimization – Machine-dependent optimization is done after the target code has been generated and when the code is transformed according to the target machine architecture. It involves CPU registers and may have absolute memory references rather than relative references.

Which of the following is machine independent?

Answer: A Machine Independent language is one that can run on any machine. An example of this would be Java. Because of the Java Virtual Machine or JVM it can take the compiled code for any given Java App and run it on the machine you are attempting to run it on.

What are the criteria for achieving machine dependent optimization and machine independent optimization?

The machine dependent optimization is attained by the following measures:

  • Allocation of adequate number of resources to enhance the execution efficiency of the program.
  • Use of immediate instructions wherever required.
  • The use of intermix instructions.

How do you write optimized code?

Basic Code Optimizations in C

  1. Unroll small loops: Most of the times Compiler does this automatically, but it is a good habit of writing optimized codes.
  2. Avoid calculations in loop: We should avoid any calculation which is more or less constant in value.

What is machine dependent optimization in compiler design?

Machine-dependent optimization is done after the target code has been generated and when the code is transformed according to the target machine architecture. It involves CPU registers and may have absolute memory references rather than relative references.

What is meant by Backpatching?

backpatching is a process in which the operand field of an instruction containing a forward reference is left blank initially. the address of the forward reference symbol is put into this field when its definition is encountered in the program.

How is machine independent optimization used in compiler?

Machine Independent Optimization – This code optimization phase attempts to improve the intermediate code to get a better target code as the output. The part of the intermediate code which is transformed here does not involve any CPU registers or absolute memory locations.

What do you mean by machine dependent optimization?

What is Machine Dependent Optimization? Machine-based optimization entails transformations that take into account the target machine’s properties, such as registers and special machine instruction sequences, among other things. These techniques are used on the target code that is produced.

How are machine dependent transformations used in compilers?

Most compilers use a statement-by-statement code generation approach, which results in a target code that contains redundant instructions and suboptimal constructs. Some machine-dependent transformations are added to such code to boost it. The peephole optimization technique is a straightforward and efficient machine-dependent process.

When is optimization done on the intermediate code?

When optimization is done on the intermediate code, it is called the machine independent code optimization. There are different techniques for achieving machine independent code optimization. They are described using following examples. Read bellow lines of code. According to the above code, b = x+2 is calculated again and again in each iteration.

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top