Search in sources :

Example 6 with MatchRule

use of org.graalvm.compiler.core.match.MatchRule in project graal by oracle.

the class AMD64NodeMatchRules method mulMemory.

@MatchRule("(Mul value Read=access)")
@MatchRule("(Mul value FloatingRead=access)")
public ComplexMatchResult mulMemory(ValueNode value, LIRLowerableAccess access) {
    OperandSize size = getMemorySize(access);
    if (size.isXmmType()) {
        TargetDescription target = getLIRGeneratorTool().target();
        boolean isAvx = ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX);
        if (isAvx) {
            return binaryRead(AVXOp.MUL, size, value, access);
        } else {
            return binaryRead(SSEOp.MUL, size, value, access);
        }
    } else {
        return binaryRead(AMD64RMOp.IMUL, size, value, access);
    }
}
Also used : TargetDescription(jdk.vm.ci.code.TargetDescription) OperandSize(org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize) MatchRule(org.graalvm.compiler.core.match.MatchRule)

Example 7 with MatchRule

use of org.graalvm.compiler.core.match.MatchRule in project graal by oracle.

the class MatchProcessor method processMatchRule.

private void processMatchRule(EconomicMap<TypeElement, MatchRuleDescriptor> map, Element element, AnnotationMirror mirror) {
    if (!processedMatchRule.contains(element)) {
        try {
            processedMatchRule.add(element);
            // The annotation element type should ensure this is true.
            assert element instanceof ExecutableElement;
            findMatchableNodes(element);
            TypeElement topDeclaringType = topDeclaringType(element);
            MatchRuleDescriptor info = map.get(topDeclaringType);
            if (info == null) {
                info = new MatchRuleDescriptor(topDeclaringType);
                map.put(topDeclaringType, info);
            }
            List<AnnotationMirror> mirrors = null;
            if (typeUtils().isSameType(mirror.getAnnotationType(), matchRulesTypeMirror)) {
                // Unpack the mirrors for a repeatable annotation
                mirrors = getAnnotationValueList(AnnotationMirror.class, mirror, "value");
            }
            int i = 0;
            for (MatchRule matchRule : element.getAnnotationsByType(MatchRule.class)) {
                processMethodMatchRule((ExecutableElement) element, info, matchRule, mirrors != null ? mirrors.get(i++) : mirror);
            }
        } catch (Throwable t) {
            reportExceptionThrow(element, t);
        }
    }
}
Also used : AnnotationMirror(javax.lang.model.element.AnnotationMirror) TypeElement(javax.lang.model.element.TypeElement) ExecutableElement(javax.lang.model.element.ExecutableElement) MatchRule(org.graalvm.compiler.core.match.MatchRule)

Aggregations

MatchRule (org.graalvm.compiler.core.match.MatchRule)7 TargetDescription (jdk.vm.ci.code.TargetDescription)4 OperandSize (org.graalvm.compiler.asm.amd64.AMD64Assembler.OperandSize)4 LIRKind (org.graalvm.compiler.core.common.LIRKind)3 ComplexMatchResult (org.graalvm.compiler.core.match.ComplexMatchResult)3 JavaConstant (jdk.vm.ci.meta.JavaConstant)2 Value (jdk.vm.ci.meta.Value)2 CanonicalCondition (org.graalvm.compiler.core.common.calc.CanonicalCondition)2 Condition (org.graalvm.compiler.core.common.calc.Condition)2 NodeLIRBuilder (org.graalvm.compiler.core.gen.NodeLIRBuilder)2 NodeMatchRules (org.graalvm.compiler.core.gen.NodeMatchRules)2 GraalError (org.graalvm.compiler.debug.GraalError)2 AMD64AddressValue (org.graalvm.compiler.lir.amd64.AMD64AddressValue)2 AnnotationMirror (javax.lang.model.element.AnnotationMirror)1 ExecutableElement (javax.lang.model.element.ExecutableElement)1 TypeElement (javax.lang.model.element.TypeElement)1 AMD64 (jdk.vm.ci.amd64.AMD64)1 CPUFeature (jdk.vm.ci.amd64.AMD64.CPUFeature)1 AMD64Kind (jdk.vm.ci.amd64.AMD64Kind)1 AllocatableValue (jdk.vm.ci.meta.AllocatableValue)1