return DECL_CHECK (decl)->decl.assembler_name;
}
-/* Compute the number of bytes occupied by a tree with code CODE. This
- function cannot be used for TREE_VEC or PHI_NODE codes, which are of
- variable length. */
+/* Compute the number of bytes occupied by a tree with code CODE.
+ This function cannot be used for TREE_VEC, PHI_NODE, or STRING_CST
+ codes, which are of variable length. */
size_t
tree_code_size (enum tree_code code)
{
- /* We can't state the size of a TREE_VEC or PHI_NODE
- without knowing how many elements it will have. */
- gcc_assert (code != TREE_VEC);
- gcc_assert (code != PHI_NODE);
-
switch (TREE_CODE_CLASS (code))
{
case tcc_declaration: /* A decl node */
case REAL_CST: return sizeof (struct tree_real_cst);
case COMPLEX_CST: return sizeof (struct tree_complex);
case VECTOR_CST: return sizeof (struct tree_vector);
- case STRING_CST: return sizeof (struct tree_string);
+ case STRING_CST: gcc_unreachable ();
default:
return lang_hooks.tree_size (code);
}
case ERROR_MARK:
case PLACEHOLDER_EXPR: return sizeof (struct tree_common);
- case PHI_NODE:
+ case TREE_VEC:
+ case PHI_NODE: gcc_unreachable ();
case SSA_NAME: return sizeof (struct tree_ssa_name);
return (sizeof (struct tree_vec)
+ (TREE_VEC_LENGTH (node) - 1) * sizeof(char *));
+ case STRING_CST:
+ return sizeof (struct tree_string) + TREE_STRING_LENGTH (node) - 1;
+
default:
return tree_code_size (code);
}
break;
case tcc_exceptional: /* something random, like an identifier. */
- if (code == IDENTIFIER_NODE)
- kind = id_kind;
- else if (code == TREE_VEC)
- kind = vec_kind;
- else if (code == TREE_BINFO)
- kind = binfo_kind;
- else if (code == PHI_NODE)
- kind = phi_kind;
- else if (code == SSA_NAME)
- kind = ssa_name_kind;
- else if (code == BLOCK)
- kind = b_kind;
- else
- kind = x_kind;
+ switch (code)
+ {
+ case IDENTIFIER_NODE:
+ kind = id_kind;
+ break;
+
+ case TREE_VEC:;
+ kind = vec_kind;
+ break;
+
+ case TREE_BINFO:
+ kind = binfo_kind;
+ break;
+
+ case PHI_NODE:
+ kind = phi_kind;
+ break;
+
+ case SSA_NAME:
+ kind = ssa_name_kind;
+ break;
+
+ case BLOCK:
+ kind = b_kind;
+ break;
+
+ default:
+ kind = x_kind;
+ break;
+ }
break;
+
+ default:
+ gcc_unreachable ();
}
tree_node_counts[(int) kind]++;
tree
build_string (int len, const char *str)
{
- tree s = make_node (STRING_CST);
+ tree s;
+ size_t length;
+
+ length = len + sizeof (struct tree_string);
+
+#ifdef GATHER_STATISTICS
+ tree_node_counts[(int) c_kind]++;
+ tree_node_sizes[(int) c_kind] += length;
+#endif
+
+ s = ggc_alloc_tree (length);
+ memset (s, 0, sizeof (struct tree_common));
+ TREE_SET_CODE (s, STRING_CST);
TREE_STRING_LENGTH (s) = len;
- TREE_STRING_POINTER (s) = ggc_alloc_string (str, len);
+ memcpy ((char *) TREE_STRING_POINTER (s), str, len);
+ ((char *) TREE_STRING_POINTER (s))[len] = '\0';
return s;
}
case BIT_FIELD_REF:
return NULL;
+ case MISALIGNED_INDIRECT_REF:
+ case ALIGN_INDIRECT_REF:
case INDIRECT_REF:
return TREE_CONSTANT (TREE_OPERAND (arg, 0)) ? arg : NULL;
TREE_READONLY (t) = 0;
break;
+ case MISALIGNED_INDIRECT_REF:
+ case ALIGN_INDIRECT_REF:
case INDIRECT_REF:
/* Whether a dereference is readonly has nothing to do with whether
its operand is readonly. */
TREE_TYPE (itype) = sizetype;
TYPE_PRECISION (itype) = TYPE_PRECISION (sizetype);
TYPE_MIN_VALUE (itype) = size_zero_node;
- TYPE_MAX_VALUE (itype) = convert (sizetype, maxval);
+ TYPE_MAX_VALUE (itype) = fold_convert (sizetype, maxval);
TYPE_MODE (itype) = TYPE_MODE (sizetype);
TYPE_SIZE (itype) = TYPE_SIZE (sizetype);
TYPE_SIZE_UNIT (itype) = TYPE_SIZE_UNIT (sizetype);
}
else if (TREE_CODE (type) == METHOD_TYPE)
{
+ tree argtypes;
inner = reconstruct_complex_type (TREE_TYPE (type), bottom);
+ /* The build_method_type_directly() routine prepends 'this' to argument list,
+ so we must compensate by getting rid of it. */
+ argtypes = TYPE_ARG_TYPES (type);
outer = build_method_type_directly (TYPE_METHOD_BASETYPE (type),
inner,
TYPE_ARG_TYPES (type));
+ TYPE_ARG_TYPES (outer) = argtypes;
}
else
return bottom;