@Override public String toString() { return "" + (isDead() ? "[DEAD]" : "") + (hasUnusedResult ? "[DEAD-RESULT]" : "") + ((this instanceof ResultInstr) ? ((ResultInstr)this).getResult() + " = " : "") + operation; }
@Override public String toString() { return "" + (isDead() ? "[DEAD]" : "") + (hasUnusedResult ? "[DEAD-RESULT]" : "") + ((this instanceof ResultInstr) ? ((ResultInstr)this).getResult() + " = " : "") + operation; }
/** * Instructions are meant to be in a machine-readable format so offline tooling can parse the * debugging output. The format is: * * (result_op '=')? instr '(' (operand ',' )* operand? ';' (extra_arg ',')* extra_arg? ')' * extra_arg can either be plain value or in a key: value format. * @return a String */ @Override public String toString() { StringBuilder buf = new StringBuilder(isDead() ? "[DEAD]" : ""); if (this instanceof ResultInstr) buf.append(((ResultInstr) this).getResult()).append(" = "); Operand[] operands = getOperands(); buf.append(operation).append('('); toArgList(buf, operands); String[] extraArgs = toStringNonOperandArgs(); if (extraArgs.length >= 1) { if (operands.length > 0) buf.append(' '); buf.append(';'); toArgList(buf, extraArgs); } buf.append(')'); return buf.toString(); }
/** * Instructions are meant to be in a machine-readable format so offline tooling can parse the * debugging output. The format is: * * (result_op '=')? instr '(' (operand ',' )* operand? ';' (extra_arg ',')* extra_arg? ')' * extra_arg can either be plain value or in a key: value format. * @return a String */ @Override public String toString() { StringBuilder buf = new StringBuilder(isDead() ? "[DEAD]" : ""); if (this instanceof ResultInstr) buf.append(((ResultInstr) this).getResult()).append(" = "); Operand[] operands = getOperands(); buf.append(operation).append('('); toArgList(buf, operands); String[] extraArgs = toStringNonOperandArgs(); if (extraArgs.length >= 1) { if (operands.length > 0) buf.append(' '); buf.append(';'); toArgList(buf, extraArgs); } buf.append(')'); return buf.toString(); }
public static void runLocalOptsOnInstrArray(IRScope s, Instr[] instrs) { // Reset value map if this instruction is the start/end of a basic block Map<Operand,Operand> valueMap = new HashMap<>(); Map<Variable,List<Variable>> simplificationMap = new HashMap<>(); for (int i = 0; i < instrs.length; i++) { Instr instr = instrs[i]; Instr newInstr = optInstr(s, instr, valueMap, simplificationMap); if (newInstr != instr) { instrs[i] = newInstr; } // If the call has been optimized away in the previous step, it is no longer a hard boundary for opts! // // Right now, calls are considered hard boundaries for optimization and // information cannot be propagated across them! // // SSS FIXME: Rather than treat all calls with a broad brush, what we need // is to capture different attributes about a call : // - uses closures // - known call target // - can modify scope, // - etc. // // This information is present in instruction flags on CallBase. Use it! Operation iop = instr.getOperation(); if (iop.startsBasicBlock() || iop.endsBasicBlock() || (iop.isCall() && !instr.isDead())) { valueMap = new HashMap<>(); simplificationMap = new HashMap<>(); } } }
public static void runLocalOptsOnInstrArray(IRScope s, Instr[] instrs) { // Reset value map if this instruction is the start/end of a basic block Map<Operand,Operand> valueMap = new HashMap<>(); Map<Variable,List<Variable>> simplificationMap = new HashMap<>(); for (int i = 0; i < instrs.length; i++) { Instr instr = instrs[i]; Instr newInstr = optInstr(s, instr, valueMap, simplificationMap); if (newInstr != instr) { instrs[i] = newInstr; } // If the call has been optimized away in the previous step, it is no longer a hard boundary for opts! // // Right now, calls are considered hard boundaries for optimization and // information cannot be propagated across them! // // SSS FIXME: Rather than treat all calls with a broad brush, what we need // is to capture different attributes about a call : // - uses closures // - known call target // - can modify scope, // - etc. // // This information is present in instruction flags on CallBase. Use it! Operation iop = instr.getOperation(); if (iop.startsBasicBlock() || iop.endsBasicBlock() || (iop.isCall() && !instr.isDead())) { valueMap = new HashMap<>(); simplificationMap = new HashMap<>(); } } }
if ((preCFG && iop.endsBasicBlock()) || (iop.isCall() && !i.isDead())) { valueMap = new HashMap<Operand,Operand>(); simplificationMap = new HashMap<Variable,List<Variable>>();
if ((preCFG && iop.endsBasicBlock()) || (iop.isCall() && !i.isDead())) { valueMap = new HashMap<Operand,Operand>(); simplificationMap = new HashMap<Variable,List<Variable>>();
if ((uses.size() == 1) && (defs.size() == 1)) { Instr soleDef = defs.get(0); if (!soleDef.isDead()) {
if ((uses.size() == 1) && (defs.size() == 1)) { Instr soleDef = defs.get(0); if (!soleDef.isDead()) {
if (!i.isDead()) markAllVariablesLive(problem, i.getUsedVariables());
if (!i.isDead()) markAllVariablesLive(problem, i.getUsedVariables());
if (!i.isDead()) markAllVariablesLive(lvp, living, i.getUsedVariables());
if (!i.isDead()) markAllVariablesLive(lvp, living, i.getUsedVariables());