This machine mirrors various open-source projects.
20 Gbit/s uplink.
If there are any issues or you want another project mirrored, please contact
mirror-service -=AT=- netcologne DOT de !
#include <AstRewriter.h>
Public Member Functions | |
AstRewriter (AstResource &resource) | |
Constructs an empty rewriter with no rewrite rules. | |
void | addTypeRewrite (Type *source, Type *target) |
template<class Iter > | |
void | addTypeRewrites (Iter I, Iter E) |
Adds a set of rewrites given by iterators over std::pair<Type*, Type*>. | |
void | installRewrites (DomainType *context) |
Generates rewrite rules for a DomainType. | |
void | installRewrites (SigInstanceDecl *context) |
Generates rewrite rules for a SigInstanceDecl. | |
bool | hasRewriteRule (Type *source) const |
Returns true if a rewrite rule is associated with source . | |
void | clear () |
Remove all rewrite rules. | |
SigInstanceDecl * | rewriteSigInstance (SigInstanceDecl *sig) const |
AstResource & | getAstResource () const |
Type Rewriters. | |
Type * | rewriteType (Type *type) const |
DomainType * | rewriteType (DomainType *dom) const |
SubroutineType * | rewriteType (SubroutineType *srType) const |
FunctionType * | rewriteType (FunctionType *ftype) const |
ProcedureType * | rewriteType (ProcedureType *ftype) const |
Protected Member Functions | |
Type * | findRewrite (Type *source) const |
Returns a rewrite if it exists, otherwise null. |
Rewrites Ast nodes.
This class implements a map from one set of nodes to another. In some ways, it is like a scope where the components of an AST can be resolved with respect to the "bindings" established in the rewriter. For example, the AstRewriter can encapsulate the mappings from the formal to actual parameters of a functor, or from a % node to a concrete domain type.
Methods are provided to build and interrogate the set of mappings, and to create new nodes using the installed set of rules.
Definition at line 35 of file AstRewriter.h.
comma::AstRewriter::AstRewriter | ( | AstResource & | resource | ) | [inline] |
Constructs an empty rewriter with no rewrite rules.
Definition at line 39 of file AstRewriter.h.
Adds a rewrite rule from source
to target
.
If a mapping from the given source already exists, this method will unconditionally re-target the rule -- it is the responsibility of the programmer to ensure that established rules are not mistakenly overwritten.
Definition at line 47 of file AstRewriter.h.
void comma::AstRewriter::addTypeRewrites | ( | Iter | I, | |
Iter | E | |||
) | [inline] |
Adds a set of rewrites given by iterators over std::pair<Type*, Type*>.
Definition at line 54 of file AstRewriter.h.
void comma::AstRewriter::clear | ( | ) | [inline] |
Remove all rewrite rules.
Definition at line 80 of file AstRewriter.h.
Returns a rewrite if it exists, otherwise null.
Definition at line 23 of file AstRewriter.cpp.
AstResource& comma::AstRewriter::getAstResource | ( | ) | const [inline] |
Definition at line 109 of file AstRewriter.h.
bool comma::AstRewriter::hasRewriteRule | ( | Type * | source | ) | const [inline] |
Returns true if a rewrite rule is associated with source
.
Definition at line 75 of file AstRewriter.h.
void AstRewriter::installRewrites | ( | SigInstanceDecl * | context | ) |
Generates rewrite rules for a SigInstanceDecl.
Populates this rewriter with rules mapping the formal argument nodes of the underlying signature declaration to the actual arguments provided by context
. This method is a no-op when context
is not parameterized.
Definition at line 54 of file AstRewriter.cpp.
void AstRewriter::installRewrites | ( | DomainType * | context | ) |
Generates rewrite rules for a DomainType.
Populates this rewriter with rules mapping the formal argument nodes of the underlying domain declaration to the actual arguments provided by context
. This method is a no-op when context
is not parameterized.
Definition at line 38 of file AstRewriter.cpp.
SigInstanceDecl * AstRewriter::rewriteSigInstance | ( | SigInstanceDecl * | sig | ) | const |
Rewrites the parameterization of the given SigInstanceDecl.
If no rewrite rules apply, the argument is returned unchanged. Otherwise, a uniqued SigInstanceDecl is returned representing the rewritten parameterization.
Definition at line 86 of file AstRewriter.cpp.
ProcedureType * AstRewriter::rewriteType | ( | ProcedureType * | ftype | ) | const |
Definition at line 155 of file AstRewriter.cpp.
FunctionType * AstRewriter::rewriteType | ( | FunctionType * | ftype | ) | const |
Definition at line 145 of file AstRewriter.cpp.
SubroutineType * AstRewriter::rewriteType | ( | SubroutineType * | srType | ) | const |
Definition at line 130 of file AstRewriter.cpp.
DomainType * AstRewriter::rewriteType | ( | DomainType * | dom | ) | const |
Definition at line 105 of file AstRewriter.cpp.
Definition at line 68 of file AstRewriter.cpp.