void tab_line(const string& line, stringstream& tab_buf, double swid, const vector<int>& delta) { int len = line.length(); bool is_modified = false; int pos = 0, c = 0, diff = 0; // cout << "line = '" << line << "'" << endl; while (pos < (int)line.length()) { if (line[pos] == 9) { c = (c/8)*8+8; pos++; } else if (line[pos] == ' ') { c++; pos++; } else { int savec = c; string next_line; while (pos < len && line[pos] != 9 && !(pos < len-1 && isspace(line[pos]) && isspace(line[pos+1]))) { next_line += line[pos++]; c++; } double br,bd; replace_exp(next_line); // cout << "'" << next_line << "': " << savec << endl; g_textfindend(next_line,&br,&bd); int real_c = savec - diff; tab_buf << "\\movexy{" << (swid*real_c) << "}{0}"; tab_buf << next_line; tab_buf << "\\movexy{" << (-br-swid*real_c) << "}{0}"; is_modified = true; diff += savec < (int)delta.size() ? delta[savec] : 0; diff ++; // cout << "savec = " << savec << " delta = " << delta[savec] << " diff = " << diff << endl; } } if (!is_modified) tab_buf << "\\movexy{0}{0}"; tab_buf << endl; }
void backprop::optimize_phi (gphi *phi, tree var, const usage_info *info) { /* If the sign of the result doesn't matter, try to strip sign operations from arguments. */ if (info->flags.ignore_sign) { basic_block bb = gimple_bb (phi); use_operand_p use; ssa_op_iter oi; bool replaced = false; FOR_EACH_PHI_ARG (use, phi, oi, SSA_OP_USE) { /* Propagating along abnormal edges is delicate, punt for now. */ const int index = PHI_ARG_INDEX_FROM_USE (use); if (EDGE_PRED (bb, index)->flags & EDGE_ABNORMAL) continue; tree new_arg = strip_sign_op (USE_FROM_PTR (use)); if (new_arg) { if (!replaced) prepare_change (var); if (dump_file && (dump_flags & TDF_DETAILS)) note_replacement (phi, USE_FROM_PTR (use), new_arg); replace_exp (use, new_arg); replaced = true; } } }
void backprop::optimize_phi (gphi *phi, tree var, const usage_info *info) { /* If the sign of the result doesn't matter, strip sign operations from all arguments. */ if (info->flags.ignore_sign) { use_operand_p use; ssa_op_iter oi; bool replaced = false; FOR_EACH_PHI_ARG (use, phi, oi, SSA_OP_USE) { tree new_arg = strip_sign_op (USE_FROM_PTR (use)); if (new_arg) { if (!replaced) prepare_change (var); if (dump_file && (dump_flags & TDF_DETAILS)) note_replacement (phi, USE_FROM_PTR (use), new_arg); replace_exp (use, new_arg); replaced = true; } }