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

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

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

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

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

示例1: vxworks_emutls_var_init

static treevxworks_emutls_var_init (tree var, tree decl, tree tmpl_addr){  VEC(constructor_elt,gc) *v = VEC_alloc (constructor_elt, gc, 3);  constructor_elt *elt;    tree type = TREE_TYPE (var);  tree field = TYPE_FIELDS (type);    elt = VEC_quick_push (constructor_elt, v, NULL);  elt->index = field;  elt->value = fold_convert (TREE_TYPE (field), tmpl_addr);    elt = VEC_quick_push (constructor_elt, v, NULL);  field = DECL_CHAIN (field);  elt->index = field;  elt->value = build_int_cst (TREE_TYPE (field), 0);    elt = VEC_quick_push (constructor_elt, v, NULL);  field = DECL_CHAIN (field);  elt->index = field;  elt->value = fold_convert (TREE_TYPE (field), DECL_SIZE_UNIT (decl));    return build_constructor (type, v);}
开发者ID:BoxianLai,项目名称:moxiedev,代码行数:25,


示例2: lto_input_ts_decl_common_tree_pointers

static voidlto_input_ts_decl_common_tree_pointers (struct lto_input_block *ib,					struct data_in *data_in, tree expr){  DECL_SIZE (expr) = stream_read_tree (ib, data_in);  DECL_SIZE_UNIT (expr) = stream_read_tree (ib, data_in);  DECL_ATTRIBUTES (expr) = stream_read_tree (ib, data_in);  /* Do not stream DECL_ABSTRACT_ORIGIN.  We cannot handle debug information     for early inlining so drop it on the floor instead of ICEing in     dwarf2out.c.  */  if (TREE_CODE (expr) == PARM_DECL)    TREE_CHAIN (expr) = streamer_read_chain (ib, data_in);  if ((TREE_CODE (expr) == VAR_DECL       || TREE_CODE (expr) == PARM_DECL)      && DECL_HAS_VALUE_EXPR_P (expr))    SET_DECL_VALUE_EXPR (expr, stream_read_tree (ib, data_in));  if (TREE_CODE (expr) == VAR_DECL)    {      tree dexpr = stream_read_tree (ib, data_in);      if (dexpr)	SET_DECL_DEBUG_EXPR (expr, dexpr);    }}
开发者ID:JuanMiguelBG,项目名称:gcc-4.7.0-PS3,代码行数:27,


示例3: add_stack_var

static voidadd_stack_var (tree decl){  if (stack_vars_num >= stack_vars_alloc)    {      if (stack_vars_alloc)	stack_vars_alloc = stack_vars_alloc * 3 / 2;      else	stack_vars_alloc = 32;      stack_vars	= XRESIZEVEC (struct stack_var, stack_vars, stack_vars_alloc);    }  stack_vars[stack_vars_num].decl = decl;  stack_vars[stack_vars_num].offset = 0;  stack_vars[stack_vars_num].size = tree_low_cst (DECL_SIZE_UNIT (decl), 1);  stack_vars[stack_vars_num].alignb = get_decl_align_unit (decl);  /* All variables are initially in their own partition.  */  stack_vars[stack_vars_num].representative = stack_vars_num;  stack_vars[stack_vars_num].next = EOC;  /* Ensure that this decl doesn't get put onto the list twice.  */  SET_DECL_RTL (decl, pc_rtx);  stack_vars_num++;}
开发者ID:seguljac,项目名称:higpu,代码行数:26,


示例4: compute_unsafe_stack_layout

unsigned int compute_unsafe_stack_layout() {  unsigned int i, total = 0;  tree var;  FOR_EACH_LOCAL_DECL(cfun, i, var) {    total += tree_to_uhwi (DECL_SIZE_UNIT(var)); /* size in bytes */  }
开发者ID:cristina2689,项目名称:gcc,代码行数:7,


示例5: write_ts_decl_common_tree_pointers

static voidwrite_ts_decl_common_tree_pointers (struct output_block *ob, tree expr,				    bool ref_p){  stream_write_tree (ob, DECL_SIZE (expr), ref_p);  stream_write_tree (ob, DECL_SIZE_UNIT (expr), ref_p);  /* Note, DECL_INITIAL is not handled here.  Since DECL_INITIAL needs     special handling in LTO, it must be handled by streamer hooks.  */  stream_write_tree (ob, DECL_ATTRIBUTES (expr), ref_p);  /* Do not stream DECL_ABSTRACT_ORIGIN.  We cannot handle debug information     for early inlining so drop it on the floor instead of ICEing in     dwarf2out.c.  */  if (TREE_CODE (expr) == PARM_DECL)    streamer_write_chain (ob, TREE_CHAIN (expr), ref_p);  if ((TREE_CODE (expr) == VAR_DECL       || TREE_CODE (expr) == PARM_DECL)      && DECL_HAS_VALUE_EXPR_P (expr))    stream_write_tree (ob, DECL_VALUE_EXPR (expr), ref_p);  if (TREE_CODE (expr) == VAR_DECL)    stream_write_tree (ob, DECL_DEBUG_EXPR (expr), ref_p);}
开发者ID:Samsara00,项目名称:DragonFlyBSD,代码行数:27,


示例6: build_field

static voidbuild_field (segment_info *h, tree union_type, record_layout_info rli){  tree field;  tree name;  HOST_WIDE_INT offset = h->offset;  unsigned HOST_WIDE_INT desired_align, known_align;  name = get_identifier (h->sym->name);  field = build_decl (FIELD_DECL, name, h->field);  gfc_set_decl_location (field, &h->sym->declared_at);  known_align = (offset & -offset) * BITS_PER_UNIT;  if (known_align == 0 || known_align > BIGGEST_ALIGNMENT)    known_align = BIGGEST_ALIGNMENT;  desired_align = update_alignment_for_field (rli, field, known_align);  if (desired_align > known_align)    DECL_PACKED (field) = 1;  DECL_FIELD_CONTEXT (field) = union_type;  DECL_FIELD_OFFSET (field) = size_int (offset);  DECL_FIELD_BIT_OFFSET (field) = bitsize_zero_node;  SET_DECL_OFFSET_ALIGN (field, known_align);  rli->offset = size_binop (MAX_EXPR, rli->offset,                            size_binop (PLUS_EXPR,                                        DECL_FIELD_OFFSET (field),                                        DECL_SIZE_UNIT (field)));  h->field = field;}
开发者ID:aosm,项目名称:gcc_40,代码行数:30,


示例7: build_equiv_decl

static treebuild_equiv_decl (tree union_type, bool is_init){  tree decl;  char name[15];  static int serial = 0;  if (is_init)    {      decl = gfc_create_var (union_type, "equiv");      TREE_STATIC (decl) = 1;      return decl;    }  snprintf (name, sizeof (name), "equiv.%d", serial++);  decl = build_decl (VAR_DECL, get_identifier (name), union_type);  DECL_ARTIFICIAL (decl) = 1;  DECL_IGNORED_P (decl) = 1;  if (!gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl)))    TREE_STATIC (decl) = 1;  TREE_ADDRESSABLE (decl) = 1;  TREE_USED (decl) = 1;  /* The source location has been lost, and doesn't really matter.     We need to set it to something though.  */  gfc_set_decl_location (decl, &gfc_current_locus);  gfc_add_decl_to_function (decl);  return decl;}
开发者ID:aosm,项目名称:libstdcxx_SUPanWheat,代码行数:33,


示例8: expand_one_stack_var

static voidexpand_one_stack_var (tree var){  HOST_WIDE_INT size, offset, align;  size = tree_low_cst (DECL_SIZE_UNIT (var), 1);  align = get_decl_align_unit (var);  offset = alloc_stack_frame_space (size, align);  expand_one_stack_var_at (var, offset);}
开发者ID:seguljac,项目名称:higpu,代码行数:11,


示例9: ubsan_walk_array_refs_r

static treeubsan_walk_array_refs_r (tree *tp, int *walk_subtrees, void *data){  hash_set<tree> *pset = (hash_set<tree> *) data;  if (TREE_CODE (*tp) == BIND_EXPR)    {      /* Since walk_tree doesn't call the callback function on the decls	 in BIND_EXPR_VARS, we have to walk them manually, so we can avoid	 instrumenting DECL_INITIAL of TREE_STATIC vars.  */      *walk_subtrees = 0;      for (tree decl = BIND_EXPR_VARS (*tp); decl; decl = DECL_CHAIN (decl))	{	  if (TREE_STATIC (decl))	    continue;	  walk_tree (&DECL_INITIAL (decl), ubsan_walk_array_refs_r, pset,		     pset);	  walk_tree (&DECL_SIZE (decl), ubsan_walk_array_refs_r, pset, pset);	  walk_tree (&DECL_SIZE_UNIT (decl), ubsan_walk_array_refs_r, pset,		     pset);	}      walk_tree (&BIND_EXPR_BODY (*tp), ubsan_walk_array_refs_r, pset, pset);    }  else if (TREE_CODE (*tp) == ADDR_EXPR	   && TREE_CODE (TREE_OPERAND (*tp, 0)) == ARRAY_REF)    {      ubsan_maybe_instrument_array_ref (&TREE_OPERAND (*tp, 0), true);      /* Make sure ubsan_maybe_instrument_array_ref is not called again	 on the ARRAY_REF, the above call might not instrument anything	 as the index might be constant or masked, so ensure it is not	 walked again and walk its subtrees manually.  */      tree aref = TREE_OPERAND (*tp, 0);      pset->add (aref);      *walk_subtrees = 0;      walk_tree (&TREE_OPERAND (aref, 0), ubsan_walk_array_refs_r, pset, pset);      walk_tree (&TREE_OPERAND (aref, 1), ubsan_walk_array_refs_r, pset, pset);      walk_tree (&TREE_OPERAND (aref, 2), ubsan_walk_array_refs_r, pset, pset);      walk_tree (&TREE_OPERAND (aref, 3), ubsan_walk_array_refs_r, pset, pset);    }  else if (TREE_CODE (*tp) == ARRAY_REF)    ubsan_maybe_instrument_array_ref (tp, false);  return NULL_TREE;}
开发者ID:MaxKellermann,项目名称:gcc,代码行数:43,


示例10: defer_stack_allocation

static booldefer_stack_allocation (tree var, bool toplevel){  /* Variables in the outermost scope automatically conflict with     every other variable.  The only reason to want to defer them     at all is that, after sorting, we can more efficiently pack     small variables in the stack frame.  Continue to defer at -O2.  */  if (toplevel && optimize < 2)    return false;  /* Without optimization, *most* variables are allocated from the     stack, which makes the quadratic problem large exactly when we     want compilation to proceed as quickly as possible.  On the      other hand, we don't want the function's stack frame size to     get completely out of hand.  So we avoid adding scalars and     "small" aggregates to the list at all.  */  if (optimize == 0 && tree_low_cst (DECL_SIZE_UNIT (var), 1) < 32)    return false;  return true;}
开发者ID:seguljac,项目名称:higpu,代码行数:21,


示例11: vxworks_emutls_var_init

static treevxworks_emutls_var_init (tree var, tree decl, tree tmpl_addr){  vec<constructor_elt, va_gc> *v;  vec_alloc (v, 3);    tree type = TREE_TYPE (var);  tree field = TYPE_FIELDS (type);    constructor_elt elt = {field, fold_convert (TREE_TYPE (field), tmpl_addr)};  v->quick_push (elt);    field = DECL_CHAIN (field);  elt.index = field;  elt.value = build_int_cst (TREE_TYPE (field), 0);  v->quick_push (elt);    field = DECL_CHAIN (field);  elt.index = field;  elt.value = fold_convert (TREE_TYPE (field), DECL_SIZE_UNIT (decl));  v->quick_push (elt);    return build_constructor (type, v);}
开发者ID:AHelper,项目名称:gcc,代码行数:24,


示例12: mf_xform_derefs_1

//.........这里部分代码省略.........              {                gcc_assert (TREE_CODE (var) == VAR_DECL                            || TREE_CODE (var) == PARM_DECL                            || TREE_CODE (var) == RESULT_DECL                            || TREE_CODE (var) == STRING_CST);                /* Don't instrument this access if the underlying                   variable is not "eligible".  This test matches                   those arrays that have only known-valid indexes,                   and thus are not labeled TREE_ADDRESSABLE.  */                if (! mf_decl_eligible_p (var) || component_ref_only)                  return;                else		  {		    base = build1 (ADDR_EXPR,				   build_pointer_type (TREE_TYPE (var)), var);		    break;		  }              }          }        /* Handle the case of ordinary non-indirection structure           accesses.  These have only nested COMPONENT_REF nodes (no           INDIRECT_REF), but pass through the above filter loop.           Note that it's possible for such a struct variable to match           the eligible_p test because someone else might take its           address sometime.  */        /* We need special processing for bitfield components, because           their addresses cannot be taken.  */        if (bitfield_ref_p)          {            tree field = TREE_OPERAND (t, 1);            if (TREE_CODE (DECL_SIZE_UNIT (field)) == INTEGER_CST)              size = DECL_SIZE_UNIT (field);	    if (elt)	      elt = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (elt)),			    elt);            addr = fold_convert_loc (location, ptr_type_node, elt ? elt : base);            addr = fold_build_pointer_plus_loc (location,						addr, byte_position (field));          }        else          addr = build1 (ADDR_EXPR, build_pointer_type (type), t);        limit = fold_build2_loc (location, MINUS_EXPR, mf_uintptr_type,                             fold_build2_loc (location, PLUS_EXPR, mf_uintptr_type,					  fold_convert (mf_uintptr_type, addr),					  size),                             integer_one_node);      }      break;    case INDIRECT_REF:      addr = TREE_OPERAND (t, 0);      base = addr;      limit = fold_build_pointer_plus_hwi_loc	(location, fold_build_pointer_plus_loc (location, base, size), -1);      break;    case MEM_REF:      if (addr_expr_of_non_mem_decl_p (TREE_OPERAND (t, 0)))	return;      addr = fold_build_pointer_plus_loc (location, TREE_OPERAND (t, 0),
开发者ID:ChaosJohn,项目名称:gcc,代码行数:67,


示例13: print_node

//.........这里部分代码省略.........                fputs (" decl_1", file);            if (DECL_LANG_FLAG_2 (node))                fputs (" decl_2", file);            if (DECL_LANG_FLAG_3 (node))                fputs (" decl_3", file);            if (DECL_LANG_FLAG_4 (node))                fputs (" decl_4", file);            if (DECL_LANG_FLAG_5 (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);        }
开发者ID:RajibTheKing,项目名称:gcc,代码行数:66,


示例14: 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,


示例15: mf_walk_comp_ref

/* The method walks the node hierarchy to the topmost node. This is   exactly how its done in mudflap and has been borrowed.*/static treemf_walk_comp_ref(tree *tp, tree type, location_t location, /        tree *addr_store, tree *base_store){    tree var, t, addr, base, size;    t = *tp;    int component_ref_only = (TREE_CODE (t) == COMPONENT_REF);    /* If we have a bitfield component reference, we must note the       innermost addressable object in ELT, from which we will       construct the byte-addressable bounds of the bitfield.  */    tree elt = NULL_TREE;    int bitfield_ref_p = (TREE_CODE (t) == COMPONENT_REF            && DECL_BIT_FIELD_TYPE (TREE_OPERAND (t, 1)));    /* Iterate to the top of the ARRAY_REF/COMPONENT_REF       containment hierarchy to find the outermost VAR_DECL.  */    var = TREE_OPERAND (t, 0);    while (1)    {        if (bitfield_ref_p && elt == NULL_TREE                && (TREE_CODE (var) == ARRAY_REF                    || TREE_CODE (var) == COMPONENT_REF))            elt = var;        if (TREE_CODE (var) == ARRAY_REF)        {            component_ref_only = 0;            var = TREE_OPERAND (var, 0);        }        else if (TREE_CODE (var) == COMPONENT_REF)            var = TREE_OPERAND (var, 0);        else if (INDIRECT_REF_P (var)                || TREE_CODE (var) == MEM_REF)        {            base = TREE_OPERAND (var, 0);            break;        }        else if (TREE_CODE (var) == VIEW_CONVERT_EXPR)        {            var = TREE_OPERAND (var, 0);            if (CONSTANT_CLASS_P (var)                    && TREE_CODE (var) != STRING_CST)                return NULL_TREE;        }        else        {            DEBUGLOG("TREE_CODE(temp) : %s comp_ref_only = %d eligigle = %d/n", /                    tree_code_name[(int)TREE_CODE(var)], component_ref_only, /                    mf_decl_eligible_p(var));            gcc_assert (TREE_CODE (var) == VAR_DECL                    || TREE_CODE (var) == SSA_NAME /* TODO: Check this */                    || TREE_CODE (var) == PARM_DECL                    || TREE_CODE (var) == RESULT_DECL                    || TREE_CODE (var) == STRING_CST);            /* Don't instrument this access if the underlying               variable is not "eligible".  This test matches               those arrays that have only known-valid indexes,               and thus are not labeled TREE_ADDRESSABLE.  */            if (! mf_decl_eligible_p (var)) //TODO is this needed? || component_ref_only)                return NULL_TREE;            else            {                base = build1 (ADDR_EXPR,                        build_pointer_type (TREE_TYPE (var)), var);                break;            }        }    }    /* Handle the case of ordinary non-indirection structure       accesses.  These have only nested COMPONENT_REF nodes (no       INDIRECT_REF), but pass through the above filter loop.       Note that it's possible for such a struct variable to match       the eligible_p test because someone else might take its       address sometime.  */    /* We need special processing for bitfield components, because       their addresses cannot be taken.  */    if (bitfield_ref_p)    {        tree field = TREE_OPERAND (t, 1);        if (TREE_CODE (DECL_SIZE_UNIT (field)) == INTEGER_CST)            size = DECL_SIZE_UNIT (field);        if (elt)            elt = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (elt)),                    elt);        addr = fold_convert_loc (location, ptr_type_node, elt ? elt : base);        addr = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,                addr, fold_convert_loc (location, sizetype,                    byte_position (field)));    }    else        addr = build1 (ADDR_EXPR, build_pointer_type (type), t);//.........这里部分代码省略.........
开发者ID:sdzahed,项目名称:LBC-Plugin,代码行数:101,


示例16: addr_object_size

static unsigned HOST_WIDE_INTaddr_object_size (struct object_size_info *osi, const_tree ptr,		  int object_size_type){  tree pt_var, pt_var_size = NULL_TREE, var_size, bytes;  gcc_assert (TREE_CODE (ptr) == ADDR_EXPR);  pt_var = TREE_OPERAND (ptr, 0);  while (handled_component_p (pt_var))    pt_var = TREE_OPERAND (pt_var, 0);  if (pt_var      && TREE_CODE (pt_var) == MEM_REF)    {      unsigned HOST_WIDE_INT sz;      if (!osi || (object_size_type & 1) != 0	  || TREE_CODE (TREE_OPERAND (pt_var, 0)) != SSA_NAME)	{	  sz = compute_builtin_object_size (TREE_OPERAND (pt_var, 0),					    object_size_type & ~1);	}      else	{	  tree var = TREE_OPERAND (pt_var, 0);	  if (osi->pass == 0)	    collect_object_sizes_for (osi, var);	  if (bitmap_bit_p (computed[object_size_type],			    SSA_NAME_VERSION (var)))	    sz = object_sizes[object_size_type][SSA_NAME_VERSION (var)];	  else	    sz = unknown[object_size_type];	}      if (sz != unknown[object_size_type])	{	  double_int dsz = double_int::from_uhwi (sz) - mem_ref_offset (pt_var);	  if (dsz.is_negative ())	    sz = 0;	  else if (dsz.fits_uhwi ())	    sz = dsz.to_uhwi ();	  else	    sz = unknown[object_size_type];	}      if (sz != unknown[object_size_type] && sz < offset_limit)	pt_var_size = size_int (sz);    }  else if (pt_var	   && DECL_P (pt_var)	   && host_integerp (DECL_SIZE_UNIT (pt_var), 1)	   && (unsigned HOST_WIDE_INT)	        tree_low_cst (DECL_SIZE_UNIT (pt_var), 1) < offset_limit)    pt_var_size = DECL_SIZE_UNIT (pt_var);  else if (pt_var	   && TREE_CODE (pt_var) == STRING_CST	   && TYPE_SIZE_UNIT (TREE_TYPE (pt_var))	   && host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)), 1)	   && (unsigned HOST_WIDE_INT)	      tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (pt_var)), 1)	      < offset_limit)    pt_var_size = TYPE_SIZE_UNIT (TREE_TYPE (pt_var));  else    return unknown[object_size_type];  if (pt_var != TREE_OPERAND (ptr, 0))    {      tree var;      if (object_size_type & 1)	{	  var = TREE_OPERAND (ptr, 0);	  while (var != pt_var		 && TREE_CODE (var) != BIT_FIELD_REF		 && TREE_CODE (var) != COMPONENT_REF		 && TREE_CODE (var) != ARRAY_REF		 && TREE_CODE (var) != ARRAY_RANGE_REF		 && TREE_CODE (var) != REALPART_EXPR		 && TREE_CODE (var) != IMAGPART_EXPR)	    var = TREE_OPERAND (var, 0);	  if (var != pt_var && TREE_CODE (var) == ARRAY_REF)	    var = TREE_OPERAND (var, 0);	  if (! TYPE_SIZE_UNIT (TREE_TYPE (var))	      || ! host_integerp (TYPE_SIZE_UNIT (TREE_TYPE (var)), 1)	      || (pt_var_size		  && tree_int_cst_lt (pt_var_size,				      TYPE_SIZE_UNIT (TREE_TYPE (var)))))	    var = pt_var;	  else if (var != pt_var && TREE_CODE (pt_var) == MEM_REF)	    {	      tree v = var;	      /* For &X->fld, compute object size only if fld isn't the last		 field, as struct { int i; char c[1]; } is often used instead		 of flexible array member.  */	      while (v && v != pt_var)		switch (TREE_CODE (v))		  {		  case ARRAY_REF:		    if (TYPE_SIZE_UNIT (TREE_TYPE (TREE_OPERAND (v, 0)))//.........这里部分代码省略.........
开发者ID:ChaosJohn,项目名称:gcc,代码行数:101,


示例17: browse_tree

//.........这里部分代码省略.........	    TB_SET_HEAD (DECL_ATTRIBUTES (head));	  else if (head && TYPE_P (head))	    TB_SET_HEAD (TYPE_ATTRIBUTES (head));	  else	    TB_WF;	  break;	case TB_CONTEXT:	  if (head && DECL_P (head))	    TB_SET_HEAD (DECL_CONTEXT (head));	  else if (head && TYPE_P (head)		   && TYPE_CONTEXT (head))	    TB_SET_HEAD (TYPE_CONTEXT (head));	  else	    TB_WF;	  break;	case TB_OFFSET:	  if (head && TREE_CODE (head) == FIELD_DECL)	    TB_SET_HEAD (DECL_FIELD_OFFSET (head));	  else	    TB_WF;	  break;	case TB_BIT_OFFSET:	  if (head && TREE_CODE (head) == FIELD_DECL)	    TB_SET_HEAD (DECL_FIELD_BIT_OFFSET (head));	  else	    TB_WF;          break;	case TB_UNIT_SIZE:	  if (head && DECL_P (head))	    TB_SET_HEAD (DECL_SIZE_UNIT (head));	  else if (head && TYPE_P (head))	    TB_SET_HEAD (TYPE_SIZE_UNIT (head));	  else	    TB_WF;	  break;	case TB_SIZE:	  if (head && DECL_P (head))	    TB_SET_HEAD (DECL_SIZE (head));	  else if (head && TYPE_P (head))	    TB_SET_HEAD (TYPE_SIZE (head));	  else	    TB_WF;	  break;	case TB_TYPE:	  if (head && TREE_TYPE (head))	    TB_SET_HEAD (TREE_TYPE (head));	  else	    TB_WF;	  break;	case TB_DECL_SAVED_TREE:	  if (head && TREE_CODE (head) == FUNCTION_DECL	      && DECL_SAVED_TREE (head))	    TB_SET_HEAD (DECL_SAVED_TREE (head));	  else	    TB_WF;	  break;	case TB_BODY:	  if (head && TREE_CODE (head) == BIND_EXPR)
开发者ID:3F,项目名称:gcc,代码行数:67,


示例18: 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,


示例19: get_init_field

static treeget_init_field (segment_info *head, tree union_type, tree *field_init,		record_layout_info rli){  segment_info *s;  HOST_WIDE_INT length = 0;  HOST_WIDE_INT offset = 0;  unsigned HOST_WIDE_INT known_align, desired_align;  bool overlap = false;  tree tmp, field;  tree init;  unsigned char *data, *chk;  VEC(constructor_elt,gc) *v = NULL;  tree type = unsigned_char_type_node;  int i;  /* Obtain the size of the union and check if there are any overlapping     initializers.  */  for (s = head; s; s = s->next)    {      HOST_WIDE_INT slen = s->offset + s->length;      if (s->sym->value)	{	  if (s->offset < offset)            overlap = true;	  offset = slen;	}      length = length < slen ? slen : length;    }  if (!overlap)    return NULL_TREE;  /* Now absorb all the initializer data into a single vector,     whilst checking for overlapping, unequal values.  */  data = XCNEWVEC (unsigned char, (size_t)length);  chk = XCNEWVEC (unsigned char, (size_t)length);  /* TODO - change this when default initialization is implemented.  */  memset (data, '/0', (size_t)length);  memset (chk, '/0', (size_t)length);  for (s = head; s; s = s->next)    if (s->sym->value)      gfc_merge_initializers (s->sym->ts, s->sym->value,			      &data[s->offset],			      &chk[s->offset],			     (size_t)s->length);    for (i = 0; i < length; i++)    CONSTRUCTOR_APPEND_ELT (v, NULL, build_int_cst (type, data[i]));  free (data);  free (chk);  /* Build a char[length] array to hold the initializers.  Much of what     follows is borrowed from build_field, above.  */  tmp = build_int_cst (gfc_array_index_type, length - 1);  tmp = build_range_type (gfc_array_index_type,			  gfc_index_zero_node, tmp);  tmp = build_array_type (type, tmp);  field = build_decl (gfc_current_locus.lb->location,		      FIELD_DECL, NULL_TREE, tmp);  known_align = BIGGEST_ALIGNMENT;  desired_align = update_alignment_for_field (rli, field, known_align);  if (desired_align > known_align)    DECL_PACKED (field) = 1;  DECL_FIELD_CONTEXT (field) = union_type;  DECL_FIELD_OFFSET (field) = size_int (0);  DECL_FIELD_BIT_OFFSET (field) = bitsize_zero_node;  SET_DECL_OFFSET_ALIGN (field, known_align);  rli->offset = size_binop (MAX_EXPR, rli->offset,                            size_binop (PLUS_EXPR,                                        DECL_FIELD_OFFSET (field),                                        DECL_SIZE_UNIT (field)));  init = build_constructor (TREE_TYPE (field), v);  TREE_CONSTANT (init) = 1;  *field_init = init;  for (s = head; s; s = s->next)    {      if (s->sym->value == NULL)	continue;      gfc_free_expr (s->sym->value);      s->sym->value = NULL;    }  return field;}
开发者ID:BoxianLai,项目名称:moxiedev,代码行数:97,


示例20: chkp_get_check_result

/* Return 1 if check CI against BOUNDS always pass,   -1 if check CI against BOUNDS always fails and   0 if we cannot compute check result.  */static intchkp_get_check_result (struct check_info *ci, tree bounds){    gimple *bnd_def;    address_t bound_val;    int sign, res = 0;    if (dump_file && (dump_flags & TDF_DETAILS))    {        fprintf (dump_file, "Trying to compute result of the check/n");        fprintf (dump_file, "  check: ");        print_gimple_stmt (dump_file, ci->stmt, 0, 0);        fprintf (dump_file, "  address: ");        chkp_print_addr (ci->addr);        fprintf (dump_file, "/n  bounds: ");        print_generic_expr (dump_file, bounds, 0);        fprintf (dump_file, "/n");    }    if (TREE_CODE (bounds) != SSA_NAME)    {        if (dump_file && (dump_flags & TDF_DETAILS))            fprintf (dump_file, "  result: bounds tree code is not ssa_name/n");        return 0;    }    bnd_def = SSA_NAME_DEF_STMT (bounds);    /* Currently we handle cases when bounds are result of bndmk       or loaded static bounds var.  */    if (gimple_code (bnd_def) == GIMPLE_CALL            && gimple_call_fndecl (bnd_def) == chkp_bndmk_fndecl)    {        bound_val.pol.create (0);        chkp_collect_value (gimple_call_arg (bnd_def, 0), bound_val);        if (ci->type == CHECK_UPPER_BOUND)        {            address_t size_val;            size_val.pol.create (0);            chkp_collect_value (gimple_call_arg (bnd_def, 1), size_val);            chkp_add_addr_addr (bound_val, size_val);            size_val.pol.release ();            chkp_add_addr_item (bound_val, integer_minus_one_node, NULL);        }    }    else if (gimple_code (bnd_def) == GIMPLE_ASSIGN             && gimple_assign_rhs1 (bnd_def) == chkp_get_zero_bounds_var ())    {        if (dump_file && (dump_flags & TDF_DETAILS))            fprintf (dump_file, "  result: always pass with zero bounds/n");        return 1;    }    else if (gimple_code (bnd_def) == GIMPLE_ASSIGN             && gimple_assign_rhs1 (bnd_def) == chkp_get_none_bounds_var ())    {        if (dump_file && (dump_flags & TDF_DETAILS))            fprintf (dump_file, "  result: always fails with none bounds/n");        return -1;    }    else if (gimple_code (bnd_def) == GIMPLE_ASSIGN             && TREE_CODE (gimple_assign_rhs1 (bnd_def)) == VAR_DECL)    {        tree bnd_var = gimple_assign_rhs1 (bnd_def);        tree var;        tree size;        if (!DECL_INITIAL (bnd_var)                || DECL_INITIAL (bnd_var) == error_mark_node)        {            if (dump_file && (dump_flags & TDF_DETAILS))                fprintf (dump_file, "  result: cannot compute bounds/n");            return 0;        }        gcc_assert (TREE_CODE (DECL_INITIAL (bnd_var)) == ADDR_EXPR);        var = TREE_OPERAND (DECL_INITIAL (bnd_var), 0);        bound_val.pol.create (0);        chkp_collect_value (DECL_INITIAL (bnd_var), bound_val);        if (ci->type == CHECK_UPPER_BOUND)        {            if (TREE_CODE (var) == VAR_DECL)            {                if (DECL_SIZE (var)                        && !chkp_variable_size_type (TREE_TYPE (var)))                    size = DECL_SIZE_UNIT (var);                else                {                    if (dump_file && (dump_flags & TDF_DETAILS))                        fprintf (dump_file, "  result: cannot compute bounds/n");                    return 0;                }            }            else            {                gcc_assert (TREE_CODE (var) == STRING_CST);                size = build_int_cst (size_type_node,                                      TREE_STRING_LENGTH (var));//.........这里部分代码省略.........
开发者ID:paranoiacblack,项目名称:gcc,代码行数:101,



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


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