explode Tuple If Possible
fun explodeTupleIfPossible(tupleReg: L2ReadBoxedOperand, requiredTypes: List<A_Type>): List<L2ReadBoxedOperand>?
Content copied to clipboard
Given a register that will hold a tuple, check that the tuple has the number of elements and statically satisfies the corresponding provided type constraints. If so, generate code and answer a list of register reads corresponding to the elements of the tuple; otherwise, generate no code and answer null.
Depending on the source of the tuple, this may cause the creation of the tuple to be entirely elided.
Return
A List of L2ReadBoxedOperands corresponding to the tuple's elements, or null if the tuple could not be proven to have the required shape and type.
Parameters
tuple Reg
The L2BoxedRegister containing the tuple.
required Types
The required types against which to check the tuple's own type.