use of claw.tatsu.xcodeml.abstraction.FunctionCall in project claw-compiler by C2SM-RCM.
the class ArrayToFctCall method transform.
@Override
public void transform(XcodeProgram xcodeml, Translator translator, Transformation other) {
FfunctionType fctType = xcodeml.getTypeTable().getFunctionType(_replaceFct);
// Prepare the function call
FunctionCall fctCall = xcodeml.createFctCall(fctType.getReturnType(), _claw.value(ClawClause.FCT_NAME), _replaceFct.getType());
for (String arg : _claw.values(ClawClause.FCT_PARAMETERS)) {
fctCall.addArguments(xcodeml.createVar(FortranType.INTEGER, arg, Xscope.LOCAL));
}
List<Xnode> refs = XnodeUtil.getAllArrayReferencesInSiblings(_claw.getPragma(), _claw.value(ClawClause.ARRAY_NAME));
for (Xnode ref : refs) {
ref.insertAfter(fctCall.cloneNode());
ref.delete();
}
fctCall.delete();
removePragma();
transformed();
}
use of claw.tatsu.xcodeml.abstraction.FunctionCall in project claw-compiler by C2SM-RCM.
the class ScaForward method analyze.
@Override
public boolean analyze(XcodeProgram xcodeml, Translator translator) {
Xnode next = _claw.getPragma().nextSibling();
if (next == null) {
xcodeml.addError("Directive is not followed by a valid statement.", _claw.getPragma());
return false;
}
if (Xnode.isOfCode(next, Xcode.EXPR_STATEMENT) || Xnode.isOfCode(next, Xcode.F_ASSIGN_STATEMENT)) {
_isNestedInAssignment = Xnode.isOfCode(next, Xcode.F_ASSIGN_STATEMENT);
Xnode fctCallNode = next.matchSeq(Xcode.FUNCTION_CALL);
if (fctCallNode != null) {
_fCall = new FunctionCall(fctCallNode);
return analyzeForward(xcodeml);
}
} else if (Xnode.isOfCode(next, Xcode.F_DO_STATEMENT)) {
_doStatements = new NestedDoStatement(next);
return analyzeForwardWithDo(xcodeml);
}
xcodeml.addError("Directive is not followed by a valid statement.", _claw.getPragma());
return false;
}
Aggregations