GNU Binutils with patches for OS216
Revision | 5ff58fb071f5d3d4ee7572af1221cdf80d10f4e8 (tree) |
---|---|
Zeit | 2010-02-12 13:38:21 |
Autor | Doug Evans <dje@goog...> |
Commiter | Doug Evans |
* m32r.cpu (HASH-PREFIX): Delete.
(duhpo, dshpo): New pmacros.
(simm8, simm16): Delete HASH-PREFIX attribute, define with dshpo.
(uimm3, uimm4, uimm5, uimm8, uimm16, imm1): Delete HASH-PREFIX
attribute, define with dshpo.
(uimm24): Delete HASH-PREFIX attribute.
* m32r.opc (CGEN_PRINT_NORMAL): Delete.
(print_signed_with_hash_prefix): New function.
(print_unsigned_with_hash_prefix): New function.
* xc16x.cpu (dowh): New pmacro.
(upof16): Define with dowh, specify print handler.
(qbit, qlobit, qhibit): Ditto.
(upag16): Ditto.
* xc16x.opc (CGEN_PRINT_NORMAL): Delete.
(print_with_dot_prefix): New functions.
(print_with_pof_prefix, print_with_pag_prefix): New functions.
@@ -1,3 +1,22 @@ | ||
1 | +2010-02-11 Doug Evans <dje@sebabeach.org> | |
2 | + | |
3 | + * m32r.cpu (HASH-PREFIX): Delete. | |
4 | + (duhpo, dshpo): New pmacros. | |
5 | + (simm8, simm16): Delete HASH-PREFIX attribute, define with dshpo. | |
6 | + (uimm3, uimm4, uimm5, uimm8, uimm16, imm1): Delete HASH-PREFIX | |
7 | + attribute, define with dshpo. | |
8 | + (uimm24): Delete HASH-PREFIX attribute. | |
9 | + * m32r.opc (CGEN_PRINT_NORMAL): Delete. | |
10 | + (print_signed_with_hash_prefix): New function. | |
11 | + (print_unsigned_with_hash_prefix): New function. | |
12 | + * xc16x.cpu (dowh): New pmacro. | |
13 | + (upof16): Define with dowh, specify print handler. | |
14 | + (qbit, qlobit, qhibit): Ditto. | |
15 | + (upag16): Ditto. | |
16 | + * xc16x.opc (CGEN_PRINT_NORMAL): Delete. | |
17 | + (print_with_dot_prefix): New functions. | |
18 | + (print_with_pof_prefix, print_with_pag_prefix): New functions. | |
19 | + | |
1 | 20 | 2010-01-24 Doug Evans <dje@sebabeach.org> |
2 | 21 | |
3 | 22 | * frv.cpu (floating-point-conversion): Update call to fp conv op. |
@@ -638,13 +638,21 @@ | ||
638 | 638 | ; code. Usually there's a bit of over-specification, but in more complicated |
639 | 639 | ; instruction sets there isn't. |
640 | 640 | |
641 | -; M32R specific operand attributes: | |
641 | +;; Print some operands take a hash prefix. | |
642 | +;; ??? Why don't we also handle one when parsing? | |
642 | 643 | |
643 | -(define-attr | |
644 | - (for operand) | |
645 | - (type boolean) | |
646 | - (name HASH-PREFIX) | |
647 | - (comment "immediates have an optional '#' prefix") | |
644 | +(define-pmacro (duhpo x-name x-comment x-attrs x-type x-index) | |
645 | + (define-operand (name x-name) (comment x-comment) | |
646 | + (.splice attrs (.unsplice x-attrs)) | |
647 | + (type x-type) (index x-index) | |
648 | + (handlers (print "unsigned_with_hash_prefix"))) | |
649 | +) | |
650 | + | |
651 | +(define-pmacro (dshpo x-name x-comment x-attrs x-type x-index) | |
652 | + (define-operand (name x-name) (comment x-comment) | |
653 | + (.splice attrs (.unsplice x-attrs)) | |
654 | + (type x-type) (index x-index) | |
655 | + (handlers (print "signed_with_hash_prefix"))) | |
648 | 656 | ) |
649 | 657 | |
650 | 658 | ; ??? Convention says this should be o-sr, but then the insn definitions |
@@ -662,21 +670,23 @@ | ||
662 | 670 | (dnop scr "source control register" () h-cr f-r2) |
663 | 671 | (dnop dcr "destination control register" () h-cr f-r1) |
664 | 672 | |
665 | -(dnop simm8 "8 bit signed immediate" (HASH-PREFIX) h-sint f-simm8) | |
666 | -(dnop simm16 "16 bit signed immediate" (HASH-PREFIX) h-sint f-simm16) | |
667 | -(dnop uimm3 "3 bit unsigned number" (HASH-PREFIX) h-uint f-uimm3) | |
668 | -(dnop uimm4 "4 bit trap number" (HASH-PREFIX) h-uint f-uimm4) | |
669 | -(dnop uimm5 "5 bit shift count" (HASH-PREFIX) h-uint f-uimm5) | |
670 | -(dnop uimm8 "8 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm8) | |
671 | -(dnop uimm16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm16) | |
673 | +(dshpo simm8 "8 bit signed immediate" () h-sint f-simm8) | |
674 | +(dshpo simm16 "16 bit signed immediate" () h-sint f-simm16) | |
675 | +(duhpo uimm3 "3 bit unsigned number" () h-uint f-uimm3) | |
676 | +(duhpo uimm4 "4 bit trap number" () h-uint f-uimm4) | |
677 | +(duhpo uimm5 "5 bit shift count" () h-uint f-uimm5) | |
678 | +(duhpo uimm8 "8 bit unsigned immediate" () h-uint f-uimm8) | |
679 | +(duhpo uimm16 "16 bit unsigned immediate" () h-uint f-uimm16) | |
680 | + | |
681 | +(duhpo imm1 "1 bit immediate" ((MACH m32rx,m32r2)) h-uint f-imm1) | |
672 | 682 | |
673 | -(dnop imm1 "1 bit immediate" ((MACH m32rx,m32r2) HASH-PREFIX) h-uint f-imm1) | |
674 | -(dnop accd "accumulator destination register" ((MACH m32rx,m32r2)) h-accums f-accd) | |
675 | -(dnop accs "accumulator source register" ((MACH m32rx,m32r2)) h-accums f-accs) | |
676 | -(dnop acc "accumulator reg (d)" ((MACH m32rx,m32r2)) h-accums f-acc) | |
683 | +(dnop accd "accumulator destination register" ((MACH m32rx,m32r2)) h-accums f-accd) | |
684 | +(dnop accs "accumulator source register" ((MACH m32rx,m32r2)) h-accums f-accs) | |
685 | +(dnop acc "accumulator reg (d)" ((MACH m32rx,m32r2)) h-accums f-acc) | |
677 | 686 | |
678 | 687 | ; slo16,ulo16 are used in both with-hash-prefix/no-hash-prefix cases. |
679 | -; e.g. add3 r3,r3,#1 and ld r3,@(4,r4). We could use HASH-PREFIX. | |
688 | +; e.g. add3 r3,r3,#1 and ld r3,@(4,r4). We could use special handlers on | |
689 | +; the operands themselves. | |
680 | 690 | ; Instead we create a fake operand `hash'. The m32r is an illustration port, |
681 | 691 | ; so we often try out various ways of doing things. |
682 | 692 |
@@ -716,7 +726,7 @@ | ||
716 | 726 | (handlers (parse "ulo16")) |
717 | 727 | ) |
718 | 728 | |
719 | -(dnop uimm24 "24 bit address" (HASH-PREFIX) h-addr f-uimm24) | |
729 | +(dnop uimm24 "24 bit address" () h-addr f-uimm24) | |
720 | 730 | |
721 | 731 | (define-operand |
722 | 732 | (name disp8) |
@@ -238,15 +238,38 @@ parse_ulo16 (CGEN_CPU_DESC cd, | ||
238 | 238 | /* -- */ |
239 | 239 | |
240 | 240 | /* -- dis.c */ |
241 | -/* Immediate values are prefixed with '#'. */ | |
242 | - | |
243 | -#define CGEN_PRINT_NORMAL(cd, info, value, attrs, pc, length) \ | |
244 | - do \ | |
245 | - { \ | |
246 | - if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_HASH_PREFIX)) \ | |
247 | - (*info->fprintf_func) (info->stream, "#"); \ | |
248 | - } \ | |
249 | - while (0) | |
241 | + | |
242 | +/* Print signed operands with '#' prefixes. */ | |
243 | + | |
244 | +static void | |
245 | +print_signed_with_hash_prefix (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, | |
246 | + void * dis_info, | |
247 | + long value, | |
248 | + unsigned int attrs ATTRIBUTE_UNUSED, | |
249 | + bfd_vma pc ATTRIBUTE_UNUSED, | |
250 | + int length ATTRIBUTE_UNUSED) | |
251 | +{ | |
252 | + disassemble_info *info = (disassemble_info *) dis_info; | |
253 | + | |
254 | + (*info->fprintf_func) (info->stream, "#"); | |
255 | + (*info->fprintf_func) (info->stream, "%ld", value); | |
256 | +} | |
257 | + | |
258 | +/* Print unsigned operands with '#' prefixes. */ | |
259 | + | |
260 | +static void | |
261 | +print_unsigned_with_hash_prefix (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, | |
262 | + void * dis_info, | |
263 | + long value, | |
264 | + unsigned int attrs ATTRIBUTE_UNUSED, | |
265 | + bfd_vma pc ATTRIBUTE_UNUSED, | |
266 | + int length ATTRIBUTE_UNUSED) | |
267 | +{ | |
268 | + disassemble_info *info = (disassemble_info *) dis_info; | |
269 | + | |
270 | + (*info->fprintf_func) (info->stream, "#"); | |
271 | + (*info->fprintf_func) (info->stream, "0x%lx", value); | |
272 | +} | |
250 | 273 | |
251 | 274 | /* Handle '#' prefixes as operands. */ |
252 | 275 |
@@ -528,6 +528,15 @@ | ||
528 | 528 | (comment "segment") |
529 | 529 | ) |
530 | 530 | |
531 | +;; Define an operand that takes a set of handlers. | |
532 | +;; dowh: define-operand-with-handlers | |
533 | +(define-pmacro (dowh x-name x-comment x-attrs x-type x-index x-handlers) | |
534 | + (define-operand (name x-name) (comment x-comment) | |
535 | + (.splice attrs (.unsplice x-attrs)) | |
536 | + (type x-type) (index x-index) | |
537 | + (.splice handlers (.unsplice x-handlers))) | |
538 | +) | |
539 | + | |
531 | 540 | (dnop sr "source register" () h-gr f-r2) |
532 | 541 | (dnop dr "destination register" () h-gr f-r1) |
533 | 542 | (dnop dri "destination register" () h-gr f-r4) |
@@ -544,7 +553,7 @@ | ||
544 | 553 | (dnop uimm7 "7 bit trap number" (HASH-PREFIX) h-uint f-uimm7) |
545 | 554 | (dnop uimm8 "8 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm8) |
546 | 555 | (dnop uimm16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm16) |
547 | -(dnop upof16 "16 bit unsigned immediate" (POF-PREFIX) h-addr f-memory) | |
556 | +(dowh upof16 "16 bit unsigned immediate" (POF-PREFIX) h-addr f-memory ((print "with_pof_prefix"))) | |
548 | 557 | (dnop reg8 "8 bit word register number" () h-r8 f-reg8) |
549 | 558 | (dnop regmem8 "8 bit word register number" () h-regmem8 f-regmem8) |
550 | 559 | (dnop regbmem8 "8 bit byte register number" () h-regbmem8 f-regmem8) |
@@ -573,16 +582,16 @@ | ||
573 | 582 | (dnop memory "16 bit memory" () h-addr f-memory) |
574 | 583 | (dnop memgr8 "16 bit memory" () h-memgr8 f-memgr8) |
575 | 584 | (dnop cbit "carry bit" (SEM-ONLY) h-cbit f-nil) |
576 | -(dnop qbit "bit addr" (DOT-PREFIX) h-uint f-qbit) | |
577 | -(dnop qlobit "bit addr" (DOT-PREFIX) h-uint f-qlobit) | |
578 | -(dnop qhibit "bit addr" (DOT-PREFIX) h-uint f-qhibit) | |
585 | +(dowh qbit "bit addr" (DOT-PREFIX) h-uint f-qbit ((print "with_dot_prefix"))) | |
586 | +(dowh qlobit "bit addr" (DOT-PREFIX) h-uint f-qlobit ((print "with_dot_prefix"))) | |
587 | +(dowh qhibit "bit addr" (DOT-PREFIX) h-uint f-qhibit ((print "with_dot_prefix"))) | |
579 | 588 | (dnop mask8 "8 bit mask" (HASH-PREFIX) h-uint f-mask8) |
580 | 589 | (dnop masklo8 "8 bit mask" (HASH-PREFIX) h-uint f-datahi8) |
581 | 590 | (dnop pagenum "10 bit page number" (HASH-PREFIX) h-uint f-pagenum) |
582 | 591 | (dnop data8 "8 bit data" (HASH-PREFIX) h-uint f-data8) |
583 | 592 | (dnop datahi8 "8 bit data" (HASH-PREFIX) h-uint f-datahi8) |
584 | 593 | (dnop sgtdisbit "segmentation enable bit" (SEM-ONLY) h-sgtdis f-nil) |
585 | -(dnop upag16 "16 bit unsigned immediate" (PAG-PREFIX) h-uint f-uimm16) | |
594 | +(dowh upag16 "16 bit unsigned immediate" (PAG-PREFIX) h-uint f-uimm16 ((print "with_pag_prefix"))) | |
586 | 595 | (dnop useg8 "8 bit segment " (SEG-PREFIX) h-uint f-seg8) |
587 | 596 | (dnop useg16 "16 bit address offset" (SEG-PREFIX) h-uint f-offset16) |
588 | 597 | (dnop usof16 "16 bit address offset" (SOF-PREFIX) h-uint f-offset16) |
@@ -149,17 +149,62 @@ parse_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, | ||
149 | 149 | |
150 | 150 | /* -- dis.c */ |
151 | 151 | |
152 | -#define CGEN_PRINT_NORMAL(cd, info, value, attrs, pc, length) \ | |
153 | - do \ | |
154 | - { \ | |
155 | - if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_DOT_PREFIX)) \ | |
156 | - info->fprintf_func (info->stream, "."); \ | |
157 | - if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_POF_PREFIX)) \ | |
158 | - info->fprintf_func (info->stream, "#pof:"); \ | |
159 | - if (CGEN_BOOL_ATTR ((attrs), CGEN_OPERAND_PAG_PREFIX)) \ | |
160 | - info->fprintf_func (info->stream, "#pag:"); \ | |
161 | - } \ | |
162 | - while (0) | |
152 | +/* Print an operand with a "." prefix. | |
153 | + NOTE: This prints the operand in hex. | |
154 | + ??? This exists to maintain disassembler compatibility with previous | |
155 | + versions. Ideally we'd print the "." in print_dot. */ | |
156 | + | |
157 | +static void | |
158 | +print_with_dot_prefix (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, | |
159 | + void * dis_info, | |
160 | + long value, | |
161 | + unsigned attrs ATTRIBUTE_UNUSED, | |
162 | + bfd_vma pc ATTRIBUTE_UNUSED, | |
163 | + int length ATTRIBUTE_UNUSED) | |
164 | +{ | |
165 | + disassemble_info *info = (disassemble_info *) dis_info; | |
166 | + | |
167 | + info->fprintf_func (info->stream, "."); | |
168 | + info->fprintf_func (info->stream, "0x%lx", value); | |
169 | +} | |
170 | + | |
171 | +/* Print an operand with a "#pof:" prefix. | |
172 | + NOTE: This prints the operand as an address. | |
173 | + ??? This exists to maintain disassembler compatibility with previous | |
174 | + versions. Ideally we'd print "#pof:" in print_pof. */ | |
175 | + | |
176 | +static void | |
177 | +print_with_pof_prefix (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, | |
178 | + void * dis_info, | |
179 | + bfd_vma value, | |
180 | + unsigned attrs ATTRIBUTE_UNUSED, | |
181 | + bfd_vma pc ATTRIBUTE_UNUSED, | |
182 | + int length ATTRIBUTE_UNUSED) | |
183 | +{ | |
184 | + disassemble_info *info = (disassemble_info *) dis_info; | |
185 | + | |
186 | + info->fprintf_func (info->stream, "#pof:"); | |
187 | + info->fprintf_func (info->stream, "0x%lx", (long) value); | |
188 | +} | |
189 | + | |
190 | +/* Print an operand with a "#pag:" prefix. | |
191 | + NOTE: This prints the operand in hex. | |
192 | + ??? This exists to maintain disassembler compatibility with previous | |
193 | + versions. Ideally we'd print "#pag:" in print_pag. */ | |
194 | + | |
195 | +static void | |
196 | +print_with_pag_prefix (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED, | |
197 | + void * dis_info, | |
198 | + long value, | |
199 | + unsigned attrs ATTRIBUTE_UNUSED, | |
200 | + bfd_vma pc ATTRIBUTE_UNUSED, | |
201 | + int length ATTRIBUTE_UNUSED) | |
202 | +{ | |
203 | + disassemble_info *info = (disassemble_info *) dis_info; | |
204 | + | |
205 | + info->fprintf_func (info->stream, "#pag:"); | |
206 | + info->fprintf_func (info->stream, "0x%lx", value); | |
207 | +} | |
163 | 208 | |
164 | 209 | /* Print a 'pof:' prefix to an operand. */ |
165 | 210 |