Java Reference
In-Depth Information
The extra steps associated with use of an intermediate language raise justifi-
able concerns of e
ciency. A given system that uses ILss may not enjoy the
performance of a competing product that avoids ILss and takes a more direct
approach. The benefits and cost of an ILs must be analyzed and compared.
While gratuitous levels of intermediate representation are unwise, thoughtful
system designs include ILss to simplify the task at hand as well as reduce the
cost of adapting and maintaining the given system. In support of this, we
next examine some principles and examples concerning the role of ILss in an
e
ff
ective programming language translation system.
10.1.2 The Middle-End
For a compiler, the terms front-end and back-end refer to the phases re-
sponsible for parsing the input language and generating the target language,
respectively. Most compilers are structured with a set of components between
the front- and back-ends, commonly called the compiler's middle-end . While
such a termmay seem nonsensical, the collection of phases situated between a
compiler's front-end and back-end can greatly simplify the crafting of a com-
piler. In particular, compiler suites that host multiple source languages and
target multiple instruction sets obtain great leverage from a middle-end.
Consider a suite of compilers (such as GNU Compiler Collection (GCC))
for s source languages (C
++
, Fortran, Java, etc.) and t target architectures (Intel,
,etc.).Ifadi
Sparc TM ,MIPS R
erent product is needed for each situation, then
this suite might contain s × t source- and target-specific compilers, as shown
in Figure 10.3(a). However, this work can be reduced to s + t e
ff
ort if an ILs
can be introduced between the source and target specifications, as shown in
Figure 10.3(b). Now the suite contains s front-ends and t back-ends: each
front-end translates its source language to the ILs; each back-end translates
the ILs into native code for its architecture. The middle-end processes the ILs
in ways that benefit all of the sources and targets.
Additional advantages obtainedby craftinga compiler to include amiddle-
end and formally defining its ILs are as follows:
ff
An IL allows various system components to interoperate by facilitating
access to information about the program undergoing translation.
For example, the IL may contain symbolic information such as variable
names, variable types, and source line numbers; such information could
be useful in the debugger. Similarly, program development tools such as
class browsers and performance profilers, operating at di
erent points
in the software development cycle, can share and utilize program infor-
mation through the IL.
ff
 
 
Search WWH ::




Custom Search