At a join, x has different incoming definitions; what SSA node merges them?
A Use-def edge
B Ο node
C Copy token
D Basic block
Answer: B. Ο node. A Ο node selects an incoming value according to the predecessor that reaches the join.
In SSA, each Ο input is associated with which item?
A Token pattern
B Successor instruction
C Predecessor block
D Source file
Answer: C. Predecessor block. Each Ο incoming value is paired with the predecessor block supplying that value.
Given USE={x}, DEF={y}, OUT={y,z}, what is LIVEIN?
A {z}
B {x, y}
C {x, z}
D {x, y, z}
Answer: C. {x, z}. LIVEIN equals USE union (OUT minus DEF), so y is removed and x is added.
For a basic block B, how is LIVEOUT(B) computed?
A Intersection of successor USE
B Union of successor LIVEIN
C FIRST(B) plus IN
D FOLLOW(B) minus DEF
Answer: B. Union of successor LIVEIN. A variable is live out if it is live into at least one successor.
Interference-graph edges mean what about the represented values?
A Blocks share successors
B Instructions share source
C Values share a type
D Values overlap in liveness
Answer: D. Values overlap in liveness. Simultaneously live values interfere and cannot use the same register.
During graph coloring, why can a node with degree below K be simplified safely?
A At least one color remains
B It cannot be spilled
C It has no live uses
D It needs no register
Answer: A. At least one color remains. With fewer than K neighbors, one of K colors remains available when the node is restored.
Suppose all usable registers conflict; what can an allocator do?
A Drop the instruction
B Spill a value to memory
C Change source language
D Erase the definition
Answer: B. Spill a value to memory. Spilling stores or recomputes a value when it cannot remain in a register.
When a live value occupies a caller-save register across a call, what protects it?
A Reorder past the call
B Remove its block
C Save and restore it
D Rename its token
Answer: C. Save and restore it. A caller-save register may be clobbered, so a live value must be preserved around the call.
Which Bison parser mode explores conflicting parses?
A Simple SLR
B Predictive LL
C Recursive descent
D Generalized LR
Answer: D. Generalized LR. Bison’s GLR mode can pursue multiple alternatives when deterministic LR choices conflict.
Merging same-core LR states can combine lookaheads and create which issue?
A Type mismatch
B Unreachable block
C Lexical error
D Reduce/reduce conflict
Answer: D. Reduce/reduce conflict. Combining lookahead sets may make two reductions possible in one LALR state.
With nonassociative <, what should a<b<c require?
A Lexer backtracking
B Automatic right grouping
C Automatic left grouping
D Parentheses or rejection
Answer: D. Parentheses or rejection. A nonassociative operator disallows an unparenthesized chain instead of choosing either grouping.
For a completed non-start item AβΞ±Β·, what does a valid lookahead permit?
A Reduce by AβΞ±
B Accept the whole input
C Call the lexer again
D Shift every token
Answer: A. Reduce by AβΞ±. A completed non-start item proposes reducing its right-hand side to A on allowed lookaheads.
Undeclared-variable use is reported by which compiler stage?
A Lexical scanning
B Instruction scheduling
C Semantic analysis
D Object linking
Answer: C. Semantic analysis. Name resolution is part of semantic analysis and detects missing declarations.
Under short-circuit AND, when is q evaluated in p && q?
A Always after compilation
B Only when p is true
C Only when p is false
D Before evaluating p
Answer: B. Only when p is true. Short-circuit AND skips its right operand when the left operand is false.
In backpatching, what does truelist store?
A Unresolved true-branch targets
B Finished object offsets
C Matched identifier names
D Available register names
Answer: A. Unresolved true-branch targets. The truelist records jump targets that should be filled for the true outcome.
In the CFG, if every entry-to-n path passes through d, how is d related to n?
A d dominates n
B d is unreachable from n
C d shares a successor
D d post-dominates n
Answer: A. d dominates n. Dominance means every path from the entry to n passes through d.
SSA requires what relationship between a definition and an ordinary use?
A Use dominates definition
B Definition follows the use
C Both share a successor
D Definition dominates every use
Answer: D. Definition dominates every use. SSA requires a definition to dominate its uses so the value exists along every path.
Why can a call block moving a memory load?
A It may modify aliased memory
B It renames a variable
C It deletes the CFG
D It changes token order
Answer: A. It may modify aliased memory. A call may write memory that aliases the location read by a later load.
Alias analysis answers what memory-reference question?
A Lexical analysis
B Alias analysis
C FIRST/FOLLOW analysis
D Liveness analysis
Answer: B. Alias analysis. Alias analysis estimates whether memory references may designate the same location.
If a stored value is overwritten before any read, which optimization can remove it?
A Constant folding
B Register spilling
C Loop unrolling
D Dead-store elimination
Answer: D. Dead-store elimination. Dead-store elimination removes a store whose value is replaced before any execution can read it.
Besides invariant operands, what must loop hoisting preserve?
A Register allocation
B Symbol-table order
C Program behavior
D Token sequence
Answer: C. Program behavior. Hoisting is valid only when moving the evaluation does not change observable behavior or required effects.
Degree at least K makes a node what in coloring?
A It has no neighbors
B It gets a free register
C Possible spill candidate
D It must be spilled
Answer: C. Possible spill candidate. High degree means coloring is not guaranteed, so the node may be considered for spilling.
Rematerialization can help after a spill by doing what?
A Avoid parsing source
B Remove all memory access
C Make the graph bipartite
D Recompute a value cheaply
Answer: D. Recompute a value cheaply. A cheap value can sometimes be recomputed instead of loaded from a spill slot.
What location does an object-file relocation entry identify?
A A register needing liveness
B An address needing later adjustment
C A token needing classification
D A grammar rule needing reduction
Answer: B. An address needing later adjustment. A relocation entry identifies where a linker or loader must apply an address-dependent adjustment.
Link-time optimization enables what across files?
A Optimization across translation units
B Lexer rule backtracking
C Parser state merging
D Token deletion
Answer: A. Optimization across translation units. LTO makes intermediate representations from multiple units available for cross-unit analysis and optimization.