Está en la página 1de 825

796 Index

patterns
peephole optimization, 593, 622629
tree, 599, 608620
peephole optimization, 593, 622631
control-flow operations, 626, 628
dead values, 626628
defined, 622
for instruction selection, 621631
logical windows, 628629
physical windows, 628629
window size, 623
perfect hashing, 73
perfect pipelining, 674
pessimistic algorithms, 518, 594
physical register, 335
pipelined loops, 666673
See also loop scheduling; loops
PL8 compiler, 398, 719
pointer analysis, 489, 535
pointer-based computations, 176
pointers, 175176
activation record, 16, 280
ambiguous, 341, 427
and anonymous values, 378379
assignments, 318, 426428
defined, 175
dereferences, 70, 163
in indirection structure, 366
to integer, 175
list, 701, 749
manipulation, 176
static analysis and, 489
type safety with, 176
values, 378379, 489
polymorphism, 176
positional encoding, 352353
positive closure, 35
postdominance, 546
postorder number, 481
postreturn sequences, 308, 394395
PostScript, 3
powerset, 45
precall sequences, 308, 393395
call-by-value parameters, 345, 346
defined, 309
precedence
arithmetic, 94
closure, 36
levels of, 93
non terminal association with, 93
precedence graph, 644
precise collectors, 319

predicated execution, 357358, 381384


predictive grammar, 103, 109
prefixing, 292
preorder walk, 505, 508
prettyprinter, 235
priority
backward list scheduling, 658
forward list scheduling, 656
procedure call abstraction, 270275
procedure calls, 180, 272275, 392396
complex control flow, 275
data-flow analysis and, 488
implementing, 339, 392
imprecision, 488, 489
leaf procedure optimizations, 462
multiple sites, 392
parameter evaluation, 393394
procedure-valued parameters, 234, 394
register save/restore, 394395
summary problems, 493494
procedure cloning, 571572
procedures, 269323
arguments, 163
callee, 270
caller, 270
called, 250, 297
epilogue sequence, 308309
functions, 270, 279
implicit arguments, 393
invoking, 163
leaf, 462
linkage, 308312, 392396
nested, 272
placement, 462466
prologue sequence, 308309
procedure-valued parameters, 234, 394
productions, 86
breaking, into two pieces, 201
left-factoring, 107108
left-recursive, 101
useless, 149
profile data, 452453, 663664
profitability
optimization and, 414
resource constraints and, 670
prologue code, 672673
promotion, 563564
pruned SSA, 504, 519, 697

R
random replacement, 338
range checking, 367369

reaching definitions, 491


real-time collectors, 322
receivers, 286
recognizers, 26
construction with scanner generator, 73
DFAs as, 5759, 7475
direct-coded, 78
encoding, into table, 3233
implementing, 32
regular expression specifications, 3441
recompilation, 467468, 471
recurrence, 670
recursive-descent parsers, 84, 108110, 141,
149, 155
construction strategy, 110
for expressions, 111
implementation of EPrime( ), 110
large grammar and, 208
for predictive grammar, 103, 109
speed, 115
structure, 109
See also top-down parsers
reduce action, 124, 136
reduced expression grammar, 152, 153
reduce-reduce conflict, 140, 144
reducible graphs, 527, 529, 530, 533
reduction, 116
redundancy elimination, 420428, 490491,
551559, 565569
with DAGs, 2, 232
reference counting, 317318, 321
See also garbage collection
region constants, 582584
regional optimization, 417418
analysis, 417
focus, 418
join points, 476
See also optimization scope
regional scheduling, 661666
EBBs, 661663
loops, 663664
trace, 663664
See also instruction scheduling
register allocation, 1720, 600, 679720
defined, 600
global, 693713
harder problems in, 713715
instruction scheduling and, 600
instruction selection and, 600
local, 684693
memory models, 250252
register assignment, 681683
register classes, 341, 683684

Index 797

registers, 679
callee-saves, 310, 394, 561
caller-saves, 394, 395, 561
condition-code, 355, 624, 732
keeping values in, 340341
memory vs., 681682
predicate, 684
restoring, 394395
saved values, 282, 310
saving, 310311, 394395
register-to-register model, 250252, 335
See also memory models
register-transfer language (RTL), 240, 631
defined, 631
regular expressions (REs), 3441, 8586
alternation, 35, 40, 41, 46
closure, 35
closure properties, 3941
closure-free, 7778
concatenation, 35
construction from DFA, 42, 7475
defined, 26, 34
deriving NFAs from, 4547
finite automata and, 4245
finite closure, 35
notation 3536
positive closure, 35
precedence, 36, 46
properties, 3941
regular languages, 34, 39, 41, 77
regular grammars, 95
regular languages, 34, 39
relationals, 350358
adding, to expression grammar, 351
numerical encoding, 351352
positional encoding, 352353
rematerialization, 716
renaming, 505510, 573574
after -insertion, 506
avoiding antidependencies and, 647
dynamic register, 659
as enabling transformation, 570574
register assignment and, 647, 682
representations
arbitrary graphs, 746747
Boolean, 350358
linear, 235243
linked list, 240, 739
list, 701, 739740
sparse-set, 741743
string, 369374
symbol table, 253254

representing sets, 738743


representing trees, 743744
resource constraints, 670
restrict keyword, 341
retargetable compilers, 7, 598599, 636
return address, 274
reverse CFG, 481
reverse dominance frontier, 546
reverse postorder (RPO), 481482, 486487
on reverse CFG, 481,486-487, 535-536
rewrite rules, 611616
right associativity, 146147
right context, 117, 126
right recursion, 100102
associativity, 146147
left recursion vs., 144147
stack depth, 145146
rightmost derivation, 90
right-recursive expression grammar, 100102
right associativity, 213
stack depth, 145146
RISC machines, 630
row-major order, 361365
See also arrays
rule-based evaluators, 188, 198
run-time environment, 7, 308
run-time heap. See heap
run-time safety, 165166
run-time tags, 377378
rvalue, 349

S
safety, 406, 412414
defining, 413
proving, 414, 469
run-time, 165166
S-attributed grammars, 188, 204
scalar optimizations, 539594
scalar replacement, 716
scanner generators
actions, 72
lex, 58
for recognizer construction, 73
right context notation, 118
tools, 58, 73
scanners, 11, 2579
context-free grammars and, 95
with DFA, implementing, 67, 5969,
7273
direct-coded, 6569
hand-coded, 6972
table-driven, 6065

scanning, 2579
scheduling 639673
backward, 656659
balanced scheduling, 654, 674
critical path, 646
EBBs, 661663
loops, 666668, 671
regional, 661666
software pipelining, 666
trace, 663664
scopes, 257260, 276279
defined, 276
level, 257
lexical, 255, 257, 258, 419
nested, 257261, 276278, 289
scoping rules, 262, 279
C, 266
FORTRAN, 279
Java, 285, 288
scheme, 279
scratchpad memory, 698
semantic elaboration, 161216
See also context-sensitive analysis
semilattice, 515
semipruned SSA form, 497, 501, 504
sentential form
defined, 87
separate compilation, 269, 279
set partition, 53
shadow index variables, 386
shift action, 134
shift operations, 729
shift-reduce conflict, 139
shift-reduce parser, 198
short-circuit evaluation, 354, 356
single-statement blocks, 232
sinking, 560
SLR(1) construction, 154155
software pipelining, 666673
source-level trees, 224, 227229
sparse conditional constant propagation
(SCCP), 575580
effectiveness, 580
initialization, 577, 582
rule for multiplication, 580
sparse simple constant propagation (SSCP),
515518, 520, 576
See also constant propagation
sparse-set representation, 741743
specialization, 560564
computation, 542543
constant propagation, 522526, 572

798 Index

specialization (continued)
peephole optimization, 561
tail-recursion elimination, 593
spill costs
global, estimating, 697699
infinite, 699
negative, 698699
spill metric, 706
spilling
avoiding, 686
clean values, 688, 689
cost, 688
defined, 340
dirty values, 688, 689
global, cost estimation, 697699, 716
interference-region, 715
live ranges and, 698699
partial live ranges, 715
top-down coloring and, 702704
splitting
live ranges, 689691, 715716
nodes, 530
partitions, 5455
SSA graphs, 575
relating SSA to, 583
See also static single-assignment (SSA)
form
stack allocation
of activation records, 283
of dynamically sized array, 284
symbol records, 756757
stack-machine code, 236237
See also linear IRs
stall, 640
start symbol, 86, 88, 96
static analysis
See also data-flow analysis
static coordinate
defined, 259, 277
distance coordinate, 303
static links. See access links
static name, 279
static single-assignment (SSA) form,
246250, 495519
building, 249, 496497
building live ranges from, 689, 696
copy insertion, 511
defined, 246
dominance, 478482
executable code reconstruction from,
510, 534
flavors, 504

inserting functions, 496


maximal, 497, 505
minimal, 504
pruned, 504
renaming variables, 505
rewriting, 511
semipruned, 497, 501, 504
simple algorithm, 497
in three-address IR, 248249
translation out, 510515
See also SSA graphs
static variables
access to, 302, 305
combining, 302
data areas, 302, 309, 335
static vs. dynamic dispatch, 293294
statically checked languages, 179, 211
statically scheduled processor, 640, 643
statically typed languages, 166, 179
static-distance coordinate, 303
stop and copy collectors, 320
storage locations
array elements, 361362
assigning, 334342
choice of, 250, 344
strength reduction, 409, 580591
defined, 409, 580
linear-function test replacement, 582,
589591
strict dominance, 498
See also dominance
string assignment, 370372
string(s), 173, 369374
arrays vs., 173, 370
concatenation, 373
as constructed type, 172, 173
length, 370, 373374
null-terminated, 373
operations, 370, 374
overlapping, 374
quoted character, 37
representations, 66, 370
sentential form, 87, 88
sets of, 35
strongly checked implementation, 179
strongly typed languages, 166, 170
structural data-flow algorithms, 527530
structural equivalence, 176, 177
structure references, 374380
anonymous values, 375, 378379
arrays of structures, 376377
structures 174175

subclass, 286
subset construction, 4753, 7577
superblock cloning, 570571
superclasses, 286, 295
superlocal value numbering, 437441
See also value numbering
superscalar processors, 641643
swap problem, 513515
defined, 513
switch statement, 332, 333
symbol tables, 202, 253264, 750762
building, 255256
defined, 202
multiset discrimination for, 256
scoped, 257261
symbols
current input, 95
eof, 134
goal, 8688, 117, 127, 134
nonterminal, 8688, 96, 613
start, 86
terminal, 8688, 94, 97, 100, 104
syntactic categories, 11, 26, 27, 32, 57
syntax 1113, 83156
errors, 11, 97, 106, 123, 141
expressing, 8596
meaning vs., 164
syntax-related trees, 89, 223230
abstract syntax trees (ASTs), 227229
abstraction level, 229230
directed acyclic graph, 229
low-level, 229, 230
parse trees, 226227
source-level, 229, 230
synthesized attributes, 184, 188

T
table-driven LL(1) parsers, 110115
table-driven scanners, 6065
tables
generating, from DFA description, 72
hash, 254255
LR(1), 124137
structure, 261262
symbol, 202, 253264
tail-recursion, 387388, 561562, 665
taken branch, 236
tbl operation, 242, 733
terminal symbols, 8688, 110
Action table, 152
defined, 86, 87
removing, 152

Index 799

Thompsons construction, 4547


three-address code, 236241, 248251
See also linear IRs
three-phase compilers, 8
thunks, 298
tiling, 611621
defined, 611
locally optimal, 620
time-optimal schedules, 646, 673
top-down coloring, 702704
defined, 702
live range splitting, 703704, 713
priority ranking, 703, 709
spill handling, 703
spill-and-iterate philosophy, 709
See also global register allocation
top-down local register allocation, 685686
top-down parsing, 96115
algorithm, 97
backtrack elimination, 107108
defined, 96
left recursion elimination, 100103, 108
recursive-descent, 108110
See also parsing
trace scheduling, 663664
trampoline function, 296
transformations, 15
enabling, 569574
inline substitution, 459460
left-factoring, 108
machine-independent, 542543
scope, increasing, 441
strength reduction, 580591
taxonomy for, 15, 592
transition diagrams
as code abstractions, 29
DFA, 66, 74
tree-height balancing, 428436
tree-pattern matching, 599, 608, 610621
tools, 620621
trees
abstract syntax (ASTs), 146, 196,
205206, 225, 227229, 230, 235,
245, 317, 333, 597, 604, 744
attributed parse, 183, 186, 188, 194
binary, 333, 744746
dominator, 498499, 502, 506, 508509,
531
implementation, simplifying, 745
low-level, 229, 230, 607, 612
mapping, 744746
operation, 610611, 614, 618

parse, 89, 90, 182, 196, 226227


representing, 743744
source-level, 224, 229, 230
syntax-related, 226230
tree-walk, 603609
code generator, 343, 344, 352, 607, 635
for expressions, 343
for instruction selection, 603609
two-dimensional hash tables, 760762
type checking, 13, 169170
type inference, 165, 166
accurate, 181
ad hoc framework for, 204
for expressions, 179180, 204
for expressions, revisited, 204
harder problems, 211213
interprocedural aspects of, 180181
rules, 177178
type signatures
defined, 180
in symbol tables, 202
type systems, 164181
base types, 170
compound/constructed types,
172176
defined, 164
dynamic and static checking, 179
dynamically-typed language, 166
expressiveness, 166167
inference rules, 177178
name equivalence, 176
parametric polymorphism, 213
polymorphism, 176
run-time safety, 165166
statically-typed language, 166
strong and weak checking, 179
strongly-typed language, 166
structural equivalence, 176
type equivalence, 176177
untyped language, 166
weakly typed language, 166
See also context-sensitive analysis
type-consistent uses, 212
constant function types and, 212
unknown function types and, 213
type(s)
base, 170
cell, 167
compound, 172176
constant function, 212
constructed, 172176
declared, 178

defined, 164
determination at compile time, 167
dynamic changes in, 212213
enumerated, 173174
errors, 178
FORTRAN result, 166
representing, 177
return, 212
specification, 164, 165
unknown function, 212
typing rules, 211

U
unambiguous references, 341, 716
See also ambiguous references
unary operators, 142143, 618
See also operator(s)
uninitialized variables
finding, 449450
with live information, 445450
unions, 174, 377378
element references, 377
multiple structure definitions, 377
universal hash functions, 752
unreachable code
defined, 544
eliminating, 550
See also useless code elimination
unroll-and-jam, 441
unrolling loops, 441443
until loops, 387
untyped languages, 166, 167, 170
upper frontier, 116118
upward-exposed, 433
use points, 287
useless code elimination, 544546
useless control flow elimination, 547550,
575580
useless productions, 149
user-defined types, 349

V
value identity vs. name identity, 565566
value numbering, 420428, 437441,
566569
algebraic identities for, 424
commutative operations, 424
defined, 421, 422
dominator-based, 566569
indirect assignments, impact of, 426428
local, 420428
superlocal, 437441

800 Index

values
ambiguous, 341, 716717
anonymous, 375, 378380
Boolean, 172, 350, 351, 357
clean, 688, 689, 719
dead, 626628
dirty, 688, 689
initializing, 209
keeping, in register, 340341
lifetimes, 247, 334, 336
mapping, to names, 243253
multiregister, 711
name choice, 225, 425
named, 17, 18, 334
naming, 201, 244246
parameter, accessing, 345347
pointer, 223, 239, 418, 489, 563,
717
position, 256
returning, 301
spilling, 688, 697
stack-based, 201
temporary, naming, 244246
unambiguous, 341
unnamed, 334
virtual register assignment, 335, 340

variables
class, 526
dead, 589
free, 275, 278
global, 276, 279, 302, 308, 522, 544
induction, 386, 582590
initializing, 282
instance, 164, 282
live, 445450, 482487
local, 282, 303307
name choice, 425
pointer-based, 341, 489
shadow index, 386
static, 207, 279, 282, 285, 302, 334
storage classes, 604
vectors, 359360
adjacency, 701, 747
bit, 53, 701, 741
characteristic, 741
defined, 359
dope, 367, 368
elements, referencing, 359360
indirection, 361366
memory layout, 359
See also arrays
very busy expressions, 491

very-long instruction word (VLIW)


machines, 642643
virtual functions, 289, 416
virtual machine, 3
virtual registers, 17, 249, 252, 331, 335, 340,
681, 684
defined, 17, 335
value assignment, 340
See also register allocation; registers
volatile keyword, 341

W
weakly typed languages, 166, 179
weakly-checked implementation, 179
while loops, 231, 386387,
See also loops
whole-program optimization, 419, 457468
words
categories, 66
in programming languages, 40
recognizing, 2733
syntactic categories, 11, 27, 88, 164

Z
zero-cost splitting, 716

También podría gustarte