ArgumentType
class ArgumentType
Represents an argument type, which defines the valid values for an instruction's operands.
enum Type
The type of the argument type.
| VALUE | DESCRIPTION |
|---|---|
ANY |
The argument type accepts any value. |
ENCODING |
The argument type accepts values that can be encoded by a specific encoding. |
ENUM |
The argument type accepts one of a fixed set of keywords. |
MAP |
The argument type accepts one of a fixed set of values that are mapped to other values. |
RANGE |
The argument type accepts values within a specific range. |
constructor ArgumentType
Initialize an ArgumentType.
| ArgumentType | ( | Symbol name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The name of the argument type. |
destructor ~ArgumentTypevirtual
| virtual ~ArgumentType | ( | ); |
method as
Get the argument type as type T.
| T * as | ( | ); |
| RETURNS | DESCRIPTION |
|---|---|
T * |
A pointer to the argument type as type T, or |
method asconst
Get the argument type as type T.
| const T * as | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
const T * |
A pointer to the argument type as type T, or |
method constraint_expressionconst virtual
Get the constraint expression for the argument type.
| virtual std::optional< Expression > constraint_expression | ( | const Location & location, | |
| Symbol name | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
location |
The location of the argument in the source code. |
name |
The name to use for the argument. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Expression > |
The constraint expression, or {} if there is no constraint. |
method isconst
Check if the argument type is of type T.
| bool is | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method is_validconst virtual
Check if an expression is valid for the argument type.
The default implementation returns {}. Subclasses should override this method to implement specific validation logic.
| virtual std::optional< bool > is_valid | ( | const Expression & expression | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
expression |
The expression to check. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< bool > |
|
method typeconst virtual
Get the type of the argument type.
Subclasses must implement this method.
| virtual Type type | ( | ) const | = 0; |
| RETURNS | DESCRIPTION |
|---|---|
Type |
The type of the argument type. |
member name
The name of the argument type.
class ArgumentTypeAny
Represents an argument type that accepts any value.
constructor ArgumentTypeAny
Initialize an ArgumentTypeAny.
| ArgumentTypeAny | ( | Symbol name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The name of the argument type. |
method is_validconst virtual
Check if an expression is valid for the argument type.
The default implementation returns {}. Subclasses should override this method to implement specific validation logic.
| virtual std::optional< bool > is_valid | ( | const Expression & expression | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
expression |
The expression to check. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< bool > |
|
method typeconst virtual
Get the type of the argument type.
Subclasses must implement this method.
| virtual Type type | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
Type |
The type of the argument type. |
class ArgumentTypeEncoding
Represents an argument type that accepts values that can be encoded by a specific encoding.
constructor ArgumentTypeEncoding
Initialize an ArgumentTypeEncoding.
| ArgumentTypeEncoding | ( | Symbol name, | |
| const IntegerEncoder & encoding | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The name of the argument type. |
encoding |
The encoding used by the argument type. |
method constraint_expressionconst virtual
Get the constraint expression for the argument type.
| virtual std::optional< Expression > constraint_expression | ( | const Location & location, | |
| Symbol name | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
location |
The location of the argument in the source code. |
name |
The name to use for the argument. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Expression > |
The constraint expression, or {} if there is no constraint. |
method is_validconst virtual
Check if an expression is valid for the argument type.
The default implementation returns {}. Subclasses should override this method to implement specific validation logic.
| virtual std::optional< bool > is_valid | ( | const Expression & expression | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
expression |
The expression to check. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< bool > |
|
method range_typeconst
| std::unique_ptr< ArgumentType > range_type | ( | Symbol range_name | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
range_name |
| RETURNS | DESCRIPTION |
|---|---|
std::unique_ptr< ArgumentType > |
method typeconst virtual
Get the type of the argument type.
Subclasses must implement this method.
| virtual Type type | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
Type |
The type of the argument type. |
member encoding
The encoding used by the argument type.
class ArgumentTypeEnum
Represents an argument type that accepts one of a fixed set of keywords.
constructor ArgumentTypeEnum
Initialize an ArgumentTypeEnum.
| ArgumentTypeEnum | ( | Symbol name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The name of the argument type. |
method entryconst
Get the value of the entry with the specified name.
| Value entry | ( | Symbol name | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The name of the entry. |
| RETURNS | DESCRIPTION |
|---|---|
Value |
The value of the entry. |
method has_entryconst
Check if the argument type has an entry with the specified name.
| bool has_entry | ( | Symbol name | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The name of the entry. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method typeconst virtual
Get the type of the argument type.
Subclasses must implement this method.
| virtual Type type | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
Type |
The type of the argument type. |
member entries
The accepted keywords and their corresponding values.
class ArgumentTypeMap
Represents an argument type that accepts one of a fixed set of values that are mapped to other values.
constructor ArgumentTypeMap
Initialize an ArgumentTypeMap.
| ArgumentTypeMap | ( | Symbol name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The name of the argument type. |
method entryconst
Get the mapped value for the specified input value.
| Value entry | ( | const Value & value | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
value |
The input value. |
| RETURNS | DESCRIPTION |
|---|---|
Value |
The mapped value. |
method has_entryconst
Check if the argument type has an entry for the specified value.
| bool has_entry | ( | const Value & value | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
value |
The value to check. |
| RETURNS | DESCRIPTION |
|---|---|
bool |
|
method is_validconst virtual
Check if an expression is valid for the argument type.
The default implementation returns {}. Subclasses should override this method to implement specific validation logic.
| virtual std::optional< bool > is_valid | ( | const Expression & expression | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
expression |
The expression to check. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< bool > |
|
method typeconst virtual
Get the type of the argument type.
Subclasses must implement this method.
| virtual Type type | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
Type |
The type of the argument type. |
member entries
The accepted input values and their corresponding mapped values.
class ArgumentTypeRange
Represents an argument type that accepts values within a specific range.
constructor ArgumentTypeRange
Initialize an ArgumentTypeRange.
| ArgumentTypeRange | ( | Symbol name | ); |
| PARAMETER | DESCRIPTION |
|---|---|
name |
The name of the argument type. |
method constraint_expressionconst virtual
Get the constraint expression for the argument type.
| virtual std::optional< Expression > constraint_expression | ( | const Location & location, | |
| Symbol name | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
location |
The location of the argument in the source code. |
name |
The name to use for the argument. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Expression > |
The constraint expression, or {} if there is no constraint. |
method is_validconst virtual
Check if an expression is valid for the argument type.
The default implementation returns {}. Subclasses should override this method to implement specific validation logic.
| virtual std::optional< bool > is_valid | ( | const Expression & expression | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
expression |
The expression to check. |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< bool > |
|
method typeconst virtual
Get the type of the argument type.
Subclasses must implement this method.
| virtual Type type | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
Type |
The type of the argument type. |
member lower_bound
The lower bound of the accepted range.
member upper_bound
The upper bound of the accepted range.