4

I need to come up with an x86(-64) disassembler so I started reading the source code for objdump. After searching around a bit I'm in a file, 'ia64-asmtab.h'. Inside is a struct 'ia64_main_table':

struct ia64_main_table
{
  /* The entry in the string table that corresponds to the name of this
     opcode. */
  unsigned short name_index;

  /* The type of opcode; corresponds to the TYPE field in 
     struct ia64_opcode. */
  unsigned char opcode_type;

  /* The number of outputs for this opcode. */
  unsigned char num_outputs;

  /* The base insn value for this opcode.  It may be modified by completers. */
  ia64_insn opcode;

  /* The mask of valid bits in OPCODE. Zeros indicate operand fields. */
  ia64_insn mask;

  /* The operands of this instruction.  Corresponds to the OPERANDS field
     in struct ia64_opcode. */
  unsigned char operands[5];

  /* The flags for this instruction.  Corresponds to the FLAGS field in
     struct ia64_opcode. */
  short flags;

  /* The tree of completers for this instruction; this is an offset into
     completer_table. */
  short completers;
};

A bit of Googling around hasn't shown any useful results and I'm stumped. Does anyone know what 'insn' stands for? I feel like it should stand for instruction, but it also seems to mean something else.

BLUC
  • 2,590
  • 2
  • 15
  • 24
  • 2
    If [this Intel patch](http://lists.freedesktop.org/archives/intel-gfx/2013-February/024261.html) is any indication, `insn` could mean instruction. – Jeff Mercado Jul 12 '14 at 01:26
  • 1
    Ya, it's got to mean instruction. There's nothing else I can think of. – BLUC Jul 12 '14 at 01:31
  • After looking at that site again, I could be wrong. I had the impression that was an official Intel changelog for official code. It appears to be from [a linux implementation of the Intel graphics drivers](https://01.org/linuxgraphics/) so may not necessarily be it. But then again, the change came from a person with an Intel email. – Jeff Mercado Jul 12 '14 at 02:51
  • If you're trying to create an x86-64 disassembler, IA-64 is the wrong place to look. Itanium is a totally separate architecture with a totally unrelated machine-code format. Fixed-width VLIW bundles are complex in a different way from x86 instructions so it's a bad starting place. – Peter Cordes Aug 02 '19 at 13:07

2 Answers2

6

Answering my own question here. The only feasible meaning of insn seems to be instruction. Thanks for the link, Jeff.

BLUC
  • 2,590
  • 2
  • 15
  • 24
2

Some insns are actual instructions; others represent dispatch tables for switch statements; others represent labels to jump to or various sorts of declarative information. A more detailed description of INSN is given in this link https://gcc.gnu.org/onlinedocs/gccint/Insns.html

DTharun
  • 746
  • 7
  • 16
  • That's for GCC RTL's use of the abbreviation, not Binutils `objdump`. It's an abbreviation for the same English word ("instruction") of course, but the actual object is different. It's just an obvious abbreviation invented independently. I've used it myself in SO answers, in fact I wondered if this question was going to be about one of my answers until I saw how old it was. – Peter Cordes Aug 02 '19 at 13:06