6. Opcodes support
Opcodes support comes in the form of machine generated opcode tables as well as supporting routines. 6.1 Generated files List of generated files 6.2 The .opc file Target specific C code 6.3 Special assembler parsing needs Support for unusual syntax [ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]
< a r c h > d i s . c Disassembler support routines. < a r c h > o p i n s t . c Operand instance tables. These describe which hardware elements are read and which are written for each instruction. This file isn't generated for all architectures, only ones that can make use of the data. For example the M32R uses them to emit warnings if the output of one parallel instruction is the input of another, and to control creating parallel instructions during optimizing assembly. [ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]
s p a r c _ c g e n _ o p c o d e _ b i t swould
/ *I ti si m p o r t a n tt h a tw eo n l yl o o ka ti n s nc o d eb i t s a st h a ti sh o wt h eo p c o d et a b l ei sh a s h e d . O P C O D E _ B I T Si sat a b l eo fv a l i db i t sf o re a c ho ft h e m a i nt y p e s( 0 , 1 , 2 , 3 ) . * / c o n s tu n s i g n e di n ts p a r c _ c g e n _ o p c o d e _ b i t s [ 4 ]={ 0 x 0 1 c 0 0 0 0 0 ,0 x 0 ,0 x 0 1 f 8 0 0 0 0 ,0 x 0 1 f 8 0 0 0 0 } ;
- opc.c - asm.c This section contains additions to the generated $ t a r g e t a s m . c file. Typically defined here are functions used by operands with a p a r s edefine-operand handler spec. - dis.c This section contains additions to the generated $ t a r g e t d i s . c file. Typically defined here these macros: #define CGEN_PRINT_NORMAL(cd, info, value, attrs, pc, length) #define CGEN_PRINT_ADDRESS(cd, info, value, attrs, pc, length) #define CGEN_PRINT_INSN function_name #define CGEN_BFD_ARCH bfd_arch_<name> #define CGEN_COMPUTE_ISA(info) [ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]
When assembling, special code must be called to recognize the h i g hand l o wpseudo-ops and generate the appropriate relocations. This is indicated by specifying a "parse handler" for the operand in question. Here is the d e f i n e o p e r a n dfor the lower 16 bit operand.
( d e f i n e o p e r a n d ( n a m eu l o 1 6 ) ( c o m m e n t" 1 6b i tu n s i g n e di m m e d i a t e ,f o rl o w ( ) " ) ( a t t r s ) ( t y p eh u l o 1 6 ) ( i n d e xf u i m m 1 6 ) ( h a n d l e r s( p a r s e" u l o 1 6 " ) ) )
The generated parser will call a function named p a r s e _ u l o 1 6for the immediate operand of the o r 3instruction. The name of the function is constructed by prepended "parse_" to the argument of the p a r s espec.
e r r m s g=p a r s e _ u l o 1 6( c d ,s t r p ,M 3 2 R _ O P E R A N D _ U L O 1 6 ,& f i e l d s > f _ u i m m 1 6 ) ;
But where does one put the p a r s e _ u l o 1 6function? Answer: in the a s m . c section of m 3 2 r . o p c . [ << ] [ >> ] [Top] [Contents] [Index] [ ? ]
This document was generated by Doug Evans on January, 28 2010 using texi2html 1.78 .