Search in sources :

Example 11 with FfunctionType

use of claw.tatsu.xcodeml.xnode.fortran.FfunctionType 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();
}
Also used : FfunctionType(claw.tatsu.xcodeml.xnode.fortran.FfunctionType) FunctionCall(claw.tatsu.xcodeml.abstraction.FunctionCall)

Aggregations

FfunctionType (claw.tatsu.xcodeml.xnode.fortran.FfunctionType)11 Xnode (claw.tatsu.xcodeml.xnode.common.Xnode)6 Context (claw.tatsu.common.Context)4 FbasicType (claw.tatsu.xcodeml.xnode.fortran.FbasicType)4 FunctionCall (claw.tatsu.xcodeml.abstraction.FunctionCall)3 IllegalTransformationException (claw.tatsu.xcodeml.exception.IllegalTransformationException)3 Xid (claw.tatsu.xcodeml.xnode.common.Xid)3 PromotionInfo (claw.tatsu.xcodeml.abstraction.PromotionInfo)2 FfunctionDefinition (claw.tatsu.xcodeml.xnode.fortran.FfunctionDefinition)2 ClawTranslator (claw.wani.x2t.translator.ClawTranslator)2 Xblock (claw.tatsu.xcodeml.abstraction.Xblock)1 Xattr (claw.tatsu.xcodeml.xnode.common.Xattr)1 XdeclTable (claw.tatsu.xcodeml.xnode.common.XdeclTable)1 XsymbolTable (claw.tatsu.xcodeml.xnode.common.XsymbolTable)1 FmoduleDefinition (claw.tatsu.xcodeml.xnode.fortran.FmoduleDefinition)1 FortranModule (claw.tatsu.xcodeml.xnode.fortran.FortranModule)1 FstructType (claw.tatsu.xcodeml.xnode.fortran.FstructType)1 ClawMapping (claw.wani.language.ClawMapping)1 ClawMappingVar (claw.wani.language.ClawMappingVar)1 Configuration (claw.wani.x2t.configuration.Configuration)1