@Override public STypeIR caseARealNumericBasicType(ARealNumericBasicType node, IRInfo question) throws AnalysisException { return new ARealNumericBasicTypeIR(); }
/** * Returns a deep clone of this {@link ARealNumericBasicTypeIR} node. * @return a deep clone of this {@link ARealNumericBasicTypeIR} node */ public ARealNumericBasicTypeIR clone() { return new ARealNumericBasicTypeIR( _sourceNode, _tag, _metaData, _optional, cloneNode(_namedInvType) ); }
/** * Essentially this.toString().equals(o.toString()). **/ @Override public boolean equals(Object o) { if (o != null && o instanceof ARealNumericBasicTypeIR) { return toString().equals(o.toString()); } return false; }
/** * Called by the {@link ARealNumericBasicTypeIR} node from {@link ARealNumericBasicTypeIR#apply(IAnalysis)}. * @param node the calling {@link ARealNumericBasicTypeIR} node */ public void caseARealNumericBasicTypeIR(ARealNumericBasicTypeIR node) throws AnalysisException { _visitedNodes.add(node); inARealNumericBasicTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outARealNumericBasicTypeIR(node); }
@Override public void caseADivideNumericBinaryExpIR(ADivideNumericBinaryExpIR node) throws AnalysisException { SExpIR leftExp = node.getLeft(); leftExp.apply(this); SExpIR rightExp = node.getRight(); rightExp.apply(this); if (info.getExpAssistant().isIntegerType(leftExp) && info.getExpAssistant().isIntegerType(rightExp)) { ARealLiteralExpIR one = new ARealLiteralExpIR(); ARealNumericBasicTypeIR realTypeCg = new ARealNumericBasicTypeIR(); realTypeCg.setSourceNode(new SourceNode(new ARealNumericBasicType())); one.setType(realTypeCg); one.setValue(1.0); ATimesNumericBinaryExpIR neutralMul = new ATimesNumericBinaryExpIR(); neutralMul.setType(realTypeCg.clone()); neutralMul.setLeft(one); neutralMul.setRight(leftExp); node.setLeft(info.getExpAssistant().isolateExpression(neutralMul)); } } }
/** * Called by the {@link ARealNumericBasicTypeIR} node from {@link ARealNumericBasicTypeIR#apply(IAnalysis)}. * @param node the calling {@link ARealNumericBasicTypeIR} node */ public void caseARealNumericBasicTypeIR(ARealNumericBasicTypeIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inARealNumericBasicTypeIR(node, question); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this, question); } outARealNumericBasicTypeIR(node, question); }
public STypeIR getExpectedOperandType(SNumericBinaryExpIR node) { if (node instanceof AIntDivNumericBinaryExpIR || node instanceof AModNumericBinaryExpIR || node instanceof ARemNumericBinaryExpIR) { return new AIntNumericBasicTypeIR(); } else { return new ARealNumericBasicTypeIR(); } }
/** * Called by the {@link ARealNumericBasicTypeIR} node from {@link ARealNumericBasicTypeIR#apply(IIsaAnalysis)}. * @param node the calling {@link ARealNumericBasicTypeIR} node */ public void caseARealNumericBasicTypeIR(ARealNumericBasicTypeIR node) throws AnalysisException { _visitedNodes.add(node); inARealNumericBasicTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outARealNumericBasicTypeIR(node); }
/** * Creates a deep clone of this {@link ARealNumericBasicTypeIR} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link ARealNumericBasicTypeIR} node */ public ARealNumericBasicTypeIR clone(Map<INode,INode> oldToNewMap) { ARealNumericBasicTypeIR node = new ARealNumericBasicTypeIR( _sourceNode, _tag, _metaData, _optional, cloneNode(_namedInvType, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
@Override public void caseARealPatternIR(ARealPatternIR node, STypeIR question) throws AnalysisException { storeType(node, new ARealNumericBasicTypeIR()); }
/** * Called by the {@link ARealNumericBasicTypeIR} node from {@link ARealNumericBasicTypeIR#apply(IAnalysis)}. * @param node the calling {@link ARealNumericBasicTypeIR} node */ public A caseARealNumericBasicTypeIR(ARealNumericBasicTypeIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inARealNumericBasicTypeIR(node, question)); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { mergeReturns(retVal,node.getNamedInvType().apply(this, question)); } mergeReturns(retVal,outARealNumericBasicTypeIR(node, question)); return retVal; }
public ARealLiteralExpIR consRealLiteral(double value) { ARealLiteralExpIR realLiteral = new ARealLiteralExpIR(); realLiteral.setType(new ARealNumericBasicTypeIR()); realLiteral.setValue(value); return realLiteral; }
/** * Called by the {@link ARealNumericBasicTypeIR} node from {@link ARealNumericBasicTypeIR#apply(IAnalysis)}. * @param node the calling {@link ARealNumericBasicTypeIR} node */ public A caseARealNumericBasicTypeIR(ARealNumericBasicTypeIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inARealNumericBasicTypeIR(node)); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { mergeReturns(retVal,node.getNamedInvType().apply(this)); } mergeReturns(retVal,outARealNumericBasicTypeIR(node)); return retVal; }
} else if (pat instanceof ARealPatternIR) return new ARealNumericBasicTypeIR();