• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revision5ff58fb071f5d3d4ee7572af1221cdf80d10f4e8 (tree)
Zeit2010-02-12 13:38:21
AutorDoug Evans <dje@goog...>
CommiterDoug Evans

Log Message

* 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.

Ändern Zusammenfassung

Diff

--- a/cpu/ChangeLog
+++ b/cpu/ChangeLog
@@ -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+
120 2010-01-24 Doug Evans <dje@sebabeach.org>
221
322 * frv.cpu (floating-point-conversion): Update call to fp conv op.
--- a/cpu/m32r.cpu
+++ b/cpu/m32r.cpu
@@ -638,13 +638,21 @@
638638 ; code. Usually there's a bit of over-specification, but in more complicated
639639 ; instruction sets there isn't.
640640
641-; M32R specific operand attributes:
641+;; Print some operands take a hash prefix.
642+;; ??? Why don't we also handle one when parsing?
642643
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")))
648656 )
649657
650658 ; ??? Convention says this should be o-sr, but then the insn definitions
@@ -662,21 +670,23 @@
662670 (dnop scr "source control register" () h-cr f-r2)
663671 (dnop dcr "destination control register" () h-cr f-r1)
664672
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)
672682
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)
677686
678687 ; 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.
680690 ; Instead we create a fake operand `hash'. The m32r is an illustration port,
681691 ; so we often try out various ways of doing things.
682692
@@ -716,7 +726,7 @@
716726 (handlers (parse "ulo16"))
717727 )
718728
719-(dnop uimm24 "24 bit address" (HASH-PREFIX) h-addr f-uimm24)
729+(dnop uimm24 "24 bit address" () h-addr f-uimm24)
720730
721731 (define-operand
722732 (name disp8)
--- a/cpu/m32r.opc
+++ b/cpu/m32r.opc
@@ -238,15 +238,38 @@ parse_ulo16 (CGEN_CPU_DESC cd,
238238 /* -- */
239239
240240 /* -- 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+}
250273
251274 /* Handle '#' prefixes as operands. */
252275
--- a/cpu/xc16x.cpu
+++ b/cpu/xc16x.cpu
@@ -528,6 +528,15 @@
528528 (comment "segment")
529529 )
530530
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+
531540 (dnop sr "source register" () h-gr f-r2)
532541 (dnop dr "destination register" () h-gr f-r1)
533542 (dnop dri "destination register" () h-gr f-r4)
@@ -544,7 +553,7 @@
544553 (dnop uimm7 "7 bit trap number" (HASH-PREFIX) h-uint f-uimm7)
545554 (dnop uimm8 "8 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm8)
546555 (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")))
548557 (dnop reg8 "8 bit word register number" () h-r8 f-reg8)
549558 (dnop regmem8 "8 bit word register number" () h-regmem8 f-regmem8)
550559 (dnop regbmem8 "8 bit byte register number" () h-regbmem8 f-regmem8)
@@ -573,16 +582,16 @@
573582 (dnop memory "16 bit memory" () h-addr f-memory)
574583 (dnop memgr8 "16 bit memory" () h-memgr8 f-memgr8)
575584 (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")))
579588 (dnop mask8 "8 bit mask" (HASH-PREFIX) h-uint f-mask8)
580589 (dnop masklo8 "8 bit mask" (HASH-PREFIX) h-uint f-datahi8)
581590 (dnop pagenum "10 bit page number" (HASH-PREFIX) h-uint f-pagenum)
582591 (dnop data8 "8 bit data" (HASH-PREFIX) h-uint f-data8)
583592 (dnop datahi8 "8 bit data" (HASH-PREFIX) h-uint f-datahi8)
584593 (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")))
586595 (dnop useg8 "8 bit segment " (SEG-PREFIX) h-uint f-seg8)
587596 (dnop useg16 "16 bit address offset" (SEG-PREFIX) h-uint f-offset16)
588597 (dnop usof16 "16 bit address offset" (SOF-PREFIX) h-uint f-offset16)
--- a/cpu/xc16x.opc
+++ b/cpu/xc16x.opc
@@ -149,17 +149,62 @@ parse_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
149149
150150 /* -- dis.c */
151151
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+}
163208
164209 /* Print a 'pof:' prefix to an operand. */
165210