Search in sources :

Example 6 with TIBConstantOperand

use of org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand in project JikesRVM by JikesRVM.

the class Simplifier method getSuperclassIdsFromTib.

private static DefUseEffect getSuperclassIdsFromTib(Instruction s, OptOptions opts) {
    if (opts.SIMPLIFY_TIB_OPS) {
        Operand tibOp = Unary.getVal(s);
        if (tibOp.isTIBConstant()) {
            TIBConstantOperand tib = tibOp.asTIBConstant();
            Move.mutate(s, REF_MOVE, Unary.getClearResult(s), new ObjectConstantOperand(tib.value.getSuperclassIds(), Offset.zero()));
            return DefUseEffect.MOVE_FOLDED;
        }
    }
    return DefUseEffect.UNCHANGED;
}
Also used : MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) UnreachableOperand(org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand) LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ConditionOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) CodeConstantOperand(org.jikesrvm.compilers.opt.ir.operand.CodeConstantOperand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand) NullConstantOperand(org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand) BranchProfileOperand(org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) TrapCodeOperand(org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand) IntConstantOperand(org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand) ConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ConstantOperand) AddressConstantOperand(org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand)

Example 7 with TIBConstantOperand

use of org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand in project JikesRVM by JikesRVM.

the class Simplifier method getTypeFromTib.

private static DefUseEffect getTypeFromTib(Instruction s, OptOptions opts) {
    if (opts.SIMPLIFY_TIB_OPS) {
        Operand tibOp = Unary.getVal(s);
        if (tibOp.isTIBConstant()) {
            TIBConstantOperand tib = tibOp.asTIBConstant();
            Move.mutate(s, REF_MOVE, Unary.getClearResult(s), new ObjectConstantOperand(tib.value, Offset.zero()));
            return DefUseEffect.MOVE_FOLDED;
        }
    }
    return DefUseEffect.UNCHANGED;
}
Also used : MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) UnreachableOperand(org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand) LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ConditionOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) CodeConstantOperand(org.jikesrvm.compilers.opt.ir.operand.CodeConstantOperand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand) NullConstantOperand(org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand) BranchProfileOperand(org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) TrapCodeOperand(org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand) IntConstantOperand(org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand) ConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ConstantOperand) AddressConstantOperand(org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand)

Example 8 with TIBConstantOperand

use of org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand in project JikesRVM by JikesRVM.

the class Simplifier method getDoesImplementFromTib.

private static DefUseEffect getDoesImplementFromTib(Instruction s, OptOptions opts) {
    if (opts.SIMPLIFY_TIB_OPS) {
        Operand tibOp = Unary.getVal(s);
        if (tibOp.isTIBConstant()) {
            TIBConstantOperand tib = tibOp.asTIBConstant();
            Move.mutate(s, REF_MOVE, Unary.getClearResult(s), new ObjectConstantOperand(tib.value.getDoesImplement(), Offset.zero()));
            return DefUseEffect.MOVE_FOLDED;
        }
    }
    return DefUseEffect.UNCHANGED;
}
Also used : MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) UnreachableOperand(org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand) LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ConditionOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) CodeConstantOperand(org.jikesrvm.compilers.opt.ir.operand.CodeConstantOperand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand) NullConstantOperand(org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand) BranchProfileOperand(org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) TrapCodeOperand(org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand) IntConstantOperand(org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand) ConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ConstantOperand) AddressConstantOperand(org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand)

Example 9 with TIBConstantOperand

use of org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand in project JikesRVM by JikesRVM.

the class Simplifier method getObjTib.

private static DefUseEffect getObjTib(Instruction s, OptOptions opts) {
    if (opts.SIMPLIFY_TIB_OPS) {
        Operand op = GuardedUnary.getVal(s);
        if (op.isNullConstant()) {
            // Simplify to an unreachable operand, this instruction is dead code
            // guarded by a nullcheck that should already have been simplified
            RegisterOperand result = GetField.getClearResult(s);
            Move.mutate(s, IRTools.getMoveOp(result.getType()), result, new UnreachableOperand());
            return DefUseEffect.MOVE_FOLDED;
        } else if (op.isConstant()) {
            final TypeReference typeRef = op.getType();
            if (typeRef.isResolved()) {
                Move.mutate(s, REF_MOVE, GuardedUnary.getClearResult(s), new TIBConstantOperand(op.getType().peekType()));
                return DefUseEffect.MOVE_FOLDED;
            }
        } else {
            RegisterOperand rop = op.asRegister();
            TypeReference typeRef = rop.getType();
            // Is the type of this register only one possible type?
            if (typeRef.isResolved() && rop.isPreciseType() && typeRef.resolve().isInstantiated()) {
                // before simplifying ensure that the type is instantiated, this stops
                // constant propagation potentially moving the TIB constant before the
                // runtime call that instantiates it
                Move.mutate(s, REF_MOVE, GuardedUnary.getClearResult(s), new TIBConstantOperand(typeRef.peekType()));
                return DefUseEffect.MOVE_FOLDED;
            }
        }
    }
    return DefUseEffect.UNCHANGED;
}
Also used : RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) UnreachableOperand(org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand) LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ConditionOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) CodeConstantOperand(org.jikesrvm.compilers.opt.ir.operand.CodeConstantOperand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand) NullConstantOperand(org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand) BranchProfileOperand(org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) TrapCodeOperand(org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand) IntConstantOperand(org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand) ConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ConstantOperand) AddressConstantOperand(org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) UnreachableOperand(org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand) TypeReference(org.jikesrvm.classloader.TypeReference)

Example 10 with TIBConstantOperand

use of org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand in project JikesRVM by JikesRVM.

the class Simplifier method getArrayElementTibFromTib.

private static DefUseEffect getArrayElementTibFromTib(Instruction s, OptOptions opts) {
    if (opts.SIMPLIFY_TIB_OPS) {
        Operand tibOp = Unary.getVal(s);
        if (tibOp.isTIBConstant()) {
            TIBConstantOperand tib = tibOp.asTIBConstant();
            Move.mutate(s, REF_MOVE, Unary.getClearResult(s), new TIBConstantOperand(tib.value.asArray().getElementType()));
            return DefUseEffect.MOVE_FOLDED;
        }
    }
    return DefUseEffect.UNCHANGED;
}
Also used : MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) UnreachableOperand(org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand) LongConstantOperand(org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) ConditionOperand(org.jikesrvm.compilers.opt.ir.operand.ConditionOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) CodeConstantOperand(org.jikesrvm.compilers.opt.ir.operand.CodeConstantOperand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand) NullConstantOperand(org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand) BranchProfileOperand(org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand) TrapCodeOperand(org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand) IntConstantOperand(org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand) ConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ConstantOperand) AddressConstantOperand(org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand) TIBConstantOperand(org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand)

Aggregations

TIBConstantOperand (org.jikesrvm.compilers.opt.ir.operand.TIBConstantOperand)12 RegisterOperand (org.jikesrvm.compilers.opt.ir.operand.RegisterOperand)10 ObjectConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand)9 Operand (org.jikesrvm.compilers.opt.ir.operand.Operand)9 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)8 CodeConstantOperand (org.jikesrvm.compilers.opt.ir.operand.CodeConstantOperand)8 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)8 LongConstantOperand (org.jikesrvm.compilers.opt.ir.operand.LongConstantOperand)8 NullConstantOperand (org.jikesrvm.compilers.opt.ir.operand.NullConstantOperand)8 TrueGuardOperand (org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand)8 ConditionOperand (org.jikesrvm.compilers.opt.ir.operand.ConditionOperand)7 ConstantOperand (org.jikesrvm.compilers.opt.ir.operand.ConstantOperand)7 TrapCodeOperand (org.jikesrvm.compilers.opt.ir.operand.TrapCodeOperand)7 UnreachableOperand (org.jikesrvm.compilers.opt.ir.operand.UnreachableOperand)7 BranchProfileOperand (org.jikesrvm.compilers.opt.ir.operand.BranchProfileOperand)6 MethodOperand (org.jikesrvm.compilers.opt.ir.operand.MethodOperand)6 TypeOperand (org.jikesrvm.compilers.opt.ir.operand.TypeOperand)6 OptimizingCompilerException (org.jikesrvm.compilers.opt.OptimizingCompilerException)5 Instruction (org.jikesrvm.compilers.opt.ir.Instruction)5 RVMType (org.jikesrvm.classloader.RVMType)3