* cgen: remove use of PTR
@ 2022-05-11 0:10 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-05-11 0:10 UTC (permalink / raw)
To: cgen
Nowadays binutils and sim both require at least C99 compilers,
negating the need for macros like PTR. I'm committing it as obvious
given the existing uses of "void *" all over the place in cgen code.
Regarding removing the PTR casts rather than replacing with void*
casts: The desc-cpu.scn changes are all init for a const void* field
CGEN_MAYBE_MULTI_IFLD.val.p. The desc.scm change is init for a void*
field CGEN_HW_ENTRY.asm_data. The cast was only ever needed when
presumably the fields were declared as PTR types, and PTR expanded to
char*. opc-itab.scm changes are in unused functions.
* desc-cpu.scm (gen-maybe-multi-ifld): Remove PTR casts.
(gen-multi-ifield-nodes, gen-operand-table): Likewise.
* desc.scm (gen-table-entry): Likewise.
* opc-itab.scm (gen-minsn-table-entry): Likewise.
(gen-minsn-opcode-entry): Likewise.
* opc-asmdis.scm (gen-print-switch): Emit void * in place of PTR.
diff --git a/desc-cpu.scm b/desc-cpu.scm
index 6fc9446..3b35fb4 100644
--- a/desc-cpu.scm
+++ b/desc-cpu.scm
@@ -409,7 +409,7 @@ const CGEN_HW_ENTRY @arch@_cgen_hw_table[] =
(set! field-count (number->string (length (elm-get fld 'subfields)))))
; else
(set! field-ref (string-append "&@arch@_cgen_ifld_table[" (ifld-enum fld) "]"))))
- (string-append "{ " field-count ", { (const PTR) " field-ref " } }")))
+ (string-append "{ " field-count ", { " field-ref " } }")))
(define (gen-multi-ifield-nodes)
(let ((multis (find multi-ifield? (current-ifld-list))))
@@ -433,7 +433,7 @@ const CGEN_HW_ENTRY @arch@_cgen_hw_table[] =
(apply string-append
(map (lambda (x) (string-append "\n " (gen-maybe-multi-ifld 'ifield x) ","))
(elm-get ifld 'subfields)))
- "\n { 0, { (const PTR) 0 } }\n};\n"))
+ "\n { 0, { 0 } }\n};\n"))
multis)))))
(define (gen-operand-table)
@@ -475,7 +475,7 @@ const CGEN_OPERAND @arch@_cgen_operand_table[] =
)))))
(current-op-list))
"/* sentinel */\n\
- { 0, 0, 0, 0, 0,\n { 0, { (const PTR) 0 } },\n " (gen-obj-attr-end-defn all-attrs num-non-bools) " }
+ { 0, 0, 0, 0, 0,\n { 0, { 0 } },\n " (gen-obj-attr-end-defn all-attrs num-non-bools) " }
};
#undef A
diff --git a/desc.scm b/desc.scm
index d10cf3f..27ba291 100644
--- a/desc.scm
+++ b/desc.scm
@@ -154,7 +154,7 @@ static const CGEN_ATTR_ENTRY bool_attr[] =
(method-make!
<keyword> 'gen-table-entry
(lambda (self)
- (string-append "CGEN_ASM_KEYWORD, (PTR) " (send self 'gen-ref) ", "))
+ (string-append "CGEN_ASM_KEYWORD, " (send self 'gen-ref) ", "))
)
; Return the C code to initialize a keyword.
diff --git a/opc-asmdis.scm b/opc-asmdis.scm
index b268bf5..fa0ab53 100644
--- a/opc-asmdis.scm
+++ b/opc-asmdis.scm
@@ -103,7 +103,7 @@ CGEN_ASM_INIT_HOOK
(string-list
"\
void @arch@_cgen_print_operand
- (CGEN_CPU_DESC, int, PTR, CGEN_FIELDS *, void const *, bfd_vma, int);
+ (CGEN_CPU_DESC, int, void *, CGEN_FIELDS *, void const *, bfd_vma, int);
/* Main entry point for printing operands.
XINFO is a `void *' and not a `disassemble_info *' to not put a requirement
diff --git a/opc-itab.scm b/opc-itab.scm
index 4500f58..2cea58e 100644
--- a/opc-itab.scm
+++ b/opc-itab.scm
@@ -509,7 +509,7 @@ static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
" "
(gen-syntax-entry "MNEM" "OP" (minsn-syntax minsn) (obj-isa-list minsn))
",\n"
- " (PTR) & macro_" (gen-sym minsn) "_expansions[0],\n"
+ " & macro_" (gen-sym minsn) "_expansions[0],\n"
" "
(gen-obj-attr-defn 'minsn minsn all-attrs num-non-bools gen-insn-attr-mask)
"\n"
@@ -532,7 +532,7 @@ static unsigned int dis_hash_insn (const char *, CGEN_INSN_INT);
" "
(gen-syntax-entry "MNEM" "OP" (minsn-syntax minsn) (obj-isa-list minsn))
",\n"
- " (PTR) & macro_" (gen-sym minsn) "_expansions[0],\n"
+ " & macro_" (gen-sym minsn) "_expansions[0],\n"
" "
(gen-obj-attr-defn 'minsn minsn all-attrs num-non-bools gen-insn-attr-mask)
"\n"
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-11 0:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 0:10 cgen: remove use of PTR Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).