L2Value Manifest
The L2ValueManifest maintains information about which L2SemanticValues hold equivalent values at this point, the TypeRestrictions for those semantic values, and the list of L2WriteOperands that are visible definitions of those values.
In order to avoid reevaluating primitives with the same values, a manifest also tracks L2Registers hold values representing which L2SemanticValues, specifically using L2Synonyms as the binding mechanism.
The mapping is keyed both ways (semantic value → synonym, and register → synonym), so that registers can be efficiently removed. This happens at control flow merges, where only the intersection of the semantic values available in each predecessor edge is kept, specifically via the introduction of new registers defined by phi instructions.
Author
Mark van Gulik
Todd L Smith
Constructors
Types
A utility type containing a mutable list of L2Registers that currently hold the same value, and a TypeRestriction.
Properties
A map from L2SemanticValue to source L2Instructions from a previous L2ControlFlowGraph, which can be translated as needed by an L2Regenerator, as part of the instruction postponement optimization (perfect redundancy elimination). The same source instruction is stored under each semantic value that was written by that instruction.
Functions
Answer a Set of all L2Registers available in this manifest.
Produce all live definitions of the synonym.
Given an L2SemanticValue, see if there's already an equivalent one in this manifest. If an L2SemanticPrimitiveInvocation is supplied, look for a recursively synonymous one.
Merge a new L2SemanticValue into an existing L2Synonym. Update the manifest to reflect the merge.
Forget only the BOXED_KIND register definitions for this synonym. Keep the synonym around in all circumstances, even if there are no remaining definitions. Also, do not alter the synonym's restriction.
Retrieve the oldest definition of the given L2SemanticValue or an equivalent, but having the given RegisterKind. Only consider registers whose definitions all include that semantic value. This should work well in SSA or non-SSA, but not after register coloring.
Retrieve all L2Registers known to contain the given L2SemanticValue. Narrow it to just those registers whose definitions all include that semantic value.
Answer whether the L2SemanticValue is known to this manifest.
Replace the TypeRestriction associated with the given L2SemanticValue, which must be known by this manifest, with the intersection of its current restriction and the given restriction. Note that this also restricts any synonymous semantic values.
Capture information about a new L2Synonym and its TypeRestriction. It's an error if any of the semantic values of the synonym are already bound to other synonyms in this manifest.
Given two L2SemanticValues, merge their L2Synonyms together, if they're not already. Update the manifest to reflect the merged synonyms.
Populate the empty receiver with bindings from the incoming manifests. Only keep the bindings for L2SemanticValues that occur in all incoming manifests. Generate phi functions as needed on the provided L2Generator. The phi functions' source registers correspond positionally with the list of manifests.
Create an L2ReadBoxedOperand for the L2SemanticValue of the earliest known boxed write for any semantic values in the same L2Synonym as the given semantic value.
Create an L2ReadFloatOperand for the L2SemanticValue of the earliest known unboxed float write for any semantic values in the same L2Synonym as the given semantic value.
Create an L2ReadIntOperand for the L2SemanticValue of the earliest known unboxed int write for any semantic values in the same L2Synonym as the given semantic value.
Record the fact that an L2Instruction has been emitted, which writes to the given L2WriteOperand. Since this is the introduction of a new L2SemanticValue, it must not yet be in this manifest.
Record the fact that an L2Instruction has been emitted, which writes to the given L2WriteOperand.
Record the fact that an L2Instruction has been emitted, which writes to the given L2WriteOperand. The source and destination should end up in the same synonym.
Record the fact that an L2Instruction has been emitted, which writes to the given L2WriteOperand. Since this is the introduction of a new L2SemanticValue, it must not yet be in this manifest.
Record a sourceInstruction, which can be translated by an L2Regenerator whenever its output values are needed.
Remove a previously recorded sourceInstruction, which can be translated by an L2Regenerator whenever its output values are needed. It will be stored under each RegisterKind and L2SemanticValue that the L2Instruction wrote in the prior L2ControlFlowGraph, so it should be removed under each such key. Answer the instruction.
Remove all definitions related to this L2WriteOperand's L2SemanticValues, then add this write operand as the sole definition in this manifest.
Look up the TypeRestriction that currently bounds this L2SemanticValue. Fail if there is none.
Retain as definitions only those L2Registers that are in the given Set, removing the rest.
Retain information only about the L2SemanticValues that are present in the given Set, removing the rest.
Look up the given L2SemanticValue, answering the L2Synonym that's bound to it. Fail if it's not found.
Replace the TypeRestriction associated with the given L2SemanticValue, which must be known by this manifest. Note that this also restricts any synonymous semantic values.
Replace the TypeRestriction associated with the given L2SemanticValue, which must be known by this manifest, with the difference between its current restriction and the given restriction. Note that this also restricts any synonymous semantic values.
Answer an arbitrarily ordered array of the L2Synonyms in this manifest.
Given an L2Register, find which L2Synonyms, if any, are mapped to it in this manifest. The CFG does not have to be in SSA form.
Transform this manifest by mapping its L2SemanticValues.
Update the Constraint associated with the given L2Synonym.