void dump_fetch() { y_msg_f(Y_MSG_DEBUG, "--------------Fetch---------------\n"); y_msg_f(Y_MSG_DEBUG, "Next Addr\tA:%08X\tB:%08X\n", s_fetch_addr1, s_fetch_addr2); y_msg_f(Y_MSG_DEBUG, "Next Mode\tF:%s\t\tD:%s\n", str_modes[s_fetch_mode], str_modes[s_decode_mode]); y_msg_f(Y_MSG_DEBUG, "Last Mode\tF:%s\n", str_modes[s_fetch_flag]); y_msg_f(Y_MSG_DEBUG, "Ins1\t%s\t%02X\t%02X\t%02X\t%02X\t%02X\n", mnemonic(s_decode_ins1[0]),s_decode_ins1[1],s_decode_ins1[2],s_decode_ins1[3],s_decode_ins1[4],s_decode_ins1[5]); y_msg_f(Y_MSG_DEBUG, "Ins2\t%s\t%02X\t%02X\t%02X\t%02X\t%02X\n", mnemonic(s_decode_ins2[0]),s_decode_ins2[1],s_decode_ins2[2],s_decode_ins2[3],s_decode_ins2[4],s_decode_ins2[5]); }
//-------------------------------------------------------------------------- static void handle_new_flags(void) { if ( mnemonic() ) { register_names[26] = "%arg0"; register_names[25] = "%arg1"; register_names[24] = "%arg2"; register_names[23] = "%arg3"; register_names[28] = "%ret0"; } else { register_names[26] = "%r26"; register_names[25] = "%r25"; register_names[24] = "%r24"; register_names[23] = "%r23"; register_names[28] = "%r28"; } }
void escribir_instruccion (FILE * salida, int i) /**********************************************************************/ { if (codigo[i].comentarios != NULL) fprintf (salida, "%s", codigo[i].comentarios); fprintf (salida, " "); fprintf (salida, "%s", mnemonic (codigo[i].op)); switch (codigo[i].op) { case STC: case RD: case WRT: fprintf (salida, "%2d", codigo[i].arg1); break; case ENP: case JMP: case JMT: case JMF: if (codigo[i].etiq == NULL) fprintf (salida, "%2d", codigo[i].arg1); else fprintf (salida, "%s", codigo[i].etiq); break ; case SRF: fprintf (salida, "%2d %2d", codigo[i].arg1, codigo[i].arg2); break; case OSF: fprintf (salida, "%2d %2d %s", codigo[i].arg1, codigo[i].arg2, codigo[i].etiq); break; } fprintf (salida, "\n"); }
void output_process(void *closure, char *canonical_hostname, struct sockaddr *peer_addr, struct gfs_client_load *load, struct gfs_connection *gfs_server, gfarm_error_t error) { struct output o; o.closure = closure; o.canonical_hostname = canonical_hostname; if (peer_addr != NULL) o.peer_addr = *peer_addr; if (load != NULL) o.load = *load; o.auth_mnemonic = mnemonic(gfs_server, load); o.error = error; assert((load != NULL) == LOADAVG_AVAIL(&o)); if (output_record) output_add(&o); else /* i.e. don't sort */ (*output_callback)(&o); }
void pMenu::setText(const string &text) { gtk_menu_item_set_label(GTK_MENU_ITEM(widget), mnemonic(text)); }
void MRU_updateWidget(std::size_t index, const char *filename) { EscapedMnemonic mnemonic(64); mnemonic << Unsigned(index + 1) << "- " << filename; gtk_label_set_text_with_mnemonic(GTK_LABEL(gtk_bin_get_child(GTK_BIN(MRU_items[index]))), mnemonic.c_str()); }
void IRGenerator::accept(BinaryExpr& expr) { FNTRACE(); static const std::unordered_map< int /*FlowVM::Opcode*/, Value* (IRGenerator::*)(Value*, Value*, const std::string&) > ops = { // numerical { FlowVM::Opcode::NADD, &IRGenerator::createAdd }, { FlowVM::Opcode::NSUB, &IRGenerator::createSub }, { FlowVM::Opcode::NMUL, &IRGenerator::createMul }, { FlowVM::Opcode::NDIV, &IRGenerator::createDiv }, { FlowVM::Opcode::NREM, &IRGenerator::createRem }, { FlowVM::Opcode::NSHL, &IRGenerator::createShl }, { FlowVM::Opcode::NSHR, &IRGenerator::createShr }, { FlowVM::Opcode::NPOW, &IRGenerator::createPow }, { FlowVM::Opcode::NAND, &IRGenerator::createAnd }, { FlowVM::Opcode::NOR, &IRGenerator::createOr }, { FlowVM::Opcode::NXOR, &IRGenerator::createXor }, { FlowVM::Opcode::NCMPEQ, &IRGenerator::createNCmpEQ }, { FlowVM::Opcode::NCMPNE, &IRGenerator::createNCmpNE }, { FlowVM::Opcode::NCMPLE, &IRGenerator::createNCmpLE }, { FlowVM::Opcode::NCMPGE, &IRGenerator::createNCmpGE }, { FlowVM::Opcode::NCMPLT, &IRGenerator::createNCmpLT }, { FlowVM::Opcode::NCMPGT, &IRGenerator::createNCmpGT }, // string { FlowVM::Opcode::SADD, &IRGenerator::createSAdd }, { FlowVM::Opcode::SCMPEQ, &IRGenerator::createSCmpEQ }, { FlowVM::Opcode::SCMPNE, &IRGenerator::createSCmpNE }, { FlowVM::Opcode::SCMPLE, &IRGenerator::createSCmpLE }, { FlowVM::Opcode::SCMPGE, &IRGenerator::createSCmpGE }, { FlowVM::Opcode::SCMPLT, &IRGenerator::createSCmpLT }, { FlowVM::Opcode::SCMPGT, &IRGenerator::createSCmpGT }, { FlowVM::Opcode::SCMPBEG, &IRGenerator::createSCmpEB }, { FlowVM::Opcode::SCMPEND, &IRGenerator::createSCmpEE }, { FlowVM::Opcode::SCONTAINS, &IRGenerator::createSIn }, // regex { FlowVM::Opcode::SREGMATCH, &IRGenerator::createSCmpRE }, // ip { FlowVM::Opcode::PCMPEQ, &IRGenerator::createPCmpEQ }, { FlowVM::Opcode::PCMPNE, &IRGenerator::createPCmpNE }, { FlowVM::Opcode::PINCIDR, &IRGenerator::createPInCidr }, }; if (expr.op() == FlowVM::Opcode::BOR) { // (lhs || rhs) // // L = lhs(); // if (L) goto end; // R = rhs(); // L = R; // end: // result = L; BasicBlock* borLeft = createBlock("bor.left"); BasicBlock* borRight = createBlock("bor.right"); BasicBlock* borCont = createBlock("bor.cont"); AllocaInstr* result = createAlloca(FlowType::Boolean, get(1), "bor"); Value* lhs = codegen(expr.leftExpr()); createCondBr(lhs, borLeft, borRight); setInsertPoint(borLeft); createStore(result, lhs, "bor.left"); createBr(borCont); setInsertPoint(borRight); Value* rhs = codegen(expr.rightExpr()); createStore(result, rhs, "bor.right"); createBr(borCont); setInsertPoint(borCont); result_ = result; return; } Value* lhs = codegen(expr.leftExpr()); Value* rhs = codegen(expr.rightExpr()); auto i = ops.find(expr.op()); if (i != ops.end()) { result_ = (this->*i->second)(lhs, rhs, ""); } else { fprintf(stderr, "BUG: Binary operation `%s` not implemented.\n", mnemonic(expr.op())); assert(!"Unimplemented"); result_ = nullptr; } }
// castExpr ::= 'int' '(' expr ')' // | 'string' '(' expr ')' // | 'bool' '(' expr ')' std::unique_ptr<Expr> FlowParser::castExpr() { FNTRACE(); FlowLocation sloc(location()); FlowToken targetTypeToken = token(); nextToken(); if (!consume(FlowToken::RndOpen)) return nullptr; std::unique_ptr<Expr> e(expr()); if (!consume(FlowToken::RndClose)) return nullptr; if (!e) return nullptr; Opcode targetType = makeOperator(targetTypeToken, e.get()); if (targetType == Opcode::EXIT) { reportError("Type cast error. No cast implementation found for requested cast from %s to %s.", tos(e->getType()).c_str(), targetTypeToken.c_str()); return nullptr; } if (targetType == Opcode::NOP) { return e; } printf("Type cast from %s to %s: %s\n", tos(e->getType()).c_str(), targetTypeToken.c_str(), mnemonic(targetType)); return std::make_unique<UnaryExpr>(targetType, std::move(e), sloc.update(end())); }