0% found this document useful (0 votes)
144 views

M2 Session4

1. Compiler technology has several applications including implementing high-level programming languages, optimizing programs for computer architectures, aiding in the design of new computer architectures, performing program translations between languages, and creating software productivity tools. 2. Compilers can optimize code for parallelism at the instruction and processor level to improve performance on modern architectures with memory hierarchies. 3. Compiler techniques like type checking, bounds checking, and memory management tools can improve software reliability by detecting errors.

Uploaded by

Amarnath Kambale
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views

M2 Session4

1. Compiler technology has several applications including implementing high-level programming languages, optimizing programs for computer architectures, aiding in the design of new computer architectures, performing program translations between languages, and creating software productivity tools. 2. Compilers can optimize code for parallelism at the instruction and processor level to improve performance on modern architectures with memory hierarchies. 3. Compiler techniques like type checking, bounds checking, and memory management tools can improve software reliability by detecting errors.

Uploaded by

Amarnath Kambale
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

1.

5 Applications of Compiler Technology [Imp]

 Implementation of high level programming language.

 Optimization for computer architecture .

 Design of new computer architecture.

 Program Translation

 Software Productivity tools


Implementation of high level programming language.
• A high level programming language defines a programming
abstractions.
• The programmer express an algorithm using the language and
compiler must translate that program to the target language.
• HLL are easier to program in but are less efficient.

• LLL produces more efficient code but they are harder to write, less
portable and more prone to errors and harder to maintain.
• Optimizing compilers improves the performance of inefficiency
intoduced by HLLs.
Optimization for computer architecture .
• The rapid evolution of computer architecture has also demand for
new compiler technology. Almost all high performance systems
take advantage of the two basic techniques

• Parallelism

• Memory hierarchies.

Parallelism: It can be found at several levels.

• At the instruction level->where multiple operation are executed


simultaneously.

• At the processor level->where different threads of the same


application are run on different processors.
Instruction level parallelism
• All modern microprocessor exploit instruction level parallelism.

• This parallelism can be hidden from the programmer.

• Programs are written as if all instruction were executed in sequence.

• The hardware dynamically checks for the dependencies in the


sequential instruction stream and issues them in parallel when possible.

• In some cases, the machine includes a hardware scheduler that can


change the instruction ordering to increase the parallelism in the
program.

• Whether the hardware reorders the instruction or not , compiler can


rearrange the instruction to make instruction level parallelism more
effective
Ex:
• VLIW ( very long instruction word) machine have
instruction that can issue multiple operations in parallel.

• Intel IA-64 architecture.


Processor level parallelism
• Personal computers often have multiple processors.

• Programmer can write multi threaded code for multiprocessor or parallel code can
be automatically generated by a compiler from sequence program.

• Such a compiler hides from the programmer the details of finding parallelism in a
program distributing the computation across the machine and minimizing
synchronization and communication among the processor.
Memory Hierarchies
• A memory hierarchies consists of several levels of storage with different
speeds and sizes.
• With the level closet to the processor being the fastest but smallest..
• Both parallelism and the existence of a memory hierarchy improve the
potential performance of a machine.
• Memory hierarchies are found in all machine.
• A processor usually has a small number of registers consisting of 100
bytes , several level of caches containing kilo bytes to mega bytes,
physical memory containing mega bytes to giga bytes , finally secondary
storage that contains giga bytes and beyond.
• It is possible to improve the effectiveness of memory hierarchy by
changing the layout of the data or changing the order of instructions
accessing the data.
Design of new Computer architecture
• In early day of computer architecture design , compiler are developed
after the machine were built. That has changed now.
• In modern computer architecture development compiler are developed
in the processor design stage and compiled code running on simulator
is used to evaluate the proposed architectural features.
1.RISC [ Reduced instruction set computer]: Most architecture like power
pc, SPARC, MIPS, alpha are RISC concepts.
2.CISC [ complex instruction set computer]: It includes complex memory
addressing modes to support data structures accesses and procedure
invocation instruction that save register and pass parameter on the stack.
8086 architecture are CISC concepts.
All these architecture are developed by corresponding compiler technology.
Program Translations
• Compiler as a translation from a high level language to the machine
level same technology can be applied to translate between different
kinds of language.
1. Binary Translation
• Complier technology can be used to translate the binary code for one
machine to that of another allowing a machine to run programs
originally complied for another instruction set.
• Binary translation technology has been used by various computer
companies to increase the availability of software for their machine.
• Binary translator have been developed to convert 8086 code into alpha
and sparc code.
2. Hardware Synthesis
• Not only in software written H.L.L , even hardware design are mostly
described in high level language . Hardware description language like
VHDL (very high speed integrated circuit hardware description
language)

• Hardware design are typically described at RTL (register transfer level),


where variables represents register and expression represents
combinational logic.

• Hardware synthesis tool translated RTL description automatically into


gates, which are then mapped to transistors and to physical layout.
3. Database Query Interpreters
• Besides specifying software, hardware languages are useful
in many other applications like SQL are used to search
databases.

• DB queries consists of predicates containing relational and


Boolean operators. They can be interpreted or compiled into
commands to search a database for records satisfying that
predicate.
5. Software productivity tools[IMP-4M]

• The problem of finding all program errors is undecidable.

 Type checking

 Bounds Checking

 Memory management tools


Type Checking

• Type checking is an effective and well established technique to


catch inconsistencies in programs
• It can be used to catch errors.

Ex: Where an operation is applied to the wrong type of object or


if parameter passed to a procedure do not match the signature of
the procedure.
Bounds Checking
• It is easier to make mistakes when programming in a low
level language than a high level one.

EX: many security breaches in system are caused by buffer


overflows in program written in C. Because C does not have
array bounds checks, it is up to the user to ensure that, the
arrays are not accessed out of bounds.

• Failing to check that the data supplied by the user can


overflow a buffer.

• Techniques have been developed to find buffer overflows in


programs but with limited success.
Memory management tools
• Garbage collection is another excellent example of the trade
off between efficiency and a combination of ease of
programming and software reliability.

• Automatic memory management tool catches memory


management errors(Memory leaks)

• Various tools have been developed to help programmers find


memory management errors.

• Ex: Purify is a widely used tool that dynamically catches


memory management error as they occur.
1.4 The science of Building a compiler

1. Modelling in compiler design and implementation

•The study of compiler are mainly a study of

• How we design the right mathematical models & choose the


right algorithms

• Some of most fundamentals models are finite state machines &


RE.

• Fundamental models of CFG used to describe the syntactic


structure of programming language such as nesting of
parenthesis or control constructs.
2. The science of code optimization
• The term optimization in compiler design refer to compiler makes to
produce code that is more efficient than obvious code.

• In modern times, the optimization of the code compiler performs has


become more complex and more important.

Compiler optimization must meet the following design objectives

• The optimization must be correct, i.e preserve the meaning of the


compiled program.

• The optimization must improve the performance of programs.

• The compilation time must be kept reasonable

• The engineering effort required must be manageable.

You might also like