shithub: mc

ref: 7be5d13a28a8424b4f0275a65fe0c896df1e9bf4
dir: /8/insns.def/

View raw version
/* Table of instructions. Each instruction
   is defined by the following macro:
        Insn(enumval, fmt, attr)
    The format string 'fmt' has the following expansions:
        %r            - A register
        %m            - A memory location.
        %l            - A location (either register or memory)
        %x            - Any value.
        %[0-9]*t      - Mode of an operand. The optional number
                        preceeding it is the operand desired for
                        the mode.
        %v            - a value (ie, immediate integer or label)
    Currently, there aren't any attrs, because none were needed yet.
    Eventually, they'll probably include flag setting and so on.

   */

/* Note, the mov instruction is specified in an overly general manner. */
Insn(Inone,     "BAD_INSN",                     0)
Insn(Imov,      "\tmov%t %x,%x\n",              0)
Insn(Imovz,     "\tmovz%0t%1t %x,%x\n",         0)
Insn(Imovs,     "\tmovs%0t%1t %x,%x\n",         0)
Insn(Ilea,      "\tlea%t %x,%x\n",              0)

Insn(Iadd,      "\tadd%t %r,%x\n",              0)
Insn(Isub,      "\tsub%t %r,%x\n",              0)
Insn(Imul,      "\tmul%t %r\n",              0)
Insn(Idiv,      "\tdiv%t %r\n",              0)
Insn(Ineg,      "\tneg%t %r\n",              0)
Insn(Iand,      "\tand%t %r,%x\n",              0)
Insn(Ior,       "\tor%t %r,%x\n",               0)
Insn(Ixor,      "\txor%t %r,%x\n",              0)

Insn(Itest,     "\ttest%t %r,%r\n",             0)
Insn(Icmp,      "\tcmp%t %r,%r\n",              0)

Insn(Ipush,     "\tpush%t %r\n",                0)
Insn(Ipop,      "\tpop%t %r\n",                 0)

/* branch instructions */
Insn(Isetz,       "\tsetz %v\n",                0)
Insn(Isetnz,      "\tsetnz %v\n",               0)
Insn(Isetlt,      "\tsetlt %v\n",               0)
Insn(Isetle,      "\tsetle %v\n",               0)
Insn(Isetgt,      "\tsetgt %v\n",               0)
Insn(Isetge,      "\tsetge %v\n",               0)

/* branch instructions */
Insn(Icall,     "\tcall %v\n",                  0)
Insn(Ijmp,      "\tjmp %v\n",                   0)
Insn(Ijz,       "\tjz %v\n",                    0)
Insn(Ijnz,      "\tjnz %v\n",                   0)
Insn(Ijl,       "\tjl %v\n",                    0)
Insn(Ijle,      "\tjle %v\n",                   0)
Insn(Ijg,       "\tjg %v\n",                    0)
Insn(Ijge,      "\tjge %v\n",                   0)
Insn(Iret,      "\tret\n",                      0)

/* not really an insn... */
Insn(Ilbl,      "%v:\n",                        0)