انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

lecture 11:compiler II

Share |
الكلية كلية تكنولوجيا المعلومات     القسم قسم البرامجيات     المرحلة 3
أستاذ المادة حوراء شريف حمزة حسين       17/05/2015 17:54:22
Code Generation
The final phase in our compiler model is the code generator. It takes as input the
intermediate representation (IR) produced by the front end of the compiler,
along with relevant symbol table information, and produces as output a
semantically equivalent target program, as shown in figure below.
Position of code generator
The requirements imposed on a code generator are severe. The target program
must preserve the semantic meaning of the source program and be of high
quality; that is, it must make effective use of the available resources of the target
machine. Moreover, the code generator itself must run efficiently.
The challenge is that, mathematically, the problem of generating an optimal target
program for a given source program is undecidable; many of the subproblems
encountered in code generation such as register allocation are computationally
intractable. In practice, we must be content with heuristic techniques that generate
good, but not necessarily optimal, code. Fortunately, heuristics have matured
enough that a carefully designed code generator can produce code that is several
times faster than code produced by a naive one. Compilers that need to produce
efficient target programs, include an optimization phase prior to code
generation. The optimizer maps the IR into IR from which more efficient code
can be generated. In general, the code optimization and code-generation phases
of a compiler, often referred to as the back end, may make multiple passes over
the IR before generating the target program. The most important criterion for a
code generator is that it produces correct code.
1. Input to the Code Generator
The input to the code generator is
? The intermediate representation of the source program produced by the front end,
? The information in the symbol table that is used to determine the run-time
addresses of the data objects denoted by the names in the IR.

المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
الرجوع الى لوحة التحكم