InstructionInvocation
class InstructionInvocation
Represents an invocation of an instruction.
It can produce the Body encoding the invocation.
class Argumentprivate
constructor Argument
| Argument | ( | const AddressingMode::Argument * definition, | |
| Node * node = nullptr | ); |
| PARAMETER | DESCRIPTION |
|---|---|
definition |
|
node |
method constraint_expressionconst
| std::optional< Expression > constraint_expression | ( | const Location & location, | |
| Symbol name | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
location |
|
name |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Expression > |
method known_invalidconst
| bool known_invalid | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
method known_validconst
| bool known_valid | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
member definition
member known_value
member valid
class Variantprivate
constructor Variant
| Variant | ( | uint64_t opcode, | |
| const AddressingMode & addressing_mode, | |||
| const AddressingMode::Notation & notation, | |||
| const std::vector< std::shared_ptr< Node > > & nodes | ); |
| PARAMETER | DESCRIPTION |
|---|---|
opcode |
|
addressing_mode |
|
notation |
|
nodes |
method encodeconst
Encode the instruction variant.
| std::pair< std::optional< Expression >, Body > encode | ( | const std::shared_ptr< Scope > & containing_scope | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
containing_scope |
The scope containing the instruction invocation. |
| RETURNS | DESCRIPTION |
|---|---|
std::pair< std::optional< Expression >, Body > |
A pair containing an optional constraint expression and the encoded body. |
method validconst
Check if the instruction variant is valid.
It is considered invalid if any of the arguments do not meet their type constraints.
| bool valid | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
member addressing_mode
The addressing mode of the instruction variant.
member argument_aliases
The arguments that have been renamed due to different names in other variants.
This is filled in by InstructionInvocation::compute_argument_names().
The key is the original name, and the value is renamed name.
member arguments
The arguments of the invocation, indexed by name.
member nodes
The parsed arguments of the instruction invocation.
member notation
The notation of the instruction variant.
member opcode
The opcode of the instruction variant.
member unknown_argument_names
The names of arguments with unknown values, indexed by their position in the argument list.
member valid_
If the variant is valid.
constructor InstructionInvocation
Construct an InstructionInvocation.
| InstructionInvocation | ( | const CPU * , | |
| Token name, | |||
| const std::vector< std::shared_ptr< Node > > & nodes, | |||
| const std::shared_ptr< Scope > & containing_scope | ); |
| PARAMETER | DESCRIPTION |
|---|---|
|
|
name |
The name of the instruction. |
nodes |
The parsed nodes representing the arguments of the invocation. |
containing_scope |
The scope containing the invocation. |
method add_pc
Add the program counter (PC) to the instruction invocation.
| void add_pc | ( | Expression pc | ); |
| PARAMETER | DESCRIPTION |
|---|---|
pc |
The PC constant to add. |
method compute_argument_namesprivate
Compute the names of the arguments in the instruction invocation.
This method populates the argument_names vector. If all variants have the same argument name at a position, it will get that name, otherwise it will get an internal name.
| void compute_argument_names | ( | ); |
method encode
Encode the instruction invocation.
| Body encode | ( | ); |
| RETURNS | DESCRIPTION |
|---|---|
Body |
The encoded body of the instruction invocation. |
method uses_pc
Check if the instruction invocation uses the program counter (PC)..
| bool uses_pc | ( | ); |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
member argument_namesprivate
The names of the arguments in the instruction invocation.
If an argument has a known value, its name in this list is the empty symbol.
member argumentsprivate
The arguments in the instruction invocation.
member containing_scopeprivate
The scope containing the instruction invocation.
member has_unknown_argumentsprivate
Whether the invocation has arguments with unknown values.
member location
The location of the invocation in the source code.
member nodesprivate
The parsed invocation line.
member pcprivate
member uses_pc_private
Whether the invocation uses the program counter (PC).
member variantsprivate
The variants of the instruction invocation.
class Argumentprivate
constructor Argument
| Argument | ( | const AddressingMode::Argument * definition, | |
| Node * node = nullptr | ); |
| PARAMETER | DESCRIPTION |
|---|---|
definition |
|
node |
method constraint_expressionconst
| std::optional< Expression > constraint_expression | ( | const Location & location, | |
| Symbol name | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
location |
|
name |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Expression > |
method known_invalidconst
| bool known_invalid | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
method known_validconst
| bool known_valid | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
member definition
member known_value
member valid
class Variantprivate
constructor Variant
| Variant | ( | uint64_t opcode, | |
| const AddressingMode & addressing_mode, | |||
| const AddressingMode::Notation & notation, | |||
| const std::vector< std::shared_ptr< Node > > & nodes | ); |
| PARAMETER | DESCRIPTION |
|---|---|
opcode |
|
addressing_mode |
|
notation |
|
nodes |
method encodeconst
Encode the instruction variant.
| std::pair< std::optional< Expression >, Body > encode | ( | const std::shared_ptr< Scope > & containing_scope | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
containing_scope |
The scope containing the instruction invocation. |
| RETURNS | DESCRIPTION |
|---|---|
std::pair< std::optional< Expression >, Body > |
A pair containing an optional constraint expression and the encoded body. |
method validconst
Check if the instruction variant is valid.
It is considered invalid if any of the arguments do not meet their type constraints.
| bool valid | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
member addressing_mode
The addressing mode of the instruction variant.
member argument_aliases
The arguments that have been renamed due to different names in other variants.
This is filled in by InstructionInvocation::compute_argument_names().
The key is the original name, and the value is renamed name.
member arguments
The arguments of the invocation, indexed by name.
member nodes
The parsed arguments of the instruction invocation.
member notation
The notation of the instruction variant.
member opcode
The opcode of the instruction variant.
member unknown_argument_names
The names of arguments with unknown values, indexed by their position in the argument list.
member valid_
If the variant is valid.