<< | Classic compiler structure | >> |
gcc
program
is the same as original K&R C Compiler:
gcc
/cc
)
processes arguments, and decides which other programs to run.cc1
/...) is invoked once for each
source file.cc1
is an assembly file,
which is assembled using as
program.<< | Slow compilation | >> |
cc1
(and as
)
for each source file.cc1
internal state (such
as predefined declarations).<< | Re-reading header files | >> |
<< | Inter-module optimization | >> |
<< | This is work-in-progress | >> |
gcc
.cc1
also applies to other Gcc compilers.cpplib
.<< | Multi-input mode | >> |
gcc
and cc1
changes.gcj
has supported this mode for a while in an ad hoc manner.<< | Server mode | >> |
cc1
waits for compilation requests../.cc1-server
.<< | Initialization | >> |
<< | Re-using text, tokens, or trees? | >> |
<< | Dependencies and invalidation vs re-use | >> |
<< | Inconsistent header file use | >> |
inc.h
:
struct device { dev_t index; };
a.c
:
#define dev_t int #include "inc.h"
b.c
:
typedef short dev_t; #include "inc.h"
<< | Extended one-definition rule | >> |
<< | Fragments | >> |
cpplib
changes modest.<< | cpplib fragment handling | >> |
cpplib
's (existing but disabled) include file cache.cpplib
logic and directive handling mostly unchanged.enter_fragment
call-back.exit_fragment
call-back.binding_level
.enter_fragment
succeeds, cpplib
skips
forward to end of fragment.<< | Remembering and restoring declarations | >> |
<< | Fragment/nesting overlap | >> |
struct
) is spread
out over multiple fragments.<< | Non-nesting example | >> |
// fragment 1 extern void F1(T1); struct St { int value; #ifdef __cplusplus // fragment 2 int getValue() { return value; } #endif // fragment 3 }; extern void F2(T2);
<< | Handling non-nesting | >> |
nesting
counter that
is non-zero when inside a declaration.nesting>0
on fragment enter or exit.nesting>0
on fragment boundary, combine neighboring fragments
into one.#define
,
#undef
or #include
.<< | Other complications | >> |
<< | Preliminary results | >> |
Carbon.h
,
which includes many of Apple's GUI headers.gcc
,c
is over 30% faster using client+server..c
files yields similar speed-up.<< | Conclusion and status |