Message ID | 201410152229.s9FMTJrd012513@greed.delorie.com |
---|---|
State | New |
Headers | show |
On Wed, 15 Oct 2014, DJ Delorie wrote: > A few more cases where pointers were assumed to be whole bytes. > Ok? I don't see what the stor-layout.c changes have to do with that description, or why they are correct (they look wrong to me; the existing addition of BITS_PER_UNIT_LOG + 1 looks logically correct for bitsizetype). The other changes are OK.
> I don't see what the stor-layout.c changes have to do with that > description, or why they are correct (they look wrong to me; the > existing addition of BITS_PER_UNIT_LOG + 1 looks logically correct > for bitsizetype). sooo... the type for bitsizetype will *always* be a bigger type than sizetype? Even when sizetype is already the largest type the target can handle naturally?
On Wed, 15 Oct 2014, DJ Delorie wrote: > > I don't see what the stor-layout.c changes have to do with that > > description, or why they are correct (they look wrong to me; the > > existing addition of BITS_PER_UNIT_LOG + 1 looks logically correct > > for bitsizetype). > > sooo... the type for bitsizetype will *always* be a bigger type than > sizetype? Even when sizetype is already the largest type the target > can handle naturally? It's expected to be larger, so that it can handle +/- the whole address space, in bits. But that's subject to the bounds of MAX_FIXED_MODE_SIZE and HOST_BITS_PER_DOUBLE_INT that are already present in the code. (If any nontrivial, nonconstant calculation is being done in bitsizetype, that should be unusual; if anything, I'd rather not have bitsizetype at all, and use bytes and bits separately for calculations where bit offsets are relevant. But under the existing logic, bitsizetype is expected to be bigger than sizetype, even if inefficient.)
> The other changes are OK.
Committed those then. Thanks!
Index: gcc/c-family/c-cppbuiltin.c =================================================================== --- gcc/c-family/c-cppbuiltin.c (revision 216287) +++ gcc/c-family/c-cppbuiltin.c (working copy) @@ -668,13 +668,13 @@ cpp_atomic_builtins (cpp_reader *pfile) to a boolean truth value, let the library work around that. */ builtin_define_with_int_value ("__GCC_ATOMIC_TEST_AND_SET_TRUEVAL", targetm.atomic_test_and_set_trueval); /* 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 / BITS_PER_UNIT; + psize = POINTER_SIZE_UNITS; if (psize >= SWAP_LIMIT) psize = 0; builtin_define_with_int_value ("__GCC_ATOMIC_POINTER_LOCK_FREE", (have_swap[psize]? 2 : 1)); } Index: gcc/stor-layout.c =================================================================== --- gcc/stor-layout.c (revision 216287) +++ gcc/stor-layout.c (working copy) @@ -2580,13 +2580,13 @@ initialize_sizetypes (void) } if (precision == -1) gcc_unreachable (); } bprecision - = MIN (precision + BITS_PER_UNIT_LOG + 1, MAX_FIXED_MODE_SIZE); + = MIN (precision, MAX_FIXED_MODE_SIZE); bprecision = GET_MODE_PRECISION (smallest_mode_for_size (bprecision, MODE_INT)); if (bprecision > HOST_BITS_PER_DOUBLE_INT) bprecision = HOST_BITS_PER_DOUBLE_INT; /* Create stubs for sizetype and bitsizetype so we can create constants. */ Index: gcc/tree-core.h =================================================================== --- gcc/tree-core.h (revision 216287) +++ gcc/tree-core.h (working copy) @@ -1170,13 +1170,13 @@ enum omp_clause_map_kind OMP_CLAUSE_MAP_ALLOC, OMP_CLAUSE_MAP_TO, OMP_CLAUSE_MAP_FROM, OMP_CLAUSE_MAP_TOFROM, /* The following kind is an internal only map kind, used for pointer based array sections. OMP_CLAUSE_SIZE for these is not the pointer size, - which is implicitly POINTER_SIZE / BITS_PER_UNIT, but the bias. */ + which is implicitly POINTER_SIZE_UNITS, but the bias. */ OMP_CLAUSE_MAP_POINTER, /* Also internal, behaves like OMP_CLAUS_MAP_TO, but additionally any OMP_CLAUSE_MAP_POINTER records consecutive after it which have addresses falling into that range will not be ignored if OMP_CLAUSE_MAP_TO_PSET wasn't mapped already. */ OMP_CLAUSE_MAP_TO_PSET,