您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DECL_ALIGN函数代码示例

51自学网 2021-06-01 20:20:15
  C++
这篇教程C++ DECL_ALIGN函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DECL_ALIGN函数的典型用法代码示例。如果您正苦于以下问题:C++ DECL_ALIGN函数的具体用法?C++ DECL_ALIGN怎么用?C++ DECL_ALIGN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DECL_ALIGN函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: increase_alignment

static unsigned intincrease_alignment (void){  struct varpool_node *vnode;  /* Increase the alignment of all global arrays for vectorization.  */  FOR_EACH_DEFINED_VARIABLE (vnode)    {      tree vectype, decl = vnode->symbol.decl;      tree t;      unsigned int alignment;      t = TREE_TYPE(decl);      if (TREE_CODE (t) != ARRAY_TYPE)        continue;      vectype = get_vectype_for_scalar_type (strip_array_types (t));      if (!vectype)        continue;      alignment = TYPE_ALIGN (vectype);      if (DECL_ALIGN (decl) >= alignment)        continue;      if (vect_can_force_dr_alignment_p (decl, alignment))        {          DECL_ALIGN (decl) = TYPE_ALIGN (vectype);          DECL_USER_ALIGN (decl) = 1;          dump_printf (MSG_NOTE, "Increasing alignment of decl: ");          dump_generic_expr (MSG_NOTE, TDF_SLIM, decl);          dump_printf (MSG_NOTE, "/n");        }    }  return 0;}
开发者ID:Lao16,项目名称:gcc,代码行数:33,


示例2: xml_generic_decl

/* Output a declaration.  Used for function locals, and struct/union members. */void xml_generic_decl(tree decl, int indent, const char *tag, FILE *out){    fprintf(out, "%s<%s", spc(indent), tag);    xml_location(decl, out);    fprintf(out, ">/n");    indent += INDENT;    xml_decl_binding(decl, indent, "binding", out);    fprintf(out, "%s<type", spc(indent));    if (DECL_SIZE(decl))        fprintf(out, " size='%lu'", TREE_INT_CST_LOW(DECL_SIZE(decl)));    if (DECL_ALIGN(decl))        fprintf(out, " alignment='%d'", DECL_ALIGN(decl));    fprintf(out, ">/n");    /* Output the type. */    xml_type(TREE_TYPE(decl), decl, indent + INDENT, out);    fprintf(out, "%s</type>/n", spc(indent));    if (TREE_CODE(decl) == VAR_DECL && DECL_INITIAL(decl))    {        fprintf(out, "%s<initial>/n", spc(indent));        xml_expr(DECL_INITIAL(decl), indent + INDENT, out);        fprintf(out, "%s</initial>/n", spc(indent));    }    indent -= INDENT;    fprintf(out, "%s</%s>/n", spc(indent), tag);}
开发者ID:ctz,项目名称:lighthouse,代码行数:32,


示例3: unpack_ts_decl_common_value_fields

static voidunpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr){  DECL_MODE (expr) = bp_unpack_machine_mode (bp);  DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_ABSTRACT_P (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_PRESERVE_P (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_EXTERNAL (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_GIMPLE_REG_P (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_ALIGN (expr) = (unsigned) bp_unpack_var_len_unsigned (bp);#ifdef ACCEL_COMPILER  if (DECL_ALIGN (expr) > targetm.absolute_biggest_alignment)    DECL_ALIGN (expr) = targetm.absolute_biggest_alignment;#endif  if (TREE_CODE (expr) == LABEL_DECL)    {      EH_LANDING_PAD_NR (expr) = (int) bp_unpack_var_len_unsigned (bp);      /* Always assume an initial value of -1 for LABEL_DECL_UID to	 force gimple_set_bb to recreate label_to_block_map.  */      LABEL_DECL_UID (expr) = -1;    }  if (TREE_CODE (expr) == FIELD_DECL)    {      DECL_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1);      DECL_NONADDRESSABLE_P (expr) = (unsigned) bp_unpack_value (bp, 1);      expr->decl_common.off_align = bp_unpack_value (bp, 8);    }  if (TREE_CODE (expr) == VAR_DECL)    {      DECL_HAS_DEBUG_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);      DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1);    }  if (TREE_CODE (expr) == RESULT_DECL      || TREE_CODE (expr) == PARM_DECL      || TREE_CODE (expr) == VAR_DECL)    {      DECL_BY_REFERENCE (expr) = (unsigned) bp_unpack_value (bp, 1);      if (TREE_CODE (expr) == VAR_DECL	  || TREE_CODE (expr) == PARM_DECL)	DECL_HAS_VALUE_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);    }}
开发者ID:pdziepak,项目名称:gcc,代码行数:50,


示例4: lto_symtab_merge_decls_2

static voidlto_symtab_merge_decls_2 (symtab_node first, bool diagnosed_p){  symtab_node prevailing, e;  vec<tree> mismatches = vNULL;  unsigned i;  tree decl;  /* Nothing to do for a single entry.  */  prevailing = first;  if (!prevailing->symbol.next_sharing_asm_name)    return;  /* Try to merge each entry with the prevailing one.  */  for (e = prevailing->symbol.next_sharing_asm_name;       e; e = e->symbol.next_sharing_asm_name)    if (TREE_PUBLIC (e->symbol.decl))      {	if (!lto_symtab_merge (prevailing, e)	    && !diagnosed_p)	  mismatches.safe_push (e->symbol.decl);      }  if (mismatches.is_empty ())    return;  /* Diagnose all mismatched re-declarations.  */  FOR_EACH_VEC_ELT (mismatches, i, decl)    {      if (!types_compatible_p (TREE_TYPE (prevailing->symbol.decl),			       TREE_TYPE (decl)))	diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,				   "type of %qD does not match original "				   "declaration", decl);      else if ((DECL_USER_ALIGN (prevailing->symbol.decl)	        && DECL_USER_ALIGN (decl))	       && DECL_ALIGN (prevailing->symbol.decl) < DECL_ALIGN (decl))	{	  diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,				     "alignment of %qD is bigger than "				     "original declaration", decl);	}    }  if (diagnosed_p)    inform (DECL_SOURCE_LOCATION (prevailing->symbol.decl),	    "previously declared here");  mismatches.release ();}
开发者ID:philscher,项目名称:gcc,代码行数:49,


示例5: createFieldInfo

struct FieldInfo* createFieldInfo(const tree field_decl){  struct FieldInfo* fi = (struct FieldInfo*) xcalloc(1, sizeof(struct FieldInfo));  fi->isSpecial = DECL_ARTIFICIAL(field_decl);  fi->isBitField = DECL_BIT_FIELD(field_decl);  const char* fieldName;  if (fi->isSpecial)    fieldName = fieldNames[FIELD_BASE];  else if (DECL_NAME(field_decl))    fieldName = IDENTIFIER_POINTER(DECL_NAME(field_decl));  else    fieldName = fieldNames[FIELD_NONAME];  fi->name = xstrdup(fieldName);  fi->size = TREE_INT_CST_LOW(DECL_SIZE(field_decl));  // Offset calculation is a little bit wierd. According to GCC docs:  // "... DECL_FIELD_OFFSET is position, counting in bytes, of the  // DECL_OFFSET_ALIGN-bit sized word ..." and ".. DECL_FIELD_BIT_OFFSET is the  // bit offset of the first bit of the field within this word"  fi->offset = TREE_INT_CST_LOW(DECL_FIELD_OFFSET(field_decl)) * BITS_PER_UNIT +    TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(field_decl));  fi->align = DECL_ALIGN(field_decl);  return fi;}
开发者ID:ostash,项目名称:recordsize2,代码行数:29,


示例6: create_struct_type

static treecreate_struct_type(tree decl, size_t front_rz_size, size_t rear_rz_size){    // TODO make this dynamic rather than static    char type_name[50];    tree fieldfront, orig_var, fieldrear, struct_type;    gcc_assert(front_rz_size % 8 == 0 && rear_rz_size % 8 == 0);    struct_type = mf_mark(make_node (RECORD_TYPE));    // Build the front red zone    tree front_array_idx =  build_index_type (size_int (front_rz_size / sizeof(unsigned int)));    tree front_rz_array = build_array_type (unsigned_type_node, front_array_idx);    fieldfront = build_decl (UNKNOWN_LOCATION,            FIELD_DECL, get_identifier ("rz_front"), front_rz_array);    DECL_ALIGN(fieldfront) = 8;    DECL_CONTEXT (fieldfront) = struct_type;    // orig variable    orig_var = build_decl (UNKNOWN_LOCATION,            FIELD_DECL, get_identifier("orig_var"), TREE_TYPE(decl));    DECL_CONTEXT (orig_var) = struct_type; // Look at comments above    DECL_CHAIN (fieldfront) = orig_var;    // Rear zone    if (COMPLETE_TYPE_P(decl)){        tree rear_array_idx =  build_index_type (size_int (rear_rz_size / sizeof(unsigned int)));        tree rear_rz_array = build_array_type (unsigned_type_node, rear_array_idx);        fieldrear = build_decl (UNKNOWN_LOCATION,                FIELD_DECL, get_identifier ("rz_rear"), rear_rz_array);        DECL_ALIGN(fieldrear) = 8;        DECL_CONTEXT (fieldrear) = struct_type;        DECL_CHAIN (orig_var) = fieldrear;    }    TYPE_FIELDS (struct_type) = fieldfront;    strcpy(type_name, "rz_");    strcat(type_name, get_name(decl));    strcat(type_name, "_type");    TYPE_NAME (struct_type) = get_identifier (type_name);    layout_type (struct_type);    return struct_type;}
开发者ID:sdzahed,项目名称:LBC-Plugin,代码行数:46,


示例7: lto_symtab_merge_decls_2

static voidlto_symtab_merge_decls_2 (void **slot, bool diagnosed_p){  lto_symtab_entry_t prevailing, e;  VEC(tree, heap) *mismatches = NULL;  unsigned i;  tree decl;  /* Nothing to do for a single entry.  */  prevailing = (lto_symtab_entry_t) *slot;  if (!prevailing->next)    return;  /* Try to merge each entry with the prevailing one.  */  for (e = prevailing->next; e; e = e->next)    {      if (!lto_symtab_merge (prevailing, e)	  && !diagnosed_p)	VEC_safe_push (tree, heap, mismatches, e->decl);    }  if (VEC_empty (tree, mismatches))    return;  /* Diagnose all mismatched re-declarations.  */  FOR_EACH_VEC_ELT (tree, mismatches, i, decl)    {      if (!types_compatible_p (TREE_TYPE (prevailing->decl), TREE_TYPE (decl)))	diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,				   "type of %qD does not match original "				   "declaration", decl);      else if ((DECL_USER_ALIGN (prevailing->decl) && DECL_USER_ALIGN (decl))	       && DECL_ALIGN (prevailing->decl) < DECL_ALIGN (decl))	{	  diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,				     "alignment of %qD is bigger than "				     "original declaration", decl);	}    }  if (diagnosed_p)    inform (DECL_SOURCE_LOCATION (prevailing->decl),	    "previously declared here");  VEC_free (tree, heap, mismatches);}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:45,


示例8: increase_alignment

static unsigned intincrease_alignment (void){  struct varpool_node *vnode;  /* Increase the alignment of all global arrays for vectorization.  */  for (vnode = varpool_nodes_queue;       vnode;       vnode = vnode->next_needed)    {      tree vectype, decl = vnode->decl;      tree t;      unsigned int alignment;      t = TREE_TYPE(decl);      if (TREE_CODE (t) != ARRAY_TYPE)        continue;      vectype = get_vectype_for_scalar_type (strip_array_types (t));      if (!vectype)        continue;      alignment = TYPE_ALIGN (vectype);      if (DECL_ALIGN (decl) >= alignment)        continue;      if (vect_can_force_dr_alignment_p (decl, alignment))        {          DECL_ALIGN (decl) = TYPE_ALIGN (vectype);          DECL_USER_ALIGN (decl) = 1;          if (dump_file)            {              fprintf (dump_file, "Increasing alignment of decl: ");              print_generic_expr (dump_file, decl, TDF_SLIM);	      fprintf (dump_file, "/n");            }        }    }  return 0;}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.toolchain,代码行数:38,


示例9: get_decl_align_unit

static unsigned intget_decl_align_unit (tree decl){  unsigned int align;  align = DECL_ALIGN (decl);  align = LOCAL_ALIGNMENT (TREE_TYPE (decl), align);  if (align > PREFERRED_STACK_BOUNDARY)    align = PREFERRED_STACK_BOUNDARY;  if (cfun->stack_alignment_needed < align)    cfun->stack_alignment_needed = align;  return align / BITS_PER_UNIT;}
开发者ID:seguljac,项目名称:higpu,代码行数:14,


示例10: pack_ts_decl_common_value_fields

static voidpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr){  bp_pack_enum (bp, machine_mode, MAX_MACHINE_MODE, DECL_MODE (expr));  bp_pack_value (bp, DECL_NONLOCAL (expr), 1);  bp_pack_value (bp, DECL_VIRTUAL_P (expr), 1);  bp_pack_value (bp, DECL_IGNORED_P (expr), 1);  bp_pack_value (bp, DECL_ABSTRACT (expr), 1);  bp_pack_value (bp, DECL_ARTIFICIAL (expr), 1);  bp_pack_value (bp, DECL_USER_ALIGN (expr), 1);  bp_pack_value (bp, DECL_PRESERVE_P (expr), 1);  bp_pack_value (bp, DECL_EXTERNAL (expr), 1);  bp_pack_value (bp, DECL_GIMPLE_REG_P (expr), 1);  bp_pack_var_len_unsigned (bp, DECL_ALIGN (expr));  if (TREE_CODE (expr) == LABEL_DECL)    {      /* Note that we do not write LABEL_DECL_UID.  The reader will	 always assume an initial value of -1 so that the	 label_to_block_map is recreated by gimple_set_bb.  */      bp_pack_value (bp, DECL_ERROR_ISSUED (expr), 1);      bp_pack_var_len_unsigned (bp, EH_LANDING_PAD_NR (expr));    }  if (TREE_CODE (expr) == FIELD_DECL)    {      bp_pack_value (bp, DECL_PACKED (expr), 1);      bp_pack_value (bp, DECL_NONADDRESSABLE_P (expr), 1);      bp_pack_value (bp, expr->decl_common.off_align, 8);    }  if (TREE_CODE (expr) == VAR_DECL)    {      bp_pack_value (bp, DECL_HAS_DEBUG_EXPR_P (expr), 1);      bp_pack_value (bp, DECL_NONLOCAL_FRAME (expr), 1);    }  if (TREE_CODE (expr) == RESULT_DECL      || TREE_CODE (expr) == PARM_DECL      || TREE_CODE (expr) == VAR_DECL)    {      bp_pack_value (bp, DECL_BY_REFERENCE (expr), 1);      if (TREE_CODE (expr) == VAR_DECL	  || TREE_CODE (expr) == PARM_DECL)	bp_pack_value (bp, DECL_HAS_VALUE_EXPR_P (expr), 1);    }}
开发者ID:delkon,项目名称:gcc,代码行数:47,


示例11: unpack_ts_decl_common_value_fields

static voidunpack_ts_decl_common_value_fields (struct bitpack_d *bp, tree expr){  DECL_MODE (expr) = bp_unpack_enum (bp, machine_mode, MAX_MACHINE_MODE);  DECL_NONLOCAL (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_VIRTUAL_P (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_IGNORED_P (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_ABSTRACT (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_ARTIFICIAL (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_PRESERVE_P (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_DEBUG_EXPR_IS_FROM (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_EXTERNAL (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_GIMPLE_REG_P (expr) = (unsigned) bp_unpack_value (bp, 1);  DECL_ALIGN (expr) = (unsigned) bp_unpack_var_len_unsigned (bp);  if (TREE_CODE (expr) == LABEL_DECL)    {      DECL_ERROR_ISSUED (expr) = (unsigned) bp_unpack_value (bp, 1);      EH_LANDING_PAD_NR (expr) = (int) bp_unpack_var_len_unsigned (bp);      /* Always assume an initial value of -1 for LABEL_DECL_UID to	 force gimple_set_bb to recreate label_to_block_map.  */      LABEL_DECL_UID (expr) = -1;    }  if (TREE_CODE (expr) == FIELD_DECL)    {      DECL_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1);      DECL_NONADDRESSABLE_P (expr) = (unsigned) bp_unpack_value (bp, 1);      expr->decl_common.off_align = bp_unpack_value (bp, 8);    }  if (TREE_CODE (expr) == VAR_DECL)    DECL_NONLOCAL_FRAME (expr) = (unsigned) bp_unpack_value (bp, 1);  if (TREE_CODE (expr) == RESULT_DECL      || TREE_CODE (expr) == PARM_DECL      || TREE_CODE (expr) == VAR_DECL)    {      DECL_BY_REFERENCE (expr) = (unsigned) bp_unpack_value (bp, 1);      if (TREE_CODE (expr) == VAR_DECL	  || TREE_CODE (expr) == PARM_DECL)	DECL_HAS_VALUE_EXPR_P (expr) = (unsigned) bp_unpack_value (bp, 1);    }}
开发者ID:MaddTheSane,项目名称:haiku-buildtools,代码行数:46,


示例12: copy_var_decl

treecopy_var_decl (tree var, tree name, tree type){  tree copy = build_decl (DECL_SOURCE_LOCATION (var), VAR_DECL, name, type);  TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (var);  TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (var);  DECL_GIMPLE_REG_P (copy) = DECL_GIMPLE_REG_P (var);  DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (var);  DECL_IGNORED_P (copy) = DECL_IGNORED_P (var);  DECL_CONTEXT (copy) = DECL_CONTEXT (var);  TREE_NO_WARNING (copy) = TREE_NO_WARNING (var);  TREE_USED (copy) = 1;  DECL_SEEN_IN_BIND_EXPR_P (copy) = 1;  DECL_ATTRIBUTES (copy) = DECL_ATTRIBUTES (var);  if (DECL_USER_ALIGN (var))    {      SET_DECL_ALIGN (copy, DECL_ALIGN (var));      DECL_USER_ALIGN (copy) = 1;    }  return copy;}
开发者ID:WojciechMigda,项目名称:gcc,代码行数:23,


示例13: expand_one_stack_var_at

static voidexpand_one_stack_var_at (tree decl, HOST_WIDE_INT offset){  HOST_WIDE_INT align;  rtx x;    /* If this fails, we've overflowed the stack frame.  Error nicely?  */  gcc_assert (offset == trunc_int_for_mode (offset, Pmode));  x = plus_constant (virtual_stack_vars_rtx, offset);  x = gen_rtx_MEM (DECL_MODE (decl), x);  /* Set alignment we actually gave this decl.  */  offset -= frame_phase;  align = offset & -offset;  align *= BITS_PER_UNIT;  if (align > STACK_BOUNDARY || align == 0)    align = STACK_BOUNDARY;  DECL_ALIGN (decl) = align;  DECL_USER_ALIGN (decl) = 0;  set_mem_attributes (x, decl, true);  SET_DECL_RTL (decl, x);}
开发者ID:seguljac,项目名称:higpu,代码行数:24,


示例14: lto_symtab_merge

static boollto_symtab_merge (symtab_node prevailing, symtab_node entry){  tree prevailing_decl = prevailing->symbol.decl;  tree decl = entry->symbol.decl;  tree prevailing_type, type;  if (prevailing_decl == decl)    return true;  /* Merge decl state in both directions, we may still end up using     the new decl.  */  TREE_ADDRESSABLE (prevailing_decl) |= TREE_ADDRESSABLE (decl);  TREE_ADDRESSABLE (decl) |= TREE_ADDRESSABLE (prevailing_decl);  /* The linker may ask us to combine two incompatible symbols.     Detect this case and notify the caller of required diagnostics.  */  if (TREE_CODE (decl) == FUNCTION_DECL)    {      if (!types_compatible_p (TREE_TYPE (prevailing_decl),			       TREE_TYPE (decl)))	/* If we don't have a merged type yet...sigh.  The linker	   wouldn't complain if the types were mismatched, so we	   probably shouldn't either.  Just use the type from	   whichever decl appears to be associated with the	   definition.  If for some odd reason neither decl is, the	   older one wins.  */	(void) 0;      return true;    }  /* Now we exclusively deal with VAR_DECLs.  */  /* Sharing a global symbol is a strong hint that two types are     compatible.  We could use this information to complete     incomplete pointed-to types more aggressively here, ignoring     mismatches in both field and tag names.  It's difficult though     to guarantee that this does not have side-effects on merging     more compatible types from other translation units though.  */  /* We can tolerate differences in type qualification, the     qualification of the prevailing definition will prevail.     ???  In principle we might want to only warn for structurally     incompatible types here, but unless we have protective measures     for TBAA in place that would hide useful information.  */  prevailing_type = TYPE_MAIN_VARIANT (TREE_TYPE (prevailing_decl));  type = TYPE_MAIN_VARIANT (TREE_TYPE (decl));  if (!types_compatible_p (prevailing_type, type))    {      if (COMPLETE_TYPE_P (type))	return false;      /* If type is incomplete then avoid warnings in the cases	 that TBAA handles just fine.  */      if (TREE_CODE (prevailing_type) != TREE_CODE (type))	return false;      if (TREE_CODE (prevailing_type) == ARRAY_TYPE)	{	  tree tem1 = TREE_TYPE (prevailing_type);	  tree tem2 = TREE_TYPE (type);	  while (TREE_CODE (tem1) == ARRAY_TYPE		 && TREE_CODE (tem2) == ARRAY_TYPE)	    {	      tem1 = TREE_TYPE (tem1);	      tem2 = TREE_TYPE (tem2);	    }	  if (TREE_CODE (tem1) != TREE_CODE (tem2))	    return false;	  if (!types_compatible_p (tem1, tem2))	    return false;	}      /* Fallthru.  Compatible enough.  */    }  /* ???  We might want to emit a warning here if type qualification     differences were spotted.  Do not do this unconditionally though.  */  /* There is no point in comparing too many details of the decls here.     The type compatibility checks or the completing of types has properly     dealt with most issues.  */  /* The following should all not invoke fatal errors as in non-LTO     mode the linker wouldn't complain either.  Just emit warnings.  */  /* Report a warning if user-specified alignments do not match.  */  if ((DECL_USER_ALIGN (prevailing_decl) && DECL_USER_ALIGN (decl))      && DECL_ALIGN (prevailing_decl) < DECL_ALIGN (decl))    return false;  return true;}
开发者ID:philscher,项目名称:gcc,代码行数:99,


示例15: build_common_decl

static treebuild_common_decl (gfc_common_head *com, tree union_type, bool is_init){  gfc_symbol *common_sym;  tree decl;  /* Create a namespace to store symbols for common blocks.  */  if (gfc_common_ns == NULL)    gfc_common_ns = gfc_get_namespace (NULL);  gfc_get_symbol (com->name, gfc_common_ns, &common_sym);  decl = common_sym->backend_decl;  /* Update the size of this common block as needed.  */  if (decl != NULL_TREE)    {      tree size = TYPE_SIZE_UNIT (union_type);      if (tree_int_cst_lt (DECL_SIZE_UNIT (decl), size))        {          /* Named common blocks of the same name shall be of the same size             in all scoping units of a program in which they appear, but             blank common blocks may be of different sizes.  */          if (strcmp (com->name, BLANK_COMMON_NAME))	    gfc_warning ("Named COMMON block '%s' at %L shall be of the "			 "same size", com->name, &com->where);          DECL_SIZE_UNIT (decl) = size;        }     }  /* If this common block has been declared in a previous program unit,     and either it is already initialized or there is no new initialization     for it, just return.  */  if ((decl != NULL_TREE) && (!is_init || DECL_INITIAL (decl)))    return decl;  /* If there is no backend_decl for the common block, build it.  */  if (decl == NULL_TREE)    {      decl = build_decl (VAR_DECL, get_identifier (com->name), union_type);      SET_DECL_ASSEMBLER_NAME (decl, gfc_sym_mangled_common_id (com->name));      TREE_PUBLIC (decl) = 1;      TREE_STATIC (decl) = 1;      DECL_ALIGN (decl) = BIGGEST_ALIGNMENT;      DECL_USER_ALIGN (decl) = 0;      gfc_set_decl_location (decl, &com->where);      /* Place the back end declaration for this common block in         GLOBAL_BINDING_LEVEL.  */      common_sym->backend_decl = pushdecl_top_level (decl);    }  /* Has no initial values.  */  if (!is_init)    {      DECL_INITIAL (decl) = NULL_TREE;      DECL_COMMON (decl) = 1;      DECL_DEFER_OUTPUT (decl) = 1;    }  else    {      DECL_INITIAL (decl) = error_mark_node;      DECL_COMMON (decl) = 0;      DECL_DEFER_OUTPUT (decl) = 0;    }  return decl;}
开发者ID:aosm,项目名称:gcc_40,代码行数:67,


示例16: print_node

//.........这里部分代码省略.........                fputs (" decl_5", file);            if (DECL_LANG_FLAG_6 (node))                fputs (" decl_6", file);            if (DECL_LANG_FLAG_7 (node))                fputs (" decl_7", file);            mode = DECL_MODE (node);            fprintf (file, " %s", GET_MODE_NAME (mode));        }        if ((code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)                && DECL_BY_REFERENCE (node))            fputs (" passed-by-reference", file);        if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)  && DECL_DEFER_OUTPUT (node))            fputs (" defer-output", file);        xloc = expand_location (DECL_SOURCE_LOCATION (node));        fprintf (file, " file %s line %d col %d", xloc.file, xloc.line,                 xloc.column);        if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))        {            print_node (file, "size", DECL_SIZE (node), indent + 4);            print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);            if (code != FUNCTION_DECL || DECL_BUILT_IN (node))                indent_to (file, indent + 3);            if (DECL_USER_ALIGN (node))                fprintf (file, " user");            fprintf (file, " align %d", DECL_ALIGN (node));            if (code == FIELD_DECL)                fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,                         DECL_OFFSET_ALIGN (node));            if (code == FUNCTION_DECL && DECL_BUILT_IN (node))            {                if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)                    fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node));                else                    fprintf (file, " built-in %s:%s",                             built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],                             built_in_names[(int) DECL_FUNCTION_CODE (node)]);            }        }        if (code == FIELD_DECL)        {            print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);            print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node),                        indent + 4);            if (DECL_BIT_FIELD_TYPE (node))                print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node),                            indent + 4);        }        print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);        if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))        {            print_node_brief (file, "attributes",                              DECL_ATTRIBUTES (node), indent + 4);            if (code != PARM_DECL)                print_node_brief (file, "initial", DECL_INITIAL (node),
开发者ID:RajibTheKing,项目名称:gcc,代码行数:67,


示例17: dequeue_and_dump

//.........这里部分代码省略.........      dump_child ("domn", TYPE_DOMAIN (t));      break;    case RECORD_TYPE:    case UNION_TYPE:      if (TREE_CODE (t) == RECORD_TYPE)	dump_string_field (di, "tag", "struct");      else	dump_string_field (di, "tag", "union");      dump_child ("flds", TYPE_FIELDS (t));      dump_child ("fncs", TYPE_METHODS (t));      queue_and_dump_index (di, "binf", TYPE_BINFO (t),			    DUMP_BINFO);      break;    case CONST_DECL:      dump_child ("cnst", DECL_INITIAL (t));      break;    case DEBUG_EXPR_DECL:      dump_int (di, "-uid", DEBUG_TEMP_UID (t));      /* Fall through.  */    case VAR_DECL:    case PARM_DECL:    case FIELD_DECL:    case RESULT_DECL:      if (TREE_CODE (t) == PARM_DECL)	dump_child ("argt", DECL_ARG_TYPE (t));      else	dump_child ("init", DECL_INITIAL (t));      dump_child ("size", DECL_SIZE (t));      dump_int (di, "algn", DECL_ALIGN (t));      if (TREE_CODE (t) == FIELD_DECL)	{	  if (DECL_FIELD_OFFSET (t))	    dump_child ("bpos", bit_position (t));	}      else if (TREE_CODE (t) == VAR_DECL	       || TREE_CODE (t) == PARM_DECL)	{	  dump_int (di, "used", TREE_USED (t));	  if (DECL_REGISTER (t))	    dump_string_field (di, "spec", "register");	}      break;    case FUNCTION_DECL:      dump_child ("args", DECL_ARGUMENTS (t));      if (DECL_EXTERNAL (t))	dump_string_field (di, "body", "undefined");      if (TREE_PUBLIC (t))	dump_string_field (di, "link", "extern");      else	dump_string_field (di, "link", "static");      if (DECL_SAVED_TREE (t) && !dump_flag (di, TDF_SLIM, t))	dump_child ("body", DECL_SAVED_TREE (t));      break;    case INTEGER_CST:      if (TREE_INT_CST_HIGH (t))	dump_int (di, "high", TREE_INT_CST_HIGH (t));      dump_int (di, "low", TREE_INT_CST_LOW (t));      break;
开发者ID:AsherBond,项目名称:MondocosmOS-Dependencies,代码行数:67,


示例18: tree_nrv

static voidtree_nrv (void){  tree result = DECL_RESULT (current_function_decl);  tree result_type = TREE_TYPE (result);  tree found = NULL;  basic_block bb;  block_stmt_iterator bsi;  struct nrv_data data;  /* If this function does not return an aggregate type in memory, then     there is nothing to do.  */  if (!aggregate_value_p (result, current_function_decl))    return;  /* Look through each block for assignments to the RESULT_DECL.  */  FOR_EACH_BB (bb)    {      for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))	{	  tree stmt = bsi_stmt (bsi);	  tree ret_expr;	  if (TREE_CODE (stmt) == RETURN_EXPR)	    {	      /* In a function with an aggregate return value, the		 gimplifier has changed all non-empty RETURN_EXPRs to		 return the RESULT_DECL.  */	      ret_expr = TREE_OPERAND (stmt, 0);	      if (ret_expr)		gcc_assert (ret_expr == result);	    }	  else if (TREE_CODE (stmt) == MODIFY_EXPR		   && TREE_OPERAND (stmt, 0) == result)	    {	      ret_expr = TREE_OPERAND (stmt, 1);	      /* Now verify that this return statement uses the same value		 as any previously encountered return statement.  */	      if (found != NULL)		{		  /* If we found a return statement using a different variable		     than previous return statements, then we can not perform		     NRV optimizations.  */		  if (found != ret_expr)		    return;		}	      else		found = ret_expr;	      /* The returned value must be a local automatic variable of the		 same type and alignment as the function's result.  */	      if (TREE_CODE (found) != VAR_DECL		  || TREE_THIS_VOLATILE (found)		  || DECL_CONTEXT (found) != current_function_decl		  || TREE_STATIC (found)		  || TREE_ADDRESSABLE (found)		  || DECL_ALIGN (found) > DECL_ALIGN (result)		  || !lang_hooks.types_compatible_p (TREE_TYPE (found), 						     result_type))		return;	    }	}    }  if (!found)    return;  /* If dumping details, then note once and only the NRV replacement.  */  if (dump_file && (dump_flags & TDF_DETAILS))    {      fprintf (dump_file, "NRV Replaced: ");      print_generic_expr (dump_file, found, dump_flags);      fprintf (dump_file, "  with: ");      print_generic_expr (dump_file, result, dump_flags);      fprintf (dump_file, "/n");    }  /* At this point we know that all the return statements return the     same local which has suitable attributes for NRV.   Copy debugging     information from FOUND to RESULT.  */  DECL_NAME (result) = DECL_NAME (found);  DECL_SOURCE_LOCATION (result) = DECL_SOURCE_LOCATION (found);  DECL_ABSTRACT_ORIGIN (result) = DECL_ABSTRACT_ORIGIN (found);  TREE_ADDRESSABLE (result) = TREE_ADDRESSABLE (found);  /* Now walk through the function changing all references to VAR to be     RESULT.  */  data.var = found;  data.result = result;  FOR_EACH_BB (bb)    {      for (bsi = bsi_start (bb); !bsi_end_p (bsi); )	{	  tree *tp = bsi_stmt_ptr (bsi);	  /* If this is a copy from VAR to RESULT, remove it.  */	  if (TREE_CODE (*tp) == MODIFY_EXPR	      && TREE_OPERAND (*tp, 0) == result	      && TREE_OPERAND (*tp, 1) == found)	    bsi_remove (&bsi);//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,


示例19: lto_symtab_merge

static boollto_symtab_merge (symtab_node *prevailing, symtab_node *entry){  tree prevailing_decl = prevailing->decl;  tree decl = entry->decl;  if (prevailing_decl == decl)    return true;  /* Merge decl state in both directions, we may still end up using     the new decl.  */  TREE_ADDRESSABLE (prevailing_decl) |= TREE_ADDRESSABLE (decl);  TREE_ADDRESSABLE (decl) |= TREE_ADDRESSABLE (prevailing_decl);  /* The linker may ask us to combine two incompatible symbols.     Detect this case and notify the caller of required diagnostics.  */  if (TREE_CODE (decl) == FUNCTION_DECL)    {      /* Merge decl state in both directions, we may still end up using	 the new decl.  */      DECL_POSSIBLY_INLINED (prevailing_decl) |= DECL_POSSIBLY_INLINED (decl);      DECL_POSSIBLY_INLINED (decl) |= DECL_POSSIBLY_INLINED (prevailing_decl);      if (warn_type_compatibility_p (TREE_TYPE (prevailing_decl),			             TREE_TYPE (decl),				     DECL_COMMON (decl)				     || DECL_EXTERNAL (decl)))	return false;      return true;    }  if (warn_type_compatibility_p (TREE_TYPE (prevailing_decl),				 TREE_TYPE (decl),				 DECL_COMMON (decl) || DECL_EXTERNAL (decl)))    return false;  /* There is no point in comparing too many details of the decls here.     The type compatibility checks or the completing of types has properly     dealt with most issues.  */  /* The following should all not invoke fatal errors as in non-LTO     mode the linker wouldn't complain either.  Just emit warnings.  */  /* Report a warning if user-specified alignments do not match.  */  if ((DECL_USER_ALIGN (prevailing_decl) && DECL_USER_ALIGN (decl))      && DECL_ALIGN (prevailing_decl) < DECL_ALIGN (decl))    return false;  if (DECL_SIZE (decl) && DECL_SIZE (prevailing_decl)      && !tree_int_cst_equal (DECL_SIZE (decl), DECL_SIZE (prevailing_decl))      /* As a special case do not warn about merging	 int a[];	 and	 int a[]={1,2,3};	 here the first declaration is COMMON	 and sizeof(a) == sizeof (int).  */      && ((!DECL_COMMON (decl) && !DECL_EXTERNAL (decl))	  || TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE	  || TYPE_SIZE (TREE_TYPE (decl))	     != TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl)))))    return false;  return true;}
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:66,


示例20: maybe_add_lambda_conv_op

//.........这里部分代码省略.........  if (generic_lambda_p)    {      if (decltype_call)	{	  ++processing_template_decl;	  fn_result = finish_decltype_type	    (decltype_call, /*id_expression_or_member_access_p=*/false,	     tf_warning_or_error);	  --processing_template_decl;	}    }  else    call = build_call_a (callop,			 direct_argvec->length (),			 direct_argvec->address ());  CALL_FROM_THUNK_P (call) = 1;  tree stattype = build_function_type (fn_result, FUNCTION_ARG_CHAIN (callop));  /* First build up the conversion op.  */  tree rettype = build_pointer_type (stattype);  tree name = mangle_conv_op_name_for_type (rettype);  tree thistype = cp_build_qualified_type (type, TYPE_QUAL_CONST);  tree fntype = build_method_type_directly (thistype, rettype, void_list_node);  tree convfn = build_lang_decl (FUNCTION_DECL, name, fntype);  tree fn = convfn;  DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop);  if (TARGET_PTRMEMFUNC_VBIT_LOCATION == ptrmemfunc_vbit_in_pfn      && DECL_ALIGN (fn) < 2 * BITS_PER_UNIT)    DECL_ALIGN (fn) = 2 * BITS_PER_UNIT;  SET_OVERLOADED_OPERATOR_CODE (fn, TYPE_EXPR);  grokclassfn (type, fn, NO_SPECIAL);  set_linkage_according_to_type (type, fn);  rest_of_decl_compilation (fn, toplevel_bindings_p (), at_eof);  DECL_IN_AGGR_P (fn) = 1;  DECL_ARTIFICIAL (fn) = 1;  DECL_NOT_REALLY_EXTERN (fn) = 1;  DECL_DECLARED_INLINE_P (fn) = 1;  DECL_ARGUMENTS (fn) = build_this_parm (fntype, TYPE_QUAL_CONST);  if (nested_def)    DECL_INTERFACE_KNOWN (fn) = 1;  if (generic_lambda_p)    fn = add_inherited_template_parms (fn, DECL_TI_TEMPLATE (callop));  add_method (type, fn, NULL_TREE);  /* Generic thunk code fails for varargs; we'll complain in mark_used if     the conversion op is used.  */  if (varargs_function_p (callop))    {      DECL_DELETED_FN (fn) = 1;      return;    }  /* Now build up the thunk to be returned.  */  name = get_identifier ("_FUN");  tree statfn = build_lang_decl (FUNCTION_DECL, name, stattype);  fn = statfn;
开发者ID:nguyentu1602,项目名称:gcc,代码行数:67,


示例21: lto_symtab_merge_decls_2

//.........这里部分代码省略.........      next = e->next_sharing_asm_name;      /* Skip non-LTO symbols and symbols whose declaration we already	 visited.  */      if (lto_symtab_prevailing_decl (e->decl) != e->decl	  || !lto_symtab_symbol_p (e)          || e->decl == prevailing->decl)	continue;      if (!lto_symtab_merge (prevailing, e)	  && !diagnosed_p	  && !DECL_ARTIFICIAL (e->decl))	mismatches.safe_push (e->decl);      symtab_node *this_prevailing;      for (this_prevailing = prevailing; ;	   this_prevailing = this_prevailing->next_sharing_asm_name)	{	  if (this_prevailing->decl != e->decl	      && lto_symtab_merge_p (this_prevailing->decl, e->decl))	    break;	  if (this_prevailing == last_prevailing)	    {	      this_prevailing = NULL;	      break;	    }	}      if (this_prevailing)	lto_symtab_prevail_decl (this_prevailing->decl, e->decl);      /* Maintain LRU list: relink the new prevaililng symbol	 just after previaling node in the chain and update last_prevailing.	 Since the number of possible declarations of a given symbol is	 small, this should be faster than building a hash.  */      else if (e == prevailing->next_sharing_asm_name)	last_prevailing = e;      else	{	  if (e->next_sharing_asm_name)	    e->next_sharing_asm_name->previous_sharing_asm_name	      = e->previous_sharing_asm_name;	  e->previous_sharing_asm_name->next_sharing_asm_name	    = e->next_sharing_asm_name;	  e->previous_sharing_asm_name = prevailing;	  e->next_sharing_asm_name = prevailing->next_sharing_asm_name;	  prevailing->next_sharing_asm_name->previous_sharing_asm_name = e;	  prevailing->next_sharing_asm_name = e;	  if (last_prevailing == prevailing)	    last_prevailing = e;	}    }  if (mismatches.is_empty ())    return;  /* Diagnose all mismatched re-declarations.  */  FOR_EACH_VEC_ELT (mismatches, i, decl)    {      int level = warn_type_compatibility_p (TREE_TYPE (prevailing->decl),					     TREE_TYPE (decl),					     DECL_COMDAT (decl));      if (level)	{	  bool diag = false;	  if (level & 2)	    diag = warning_at (DECL_SOURCE_LOCATION (decl),			       OPT_Wodr,			       "%qD violates the C++ One Definition Rule ",			       decl);	  if (!diag && (level & 1))	    diag = warning_at (DECL_SOURCE_LOCATION (decl),			       OPT_Wlto_type_mismatch,			       "type of %qD does not match original "			       "declaration", decl);	  if (diag)	    {	      warn_types_mismatch (TREE_TYPE (prevailing->decl),				   TREE_TYPE (decl),				   DECL_SOURCE_LOCATION (prevailing->decl),				   DECL_SOURCE_LOCATION (decl));	      if ((level & 4)		  && !TREE_READONLY (prevailing->decl))		tbaa_p = true;	    }	  diagnosed_p |= diag;	}      else if ((DECL_USER_ALIGN (prevailing->decl)	        && DECL_USER_ALIGN (decl))	       && DECL_ALIGN (prevailing->decl) < DECL_ALIGN (decl))	{	  diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl),				     OPT_Wlto_type_mismatch,				     "alignment of %qD is bigger than "				     "original declaration", decl);	}      else	diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl),				   OPT_Wlto_type_mismatch,				   "size of %qD differ from the size of "				   "original declaration", decl);    }
开发者ID:chinabin,项目名称:gcc-tiny,代码行数:101,


示例22: build_common_decl

static treebuild_common_decl (gfc_common_head *com, tree union_type, bool is_init){  gfc_symbol *common_sym;  tree decl;  /* Create a namespace to store symbols for common blocks.  */  if (gfc_common_ns == NULL)    gfc_common_ns = gfc_get_namespace (NULL, 0);  gfc_get_symbol (com->name, gfc_common_ns, &common_sym);  decl = common_sym->backend_decl;  /* Update the size of this common block as needed.  */  if (decl != NULL_TREE)    {      tree size = TYPE_SIZE_UNIT (union_type);      /* Named common blocks of the same name shall be of the same size	 in all scoping units of a program in which they appear, but	 blank common blocks may be of different sizes.  */      if (!tree_int_cst_equal (DECL_SIZE_UNIT (decl), size)	  && strcmp (com->name, BLANK_COMMON_NAME))	gfc_warning ("Named COMMON block '%s' at %L shall be of the "		     "same size as elsewhere (%lu vs %lu bytes)", com->name,		     &com->where,		     (unsigned long) TREE_INT_CST_LOW (size),		     (unsigned long) TREE_INT_CST_LOW (DECL_SIZE_UNIT (decl)));      if (tree_int_cst_lt (DECL_SIZE_UNIT (decl), size))	{	  DECL_SIZE (decl) = TYPE_SIZE (union_type);	  DECL_SIZE_UNIT (decl) = size;	  DECL_MODE (decl) = TYPE_MODE (union_type);	  TREE_TYPE (decl) = union_type;	  layout_decl (decl, 0);	}     }  /* If this common block has been declared in a previous program unit,     and either it is already initialized or there is no new initialization     for it, just return.  */  if ((decl != NULL_TREE) && (!is_init || DECL_INITIAL (decl)))    return decl;  /* If there is no backend_decl for the common block, build it.  */  if (decl == NULL_TREE)    {      decl = build_decl (input_location,			 VAR_DECL, get_identifier (com->name), union_type);      gfc_set_decl_assembler_name (decl, gfc_sym_mangled_common_id (com));      TREE_PUBLIC (decl) = 1;      TREE_STATIC (decl) = 1;      DECL_IGNORED_P (decl) = 1;      if (!com->is_bind_c)	DECL_ALIGN (decl) = BIGGEST_ALIGNMENT;      else        {	  /* Do not set the alignment for bind(c) common blocks to	     BIGGEST_ALIGNMENT because that won't match what C does.  Also,	     for common blocks with one element, the alignment must be	     that of the field within the common block in order to match	     what C will do.  */	  tree field = NULL_TREE;	  field = TYPE_FIELDS (TREE_TYPE (decl));	  if (DECL_CHAIN (field) == NULL_TREE)	    DECL_ALIGN (decl) = TYPE_ALIGN (TREE_TYPE (field));	}      DECL_USER_ALIGN (decl) = 0;      GFC_DECL_COMMON_OR_EQUIV (decl) = 1;      gfc_set_decl_location (decl, &com->where);      if (com->threadprivate)	DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);      /* Place the back end declaration for this common block in         GLOBAL_BINDING_LEVEL.  */      common_sym->backend_decl = pushdecl_top_level (decl);    }  /* Has no initial values.  */  if (!is_init)    {      DECL_INITIAL (decl) = NULL_TREE;      DECL_COMMON (decl) = 1;      DECL_DEFER_OUTPUT (decl) = 1;    }  else    {      DECL_INITIAL (decl) = error_mark_node;      DECL_COMMON (decl) = 0;      DECL_DEFER_OUTPUT (decl) = 0;    }  return decl;}
开发者ID:BoxianLai,项目名称:moxiedev,代码行数:96,


示例23: build_java_array_type

treebuild_java_array_type (tree element_type, HOST_WIDE_INT length){  tree sig, t, fld, atype, arfld;  char buf[23];  tree elsig = build_java_signature (element_type);  tree el_name = element_type;  buf[0] = '[';  if (length >= 0)    sprintf (buf+1, HOST_WIDE_INT_PRINT_DEC, length);  else    buf[1] = '/0';  sig = ident_subst (IDENTIFIER_POINTER (elsig), IDENTIFIER_LENGTH (elsig),		     buf, 0, 0, "");  t = IDENTIFIER_SIGNATURE_TYPE (sig);  if (t != NULL_TREE)    return TREE_TYPE (t);  t = make_class ();  IDENTIFIER_SIGNATURE_TYPE (sig) = build_pointer_type (t);  TYPE_ARRAY_P (t) = 1;  if (TREE_CODE (el_name) == POINTER_TYPE)    el_name = TREE_TYPE (el_name);  el_name = TYPE_NAME (el_name);  if (TREE_CODE (el_name) == TYPE_DECL)    el_name = DECL_NAME (el_name);  {    char suffix[23];    if (length >= 0)      sprintf (suffix, "[%d]", (int)length);     else      strcpy (suffix, "[]");    TYPE_NAME (t)       = TYPE_STUB_DECL (t)      = build_decl (input_location, TYPE_DECL,		    identifier_subst (el_name, "", '.', '.', suffix),                             t);    TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (t)) = true;  }  set_java_signature (t, sig);  set_super_info (0, t, object_type_node, 0);  if (TREE_CODE (element_type) == RECORD_TYPE)    element_type = promote_type (element_type);  TYPE_ARRAY_ELEMENT (t) = element_type;  /* Add length pseudo-field. */  fld = build_decl (input_location,		    FIELD_DECL, get_identifier ("length"), int_type_node);  TYPE_FIELDS (t) = fld;  DECL_CONTEXT (fld) = t;  FIELD_PUBLIC (fld) = 1;  FIELD_FINAL (fld) = 1;  TREE_READONLY (fld) = 1;  atype = build_prim_array_type (element_type, length);  arfld = build_decl (input_location,		      FIELD_DECL, get_identifier ("data"), atype);  DECL_CONTEXT (arfld) = t;  DECL_CHAIN (fld) = arfld;  DECL_ALIGN (arfld) = TYPE_ALIGN (element_type);  /* We could layout_class, but that loads java.lang.Object prematurely.   * This is called by the parser, and it is a bad idea to do load_class   * in the middle of parsing, because of possible circularity problems. */  push_super_field (t, object_type_node);  layout_type (t);  return t;}
开发者ID:AHelper,项目名称:gcc,代码行数:70,



注:本文中的DECL_ALIGN函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DECL_ARGUMENTS函数代码示例
C++ DECLARE_WAITQUEUE函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。