void bc_dump::dump(alu_node& n) { sb_ostringstream s; static const char *omod_str[] = {"","*2","*4","/2"}; static const char *slots = "xyzwt"; s << (n.bc.update_exec_mask ? "M" : " "); s << (n.bc.update_pred ? "P" : " "); s << " "; s << (n.bc.pred_sel>=2 ? (n.bc.pred_sel == 2 ? "0" : "1") : " "); s << " "; s << slots[n.bc.slot] << ": "; s << n.bc.op_ptr->name << omod_str[n.bc.omod] << (n.bc.clamp ? "_sat" : ""); fill_to(s, 26); s << " "; print_dst(s, n.bc); for (int k = 0; k < n.bc.op_ptr->src_count; ++k) { s << (k ? ", " : ", "); print_src(s, n.bc, k); } if (n.bc.bank_swizzle) { fill_to(s, 55); if (n.bc.slot == SLOT_TRANS) s << " " << scl_bs[n.bc.bank_swizzle]; else s << " " << vec_bs[n.bc.bank_swizzle]; } sblog << s.str() << "\n"; }
void InstructionPrinter::print_head() { const char filler = '_'; fill_to(bci_pos , filler); tty->print("bci" ); fill_to(use_pos , filler); tty->print("use" ); fill_to(temp_pos , filler); tty->print("tid" ); fill_to(instr_pos, filler); tty->print("instr"); fill_to(end_pos , filler); tty->cr(); }
void InstructionPrinter::do_LookupSwitch(LookupSwitch* x) { tty->print("lookupswitch "); print_value(x->tag()); tty->cr(); int l = x->length(); for (int i = 0; i < l; i++) { fill_to(instr_pos); tty->print_cr("case %5d: B%d", x->key_at(i), x->sux_at(i)->block_id()); } fill_to(instr_pos); tty->print("default : B%d", x->default_sux()->block_id()); }
void InstructionPrinter::do_TableSwitch(TableSwitch* x) { output()->print("tableswitch "); if (x->is_safepoint()) output()->print("(safepoint) "); print_value(x->tag()); output()->cr(); int l = x->length(); for (int i = 0; i < l; i++) { fill_to(instr_pos); output()->print_cr("case %5d: B%d", x->lo_key() + i, x->sux_at(i)->block_id()); } fill_to(instr_pos); output()->print("default : B%d", x->default_sux()->block_id()); }
void InstructionPrinter::print_line(Instruction* instr) { // print instruction data on one line if (instr->is_pinned()) tty->put('.'); fill_to(bci_pos ); tty->print("%d", instr->bci()); fill_to(use_pos ); tty->print("%d", instr->use_count()); fill_to(temp_pos ); print_temp(instr); fill_to(instr_pos); print_instr(instr); tty->cr(); // add a line for StateSplit instructions w/ non-empty stacks // (make it robust so we can print incomplete instructions) StateSplit* split = instr->as_StateSplit(); if (split != NULL && split->state() != NULL && !split->state()->stack_is_empty()) { fill_to(instr_pos); print_stack(split->state()); tty->cr(); } }
void InstructionPrinter::print_stack(ValueStack* stack) { int start_position = tty->position(); if (stack->stack_is_empty()) { tty->print("empty stack"); } else { tty->print("stack ["); for (int i = 0; i < stack->stack_size();) { if (i > 0) tty->print(", "); tty->print("%d:", i); print_value(stack->stack_at_inc(i)); } tty->put(']'); } if (!stack->no_active_locks()) { // print out the lines on the line below this // one at the same indentation level. tty->cr(); fill_to(start_position, ' '); tty->print("locks ["); for (int i = i = 0; i < stack->locks_size(); i++) { Value t = stack->locks().at(i); if (i > 0) tty->print(", "); tty->print("%d:", i); if (t == NULL) { // synchronized methods push null on the lock stack tty->print("this"); } else { print_value(t); } } tty->print("]"); } }
void InstructionPrinter::do_Invoke(Invoke* x) { if (x->receiver() != NULL) { print_value(x->receiver()); output()->print("."); } output()->print("%s(", Bytecodes::name(x->code())); for (int i = 0; i < x->number_of_arguments(); i++) { if (i > 0) output()->print(", "); print_value(x->argument_at(i)); } output()->print_cr(")"); fill_to(instr_pos); output()->print("%s.%s%s", x->target()->holder()->name()->as_utf8(), x->target()->name()->as_utf8(), x->target()->signature()->as_symbol()->as_utf8()); }
void InstructionPrinter::print_stack(ValueStack* stack) { int start_position = output()->position(); if(!stack||stack->stack_is_empty()){ output()->print("empty stack"); } else { output()->print("stack ["); for (int i = 0; i < stack->stack_size();) { if (i > 0) output()->print(", "); output()->print("%d:", i); Value value = stack->stack_at_inc(i); print_value(value); Phi* phi = value->as_Phi(); if (phi != NULL) { if (phi->operand()->is_valid()) { output()->print(" "); phi->operand()->print(output()); } } } output()->put(']'); } if(stack&&!stack->no_active_locks()){ // print out the lines on the line below this // one at the same indentation level. output()->cr(); fill_to(start_position, ' '); output()->print("locks ["); for(int i=0;i<stack->locks_size();i++){ Value t = stack->lock_at(i); if (i > 0) output()->print(", "); output()->print("%d:", i); if (t == NULL) { // synchronized methods push null on the lock stack output()->print("this"); } else { print_value(t); } } output()->print("]"); } }
void builder::writer_t::next() { fill_to(++position); }
void builder::writer_t::after(std::size_t position, const std::string& string) { fill_to(position); code[position] += string; }
void builder::writer_t::before(std::size_t position, const std::string& string) { fill_to(position); code[position] = string + code[position]; }
builder::writer_t::writer_t() { fill_to(position); }
void bc_dump::dump(fetch_node& n) { sb_ostringstream s; static const char * fetch_type[] = {"VERTEX", "INSTANCE", ""}; s << n.bc.op_ptr->name; fill_to(s, 20); s << "R"; print_sel(s, n.bc.dst_gpr, n.bc.dst_rel, INDEX_LOOP, 0); s << "."; for (int k = 0; k < 4; ++k) s << chans[n.bc.dst_sel[k]]; s << ", "; s << "R"; print_sel(s, n.bc.src_gpr, n.bc.src_rel, INDEX_LOOP, 0); s << "."; unsigned vtx = n.bc.op_ptr->flags & FF_VTX; unsigned num_src_comp = vtx ? ctx.is_cayman() ? 2 : 1 : 4; for (unsigned k = 0; k < num_src_comp; ++k) s << chans[n.bc.src_sel[k]]; if (vtx && n.bc.offset[0]) { s << " + " << n.bc.offset[0] << "b "; } s << ", RID:" << n.bc.resource_id; if (vtx) { s << " " << fetch_type[n.bc.fetch_type]; if (!ctx.is_cayman() && n.bc.mega_fetch_count) s << " MFC:" << n.bc.mega_fetch_count; if (n.bc.fetch_whole_quad) s << " FWQ"; if (ctx.is_egcm() && n.bc.resource_index_mode) s << " RIM:SQ_CF_INDEX_" << n.bc.resource_index_mode; if (ctx.is_egcm() && n.bc.sampler_index_mode) s << " SID:SQ_CF_INDEX_" << n.bc.sampler_index_mode; s << " UCF:" << n.bc.use_const_fields << " FMT(DTA:" << n.bc.data_format << " NUM:" << n.bc.num_format_all << " COMP:" << n.bc.format_comp_all << " MODE:" << n.bc.srf_mode_all << ")"; } else { s << ", SID:" << n.bc.sampler_id; if (n.bc.lod_bias) s << " LB:" << n.bc.lod_bias; s << " CT:"; for (unsigned k = 0; k < 4; ++k) s << (n.bc.coord_type[k] ? "N" : "U"); for (unsigned k = 0; k < 3; ++k) if (n.bc.offset[k]) s << " O" << chans[k] << ":" << n.bc.offset[k]; if (ctx.is_egcm() && n.bc.resource_index_mode) s << " RIM:SQ_CF_INDEX_" << n.bc.resource_index_mode; if (ctx.is_egcm() && n.bc.sampler_index_mode) s << " SID:SQ_CF_INDEX_" << n.bc.sampler_index_mode; } sblog << s.str() << "\n"; }
void bc_dump::dump(cf_node& n) { sb_ostringstream s; s << n.bc.op_ptr->name; if (n.bc.op_ptr->flags & CF_EXP) { static const char *exp_type[] = {"PIXEL", "POS ", "PARAM"}; fill_to(s, 18); s << " " << exp_type[n.bc.type] << " "; if (n.bc.burst_count) { sb_ostringstream s2; s2 << n.bc.array_base << "-" << n.bc.array_base + n.bc.burst_count; s.print_wl(s2.str(), 5); s << " R" << n.bc.rw_gpr << "-" << n.bc.rw_gpr + n.bc.burst_count << "."; } else { s.print_wl(n.bc.array_base, 5); s << " R" << n.bc.rw_gpr << "."; } for (int k = 0; k < 4; ++k) s << chans[n.bc.sel[k]]; } else if (n.bc.op_ptr->flags & CF_MEM) { static const char *exp_type[] = {"WRITE", "WRITE_IND", "WRITE_ACK", "WRITE_IND_ACK"}; fill_to(s, 18); s << " " << exp_type[n.bc.type] << " "; s.print_wl(n.bc.array_base, 5); s << " R" << n.bc.rw_gpr << "."; for (int k = 0; k < 4; ++k) s << ((n.bc.comp_mask & (1 << k)) ? chans[k] : '_'); if ((n.bc.op_ptr->flags & CF_RAT) && (n.bc.type & 1)) { s << ", @R" << n.bc.index_gpr << ".xyz"; } if ((n.bc.op_ptr->flags & CF_MEM) && (n.bc.type & 1)) { s << ", @R" << n.bc.index_gpr << ".x"; } s << " ES:" << n.bc.elem_size; } else { if (n.bc.op_ptr->flags & CF_CLAUSE) { s << " " << n.bc.count+1; } s << " @" << (n.bc.addr << 1); if (n.bc.op_ptr->flags & CF_ALU) { static const char *index_mode[] = {"", " CF_INDEX_0", " CF_INDEX_1"}; for (int k = 0; k < 4; ++k) { bc_kcache &kc = n.bc.kc[k]; if (kc.mode) { s << " KC" << k << "[CB" << kc.bank << ":" << (kc.addr << 4) << "-" << (((kc.addr + kc.mode) << 4) - 1) << index_mode[kc.index_mode] << "]"; } } } if (n.bc.cond) s << " CND:" << n.bc.cond; if (n.bc.pop_count) s << " POP:" << n.bc.pop_count; if (n.bc.count && (n.bc.op_ptr->flags & CF_EMIT)) s << " STREAM" << n.bc.count; } if (!n.bc.barrier) s << " NO_BARRIER"; if (n.bc.valid_pixel_mode) s << " VPM"; if (n.bc.whole_quad_mode) s << " WQM"; if (n.bc.end_of_program) s << " EOP"; sblog << s.str() << "\n"; }