Search in sources :

Example 1 with OpenAccContinuation

use of claw.wani.transformation.internal.OpenAccContinuation in project claw-compiler by C2SM-RCM.

the class DirectivePrimitive method transform.

/**
 * Apply the directive primitive transformation.
 *
 * @param xcodeml        The XcodeML on which the transformations are applied.
 * @param translator     The translator used to applied the transformations.
 * @param transformation Not used in this transformation
 * @throws IllegalTransformationException if the transformation cannot be
 *                                        applied.
 */
@Override
public void transform(XcodeProgram xcodeml, Translator translator, Transformation transformation) throws IllegalTransformationException {
    String prefix = xcodeml.context().getGenerator().getDirectiveLanguage().getPrefix();
    if (prefix == null) {
        return;
    }
    if (getDirective().getPragma().value().toLowerCase().contains(prefix)) {
        String regex = ClawConstant.CLAW + " *" + prefix;
        getDirective().getPragma().setValue(getDirective().getPragma().value().replaceAll(regex, prefix));
        getDirective().getPragma().setValue(getDirective().getPragma().value().replaceAll(ClawConstant.CLAW, ""));
    }
    translator.addTransformation(xcodeml, new OpenAccContinuation((ClawPragma) getDirective()));
}
Also used : OpenAccContinuation(claw.wani.transformation.internal.OpenAccContinuation) ClawPragma(claw.wani.language.ClawPragma)

Aggregations

ClawPragma (claw.wani.language.ClawPragma)1 OpenAccContinuation (claw.wani.transformation.internal.OpenAccContinuation)1