From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113865 invoked by alias); 27 Jul 2015 03:10:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 113339 invoked by uid 89); 27 Jul 2015 03:10:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: paperclip.tbsaunde.org Received: from tbsaunde.org (HELO paperclip.tbsaunde.org) (66.228.47.254) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Jul 2015 03:10:40 +0000 Received: from iceball.corp.tor1.mozilla.com (unknown [23.233.68.71]) by paperclip.tbsaunde.org (Postfix) with ESMTPSA id C8D32C0B1 for ; Mon, 27 Jul 2015 03:10:38 +0000 (UTC) From: tbsaunde+gcc@tbsaunde.org To: gcc-patches@gcc.gnu.org Subject: [PATCH 1/9] remove POINTER_SIZE_UNITS macro Date: Mon, 27 Jul 2015 03:10:00 -0000 Message-Id: <1437966615-21093-2-git-send-email-tbsaunde+gcc@tbsaunde.org> In-Reply-To: <1437966615-21093-1-git-send-email-tbsaunde+gcc@tbsaunde.org> References: <1437966615-21093-1-git-send-email-tbsaunde+gcc@tbsaunde.org> X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg02200.txt.bz2 From: Trevor Saunders gcc/lto/ChangeLog: 2015-07-26 Trevor Saunders * lto-object.c (lto_obj_begin_section): Call pointer_size_units (). gcc/c-family/ChangeLog: 2015-07-26 Trevor Saunders * c-cppbuiltin.c (cpp_atomic_builtins): Call pointer_size_units (). gcc/ChangeLog: 2015-07-26 Trevor Saunders * defaults.h (POINTER_SIZE_UNITS): Remove. * dwarf2asm.c (size_of_encoded_value): Adjust. (dw2_output_indirect_constant_1): Likewise. * stor-layout.c (layout_type): Likewise. * target.h (pointer_size_units): New function. * varasm.c (assemble_addr_to_section): Adjust. (default_assemble_integer): Likewise. (dump_tm_clone_pairs): Likewise. --- gcc/c-family/c-cppbuiltin.c | 2 +- gcc/defaults.h | 3 --- gcc/dwarf2asm.c | 4 ++-- gcc/lto/lto-object.c | 3 ++- gcc/stor-layout.c | 2 +- gcc/target.h | 8 ++++++++ gcc/varasm.c | 8 ++++---- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 1beb2db..73ec8eb 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -674,7 +674,7 @@ cpp_atomic_builtins (cpp_reader *pfile) /* ptr_type_node can't be used here since ptr_mode is only set when toplev calls backend_init which is not done with -E or pch. */ - psize = POINTER_SIZE_UNITS; + psize = pointer_size_units (); if (psize >= SWAP_LIMIT) psize = 0; builtin_define_with_int_value ("__GCC_ATOMIC_POINTER_LOCK_FREE", diff --git a/gcc/defaults.h b/gcc/defaults.h index 9d38ba1..1dd965b 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -771,9 +771,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #ifndef POINTER_SIZE #define POINTER_SIZE BITS_PER_WORD #endif -#ifndef POINTER_SIZE_UNITS -#define POINTER_SIZE_UNITS ((POINTER_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT) -#endif #ifndef PIC_OFFSET_TABLE_REGNUM diff --git a/gcc/dwarf2asm.c b/gcc/dwarf2asm.c index 9f3c4b1..b63f82e 100644 --- a/gcc/dwarf2asm.c +++ b/gcc/dwarf2asm.c @@ -385,7 +385,7 @@ size_of_encoded_value (int encoding) switch (encoding & 0x07) { case DW_EH_PE_absptr: - return POINTER_SIZE_UNITS; + return pointer_size_units (); case DW_EH_PE_udata2: return 2; case DW_EH_PE_udata4: @@ -902,7 +902,7 @@ dw2_output_indirect_constant_1 (const char *sym, tree id) sym_ref = gen_rtx_SYMBOL_REF (Pmode, sym); assemble_variable (decl, 1, 1, 1); - assemble_integer (sym_ref, POINTER_SIZE_UNITS, POINTER_SIZE, 1); + assemble_integer (sym_ref, pointer_size_units (), POINTER_SIZE, 1); return 0; } diff --git a/gcc/lto/lto-object.c b/gcc/lto/lto-object.c index 087c6b1..198a585 100644 --- a/gcc/lto/lto-object.c +++ b/gcc/lto/lto-object.c @@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see #include "cgraph.h" #include "lto-section-names.h" #include "simple-object.h" +#include "target.h" /* An LTO file wrapped around an simple_object. */ @@ -340,7 +341,7 @@ lto_obj_begin_section (const char *name) && lo->sobj_w != NULL && lo->section == NULL); - align = ceil_log2 (POINTER_SIZE_UNITS); + align = ceil_log2 (pointer_size_units ()); lo->section = simple_object_write_create_section (lo->sobj_w, name, align, &errmsg, &err); if (lo->section == NULL) diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 0d4f4a4..160ffe2 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -2229,7 +2229,7 @@ layout_type (tree type) case OFFSET_TYPE: TYPE_SIZE (type) = bitsize_int (POINTER_SIZE); - TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE_UNITS); + TYPE_SIZE_UNIT (type) = size_int (pointer_size_units ()); /* A pointer might be MODE_PARTIAL_INT, but ptrdiff_t must be integral, which may be an __intN. */ SET_TYPE_MODE (type, mode_for_size (POINTER_SIZE, MODE_INT, 0)); diff --git a/gcc/target.h b/gcc/target.h index a79f424..6715b07 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -219,4 +219,12 @@ pack_cumulative_args (CUMULATIVE_ARGS *arg) } #endif /* GCC_TM_H */ +/* Return the width of a pointer in units. */ + +inline unsigned int +pointer_size_units () +{ + return (POINTER_SIZE + BITS_PER_UNIT - 1) / BITS_PER_UNIT; +} + #endif /* GCC_TARGET_H */ diff --git a/gcc/varasm.c b/gcc/varasm.c index 6a4ba0b..8cb2ec9 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1544,7 +1544,7 @@ assemble_addr_to_section (rtx symbol, section *sec) { switch_to_section (sec); assemble_align (POINTER_SIZE); - assemble_integer (symbol, POINTER_SIZE_UNITS, POINTER_SIZE, 1); + assemble_integer (symbol, pointer_size_units (), POINTER_SIZE, 1); } /* Return the numbered .ctors.N (if CONSTRUCTOR_P) or .dtors.N (if @@ -2732,7 +2732,7 @@ default_assemble_integer (rtx x ATTRIBUTE_UNUSED, const char *op = integer_asm_op (size, aligned_p); /* Avoid GAS bugs for large values. Specifically negative values whose absolute value fits in a bfd_vma, but not in a bfd_signed_vma. */ - if (size > UNITS_PER_WORD && size > POINTER_SIZE_UNITS) + if (size > UNITS_PER_WORD && size > pointer_size_units ()) return false; return op && (assemble_integer_with_op (op, x), true); } @@ -5875,9 +5875,9 @@ dump_tm_clone_pairs (vec tm_alias_pairs) } assemble_integer (XEXP (DECL_RTL (src), 0), - POINTER_SIZE_UNITS, POINTER_SIZE, 1); + pointer_size_units (), POINTER_SIZE, 1); assemble_integer (XEXP (DECL_RTL (dst), 0), - POINTER_SIZE_UNITS, POINTER_SIZE, 1); + pointer_size_units (), POINTER_SIZE, 1); } } -- 2.4.0