diff options
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 35 |
1 files changed, 22 insertions, 13 deletions
@@ -11659,6 +11659,27 @@ block_ultimate_origin (const_tree block) } } +/* Return true iff conversion from INNER_TYPE to OUTER_TYPE generates + no instruction. */ + +bool +tree_nop_conversion_p (const_tree outer_type, const_tree inner_type) +{ + /* Use precision rather then machine mode when we can, which gives + the correct answer even for submode (bit-field) types. */ + if ((INTEGRAL_TYPE_P (outer_type) + || POINTER_TYPE_P (outer_type) + || TREE_CODE (outer_type) == OFFSET_TYPE) + && (INTEGRAL_TYPE_P (inner_type) + || POINTER_TYPE_P (inner_type) + || TREE_CODE (inner_type) == OFFSET_TYPE)) + return TYPE_PRECISION (outer_type) == TYPE_PRECISION (inner_type); + + /* Otherwise fall back on comparing machine modes (e.g. for + aggregate types, floats). */ + return TYPE_MODE (outer_type) == TYPE_MODE (inner_type); +} + /* Return true iff conversion in EXP generates no instruction. Mark it inline so that we fully inline into the stripping functions even though we have two uses of this function. */ @@ -11680,19 +11701,7 @@ tree_nop_conversion (const_tree exp) if (!inner_type) return false; - /* Use precision rather then machine mode when we can, which gives - the correct answer even for submode (bit-field) types. */ - if ((INTEGRAL_TYPE_P (outer_type) - || POINTER_TYPE_P (outer_type) - || TREE_CODE (outer_type) == OFFSET_TYPE) - && (INTEGRAL_TYPE_P (inner_type) - || POINTER_TYPE_P (inner_type) - || TREE_CODE (inner_type) == OFFSET_TYPE)) - return TYPE_PRECISION (outer_type) == TYPE_PRECISION (inner_type); - - /* Otherwise fall back on comparing machine modes (e.g. for - aggregate types, floats). */ - return TYPE_MODE (outer_type) == TYPE_MODE (inner_type); + return tree_nop_conversion_p (outer_type, inner_type); } /* Return true iff conversion in EXP generates no instruction. Don't |