ACT Library
|
An instance type. More...
#include <inst.h>
Private Attributes | |
Type * | t |
Type::direction | dir |
Scope * | s |
Array * | a |
int | nt |
inst_param * | u |
unsigned int | temp_type:1 |
unsigned int | expanded:1 |
const char * | ptype_id |
InstType * | iface_type |
Friends | |
class | TypeFactory |
An instance type.
An instance type contains
An instance type can be unexpanded or expanded.
InstType pointers are recorded in various data strutures like the instance table in a Scope. They are also used temporarily for type-checking. InstType pointers held in other data structures are marked as "cached", and deleting those pointers does nothing. Hence it should always be safe to delete an InstType pointer even if its use is recorded elsewhere.
InstType::InstType | ( | InstType * | i, |
int | skip_array = 0 |
||
) |
This creates a duplicate of the InstType passed in, making sure it is a temp type by default. You can optionally skip any array specifiers for the type
i | is the InstType to be copied |
skip_array | is set to 1 when you want the copy to omit any array specifier. If skip_array is set to 0 and the type has an array specifier, this is flagged as an error (assertion failure). |
InstType::~InstType | ( | ) |
Free the type if it is an uncached (is_temp = 1) type. If the type is marked as cached, then this desctructor does nothing.
|
inline |
void InstType::appendParams | ( | int | na, |
inst_param * | a | ||
) |
Append parameters to the list of current template parameters.
na | are the additional parameters |
a | is an array of template parameters that are to be appended. |
|
inline |
Return root/base type
|
inline |
Remove the array specifier from the type by setting it to NULL
InstType * InstType::Expand | ( | ActNamespace * | ns, |
Scope * | s | ||
) |
Return a fresh instance type that is the expanded version of the type we had originally!
ns | is the namespace in which any types should be looked up |
s | is the expanded scope in which any parameters should be evaluated |
AExpr * InstType::getAExprParam | ( | int | pn | ) |
pn | is the slot number |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
InstType * InstType::getTypeParam | ( | int | pn | ) |
pn | is the slot number |
|
inline |
|
inline |
XXX: Return 1 if any template parameter in inst_param involves global symbols. This may no longer be needed?
check if two types are compatible for connections. Returns NULL if error, otherwise returns the most specific type. The weak flag has the same meaning as isEqual().
int InstType::isEqual | ( | InstType * | t, |
int | weak = 0 |
||
) |
Check if two instance types are identical. Note that this DOES NOT CHECK DIRECTION FLAGS! There are different degrees of equality checking that are controlled by the parameter weak
.
The weak
parameter only matters for array types. All cases check that the # of dimensions match. The remaining check for equality of array types is:
Weak | Meaning |
---|---|
0 | check that the arrays are in fact equal and have the same index ranges (and range expressions). Used for checking that port parameters are the same in the definition and declaration. |
1 | checks that arrays are compatible in terms of # of dimensions, rather than equal. Used to sanity check connections prior to expanding parameters. |
2 | check that array ranges have the same size; they could have different index ranges. Used to check that two types can be connected. |
3 | check that array ranges have the same size, except for the first dimension. Used to check that two types can be concatenated in an array expression. |
t | is the InstType to compare with |
weak | is the weak parameter (default is zero) |
int InstType::isEqualDir | ( | InstType * | t, |
int | weak = 0 |
||
) |
The same as isEqual(), except it also checks that the direction flags for the type match.
int InstType::isExpanded | ( | ) | const |
int InstType::isParamAType | ( | int | k | ) |
|
inline |
Check if two types are related in the implementation relation hierarchy. Array references are ignored.
it | is the type to compare against |
common | is used to return the type where the relationship was found |
|
inline |
void InstType::MkArray | ( | Array * | a | ) |
|
inline |
Mark this InstType as cached
|
inline |
Mark this type as expanded
|
inline |
|
inline |
void InstType::Print | ( | FILE * | fp, |
int | nl_mode = 0 |
||
) |
print inst type string
Used to change the type signature during overrides.
update | is the updated type. |
Used to change the type signature during overrides.
update | is the updated type. |
|
inline |
Set direction flags
d | is the direction flag to be used. |
|
inline |
Set the interface type
x | is the interface type |
void InstType::setNumParams | ( | int | n | ) |
Used to create slots for template parameters
n | is the number of template parameter slots to be created. |
void InstType::setParam | ( | int | pn, |
AExpr * | a | ||
) |
Sets the template parameter at the specified slot number to be an array expression
pn | is the slot number |
a | is the array expression. This does not copy it, but keeps a reference to the parameter. Do not free! |
void InstType::setParam | ( | int | pn, |
Expr * | e | ||
) |
Sets the template parameter at the specified slot number to be a simple expression
pn | is the slot number |
e | is the expression. This does not copy it, but keeps a reference to the parameter. Do not free! |
void InstType::setParam | ( | int | pn, |
InstType * | t | ||
) |
Sets the template parameter at the specified slot number to be an InstType. This is used for channels and ptype parameters.
pn | is the slot number |
t | is the type. This does not copy it, but keeps a reference to the parameter. Do not free! |
|
inline |
set PType ID. When an instance is created using a "ptype" type, we need a dummy place-holder name for the type itself. When this is expanded out, the type is replaced with the actual value of this parameter. Additionally, the Type pointer is actually set to the interface so that one can determine that this is a ptype. XXX: this can be cleaned up.
s | is the name of the ID that is the ptype |
void InstType::sPrint | ( | char * | buf, |
int | sz, | ||
int | nl_mode = 0 |
||
) |
snprintf
|
friend |
|
private |
array specification, if any
|
private |
Direction flags for types. ? = in, ! = out. ?! and !? used to specify modifiers in port parameters for channels and data
|
private |
set if this is expanded
|
private |
if you're expanded, this is your interface (for ptypes)
|
private |
template parameters, if any
|
private |
for inst-types, this is the name of the ptype
|
private |
root/base type
|
private |
set if this is an uncached inst type
|
private |
array of parameters, if any