static const char * parse_hi16 (CGEN_CPU_DESC cd, const char **strp, int opindex, unsigned long *valuep) { if (strncasecmp (*strp, "hi(", 3) == 0) { enum cgen_parse_operand_result result_type; bfd_vma value; const char *errmsg; *strp += 3; errmsg = cgen_parse_address (cd, strp, opindex, BFD_RELOC_HI16, &result_type, &value); if (**strp != ')') return _("missing `)'"); ++*strp; if (errmsg == NULL && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) value = (value >> 16) & 0xffff; *valuep = value; return errmsg; } return parse_imm (cd, strp, opindex, valuep); }
static inline vm_word assemble_format4(uint8_t opcode,char *instr){ while(is_space(*instr)){instr++;} uint8_t reg=parse_reg(&instr); //scan to comma vm_word imm=parse_imm(&instr); vm_op retval={.op_reg_imm={.op=opcode,.imm=imm,.reg=reg}} }