public abstract class MmuTreeWalkerBase extends TreeParserBase
Modifier and Type | Class and Description |
---|---|
protected class |
MmuTreeWalkerBase.BufferBuilder
Builder for Builder objects.
|
protected class |
MmuTreeWalkerBase.CallableBuilder |
protected class |
MmuTreeWalkerBase.CommonBuilder |
protected class |
MmuTreeWalkerBase.IfBuilder |
protected class |
MmuTreeWalkerBase.OperationBuilder |
protected class |
MmuTreeWalkerBase.StructBuilder
Builder for a Type.
|
Modifier and Type | Field and Description |
---|---|
protected ConstantPropagator |
propagator |
Constructor and Description |
---|
MmuTreeWalkerBase(org.antlr.runtime.tree.TreeNodeStream input,
org.antlr.runtime.RecognizerSharedState state) |
Modifier and Type | Method and Description |
---|---|
void |
assignContext(TranslatorContext context) |
void |
assignIR(Ir ir) |
protected java.util.List<java.lang.String> |
checkContextKeywords(MmuLanguageContext langCtx,
java.util.Collection<org.antlr.runtime.tree.CommonTree> nodes) |
protected java.math.BigInteger |
extractBigInteger(Where w,
ru.ispras.fortress.expression.Node expr,
java.lang.String exprDesc) |
protected int |
extractInt(Where w,
ru.ispras.fortress.expression.Node expr,
java.lang.String exprDesc) |
protected java.math.BigInteger |
extractPositiveBigInteger(Where w,
ru.ispras.fortress.expression.Node expr,
java.lang.String nodeName) |
protected int |
extractPositiveInt(Where w,
ru.ispras.fortress.expression.Node expr,
java.lang.String nodeName) |
protected Type |
findType(org.antlr.runtime.tree.CommonTree typeId) |
protected ru.ispras.fortress.expression.Node |
getConstant(org.antlr.runtime.tree.CommonTree id)
Returns the value of the specified constant.
|
TranslatorContext |
getContext() |
Ir |
getIR() |
protected Address |
newAddress(org.antlr.runtime.tree.CommonTree addressId,
Type type,
java.util.List<org.antlr.runtime.tree.CommonTree> memberChain)
Creates an Address IR object and adds it to the MMU IR.
|
protected Stmt |
newAssert(org.antlr.runtime.tree.CommonTree place,
ru.ispras.fortress.expression.Node condition) |
protected Stmt |
newAssignment(org.antlr.runtime.tree.CommonTree where,
ru.ispras.fortress.expression.Node leftExpr,
ru.ispras.fortress.expression.Node rightExpr) |
protected ru.ispras.fortress.expression.Node |
newAttributeCall(org.antlr.runtime.tree.CommonTree id,
java.util.List<org.antlr.runtime.tree.CommonTree> memberChain) |
protected ru.ispras.fortress.expression.Node |
newAttributeRef(org.antlr.runtime.tree.CommonTree id,
boolean isLhs,
java.util.List<ru.ispras.fortress.expression.Node> args,
org.antlr.runtime.tree.CommonTree attrId) |
protected ru.ispras.fortress.expression.Node |
newBitfield(org.antlr.runtime.tree.CommonTree where,
ru.ispras.fortress.expression.Node variable,
ru.ispras.fortress.expression.Node fromExpr,
ru.ispras.fortress.expression.Node toExpr) |
protected ru.ispras.fortress.expression.NodeOperation |
newCall(org.antlr.runtime.tree.CommonTree node,
java.util.List<ru.ispras.fortress.expression.Node> args) |
protected ru.ispras.fortress.expression.Node |
newCallExpr(Where w,
ru.ispras.fortress.expression.NodeOperation call) |
protected Stmt |
newCallStmt(ru.ispras.fortress.expression.NodeOperation call) |
protected ru.ispras.fortress.expression.Node |
newConcat(org.antlr.runtime.tree.CommonTree where,
ru.ispras.fortress.expression.Node left,
ru.ispras.fortress.expression.Node right) |
protected ru.ispras.fortress.expression.Node |
newCondExpression(org.antlr.runtime.tree.CommonTree id,
java.util.List<ru.ispras.fortress.util.Pair<ru.ispras.fortress.expression.Node,ru.ispras.fortress.expression.Node>> blocks)
Creates a conditional expression of the following kind:
|
protected void |
newConstant(org.antlr.runtime.tree.CommonTree id,
ru.ispras.fortress.expression.Node value)
Adds a static constant (let expression) to the IR.
|
protected Stmt |
newException(org.antlr.runtime.tree.CommonTree message) |
protected ru.ispras.fortress.expression.Node |
newExpression(org.antlr.runtime.tree.CommonTree operatorId,
ru.ispras.fortress.expression.Node... operands)
Creates a new operator-based expression.
|
protected void |
newExtern(org.antlr.runtime.tree.CommonTree id,
org.antlr.runtime.tree.CommonTree aliasId,
java.util.List<ru.ispras.fortress.expression.Node> args)
Adds an external variable linked to the specified source entity defined
in the ISA specification to the IR.
|
protected ru.ispras.fortress.expression.Node |
newIndexedVariable(org.antlr.runtime.tree.CommonTree id,
ru.ispras.fortress.expression.Node indexExpr) |
protected Stmt |
newMark(org.antlr.runtime.tree.CommonTree text) |
protected MmuTreeWalkerBase.CommonBuilder |
newMemoryBuilder(org.antlr.runtime.tree.CommonTree memoryId,
org.antlr.runtime.tree.CommonTree addressArgId,
org.antlr.runtime.tree.CommonTree addressArgType,
org.antlr.runtime.tree.CommonTree dataArgId,
ru.ispras.fortress.expression.Node dataArgSizeExpr) |
protected MmuTreeWalkerBase.CommonBuilder |
newSegmentBuilder(org.antlr.runtime.tree.CommonTree id,
org.antlr.runtime.tree.CommonTree addressArgId,
org.antlr.runtime.tree.CommonTree addressArgType,
org.antlr.runtime.tree.CommonTree outputVarId,
org.antlr.runtime.tree.CommonTree outputVarType) |
protected Stmt |
newTrace(org.antlr.runtime.tree.CommonTree format,
java.util.List<ru.ispras.fortress.expression.Node> fargs) |
protected Type |
newType(org.antlr.runtime.tree.CommonTree typeId,
Type type) |
protected ru.ispras.fortress.expression.Node |
newVariable(boolean isLhs,
org.antlr.runtime.tree.CommonTree id) |
protected void |
registerFunction(Callable func) |
protected Type |
resolveTypeName(org.antlr.runtime.tree.CommonTree typeId) |
assignSymbols, checkMemberDeclared, checkRedeclared, declare, declareAndPushSymbolScope, getSymbol, getSymbols, isDeclaredAs, popSymbolScope, pushSymbolScope
assignLog, checkNotNull, checkNotNull, checkNotNull, emitErrorMessage, getErrorCount, isCorrect, raiseError, raiseError, reportError, reportError, resetErrorCount, where
getAncestor, getCurrentInputSymbol, getErrorHeader, getErrorMessage, getMissingSymbol, getSourceName, getTreeNodeStream, inContext, inContext, matchAny, recoverFromMismatchedToken, reset, setTreeNodeStream, traceIn, traceOut
alreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, displayRecognitionError, endResync, failed, getBacktrackingLevel, getGrammarFileName, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, getTokenNames, match, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, setBacktrackingLevel, toStrings, traceIn, traceOut
protected final ConstantPropagator propagator
public MmuTreeWalkerBase(org.antlr.runtime.tree.TreeNodeStream input, org.antlr.runtime.RecognizerSharedState state)
public final void assignIR(Ir ir)
public final Ir getIR()
public final void assignContext(TranslatorContext context)
public final TranslatorContext getContext()
protected final void newConstant(org.antlr.runtime.tree.CommonTree id, ru.ispras.fortress.expression.Node value) throws SemanticException
id
- Constant identifier.value
- Constant value.SemanticException
- if the value expression is null
.protected final ru.ispras.fortress.expression.Node getConstant(org.antlr.runtime.tree.CommonTree id) throws SemanticException
id
- Constant identifier.SemanticException
- if the constant is not defined.protected void newExtern(org.antlr.runtime.tree.CommonTree id, org.antlr.runtime.tree.CommonTree aliasId, java.util.List<ru.ispras.fortress.expression.Node> args) throws SemanticException
id
- Variable name.aliasId
- Name of the source entity.args
- Arguments used to access the source entity (e.g. register index,
or addressing mode arguments).SemanticException
protected final Address newAddress(org.antlr.runtime.tree.CommonTree addressId, Type type, java.util.List<org.antlr.runtime.tree.CommonTree> memberChain) throws SemanticException
addressId
- Address identifier.widthExpr
- Address width expression.SemanticException
- (1) if the width expression is null
; (2) if the width
expression cannot be reduced to a constant integer value; (3) if the width value is beyond
the Java Integer allowed range; (4) if the width value is less or equal 0.protected final Type newType(org.antlr.runtime.tree.CommonTree typeId, Type type) throws SemanticException
SemanticException
protected final Type findType(org.antlr.runtime.tree.CommonTree typeId) throws SemanticException
SemanticException
protected final Type resolveTypeName(org.antlr.runtime.tree.CommonTree typeId) throws SemanticException
SemanticException
protected final java.util.List<java.lang.String> checkContextKeywords(MmuLanguageContext langCtx, java.util.Collection<org.antlr.runtime.tree.CommonTree> nodes) throws SemanticException
SemanticException
protected final MmuTreeWalkerBase.CommonBuilder newMemoryBuilder(org.antlr.runtime.tree.CommonTree memoryId, org.antlr.runtime.tree.CommonTree addressArgId, org.antlr.runtime.tree.CommonTree addressArgType, org.antlr.runtime.tree.CommonTree dataArgId, ru.ispras.fortress.expression.Node dataArgSizeExpr) throws SemanticException
SemanticException
protected final MmuTreeWalkerBase.CommonBuilder newSegmentBuilder(org.antlr.runtime.tree.CommonTree id, org.antlr.runtime.tree.CommonTree addressArgId, org.antlr.runtime.tree.CommonTree addressArgType, org.antlr.runtime.tree.CommonTree outputVarId, org.antlr.runtime.tree.CommonTree outputVarType) throws SemanticException
SemanticException
protected final void registerFunction(Callable func)
protected final ru.ispras.fortress.expression.NodeOperation newCall(org.antlr.runtime.tree.CommonTree node, java.util.List<ru.ispras.fortress.expression.Node> args) throws SemanticException
SemanticException
protected final ru.ispras.fortress.expression.Node newCallExpr(Where w, ru.ispras.fortress.expression.NodeOperation call) throws SemanticException
SemanticException
protected final Stmt newCallStmt(ru.ispras.fortress.expression.NodeOperation call)
protected final Stmt newAssignment(org.antlr.runtime.tree.CommonTree where, ru.ispras.fortress.expression.Node leftExpr, ru.ispras.fortress.expression.Node rightExpr) throws SemanticException
SemanticException
protected final Stmt newException(org.antlr.runtime.tree.CommonTree message)
protected final Stmt newTrace(org.antlr.runtime.tree.CommonTree format, java.util.List<ru.ispras.fortress.expression.Node> fargs) throws SemanticException
SemanticException
protected final Stmt newMark(org.antlr.runtime.tree.CommonTree text)
protected final Stmt newAssert(org.antlr.runtime.tree.CommonTree place, ru.ispras.fortress.expression.Node condition) throws SemanticException
SemanticException
protected final ru.ispras.fortress.expression.Node newExpression(org.antlr.runtime.tree.CommonTree operatorId, ru.ispras.fortress.expression.Node... operands) throws org.antlr.runtime.RecognitionException
operatorId
- Operator identifier.operands
- Array of operands.org.antlr.runtime.RecognitionException
protected final ru.ispras.fortress.expression.Node newCondExpression(org.antlr.runtime.tree.CommonTree id, java.util.List<ru.ispras.fortress.util.Pair<ru.ispras.fortress.expression.Node,ru.ispras.fortress.expression.Node>> blocks) throws org.antlr.runtime.RecognitionException
if C1 then V1 (elif Ci then Vi)* else Vn endif
.
id
- Token that marks location of the construction in code,blocks
- Pairs org.antlr.runtime.RecognitionException
protected final ru.ispras.fortress.expression.Node newConcat(org.antlr.runtime.tree.CommonTree where, ru.ispras.fortress.expression.Node left, ru.ispras.fortress.expression.Node right) throws SemanticException
SemanticException
protected final ru.ispras.fortress.expression.Node newBitfield(org.antlr.runtime.tree.CommonTree where, ru.ispras.fortress.expression.Node variable, ru.ispras.fortress.expression.Node fromExpr, ru.ispras.fortress.expression.Node toExpr) throws SemanticException
SemanticException
protected final ru.ispras.fortress.expression.Node newAttributeRef(org.antlr.runtime.tree.CommonTree id, boolean isLhs, java.util.List<ru.ispras.fortress.expression.Node> args, org.antlr.runtime.tree.CommonTree attrId) throws SemanticException
SemanticException
protected final ru.ispras.fortress.expression.Node newVariable(boolean isLhs, org.antlr.runtime.tree.CommonTree id) throws SemanticException
SemanticException
protected final ru.ispras.fortress.expression.Node newIndexedVariable(org.antlr.runtime.tree.CommonTree id, ru.ispras.fortress.expression.Node indexExpr) throws SemanticException
SemanticException
protected final ru.ispras.fortress.expression.Node newAttributeCall(org.antlr.runtime.tree.CommonTree id, java.util.List<org.antlr.runtime.tree.CommonTree> memberChain) throws SemanticException
SemanticException
protected java.math.BigInteger extractBigInteger(Where w, ru.ispras.fortress.expression.Node expr, java.lang.String exprDesc) throws SemanticException
SemanticException
protected int extractInt(Where w, ru.ispras.fortress.expression.Node expr, java.lang.String exprDesc) throws SemanticException
SemanticException
protected int extractPositiveInt(Where w, ru.ispras.fortress.expression.Node expr, java.lang.String nodeName) throws SemanticException
SemanticException
protected java.math.BigInteger extractPositiveBigInteger(Where w, ru.ispras.fortress.expression.Node expr, java.lang.String nodeName) throws SemanticException
SemanticException