From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 7FAD03858D33 for ; Wed, 11 May 2022 00:10:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7FAD03858D33 Received: by mail-pf1-x42b.google.com with SMTP id i24so534293pfa.7 for ; Tue, 10 May 2022 17:10:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition; bh=XykzRrGKV066p960Q67NppoifgqpfUmFttO8FWKlE/s=; b=2x/I8hbAaos/h/Fk+dyGUhftWbEA6EF3eArUB9zQC6NfkiYRn3liOtQrYmi7CEcmoX +Raq+1woP5ZSppjOkAtroGR2Oyq5cUr7DRMivZYCnEwMTW68sigyUw8o3T3uKqm6hq0z 9eBJDbD7en6kY65ARQdENJHprbDRbLosL3r9rq/dcrW/mY1YlWAOwkqijA0o+qEZLJ7K udRL07AYiJtqUHKYZhdwUWS7NE1Q/6gHUMBl7pOjFuzGBRC3qQKVEHcspN7ZK+pJ8yGw t/SZBvlMAsPKSFs1W602cgULy8RGIsEQ5JQ81IHpzs5Rw+tQ6L3ciMArzfzypKY0eQZ4 NoBQ== X-Gm-Message-State: AOAM532kwevvsylG2cz6T63GudZi5Gwieg6hzI1aDyXlIGwq95UWlDDF tPa5OTms/WDX6/56pQ3BB8BPQJ94feQ= X-Google-Smtp-Source: ABdhPJyNEQfRzimVt5l1l94SePrPvMUIO0gwFisne2X7wowxd4/kyQPpzlsUtp17UNve5WGlnI40QQ== X-Received: by 2002:a65:6e88:0:b0:382:3851:50c8 with SMTP id bm8-20020a656e88000000b00382385150c8mr19169873pgb.270.1652227829166; Tue, 10 May 2022 17:10:29 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id y19-20020a170902d65300b0015e8d4eb273sm201176plh.189.2022.05.10.17.10.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 17:10:28 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id A88831140052; Wed, 11 May 2022 09:40:25 +0930 (ACST) Date: Wed, 11 May 2022 09:40:25 +0930 From: Alan Modra To: cgen@sourceware.org Subject: cgen: remove use of PTR Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3036.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, LOCALPART_IN_SUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cgen@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cgen mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2022 00:10:34 -0000 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! '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