Search in sources :

Example 1 with GetFieldExpression

use of de.mirkosertic.bytecoder.ssa.GetFieldExpression in project Bytecoder by mirkosertic.

the class OpenCLCompileBackend method registerInputs.

private void registerInputs(BytecodeLinkerContext aContext, BytecodeLinkedClass aKernelClass, Value aValue, OpenCLInputOutputs aInputOutputs) {
    if (aValue instanceof GetFieldExpression) {
        GetFieldExpression theGetField = (GetFieldExpression) aValue;
        BytecodeLinkedClass theClass = aContext.resolveClass(BytecodeObjectTypeRef.fromUtf8Constant(theGetField.getField().getClassIndex().getClassConstant().getConstant()));
        if (theClass == aKernelClass) {
            BytecodeResolvedFields theInstanceFields = aKernelClass.resolvedFields();
            BytecodeResolvedFields.FieldEntry theField = theInstanceFields.fieldByName(theGetField.getField().getNameAndTypeIndex().getNameAndType().getNameIndex().getName().stringValue());
            aInputOutputs.registerReadFrom(theField);
        }
    }
}
Also used : GetFieldExpression(de.mirkosertic.bytecoder.ssa.GetFieldExpression) BytecodeLinkedClass(de.mirkosertic.bytecoder.core.BytecodeLinkedClass) BytecodeResolvedFields(de.mirkosertic.bytecoder.core.BytecodeResolvedFields)

Example 2 with GetFieldExpression

use of de.mirkosertic.bytecoder.ssa.GetFieldExpression in project Bytecoder by mirkosertic.

the class OpenCLWriter method printValue.

private void printValue(Value aValue) {
    if (aValue instanceof Variable) {
        Variable theVariable = (Variable) aValue;
        print(theVariable.getName());
    } else if (aValue instanceof InvokeVirtualMethodExpression) {
        printInvokeVirtual((InvokeVirtualMethodExpression) aValue);
    } else if (aValue instanceof InvokeStaticMethodExpression) {
        printInvokeStatic((InvokeStaticMethodExpression) aValue);
    } else if (aValue instanceof GetFieldExpression) {
        printGetFieldValue((GetFieldExpression) aValue);
    } else if (aValue instanceof ArrayEntryExpression) {
        printArrayEntryValue((ArrayEntryExpression) aValue);
    } else if (aValue instanceof BinaryExpression) {
        printBinaryValue((BinaryExpression) aValue);
    } else if (aValue instanceof IntegerValue) {
        printIntegerValue((IntegerValue) aValue);
    } else if (aValue instanceof LongValue) {
        printLongValue((LongValue) aValue);
    } else if (aValue instanceof FloatValue) {
        printFloatValue((FloatValue) aValue);
    } else if (aValue instanceof DoubleValue) {
        printDoubleValue((DoubleValue) aValue);
    } else if (aValue instanceof TypeConversionExpression) {
        printTypeConversionValue((TypeConversionExpression) aValue);
    } else if (aValue instanceof CompareExpression) {
        printCompareExpression((CompareExpression) aValue);
    } else if (aValue instanceof DirectInvokeMethodExpression) {
        printDirectInvokeMethodExpression((DirectInvokeMethodExpression) aValue);
    } else {
        throw new IllegalArgumentException("Not supported : " + aValue);
    }
}
Also used : Variable(de.mirkosertic.bytecoder.ssa.Variable) IntegerValue(de.mirkosertic.bytecoder.ssa.IntegerValue) GetFieldExpression(de.mirkosertic.bytecoder.ssa.GetFieldExpression) CompareExpression(de.mirkosertic.bytecoder.ssa.CompareExpression) DirectInvokeMethodExpression(de.mirkosertic.bytecoder.ssa.DirectInvokeMethodExpression) InvokeStaticMethodExpression(de.mirkosertic.bytecoder.ssa.InvokeStaticMethodExpression) InvokeVirtualMethodExpression(de.mirkosertic.bytecoder.ssa.InvokeVirtualMethodExpression) BinaryExpression(de.mirkosertic.bytecoder.ssa.BinaryExpression) DoubleValue(de.mirkosertic.bytecoder.ssa.DoubleValue) TypeConversionExpression(de.mirkosertic.bytecoder.ssa.TypeConversionExpression) LongValue(de.mirkosertic.bytecoder.ssa.LongValue) FloatValue(de.mirkosertic.bytecoder.ssa.FloatValue) ArrayEntryExpression(de.mirkosertic.bytecoder.ssa.ArrayEntryExpression)

Aggregations

GetFieldExpression (de.mirkosertic.bytecoder.ssa.GetFieldExpression)2 BytecodeLinkedClass (de.mirkosertic.bytecoder.core.BytecodeLinkedClass)1 BytecodeResolvedFields (de.mirkosertic.bytecoder.core.BytecodeResolvedFields)1 ArrayEntryExpression (de.mirkosertic.bytecoder.ssa.ArrayEntryExpression)1 BinaryExpression (de.mirkosertic.bytecoder.ssa.BinaryExpression)1 CompareExpression (de.mirkosertic.bytecoder.ssa.CompareExpression)1 DirectInvokeMethodExpression (de.mirkosertic.bytecoder.ssa.DirectInvokeMethodExpression)1 DoubleValue (de.mirkosertic.bytecoder.ssa.DoubleValue)1 FloatValue (de.mirkosertic.bytecoder.ssa.FloatValue)1 IntegerValue (de.mirkosertic.bytecoder.ssa.IntegerValue)1 InvokeStaticMethodExpression (de.mirkosertic.bytecoder.ssa.InvokeStaticMethodExpression)1 InvokeVirtualMethodExpression (de.mirkosertic.bytecoder.ssa.InvokeVirtualMethodExpression)1 LongValue (de.mirkosertic.bytecoder.ssa.LongValue)1 TypeConversionExpression (de.mirkosertic.bytecoder.ssa.TypeConversionExpression)1 Variable (de.mirkosertic.bytecoder.ssa.Variable)1