This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: About opcode!


On Fri, 2004-07-02 at 18:19, Ian Lance Taylor wrote:
> libra <mr924352@cs.nthu.edu.tw> writes:
> 
> > I have one question about opcode in binutils source directory.
> > Why have two opcode information(file) in two different location,one is in 
> > "binutils-2.14/opcodes/xxx-opc.h", the other is in "binutils-
> > 2.14/include/opcode/xxx.h"
> > 
> > For example:
> > "binutils-2.14/opcodes/arm-opc.h" and "binutils-2.14/include/opcode/arm.h"
> > 
> > Why can not just use one opcode table file? For example, just use "binutils-
> > 2.14/include/opcode/arm.h". What's different purpose between arm-opc.h and 
> > arm.h?
> 
> There is no good reason for this.  It is just the ways the ARM tools
> were historically developed.  You didn't even mention that there is
> yet another version of the ARM opcode table in gas/config/tc-arm.c.  I
> think it would be great if somebody cleaned it up.
> 

The version in include/opcode/arm.h is obsolete and probably should be
removed.  I don't think it's been used or updated in at least ten years
(13 years if you believe the copyright notice) and doesn't go beyond ARM
architecture 3.  The model of breaking instructions down to bit-fields
isn't in general portable.

The issue between the information in gas/config/tc-arm.c and
opcodes/arm-opc.h is that they are for translation in opposite
directions.  In general it's not possible to write simple rules that
translate from assembly syntax to bit patterns (there are pseudo ops,
for example) and it's not possible to do the reverse trivially either
(the disassembly table has a partial ordering constraint on it).

R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]