void foo (int attr_kind, unsigned long offset) { dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node)); attr->dw_attr = attr_kind; if (attr != ((void *)0)) exit (0); }
lambda_trans_matrix lambda_trans_matrix_new (int colsize, int rowsize) { lambda_trans_matrix ret; ret = ggc_alloc (sizeof (*ret)); LTM_MATRIX (ret) = lambda_matrix_new (rowsize, colsize); LTM_ROWSIZE (ret) = rowsize; LTM_COLSIZE (ret) = colsize; LTM_DENOMINATOR (ret) = 1; return ret; }
lambda_matrix lambda_matrix_new (int m, int n) { lambda_matrix mat; int i; mat = ggc_alloc (m * sizeof (lambda_vector)); for (i = 0; i < m; i++) mat[i] = lambda_vector_new (n); return mat; }
static inline gimple allocate_phi_node (size_t len) { gimple phi; size_t bucket = NUM_BUCKETS - 2; size_t size = sizeof (struct gimple_statement_phi) + (len - 1) * sizeof (struct phi_arg_d); if (free_phinode_count) for (bucket = len - 2; bucket < NUM_BUCKETS - 2; bucket++) if (free_phinodes[bucket]) break; /* If our free list has an element, then use it. */ if (bucket < NUM_BUCKETS - 2 && gimple_phi_capacity (VEC_index (gimple, free_phinodes[bucket], 0)) >= len) { free_phinode_count--; phi = VEC_pop (gimple, free_phinodes[bucket]); if (VEC_empty (gimple, free_phinodes[bucket])) VEC_free (gimple, gc, free_phinodes[bucket]); #ifdef GATHER_STATISTICS phi_nodes_reused++; #endif } else { phi = (gimple) ggc_alloc (size); #ifdef GATHER_STATISTICS phi_nodes_created++; { enum gimple_alloc_kind kind = gimple_alloc_kind (GIMPLE_PHI); gimple_alloc_counts[(int) kind]++; gimple_alloc_sizes[(int) kind] += size; } #endif } return phi; }
void duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info) { struct ptr_info_def *new_ptr_info; gcc_assert (POINTER_TYPE_P (TREE_TYPE (name))); gcc_assert (!SSA_NAME_PTR_INFO (name)); if (!ptr_info) return; new_ptr_info = ggc_alloc (sizeof (struct ptr_info_def)); *new_ptr_info = *ptr_info; if (ptr_info->pt_vars) { new_ptr_info->pt_vars = BITMAP_GGC_ALLOC (); bitmap_copy (new_ptr_info->pt_vars, ptr_info->pt_vars); } SSA_NAME_PTR_INFO (name) = new_ptr_info; }
static inline tree allocate_phi_node (int len) { tree phi; int bucket = NUM_BUCKETS - 2; int size = (sizeof (struct tree_phi_node) + (len - 1) * sizeof (struct phi_arg_d)); if (free_phinode_count) for (bucket = len - 2; bucket < NUM_BUCKETS - 2; bucket++) if (free_phinodes[bucket]) break; /* If our free list has an element, then use it. */ if (bucket < NUM_BUCKETS - 2 && PHI_ARG_CAPACITY (free_phinodes[bucket]) >= len) { free_phinode_count--; phi = free_phinodes[bucket]; free_phinodes[bucket] = PHI_CHAIN (free_phinodes[bucket]); #ifdef GATHER_STATISTICS phi_nodes_reused++; #endif } else { phi = ggc_alloc (size); #ifdef GATHER_STATISTICS phi_nodes_created++; tree_node_counts[(int) phi_kind]++; tree_node_sizes[(int) phi_kind] += size; #endif } return phi; }
static bool insn_prefetch_values_to_profile (rtx insn, histogram_values *values) { rtx mem, address; int write; histogram_value hist; /* It only makes sense to look for memory references in ordinary insns. */ if (GET_CODE (insn) != INSN) return false; if (!find_mem_reference (insn, &mem, &write)) return false; address = XEXP (mem, 0); if (side_effects_p (address)) return false; /* APPLE LOCAL begin should be in FSF, and has been submitted. */ if (GET_CODE (PATTERN (insn)) == CLOBBER) return false; /* APPLE LOCAL end should be in FSF, and has been submitted. */ if (CONSTANT_P (address)) return false; hist = ggc_alloc (sizeof (*hist)); hist->value = address; hist->mode = GET_MODE (address); hist->seq = NULL_RTX; hist->insn = insn; hist->type = HIST_TYPE_CONST_DELTA; VEC_safe_push (histogram_value, *values, hist); return true; }
/* These are for splay_tree_new_ggc. */ void * ggc_splay_alloc (int sz, void *nl) { gcc_assert (!nl); return ggc_alloc (sz); }
void tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode) { struct tree_statement_list_node *head, *tail, *cur; /* Die on looping. */ gcc_assert (t != i->container); if (TREE_CODE (t) == STATEMENT_LIST) { head = STATEMENT_LIST_HEAD (t); tail = STATEMENT_LIST_TAIL (t); STATEMENT_LIST_HEAD (t) = NULL; STATEMENT_LIST_TAIL (t) = NULL; free_stmt_list (t); /* Empty statement lists need no work. */ if (!head || !tail) { gcc_assert (head == tail); return; } } else { head = ggc_alloc (sizeof (*head)); head->prev = NULL; head->next = NULL; head->stmt = t; tail = head; } TREE_SIDE_EFFECTS (i->container) = 1; cur = i->ptr; /* Link it into the list. */ if (cur) { head->prev = cur->prev; if (head->prev) head->prev->next = head; else STATEMENT_LIST_HEAD (i->container) = head; tail->next = cur; cur->prev = tail; } else { head->prev = STATEMENT_LIST_TAIL (i->container); if (head->prev) head->prev->next = head; else STATEMENT_LIST_HEAD (i->container) = head; STATEMENT_LIST_TAIL (i->container) = tail; } /* Update the iterator, if requested. */ switch (mode) { case TSI_NEW_STMT: case TSI_CONTINUE_LINKING: case TSI_CHAIN_START: i->ptr = head; break; case TSI_CHAIN_END: i->ptr = tail; break; case TSI_SAME_STMT: break; } }
/* Read and handle the constant pool. Return 0 if OK. Return -2 if a bad cross-reference (index of other constant) was seen. */ static int jcf_parse_constant_pool (JCF* jcf) { int i, n; JPOOL_SIZE (jcf) = (JCF_FILL (jcf, 2), JCF_readu2 (jcf)); jcf->cpool.tags = ggc_alloc (JPOOL_SIZE (jcf)); jcf->cpool.data = ggc_alloc (sizeof (jword) * JPOOL_SIZE (jcf)); jcf->cpool.tags[0] = 0; #ifdef HANDLE_START_CONSTANT_POOL HANDLE_START_CONSTANT_POOL (JPOOL_SIZE (jcf)); #endif for (i = 1; i < (int) JPOOL_SIZE (jcf); i++) { int constant_kind; /* Make sure at least 9 bytes are available. This is enough for all fixed-sized constant pool entries (so we don't need many more JCF_FILL calls below), but is is small enough that we are guaranteed to not hit EOF (in a valid .class file). */ JCF_FILL (jcf, 9); constant_kind = JCF_readu (jcf); jcf->cpool.tags[i] = constant_kind; switch (constant_kind) { case CONSTANT_String: case CONSTANT_Class: jcf->cpool.data[i].w = JCF_readu2 (jcf); break; case CONSTANT_Fieldref: case CONSTANT_Methodref: case CONSTANT_InterfaceMethodref: case CONSTANT_NameAndType: jcf->cpool.data[i].w = JCF_readu2 (jcf); jcf->cpool.data[i].w |= JCF_readu2 (jcf) << 16; break; case CONSTANT_Integer: case CONSTANT_Float: jcf->cpool.data[i].w = JCF_readu4 (jcf); break; case CONSTANT_Long: case CONSTANT_Double: jcf->cpool.data[i].w = JCF_readu4 (jcf); i++; /* These take up two spots in the constant pool */ jcf->cpool.tags[i] = 0; jcf->cpool.data[i].w = JCF_readu4 (jcf); break; case CONSTANT_Utf8: n = JCF_readu2 (jcf); JCF_FILL (jcf, n); #ifdef HANDLE_CONSTANT_Utf8 HANDLE_CONSTANT_Utf8(jcf, i, n); #else jcf->cpool.data[i].w = JCF_TELL(jcf) - 2; JCF_SKIP (jcf, n); #endif break; default: return i; } } return 0; }
static void * stringpool_ggc_alloc (size_t x) { return ggc_alloc (x); }
/* Find values inside INSN for that we want to measure histograms for division/modulo optimization and stores them to VALUES. */ static void insn_divmod_values_to_profile (rtx insn, histogram_values *values) { rtx set, set_src, op1, op2; enum machine_mode mode; histogram_value hist; if (!INSN_P (insn)) return; set = single_set (insn); if (!set) return; mode = GET_MODE (SET_DEST (set)); if (!INTEGRAL_MODE_P (mode)) return; set_src = SET_SRC (set); switch (GET_CODE (set_src)) { case DIV: case MOD: case UDIV: case UMOD: op1 = XEXP (set_src, 0); op2 = XEXP (set_src, 1); if (side_effects_p (op2)) return; /* Check for a special case where the divisor is power of 2. */ if ((GET_CODE (set_src) == UMOD) && !CONSTANT_P (op2)) { hist = ggc_alloc (sizeof (*hist)); hist->value = op2; hist->seq = NULL_RTX; hist->mode = mode; hist->insn = insn; hist->type = HIST_TYPE_POW2; hist->hdata.pow2.may_be_other = 1; VEC_safe_push (histogram_value, *values, hist); } /* Check whether the divisor is not in fact a constant. */ if (!CONSTANT_P (op2)) { hist = ggc_alloc (sizeof (*hist)); hist->value = op2; hist->mode = mode; hist->seq = NULL_RTX; hist->insn = insn; hist->type = HIST_TYPE_SINGLE_VALUE; VEC_safe_push (histogram_value, *values, hist); } /* For mod, check whether it is not often a noop (or replaceable by a few subtractions). */ if (GET_CODE (set_src) == UMOD && !side_effects_p (op1)) { rtx tmp; hist = ggc_alloc (sizeof (*hist)); start_sequence (); tmp = simplify_gen_binary (DIV, mode, copy_rtx (op1), copy_rtx (op2)); hist->value = force_operand (tmp, NULL_RTX); hist->seq = get_insns (); end_sequence (); hist->mode = mode; hist->insn = insn; hist->type = HIST_TYPE_INTERVAL; hist->hdata.intvl.int_start = 0; hist->hdata.intvl.steps = 2; hist->hdata.intvl.may_be_less = 1; hist->hdata.intvl.may_be_more = 1; VEC_safe_push (histogram_value, *values, hist); } return; default: return; } }