hexsha
stringlengths 40
40
| repo
stringlengths 5
105
| path
stringlengths 3
173
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
438
| return_type
stringlengths 1
106
⌀ | original_string
stringlengths 21
40.7k
| original_docstring
stringlengths 18
13.4k
| docstring
stringlengths 11
3.24k
| docstring_tokens
sequence | code
stringlengths 14
20.4k
| code_tokens
sequence | short_docstring
stringlengths 0
4.36k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0ae5d444e671bc005e1cbf08f54f6cc9f1faedbd | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-parloops.c | [
"BSD-3-Clause"
] | C | try_get_loop_niter | bool | static bool
try_get_loop_niter (loop_p loop, struct tree_niter_desc *niter)
{
edge exit = single_dom_exit (loop);
gcc_assert (exit);
/* We need to know # of iterations, and there should be no uses of values
defined inside loop outside of it, unless the values are invariants of
the loop. */
if (!number_of_iterations_exit (loop, exit, niter, false))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " FAILED: number of iterations not known\n");
return false;
}
return true;
} | /* Try to initialize NITER for code generation part. */ | Try to initialize NITER for code generation part. | [
"Try",
"to",
"initialize",
"NITER",
"for",
"code",
"generation",
"part",
"."
] | static bool
try_get_loop_niter (loop_p loop, struct tree_niter_desc *niter)
{
edge exit = single_dom_exit (loop);
gcc_assert (exit);
if (!number_of_iterations_exit (loop, exit, niter, false))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " FAILED: number of iterations not known\n");
return false;
}
return true;
} | [
"static",
"bool",
"try_get_loop_niter",
"(",
"loop_p",
"loop",
",",
"struct",
"tree_niter_desc",
"*",
"niter",
")",
"{",
"edge",
"exit",
"=",
"single_dom_exit",
"(",
"loop",
")",
";",
"gcc_assert",
"(",
"exit",
")",
";",
"if",
"(",
"!",
"number_of_iterations_exit",
"(",
"loop",
",",
"exit",
",",
"niter",
",",
"false",
")",
")",
"{",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Try to initialize NITER for code generation part. | [
"Try",
"to",
"initialize",
"NITER",
"for",
"code",
"generation",
"part",
"."
] | [
"/* We need to know # of iterations, and there should be no uses of values\n defined inside loop outside of it, unless the values are invariants of\n the loop. */"
] | [
{
"param": "loop",
"type": "loop_p"
},
{
"param": "niter",
"type": "struct tree_niter_desc"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "loop_p",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "niter",
"type": "struct tree_niter_desc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ae5d444e671bc005e1cbf08f54f6cc9f1faedbd | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-parloops.c | [
"BSD-3-Clause"
] | C | try_create_reduction_list | bool | static bool
try_create_reduction_list (loop_p loop, htab_t reduction_list)
{
edge exit = single_dom_exit (loop);
gimple_stmt_iterator gsi;
gcc_assert (exit);
gather_scalar_reductions (loop, reduction_list);
for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
struct reduction_info *red;
imm_use_iterator imm_iter;
use_operand_p use_p;
gimple reduc_phi;
tree val = PHI_ARG_DEF_FROM_EDGE (phi, exit);
if (is_gimple_reg (val))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "phi is ");
print_gimple_stmt (dump_file, phi, 0, 0);
fprintf (dump_file, "arg of phi to exit: value ");
print_generic_expr (dump_file, val, 0);
fprintf (dump_file, " used outside loop\n");
fprintf (dump_file,
" checking if it a part of reduction pattern: \n");
}
if (htab_elements (reduction_list) == 0)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
" FAILED: it is not a part of reduction.\n");
return false;
}
reduc_phi = NULL;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, val)
{
if (!gimple_debug_bind_p (USE_STMT (use_p))
&& flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
{
reduc_phi = USE_STMT (use_p);
break;
}
}
red = reduction_phi (reduction_list, reduc_phi);
if (red == NULL)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
" FAILED: it is not a part of reduction.\n");
return false;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "reduction phi is ");
print_gimple_stmt (dump_file, red->reduc_phi, 0, 0);
fprintf (dump_file, "reduction stmt is ");
print_gimple_stmt (dump_file, red->reduc_stmt, 0, 0);
}
}
}
/* The iterations of the loop may communicate only through bivs whose
iteration space can be distributed efficiently. */
for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
tree def = PHI_RESULT (phi);
affine_iv iv;
if (is_gimple_reg (def) && !simple_iv (loop, loop, def, &iv, true))
{
struct reduction_info *red;
red = reduction_phi (reduction_list, phi);
if (red == NULL)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
" FAILED: scalar dependency between iterations\n");
return false;
}
}
}
return true;
} | /* Try to initialize REDUCTION_LIST for code generation part.
REDUCTION_LIST describes the reductions. */ | Try to initialize REDUCTION_LIST for code generation part.
REDUCTION_LIST describes the reductions. | [
"Try",
"to",
"initialize",
"REDUCTION_LIST",
"for",
"code",
"generation",
"part",
".",
"REDUCTION_LIST",
"describes",
"the",
"reductions",
"."
] | static bool
try_create_reduction_list (loop_p loop, htab_t reduction_list)
{
edge exit = single_dom_exit (loop);
gimple_stmt_iterator gsi;
gcc_assert (exit);
gather_scalar_reductions (loop, reduction_list);
for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
struct reduction_info *red;
imm_use_iterator imm_iter;
use_operand_p use_p;
gimple reduc_phi;
tree val = PHI_ARG_DEF_FROM_EDGE (phi, exit);
if (is_gimple_reg (val))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "phi is ");
print_gimple_stmt (dump_file, phi, 0, 0);
fprintf (dump_file, "arg of phi to exit: value ");
print_generic_expr (dump_file, val, 0);
fprintf (dump_file, " used outside loop\n");
fprintf (dump_file,
" checking if it a part of reduction pattern: \n");
}
if (htab_elements (reduction_list) == 0)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
" FAILED: it is not a part of reduction.\n");
return false;
}
reduc_phi = NULL;
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, val)
{
if (!gimple_debug_bind_p (USE_STMT (use_p))
&& flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
{
reduc_phi = USE_STMT (use_p);
break;
}
}
red = reduction_phi (reduction_list, reduc_phi);
if (red == NULL)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
" FAILED: it is not a part of reduction.\n");
return false;
}
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "reduction phi is ");
print_gimple_stmt (dump_file, red->reduc_phi, 0, 0);
fprintf (dump_file, "reduction stmt is ");
print_gimple_stmt (dump_file, red->reduc_stmt, 0, 0);
}
}
}
for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple phi = gsi_stmt (gsi);
tree def = PHI_RESULT (phi);
affine_iv iv;
if (is_gimple_reg (def) && !simple_iv (loop, loop, def, &iv, true))
{
struct reduction_info *red;
red = reduction_phi (reduction_list, phi);
if (red == NULL)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
" FAILED: scalar dependency between iterations\n");
return false;
}
}
}
return true;
} | [
"static",
"bool",
"try_create_reduction_list",
"(",
"loop_p",
"loop",
",",
"htab_t",
"reduction_list",
")",
"{",
"edge",
"exit",
"=",
"single_dom_exit",
"(",
"loop",
")",
";",
"gimple_stmt_iterator",
"gsi",
";",
"gcc_assert",
"(",
"exit",
")",
";",
"gather_scalar_reductions",
"(",
"loop",
",",
"reduction_list",
")",
";",
"for",
"(",
"gsi",
"=",
"gsi_start_phis",
"(",
"exit",
"->",
"dest",
")",
";",
"!",
"gsi_end_p",
"(",
"gsi",
")",
";",
"gsi_next",
"(",
"&",
"gsi",
")",
")",
"{",
"gimple",
"phi",
"=",
"gsi_stmt",
"(",
"gsi",
")",
";",
"struct",
"reduction_info",
"*",
"red",
";",
"imm_use_iterator",
"imm_iter",
";",
"use_operand_p",
"use_p",
";",
"gimple",
"reduc_phi",
";",
"tree",
"val",
"=",
"PHI_ARG_DEF_FROM_EDGE",
"(",
"phi",
",",
"exit",
")",
";",
"if",
"(",
"is_gimple_reg",
"(",
"val",
")",
")",
"{",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"{",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\"",
")",
";",
"print_gimple_stmt",
"(",
"dump_file",
",",
"phi",
",",
"0",
",",
"0",
")",
";",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\"",
")",
";",
"print_generic_expr",
"(",
"dump_file",
",",
"val",
",",
"0",
")",
";",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"if",
"(",
"htab_elements",
"(",
"reduction_list",
")",
"==",
"0",
")",
"{",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
"false",
";",
"}",
"reduc_phi",
"=",
"NULL",
";",
"FOR_EACH_IMM_USE_FAST",
"(",
"use_p",
",",
"imm_iter",
",",
"val",
")",
"",
"{",
"if",
"(",
"!",
"gimple_debug_bind_p",
"(",
"USE_STMT",
"(",
"use_p",
")",
")",
"&&",
"flow_bb_inside_loop_p",
"(",
"loop",
",",
"gimple_bb",
"(",
"USE_STMT",
"(",
"use_p",
")",
")",
")",
")",
"{",
"reduc_phi",
"=",
"USE_STMT",
"(",
"use_p",
")",
";",
"break",
";",
"}",
"}",
"red",
"=",
"reduction_phi",
"(",
"reduction_list",
",",
"reduc_phi",
")",
";",
"if",
"(",
"red",
"==",
"NULL",
")",
"{",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
"false",
";",
"}",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"{",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\"",
")",
";",
"print_gimple_stmt",
"(",
"dump_file",
",",
"red",
"->",
"reduc_phi",
",",
"0",
",",
"0",
")",
";",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\"",
")",
";",
"print_gimple_stmt",
"(",
"dump_file",
",",
"red",
"->",
"reduc_stmt",
",",
"0",
",",
"0",
")",
";",
"}",
"}",
"}",
"for",
"(",
"gsi",
"=",
"gsi_start_phis",
"(",
"loop",
"->",
"header",
")",
";",
"!",
"gsi_end_p",
"(",
"gsi",
")",
";",
"gsi_next",
"(",
"&",
"gsi",
")",
")",
"{",
"gimple",
"phi",
"=",
"gsi_stmt",
"(",
"gsi",
")",
";",
"tree",
"def",
"=",
"PHI_RESULT",
"(",
"phi",
")",
";",
"affine_iv",
"iv",
";",
"if",
"(",
"is_gimple_reg",
"(",
"def",
")",
"&&",
"!",
"simple_iv",
"(",
"loop",
",",
"loop",
",",
"def",
",",
"&",
"iv",
",",
"true",
")",
")",
"{",
"struct",
"reduction_info",
"*",
"red",
";",
"red",
"=",
"reduction_phi",
"(",
"reduction_list",
",",
"phi",
")",
";",
"if",
"(",
"red",
"==",
"NULL",
")",
"{",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
"false",
";",
"}",
"}",
"}",
"return",
"true",
";",
"}"
] | Try to initialize REDUCTION_LIST for code generation part. | [
"Try",
"to",
"initialize",
"REDUCTION_LIST",
"for",
"code",
"generation",
"part",
"."
] | [
"/* The iterations of the loop may communicate only through bivs whose\n iteration space can be distributed efficiently. */"
] | [
{
"param": "loop",
"type": "loop_p"
},
{
"param": "reduction_list",
"type": "htab_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "loop_p",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reduction_list",
"type": "htab_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ae5d444e671bc005e1cbf08f54f6cc9f1faedbd | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-parloops.c | [
"BSD-3-Clause"
] | C | parallelize_loops | bool | bool
parallelize_loops (void)
{
unsigned n_threads = flag_tree_parallelize_loops;
bool changed = false;
struct loop *loop;
struct tree_niter_desc niter_desc;
loop_iterator li;
htab_t reduction_list;
struct obstack parloop_obstack;
HOST_WIDE_INT estimated;
LOC loop_loc;
/* Do not parallelize loops in the functions created by parallelization. */
if (parallelized_function_p (cfun->decl))
return false;
if (cfun->has_nonlocal_label)
return false;
gcc_obstack_init (&parloop_obstack);
reduction_list = htab_create (10, reduction_info_hash,
reduction_info_eq, free);
init_stmt_vec_info_vec ();
FOR_EACH_LOOP (li, loop, 0)
{
htab_empty (reduction_list);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Trying loop %d as candidate\n",loop->num);
if (loop->inner)
fprintf (dump_file, "loop %d is not innermost\n",loop->num);
else
fprintf (dump_file, "loop %d is innermost\n",loop->num);
}
/* If we use autopar in graphite pass, we use its marked dependency
checking results. */
if (flag_loop_parallelize_all && !loop->can_be_parallel)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "loop is not parallel according to graphite\n");
continue;
}
if (!single_dom_exit (loop))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "loop is !single_dom_exit\n");
continue;
}
if (/* And of course, the loop must be parallelizable. */
!can_duplicate_loop_p (loop)
|| loop_has_blocks_with_irreducible_flag (loop)
|| (loop_preheader_edge (loop)->src->flags & BB_IRREDUCIBLE_LOOP)
/* FIXME: the check for vector phi nodes could be removed. */
|| loop_has_vector_phi_nodes (loop)
/* FIXME: transform_to_exit_first_loop does not handle not
header-copied loops correctly - see PR46886. */
|| !do_while_loop_p (loop))
continue;
estimated = max_stmt_executions_int (loop, false);
/* FIXME: Bypass this check as graphite doesn't update the
count and frequency correctly now. */
if (!flag_loop_parallelize_all
&& ((estimated !=-1
&& estimated <= (HOST_WIDE_INT) n_threads * MIN_PER_THREAD)
/* Do not bother with loops in cold areas. */
|| optimize_loop_nest_for_size_p (loop)))
continue;
if (!try_get_loop_niter (loop, &niter_desc))
continue;
if (!try_create_reduction_list (loop, reduction_list))
continue;
if (!flag_loop_parallelize_all
&& !loop_parallel_p (loop, &parloop_obstack))
continue;
changed = true;
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (loop->inner)
fprintf (dump_file, "parallelizing outer loop %d\n",loop->header->index);
else
fprintf (dump_file, "parallelizing inner loop %d\n",loop->header->index);
loop_loc = find_loop_location (loop);
if (loop_loc != UNKNOWN_LOC)
fprintf (dump_file, "\nloop at %s:%d: ",
LOC_FILE (loop_loc), LOC_LINE (loop_loc));
}
gen_parallel_loop (loop, reduction_list,
n_threads, &niter_desc);
verify_flow_info ();
verify_dominators (CDI_DOMINATORS);
verify_loop_structure ();
verify_loop_closed_ssa (true);
}
free_stmt_vec_info_vec ();
htab_delete (reduction_list);
obstack_free (&parloop_obstack, NULL);
/* Parallelization will cause new function calls to be inserted through
which local variables will escape. Reset the points-to solution
for ESCAPED. */
if (changed)
pt_solution_reset (&cfun->gimple_df->escaped);
return changed;
} | /* Detect parallel loops and generate parallel code using libgomp
primitives. Returns true if some loop was parallelized, false
otherwise. */ | Detect parallel loops and generate parallel code using libgomp
primitives. Returns true if some loop was parallelized, false
otherwise. | [
"Detect",
"parallel",
"loops",
"and",
"generate",
"parallel",
"code",
"using",
"libgomp",
"primitives",
".",
"Returns",
"true",
"if",
"some",
"loop",
"was",
"parallelized",
"false",
"otherwise",
"."
] | bool
parallelize_loops (void)
{
unsigned n_threads = flag_tree_parallelize_loops;
bool changed = false;
struct loop *loop;
struct tree_niter_desc niter_desc;
loop_iterator li;
htab_t reduction_list;
struct obstack parloop_obstack;
HOST_WIDE_INT estimated;
LOC loop_loc;
if (parallelized_function_p (cfun->decl))
return false;
if (cfun->has_nonlocal_label)
return false;
gcc_obstack_init (&parloop_obstack);
reduction_list = htab_create (10, reduction_info_hash,
reduction_info_eq, free);
init_stmt_vec_info_vec ();
FOR_EACH_LOOP (li, loop, 0)
{
htab_empty (reduction_list);
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Trying loop %d as candidate\n",loop->num);
if (loop->inner)
fprintf (dump_file, "loop %d is not innermost\n",loop->num);
else
fprintf (dump_file, "loop %d is innermost\n",loop->num);
}
if (flag_loop_parallelize_all && !loop->can_be_parallel)
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "loop is not parallel according to graphite\n");
continue;
}
if (!single_dom_exit (loop))
{
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "loop is !single_dom_exit\n");
continue;
}
if (
!can_duplicate_loop_p (loop)
|| loop_has_blocks_with_irreducible_flag (loop)
|| (loop_preheader_edge (loop)->src->flags & BB_IRREDUCIBLE_LOOP)
|| loop_has_vector_phi_nodes (loop)
|| !do_while_loop_p (loop))
continue;
estimated = max_stmt_executions_int (loop, false);
if (!flag_loop_parallelize_all
&& ((estimated !=-1
&& estimated <= (HOST_WIDE_INT) n_threads * MIN_PER_THREAD)
|| optimize_loop_nest_for_size_p (loop)))
continue;
if (!try_get_loop_niter (loop, &niter_desc))
continue;
if (!try_create_reduction_list (loop, reduction_list))
continue;
if (!flag_loop_parallelize_all
&& !loop_parallel_p (loop, &parloop_obstack))
continue;
changed = true;
if (dump_file && (dump_flags & TDF_DETAILS))
{
if (loop->inner)
fprintf (dump_file, "parallelizing outer loop %d\n",loop->header->index);
else
fprintf (dump_file, "parallelizing inner loop %d\n",loop->header->index);
loop_loc = find_loop_location (loop);
if (loop_loc != UNKNOWN_LOC)
fprintf (dump_file, "\nloop at %s:%d: ",
LOC_FILE (loop_loc), LOC_LINE (loop_loc));
}
gen_parallel_loop (loop, reduction_list,
n_threads, &niter_desc);
verify_flow_info ();
verify_dominators (CDI_DOMINATORS);
verify_loop_structure ();
verify_loop_closed_ssa (true);
}
free_stmt_vec_info_vec ();
htab_delete (reduction_list);
obstack_free (&parloop_obstack, NULL);
if (changed)
pt_solution_reset (&cfun->gimple_df->escaped);
return changed;
} | [
"bool",
"parallelize_loops",
"(",
"void",
")",
"{",
"unsigned",
"n_threads",
"=",
"flag_tree_parallelize_loops",
";",
"bool",
"changed",
"=",
"false",
";",
"struct",
"loop",
"*",
"loop",
";",
"struct",
"tree_niter_desc",
"niter_desc",
";",
"loop_iterator",
"li",
";",
"htab_t",
"reduction_list",
";",
"struct",
"obstack",
"parloop_obstack",
";",
"HOST_WIDE_INT",
"estimated",
";",
"LOC",
"loop_loc",
";",
"if",
"(",
"parallelized_function_p",
"(",
"cfun",
"->",
"decl",
")",
")",
"return",
"false",
";",
"if",
"(",
"cfun",
"->",
"has_nonlocal_label",
")",
"return",
"false",
";",
"gcc_obstack_init",
"(",
"&",
"parloop_obstack",
")",
";",
"reduction_list",
"=",
"htab_create",
"(",
"10",
",",
"reduction_info_hash",
",",
"reduction_info_eq",
",",
"free",
")",
";",
"init_stmt_vec_info_vec",
"(",
")",
";",
"FOR_EACH_LOOP",
"(",
"li",
",",
"loop",
",",
"0",
")",
"",
"{",
"htab_empty",
"(",
"reduction_list",
")",
";",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"{",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
",",
"loop",
"->",
"num",
")",
";",
"if",
"(",
"loop",
"->",
"inner",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
",",
"loop",
"->",
"num",
")",
";",
"else",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
",",
"loop",
"->",
"num",
")",
";",
"}",
"if",
"(",
"flag_loop_parallelize_all",
"&&",
"!",
"loop",
"->",
"can_be_parallel",
")",
"{",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
")",
";",
"continue",
";",
"}",
"if",
"(",
"!",
"single_dom_exit",
"(",
"loop",
")",
")",
"{",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
")",
";",
"continue",
";",
"}",
"if",
"(",
"!",
"can_duplicate_loop_p",
"(",
"loop",
")",
"||",
"loop_has_blocks_with_irreducible_flag",
"(",
"loop",
")",
"||",
"(",
"loop_preheader_edge",
"(",
"loop",
")",
"->",
"src",
"->",
"flags",
"&",
"BB_IRREDUCIBLE_LOOP",
")",
"||",
"loop_has_vector_phi_nodes",
"(",
"loop",
")",
"||",
"!",
"do_while_loop_p",
"(",
"loop",
")",
")",
"continue",
";",
"estimated",
"=",
"max_stmt_executions_int",
"(",
"loop",
",",
"false",
")",
";",
"if",
"(",
"!",
"flag_loop_parallelize_all",
"&&",
"(",
"(",
"estimated",
"!=",
"-1",
"&&",
"estimated",
"<=",
"(",
"HOST_WIDE_INT",
")",
"n_threads",
"*",
"MIN_PER_THREAD",
")",
"||",
"optimize_loop_nest_for_size_p",
"(",
"loop",
")",
")",
")",
"continue",
";",
"if",
"(",
"!",
"try_get_loop_niter",
"(",
"loop",
",",
"&",
"niter_desc",
")",
")",
"continue",
";",
"if",
"(",
"!",
"try_create_reduction_list",
"(",
"loop",
",",
"reduction_list",
")",
")",
"continue",
";",
"if",
"(",
"!",
"flag_loop_parallelize_all",
"&&",
"!",
"loop_parallel_p",
"(",
"loop",
",",
"&",
"parloop_obstack",
")",
")",
"continue",
";",
"changed",
"=",
"true",
";",
"if",
"(",
"dump_file",
"&&",
"(",
"dump_flags",
"&",
"TDF_DETAILS",
")",
")",
"{",
"if",
"(",
"loop",
"->",
"inner",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
",",
"loop",
"->",
"header",
"->",
"index",
")",
";",
"else",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
",",
"loop",
"->",
"header",
"->",
"index",
")",
";",
"loop_loc",
"=",
"find_loop_location",
"(",
"loop",
")",
";",
"if",
"(",
"loop_loc",
"!=",
"UNKNOWN_LOC",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
",",
"LOC_FILE",
"(",
"loop_loc",
")",
",",
"LOC_LINE",
"(",
"loop_loc",
")",
")",
";",
"}",
"gen_parallel_loop",
"(",
"loop",
",",
"reduction_list",
",",
"n_threads",
",",
"&",
"niter_desc",
")",
";",
"verify_flow_info",
"(",
")",
";",
"verify_dominators",
"(",
"CDI_DOMINATORS",
")",
";",
"verify_loop_structure",
"(",
")",
";",
"verify_loop_closed_ssa",
"(",
"true",
")",
";",
"}",
"free_stmt_vec_info_vec",
"(",
")",
";",
"htab_delete",
"(",
"reduction_list",
")",
";",
"obstack_free",
"(",
"&",
"parloop_obstack",
",",
"NULL",
")",
";",
"if",
"(",
"changed",
")",
"pt_solution_reset",
"(",
"&",
"cfun",
"->",
"gimple_df",
"->",
"escaped",
")",
";",
"return",
"changed",
";",
"}"
] | Detect parallel loops and generate parallel code using libgomp
primitives. | [
"Detect",
"parallel",
"loops",
"and",
"generate",
"parallel",
"code",
"using",
"libgomp",
"primitives",
"."
] | [
"/* Do not parallelize loops in the functions created by parallelization. */",
"/* If we use autopar in graphite pass, we use its marked dependency\n checking results. */",
"/* And of course, the loop must be parallelizable. */",
"/* FIXME: the check for vector phi nodes could be removed. */",
"/* FIXME: transform_to_exit_first_loop does not handle not\n\t header-copied loops correctly - see PR46886. */",
"/* FIXME: Bypass this check as graphite doesn't update the\n count and frequency correctly now. */",
"/* Do not bother with loops in cold areas. */",
"/* Parallelization will cause new function calls to be inserted through\n which local variables will escape. Reset the points-to solution\n for ESCAPED. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
cda3e3d4e76fb51b0647f21dfa448630714828ec | atrens/DragonFlyBSD-src | bin/ed/sub.c | [
"BSD-3-Clause"
] | C | extract_subst_tail | int | int
extract_subst_tail(int *flagp, long *np)
{
char delimiter;
*flagp = *np = 0;
if ((delimiter = *ibufp) == '\n') {
rhbufi = 0;
*flagp = GPR;
return 0;
} else if (extract_subst_template() == NULL)
return ERR;
else if (*ibufp == '\n') {
*flagp = GPR;
return 0;
} else if (*ibufp == delimiter)
ibufp++;
if ('1' <= *ibufp && *ibufp <= '9') {
STRTOL(*np, ibufp);
return 0;
} else if (*ibufp == 'g') {
ibufp++;
*flagp = GSG;
return 0;
}
return 0;
} | /* extract_subst_tail: extract substitution tail from the command buffer */ | extract substitution tail from the command buffer | [
"extract",
"substitution",
"tail",
"from",
"the",
"command",
"buffer"
] | int
extract_subst_tail(int *flagp, long *np)
{
char delimiter;
*flagp = *np = 0;
if ((delimiter = *ibufp) == '\n') {
rhbufi = 0;
*flagp = GPR;
return 0;
} else if (extract_subst_template() == NULL)
return ERR;
else if (*ibufp == '\n') {
*flagp = GPR;
return 0;
} else if (*ibufp == delimiter)
ibufp++;
if ('1' <= *ibufp && *ibufp <= '9') {
STRTOL(*np, ibufp);
return 0;
} else if (*ibufp == 'g') {
ibufp++;
*flagp = GSG;
return 0;
}
return 0;
} | [
"int",
"extract_subst_tail",
"(",
"int",
"*",
"flagp",
",",
"long",
"*",
"np",
")",
"{",
"char",
"delimiter",
";",
"*",
"flagp",
"=",
"*",
"np",
"=",
"0",
";",
"if",
"(",
"(",
"delimiter",
"=",
"*",
"ibufp",
")",
"==",
"'",
"\\n",
"'",
")",
"{",
"rhbufi",
"=",
"0",
";",
"*",
"flagp",
"=",
"GPR",
";",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"extract_subst_template",
"(",
")",
"==",
"NULL",
")",
"return",
"ERR",
";",
"else",
"if",
"(",
"*",
"ibufp",
"==",
"'",
"\\n",
"'",
")",
"{",
"*",
"flagp",
"=",
"GPR",
";",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"*",
"ibufp",
"==",
"delimiter",
")",
"ibufp",
"++",
";",
"if",
"(",
"'",
"'",
"<=",
"*",
"ibufp",
"&&",
"*",
"ibufp",
"<=",
"'",
"'",
")",
"{",
"STRTOL",
"(",
"*",
"np",
",",
"ibufp",
")",
";",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"*",
"ibufp",
"==",
"'",
"'",
")",
"{",
"ibufp",
"++",
";",
"*",
"flagp",
"=",
"GSG",
";",
"return",
"0",
";",
"}",
"return",
"0",
";",
"}"
] | extract_subst_tail: extract substitution tail from the command buffer | [
"extract_subst_tail",
":",
"extract",
"substitution",
"tail",
"from",
"the",
"command",
"buffer"
] | [] | [
{
"param": "flagp",
"type": "int"
},
{
"param": "np",
"type": "long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "flagp",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "np",
"type": "long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cda3e3d4e76fb51b0647f21dfa448630714828ec | atrens/DragonFlyBSD-src | bin/ed/sub.c | [
"BSD-3-Clause"
] | C | extract_subst_template | char | char *
extract_subst_template(void)
{
int n = 0;
int i = 0;
char c;
char delimiter = *ibufp++;
if (*ibufp == '%' && *(ibufp + 1) == delimiter) {
ibufp++;
if (!rhbuf)
errmsg = "no previous substitution";
return rhbuf;
}
while (*ibufp != delimiter) {
REALLOC(rhbuf, rhbufsz, i + 2, NULL);
if ((c = rhbuf[i++] = *ibufp++) == '\n' && *ibufp == '\0') {
i--, ibufp--;
break;
} else if (c != '\\')
;
else if ((rhbuf[i++] = *ibufp++) != '\n')
;
else if (!isglobal) {
while ((n = get_tty_line()) == 0 ||
(n > 0 && ibuf[n - 1] != '\n'))
clearerr(stdin);
if (n < 0)
return NULL;
}
}
REALLOC(rhbuf, rhbufsz, i + 1, NULL);
rhbuf[rhbufi = i] = '\0';
return rhbuf;
} | /* extract_subst_template: return pointer to copy of substitution template
in the command buffer */ | return pointer to copy of substitution template
in the command buffer | [
"return",
"pointer",
"to",
"copy",
"of",
"substitution",
"template",
"in",
"the",
"command",
"buffer"
] | char *
extract_subst_template(void)
{
int n = 0;
int i = 0;
char c;
char delimiter = *ibufp++;
if (*ibufp == '%' && *(ibufp + 1) == delimiter) {
ibufp++;
if (!rhbuf)
errmsg = "no previous substitution";
return rhbuf;
}
while (*ibufp != delimiter) {
REALLOC(rhbuf, rhbufsz, i + 2, NULL);
if ((c = rhbuf[i++] = *ibufp++) == '\n' && *ibufp == '\0') {
i--, ibufp--;
break;
} else if (c != '\\')
;
else if ((rhbuf[i++] = *ibufp++) != '\n')
;
else if (!isglobal) {
while ((n = get_tty_line()) == 0 ||
(n > 0 && ibuf[n - 1] != '\n'))
clearerr(stdin);
if (n < 0)
return NULL;
}
}
REALLOC(rhbuf, rhbufsz, i + 1, NULL);
rhbuf[rhbufi = i] = '\0';
return rhbuf;
} | [
"char",
"*",
"extract_subst_template",
"(",
"void",
")",
"{",
"int",
"n",
"=",
"0",
";",
"int",
"i",
"=",
"0",
";",
"char",
"c",
";",
"char",
"delimiter",
"=",
"*",
"ibufp",
"++",
";",
"if",
"(",
"*",
"ibufp",
"==",
"'",
"'",
"&&",
"*",
"(",
"ibufp",
"+",
"1",
")",
"==",
"delimiter",
")",
"{",
"ibufp",
"++",
";",
"if",
"(",
"!",
"rhbuf",
")",
"errmsg",
"=",
"\"",
"\"",
";",
"return",
"rhbuf",
";",
"}",
"while",
"(",
"*",
"ibufp",
"!=",
"delimiter",
")",
"{",
"REALLOC",
"(",
"rhbuf",
",",
"rhbufsz",
",",
"i",
"+",
"2",
",",
"NULL",
")",
";",
"if",
"(",
"(",
"c",
"=",
"rhbuf",
"[",
"i",
"++",
"]",
"=",
"*",
"ibufp",
"++",
")",
"==",
"'",
"\\n",
"'",
"&&",
"*",
"ibufp",
"==",
"'",
"\\0",
"'",
")",
"{",
"i",
"--",
",",
"ibufp",
"--",
";",
"break",
";",
"}",
"else",
"if",
"(",
"c",
"!=",
"'",
"\\\\",
"'",
")",
";",
"else",
"if",
"(",
"(",
"rhbuf",
"[",
"i",
"++",
"]",
"=",
"*",
"ibufp",
"++",
")",
"!=",
"'",
"\\n",
"'",
")",
";",
"else",
"if",
"(",
"!",
"isglobal",
")",
"{",
"while",
"(",
"(",
"n",
"=",
"get_tty_line",
"(",
")",
")",
"==",
"0",
"||",
"(",
"n",
">",
"0",
"&&",
"ibuf",
"[",
"n",
"-",
"1",
"]",
"!=",
"'",
"\\n",
"'",
")",
")",
"clearerr",
"(",
"stdin",
")",
";",
"if",
"(",
"n",
"<",
"0",
")",
"return",
"NULL",
";",
"}",
"}",
"REALLOC",
"(",
"rhbuf",
",",
"rhbufsz",
",",
"i",
"+",
"1",
",",
"NULL",
")",
";",
"rhbuf",
"[",
"rhbufi",
"=",
"i",
"]",
"=",
"'",
"\\0",
"'",
";",
"return",
"rhbuf",
";",
"}"
] | extract_subst_template: return pointer to copy of substitution template
in the command buffer | [
"extract_subst_template",
":",
"return",
"pointer",
"to",
"copy",
"of",
"substitution",
"template",
"in",
"the",
"command",
"buffer"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
cda3e3d4e76fb51b0647f21dfa448630714828ec | atrens/DragonFlyBSD-src | bin/ed/sub.c | [
"BSD-3-Clause"
] | C | search_and_replace | int | int
search_and_replace(pattern_t *pat, int gflag, int kth)
{
undo_t *up;
const char *txt;
const char *eot;
long lc;
long xa = current_addr;
int nsubs = 0;
line_t *lp;
int len;
current_addr = first_addr - 1;
for (lc = 0; lc <= second_addr - first_addr; lc++) {
lp = get_addressed_line_node(++current_addr);
if ((len = substitute_matching_text(pat, lp, gflag, kth)) < 0)
return ERR;
else if (len) {
up = NULL;
if (delete_lines(current_addr, current_addr) < 0)
return ERR;
txt = rbuf;
eot = rbuf + len;
SPL1();
do {
if ((txt = put_sbuf_line(txt)) == NULL) {
SPL0();
return ERR;
} else if (up)
up->t = get_addressed_line_node(current_addr);
else if ((up = push_undo_stack(UADD,
current_addr, current_addr)) == NULL) {
SPL0();
return ERR;
}
} while (txt != eot);
SPL0();
nsubs++;
xa = current_addr;
}
}
current_addr = xa;
if (nsubs == 0 && !(gflag & GLB)) {
errmsg = "no match";
return ERR;
} else if ((gflag & (GPR | GLS | GNP)) &&
display_lines(current_addr, current_addr, gflag) < 0)
return ERR;
return 0;
} | /* search_and_replace: for each line in a range, change text matching a pattern
according to a substitution template; return status */ | for each line in a range, change text matching a pattern
according to a substitution template; return status | [
"for",
"each",
"line",
"in",
"a",
"range",
"change",
"text",
"matching",
"a",
"pattern",
"according",
"to",
"a",
"substitution",
"template",
";",
"return",
"status"
] | int
search_and_replace(pattern_t *pat, int gflag, int kth)
{
undo_t *up;
const char *txt;
const char *eot;
long lc;
long xa = current_addr;
int nsubs = 0;
line_t *lp;
int len;
current_addr = first_addr - 1;
for (lc = 0; lc <= second_addr - first_addr; lc++) {
lp = get_addressed_line_node(++current_addr);
if ((len = substitute_matching_text(pat, lp, gflag, kth)) < 0)
return ERR;
else if (len) {
up = NULL;
if (delete_lines(current_addr, current_addr) < 0)
return ERR;
txt = rbuf;
eot = rbuf + len;
SPL1();
do {
if ((txt = put_sbuf_line(txt)) == NULL) {
SPL0();
return ERR;
} else if (up)
up->t = get_addressed_line_node(current_addr);
else if ((up = push_undo_stack(UADD,
current_addr, current_addr)) == NULL) {
SPL0();
return ERR;
}
} while (txt != eot);
SPL0();
nsubs++;
xa = current_addr;
}
}
current_addr = xa;
if (nsubs == 0 && !(gflag & GLB)) {
errmsg = "no match";
return ERR;
} else if ((gflag & (GPR | GLS | GNP)) &&
display_lines(current_addr, current_addr, gflag) < 0)
return ERR;
return 0;
} | [
"int",
"search_and_replace",
"(",
"pattern_t",
"*",
"pat",
",",
"int",
"gflag",
",",
"int",
"kth",
")",
"{",
"undo_t",
"*",
"up",
";",
"const",
"char",
"*",
"txt",
";",
"const",
"char",
"*",
"eot",
";",
"long",
"lc",
";",
"long",
"xa",
"=",
"current_addr",
";",
"int",
"nsubs",
"=",
"0",
";",
"line_t",
"*",
"lp",
";",
"int",
"len",
";",
"current_addr",
"=",
"first_addr",
"-",
"1",
";",
"for",
"(",
"lc",
"=",
"0",
";",
"lc",
"<=",
"second_addr",
"-",
"first_addr",
";",
"lc",
"++",
")",
"{",
"lp",
"=",
"get_addressed_line_node",
"(",
"++",
"current_addr",
")",
";",
"if",
"(",
"(",
"len",
"=",
"substitute_matching_text",
"(",
"pat",
",",
"lp",
",",
"gflag",
",",
"kth",
")",
")",
"<",
"0",
")",
"return",
"ERR",
";",
"else",
"if",
"(",
"len",
")",
"{",
"up",
"=",
"NULL",
";",
"if",
"(",
"delete_lines",
"(",
"current_addr",
",",
"current_addr",
")",
"<",
"0",
")",
"return",
"ERR",
";",
"txt",
"=",
"rbuf",
";",
"eot",
"=",
"rbuf",
"+",
"len",
";",
"SPL1",
"(",
")",
";",
"do",
"{",
"if",
"(",
"(",
"txt",
"=",
"put_sbuf_line",
"(",
"txt",
")",
")",
"==",
"NULL",
")",
"{",
"SPL0",
"(",
")",
";",
"return",
"ERR",
";",
"}",
"else",
"if",
"(",
"up",
")",
"up",
"->",
"t",
"=",
"get_addressed_line_node",
"(",
"current_addr",
")",
";",
"else",
"if",
"(",
"(",
"up",
"=",
"push_undo_stack",
"(",
"UADD",
",",
"current_addr",
",",
"current_addr",
")",
")",
"==",
"NULL",
")",
"{",
"SPL0",
"(",
")",
";",
"return",
"ERR",
";",
"}",
"}",
"while",
"(",
"txt",
"!=",
"eot",
")",
";",
"SPL0",
"(",
")",
";",
"nsubs",
"++",
";",
"xa",
"=",
"current_addr",
";",
"}",
"}",
"current_addr",
"=",
"xa",
";",
"if",
"(",
"nsubs",
"==",
"0",
"&&",
"!",
"(",
"gflag",
"&",
"GLB",
")",
")",
"{",
"errmsg",
"=",
"\"",
"\"",
";",
"return",
"ERR",
";",
"}",
"else",
"if",
"(",
"(",
"gflag",
"&",
"(",
"GPR",
"|",
"GLS",
"|",
"GNP",
")",
")",
"&&",
"display_lines",
"(",
"current_addr",
",",
"current_addr",
",",
"gflag",
")",
"<",
"0",
")",
"return",
"ERR",
";",
"return",
"0",
";",
"}"
] | search_and_replace: for each line in a range, change text matching a pattern
according to a substitution template; return status | [
"search_and_replace",
":",
"for",
"each",
"line",
"in",
"a",
"range",
"change",
"text",
"matching",
"a",
"pattern",
"according",
"to",
"a",
"substitution",
"template",
";",
"return",
"status"
] | [] | [
{
"param": "pat",
"type": "pattern_t"
},
{
"param": "gflag",
"type": "int"
},
{
"param": "kth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pat",
"type": "pattern_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gflag",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cda3e3d4e76fb51b0647f21dfa448630714828ec | atrens/DragonFlyBSD-src | bin/ed/sub.c | [
"BSD-3-Clause"
] | C | substitute_matching_text | int | int
substitute_matching_text(pattern_t *pat, line_t *lp, int gflag, int kth)
{
int off = 0;
int changed = 0;
int matchno = 0;
int i = 0;
regmatch_t rm[SE_MAX];
char *txt;
char *eot;
if ((txt = get_sbuf_line(lp)) == NULL)
return ERR;
if (isbinary)
NUL_TO_NEWLINE(txt, lp->len);
eot = txt + lp->len;
if (!regexec(pat, txt, SE_MAX, rm, 0)) {
do {
if (!kth || kth == ++matchno) {
changed++;
i = rm[0].rm_so;
REALLOC(rbuf, rbufsz, off + i, ERR);
if (isbinary)
NEWLINE_TO_NUL(txt, rm[0].rm_eo);
memcpy(rbuf + off, txt, i);
off += i;
if ((off = apply_subst_template(txt, rm, off,
pat->re_nsub)) < 0)
return ERR;
} else {
i = rm[0].rm_eo;
REALLOC(rbuf, rbufsz, off + i, ERR);
if (isbinary)
NEWLINE_TO_NUL(txt, i);
memcpy(rbuf + off, txt, i);
off += i;
}
txt += rm[0].rm_eo;
} while (*txt &&
(!changed || ((gflag & GSG) && rm[0].rm_eo)) &&
!regexec(pat, txt, SE_MAX, rm, REG_NOTBOL));
i = eot - txt;
REALLOC(rbuf, rbufsz, off + i + 2, ERR);
if (i > 0 && !rm[0].rm_eo && (gflag & GSG)) {
errmsg = "infinite substitution loop";
return ERR;
}
if (isbinary)
NEWLINE_TO_NUL(txt, i);
memcpy(rbuf + off, txt, i);
memcpy(rbuf + off + i, "\n", 2);
}
return changed ? off + i + 1 : 0;
} | /* substitute_matching_text: replace text matched by a pattern according to
a substitution template; return pointer to the modified text */ | replace text matched by a pattern according to
a substitution template; return pointer to the modified text | [
"replace",
"text",
"matched",
"by",
"a",
"pattern",
"according",
"to",
"a",
"substitution",
"template",
";",
"return",
"pointer",
"to",
"the",
"modified",
"text"
] | int
substitute_matching_text(pattern_t *pat, line_t *lp, int gflag, int kth)
{
int off = 0;
int changed = 0;
int matchno = 0;
int i = 0;
regmatch_t rm[SE_MAX];
char *txt;
char *eot;
if ((txt = get_sbuf_line(lp)) == NULL)
return ERR;
if (isbinary)
NUL_TO_NEWLINE(txt, lp->len);
eot = txt + lp->len;
if (!regexec(pat, txt, SE_MAX, rm, 0)) {
do {
if (!kth || kth == ++matchno) {
changed++;
i = rm[0].rm_so;
REALLOC(rbuf, rbufsz, off + i, ERR);
if (isbinary)
NEWLINE_TO_NUL(txt, rm[0].rm_eo);
memcpy(rbuf + off, txt, i);
off += i;
if ((off = apply_subst_template(txt, rm, off,
pat->re_nsub)) < 0)
return ERR;
} else {
i = rm[0].rm_eo;
REALLOC(rbuf, rbufsz, off + i, ERR);
if (isbinary)
NEWLINE_TO_NUL(txt, i);
memcpy(rbuf + off, txt, i);
off += i;
}
txt += rm[0].rm_eo;
} while (*txt &&
(!changed || ((gflag & GSG) && rm[0].rm_eo)) &&
!regexec(pat, txt, SE_MAX, rm, REG_NOTBOL));
i = eot - txt;
REALLOC(rbuf, rbufsz, off + i + 2, ERR);
if (i > 0 && !rm[0].rm_eo && (gflag & GSG)) {
errmsg = "infinite substitution loop";
return ERR;
}
if (isbinary)
NEWLINE_TO_NUL(txt, i);
memcpy(rbuf + off, txt, i);
memcpy(rbuf + off + i, "\n", 2);
}
return changed ? off + i + 1 : 0;
} | [
"int",
"substitute_matching_text",
"(",
"pattern_t",
"*",
"pat",
",",
"line_t",
"*",
"lp",
",",
"int",
"gflag",
",",
"int",
"kth",
")",
"{",
"int",
"off",
"=",
"0",
";",
"int",
"changed",
"=",
"0",
";",
"int",
"matchno",
"=",
"0",
";",
"int",
"i",
"=",
"0",
";",
"regmatch_t",
"rm",
"[",
"SE_MAX",
"]",
";",
"char",
"*",
"txt",
";",
"char",
"*",
"eot",
";",
"if",
"(",
"(",
"txt",
"=",
"get_sbuf_line",
"(",
"lp",
")",
")",
"==",
"NULL",
")",
"return",
"ERR",
";",
"if",
"(",
"isbinary",
")",
"NUL_TO_NEWLINE",
"(",
"txt",
",",
"lp",
"->",
"len",
")",
";",
"eot",
"=",
"txt",
"+",
"lp",
"->",
"len",
";",
"if",
"(",
"!",
"regexec",
"(",
"pat",
",",
"txt",
",",
"SE_MAX",
",",
"rm",
",",
"0",
")",
")",
"{",
"do",
"{",
"if",
"(",
"!",
"kth",
"||",
"kth",
"==",
"++",
"matchno",
")",
"{",
"changed",
"++",
";",
"i",
"=",
"rm",
"[",
"0",
"]",
".",
"rm_so",
";",
"REALLOC",
"(",
"rbuf",
",",
"rbufsz",
",",
"off",
"+",
"i",
",",
"ERR",
")",
";",
"if",
"(",
"isbinary",
")",
"NEWLINE_TO_NUL",
"(",
"txt",
",",
"rm",
"[",
"0",
"]",
".",
"rm_eo",
")",
";",
"memcpy",
"(",
"rbuf",
"+",
"off",
",",
"txt",
",",
"i",
")",
";",
"off",
"+=",
"i",
";",
"if",
"(",
"(",
"off",
"=",
"apply_subst_template",
"(",
"txt",
",",
"rm",
",",
"off",
",",
"pat",
"->",
"re_nsub",
")",
")",
"<",
"0",
")",
"return",
"ERR",
";",
"}",
"else",
"{",
"i",
"=",
"rm",
"[",
"0",
"]",
".",
"rm_eo",
";",
"REALLOC",
"(",
"rbuf",
",",
"rbufsz",
",",
"off",
"+",
"i",
",",
"ERR",
")",
";",
"if",
"(",
"isbinary",
")",
"NEWLINE_TO_NUL",
"(",
"txt",
",",
"i",
")",
";",
"memcpy",
"(",
"rbuf",
"+",
"off",
",",
"txt",
",",
"i",
")",
";",
"off",
"+=",
"i",
";",
"}",
"txt",
"+=",
"rm",
"[",
"0",
"]",
".",
"rm_eo",
";",
"}",
"while",
"(",
"*",
"txt",
"&&",
"(",
"!",
"changed",
"||",
"(",
"(",
"gflag",
"&",
"GSG",
")",
"&&",
"rm",
"[",
"0",
"]",
".",
"rm_eo",
")",
")",
"&&",
"!",
"regexec",
"(",
"pat",
",",
"txt",
",",
"SE_MAX",
",",
"rm",
",",
"REG_NOTBOL",
")",
")",
";",
"i",
"=",
"eot",
"-",
"txt",
";",
"REALLOC",
"(",
"rbuf",
",",
"rbufsz",
",",
"off",
"+",
"i",
"+",
"2",
",",
"ERR",
")",
";",
"if",
"(",
"i",
">",
"0",
"&&",
"!",
"rm",
"[",
"0",
"]",
".",
"rm_eo",
"&&",
"(",
"gflag",
"&",
"GSG",
")",
")",
"{",
"errmsg",
"=",
"\"",
"\"",
";",
"return",
"ERR",
";",
"}",
"if",
"(",
"isbinary",
")",
"NEWLINE_TO_NUL",
"(",
"txt",
",",
"i",
")",
";",
"memcpy",
"(",
"rbuf",
"+",
"off",
",",
"txt",
",",
"i",
")",
";",
"memcpy",
"(",
"rbuf",
"+",
"off",
"+",
"i",
",",
"\"",
"\\n",
"\"",
",",
"2",
")",
";",
"}",
"return",
"changed",
"?",
"off",
"+",
"i",
"+",
"1",
":",
"0",
";",
"}"
] | substitute_matching_text: replace text matched by a pattern according to
a substitution template; return pointer to the modified text | [
"substitute_matching_text",
":",
"replace",
"text",
"matched",
"by",
"a",
"pattern",
"according",
"to",
"a",
"substitution",
"template",
";",
"return",
"pointer",
"to",
"the",
"modified",
"text"
] | [] | [
{
"param": "pat",
"type": "pattern_t"
},
{
"param": "lp",
"type": "line_t"
},
{
"param": "gflag",
"type": "int"
},
{
"param": "kth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pat",
"type": "pattern_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lp",
"type": "line_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "gflag",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cda3e3d4e76fb51b0647f21dfa448630714828ec | atrens/DragonFlyBSD-src | bin/ed/sub.c | [
"BSD-3-Clause"
] | C | apply_subst_template | int | int
apply_subst_template(const char *boln, regmatch_t *rm, int off, int re_nsub)
{
int j = 0;
int k = 0;
int n;
char *sub = rhbuf;
for (; sub - rhbuf < rhbufi; sub++)
if (*sub == '&') {
j = rm[0].rm_so;
k = rm[0].rm_eo;
REALLOC(rbuf, rbufsz, off + k - j, ERR);
while (j < k)
rbuf[off++] = boln[j++];
} else if (*sub == '\\' && '1' <= *++sub && *sub <= '9' &&
(n = *sub - '0') <= re_nsub) {
j = rm[n].rm_so;
k = rm[n].rm_eo;
REALLOC(rbuf, rbufsz, off + k - j, ERR);
while (j < k)
rbuf[off++] = boln[j++];
} else {
REALLOC(rbuf, rbufsz, off + 1, ERR);
rbuf[off++] = *sub;
}
REALLOC(rbuf, rbufsz, off + 1, ERR);
rbuf[off] = '\0';
return off;
} | /* apply_subst_template: modify text according to a substitution template;
return offset to end of modified text */ | modify text according to a substitution template;
return offset to end of modified text | [
"modify",
"text",
"according",
"to",
"a",
"substitution",
"template",
";",
"return",
"offset",
"to",
"end",
"of",
"modified",
"text"
] | int
apply_subst_template(const char *boln, regmatch_t *rm, int off, int re_nsub)
{
int j = 0;
int k = 0;
int n;
char *sub = rhbuf;
for (; sub - rhbuf < rhbufi; sub++)
if (*sub == '&') {
j = rm[0].rm_so;
k = rm[0].rm_eo;
REALLOC(rbuf, rbufsz, off + k - j, ERR);
while (j < k)
rbuf[off++] = boln[j++];
} else if (*sub == '\\' && '1' <= *++sub && *sub <= '9' &&
(n = *sub - '0') <= re_nsub) {
j = rm[n].rm_so;
k = rm[n].rm_eo;
REALLOC(rbuf, rbufsz, off + k - j, ERR);
while (j < k)
rbuf[off++] = boln[j++];
} else {
REALLOC(rbuf, rbufsz, off + 1, ERR);
rbuf[off++] = *sub;
}
REALLOC(rbuf, rbufsz, off + 1, ERR);
rbuf[off] = '\0';
return off;
} | [
"int",
"apply_subst_template",
"(",
"const",
"char",
"*",
"boln",
",",
"regmatch_t",
"*",
"rm",
",",
"int",
"off",
",",
"int",
"re_nsub",
")",
"{",
"int",
"j",
"=",
"0",
";",
"int",
"k",
"=",
"0",
";",
"int",
"n",
";",
"char",
"*",
"sub",
"=",
"rhbuf",
";",
"for",
"(",
";",
"sub",
"-",
"rhbuf",
"<",
"rhbufi",
";",
"sub",
"++",
")",
"if",
"(",
"*",
"sub",
"==",
"'",
"'",
")",
"{",
"j",
"=",
"rm",
"[",
"0",
"]",
".",
"rm_so",
";",
"k",
"=",
"rm",
"[",
"0",
"]",
".",
"rm_eo",
";",
"REALLOC",
"(",
"rbuf",
",",
"rbufsz",
",",
"off",
"+",
"k",
"-",
"j",
",",
"ERR",
")",
";",
"while",
"(",
"j",
"<",
"k",
")",
"rbuf",
"[",
"off",
"++",
"]",
"=",
"boln",
"[",
"j",
"++",
"]",
";",
"}",
"else",
"if",
"(",
"*",
"sub",
"==",
"'",
"\\\\",
"'",
"&&",
"'",
"'",
"<=",
"*",
"++",
"sub",
"&&",
"*",
"sub",
"<=",
"'",
"'",
"&&",
"(",
"n",
"=",
"*",
"sub",
"-",
"'",
"'",
")",
"<=",
"re_nsub",
")",
"{",
"j",
"=",
"rm",
"[",
"n",
"]",
".",
"rm_so",
";",
"k",
"=",
"rm",
"[",
"n",
"]",
".",
"rm_eo",
";",
"REALLOC",
"(",
"rbuf",
",",
"rbufsz",
",",
"off",
"+",
"k",
"-",
"j",
",",
"ERR",
")",
";",
"while",
"(",
"j",
"<",
"k",
")",
"rbuf",
"[",
"off",
"++",
"]",
"=",
"boln",
"[",
"j",
"++",
"]",
";",
"}",
"else",
"{",
"REALLOC",
"(",
"rbuf",
",",
"rbufsz",
",",
"off",
"+",
"1",
",",
"ERR",
")",
";",
"rbuf",
"[",
"off",
"++",
"]",
"=",
"*",
"sub",
";",
"}",
"REALLOC",
"(",
"rbuf",
",",
"rbufsz",
",",
"off",
"+",
"1",
",",
"ERR",
")",
";",
"rbuf",
"[",
"off",
"]",
"=",
"'",
"\\0",
"'",
";",
"return",
"off",
";",
"}"
] | apply_subst_template: modify text according to a substitution template;
return offset to end of modified text | [
"apply_subst_template",
":",
"modify",
"text",
"according",
"to",
"a",
"substitution",
"template",
";",
"return",
"offset",
"to",
"end",
"of",
"modified",
"text"
] | [] | [
{
"param": "boln",
"type": "char"
},
{
"param": "rm",
"type": "regmatch_t"
},
{
"param": "off",
"type": "int"
},
{
"param": "re_nsub",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "boln",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rm",
"type": "regmatch_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "off",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "re_nsub",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | make_hard_regno_born | void | static void
make_hard_regno_born (int regno)
{
unsigned int i;
SET_HARD_REG_BIT (hard_regs_live, regno);
EXECUTE_IF_SET_IN_SPARSESET (objects_live, i)
{
ira_object_t obj = ira_object_id_map[i];
SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
}
} | /* Record the birth of hard register REGNO, updating hard_regs_live and
hard reg conflict information for living allocnos. */ | Record the birth of hard register REGNO, updating hard_regs_live and
hard reg conflict information for living allocnos. | [
"Record",
"the",
"birth",
"of",
"hard",
"register",
"REGNO",
"updating",
"hard_regs_live",
"and",
"hard",
"reg",
"conflict",
"information",
"for",
"living",
"allocnos",
"."
] | static void
make_hard_regno_born (int regno)
{
unsigned int i;
SET_HARD_REG_BIT (hard_regs_live, regno);
EXECUTE_IF_SET_IN_SPARSESET (objects_live, i)
{
ira_object_t obj = ira_object_id_map[i];
SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno);
}
} | [
"static",
"void",
"make_hard_regno_born",
"(",
"int",
"regno",
")",
"{",
"unsigned",
"int",
"i",
";",
"SET_HARD_REG_BIT",
"(",
"hard_regs_live",
",",
"regno",
")",
";",
"EXECUTE_IF_SET_IN_SPARSESET",
"(",
"objects_live",
",",
"i",
")",
"",
"{",
"ira_object_t",
"obj",
"=",
"ira_object_id_map",
"[",
"i",
"]",
";",
"SET_HARD_REG_BIT",
"(",
"OBJECT_CONFLICT_HARD_REGS",
"(",
"obj",
")",
",",
"regno",
")",
";",
"SET_HARD_REG_BIT",
"(",
"OBJECT_TOTAL_CONFLICT_HARD_REGS",
"(",
"obj",
")",
",",
"regno",
")",
";",
"}",
"}"
] | Record the birth of hard register REGNO, updating hard_regs_live and
hard reg conflict information for living allocnos. | [
"Record",
"the",
"birth",
"of",
"hard",
"register",
"REGNO",
"updating",
"hard_regs_live",
"and",
"hard",
"reg",
"conflict",
"information",
"for",
"living",
"allocnos",
"."
] | [] | [
{
"param": "regno",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regno",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | make_hard_regno_dead | void | static void
make_hard_regno_dead (int regno)
{
CLEAR_HARD_REG_BIT (hard_regs_live, regno);
} | /* Process the death of hard register REGNO. This updates
hard_regs_live. */ | Process the death of hard register REGNO. | [
"Process",
"the",
"death",
"of",
"hard",
"register",
"REGNO",
"."
] | static void
make_hard_regno_dead (int regno)
{
CLEAR_HARD_REG_BIT (hard_regs_live, regno);
} | [
"static",
"void",
"make_hard_regno_dead",
"(",
"int",
"regno",
")",
"{",
"CLEAR_HARD_REG_BIT",
"(",
"hard_regs_live",
",",
"regno",
")",
";",
"}"
] | Process the death of hard register REGNO. | [
"Process",
"the",
"death",
"of",
"hard",
"register",
"REGNO",
"."
] | [] | [
{
"param": "regno",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regno",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | make_object_born | void | static void
make_object_born (ira_object_t obj)
{
live_range_t lr = OBJECT_LIVE_RANGES (obj);
sparseset_set_bit (objects_live, OBJECT_CONFLICT_ID (obj));
IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), hard_regs_live);
IOR_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), hard_regs_live);
if (lr == NULL
|| (lr->finish != curr_point && lr->finish + 1 != curr_point))
ira_add_live_range_to_object (obj, curr_point, -1);
} | /* Record the birth of object OBJ. Set a bit for it in objects_live,
start a new live range for it if necessary and update hard register
conflicts. */ | Record the birth of object OBJ. Set a bit for it in objects_live,
start a new live range for it if necessary and update hard register
conflicts. | [
"Record",
"the",
"birth",
"of",
"object",
"OBJ",
".",
"Set",
"a",
"bit",
"for",
"it",
"in",
"objects_live",
"start",
"a",
"new",
"live",
"range",
"for",
"it",
"if",
"necessary",
"and",
"update",
"hard",
"register",
"conflicts",
"."
] | static void
make_object_born (ira_object_t obj)
{
live_range_t lr = OBJECT_LIVE_RANGES (obj);
sparseset_set_bit (objects_live, OBJECT_CONFLICT_ID (obj));
IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), hard_regs_live);
IOR_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), hard_regs_live);
if (lr == NULL
|| (lr->finish != curr_point && lr->finish + 1 != curr_point))
ira_add_live_range_to_object (obj, curr_point, -1);
} | [
"static",
"void",
"make_object_born",
"(",
"ira_object_t",
"obj",
")",
"{",
"live_range_t",
"lr",
"=",
"OBJECT_LIVE_RANGES",
"(",
"obj",
")",
";",
"sparseset_set_bit",
"(",
"objects_live",
",",
"OBJECT_CONFLICT_ID",
"(",
"obj",
")",
")",
";",
"IOR_HARD_REG_SET",
"(",
"OBJECT_CONFLICT_HARD_REGS",
"(",
"obj",
")",
",",
"hard_regs_live",
")",
";",
"IOR_HARD_REG_SET",
"(",
"OBJECT_TOTAL_CONFLICT_HARD_REGS",
"(",
"obj",
")",
",",
"hard_regs_live",
")",
";",
"if",
"(",
"lr",
"==",
"NULL",
"||",
"(",
"lr",
"->",
"finish",
"!=",
"curr_point",
"&&",
"lr",
"->",
"finish",
"+",
"1",
"!=",
"curr_point",
")",
")",
"ira_add_live_range_to_object",
"(",
"obj",
",",
"curr_point",
",",
"-1",
")",
";",
"}"
] | Record the birth of object OBJ. | [
"Record",
"the",
"birth",
"of",
"object",
"OBJ",
"."
] | [] | [
{
"param": "obj",
"type": "ira_object_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "ira_object_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | update_allocno_pressure_excess_length | void | static void
update_allocno_pressure_excess_length (ira_object_t obj)
{
ira_allocno_t a = OBJECT_ALLOCNO (obj);
int start, i;
enum reg_class aclass, pclass, cl;
live_range_t p;
aclass = ALLOCNO_CLASS (a);
pclass = ira_pressure_class_translate[aclass];
for (i = 0;
(cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
i++)
{
if (! ira_reg_pressure_class_p[cl])
continue;
if (high_pressure_start_point[cl] < 0)
continue;
p = OBJECT_LIVE_RANGES (obj);
ira_assert (p != NULL);
start = (high_pressure_start_point[cl] > p->start
? high_pressure_start_point[cl] : p->start);
ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (a) += curr_point - start + 1;
}
} | /* Update ALLOCNO_EXCESS_PRESSURE_POINTS_NUM for the allocno
associated with object OBJ. */ | Update ALLOCNO_EXCESS_PRESSURE_POINTS_NUM for the allocno
associated with object OBJ. | [
"Update",
"ALLOCNO_EXCESS_PRESSURE_POINTS_NUM",
"for",
"the",
"allocno",
"associated",
"with",
"object",
"OBJ",
"."
] | static void
update_allocno_pressure_excess_length (ira_object_t obj)
{
ira_allocno_t a = OBJECT_ALLOCNO (obj);
int start, i;
enum reg_class aclass, pclass, cl;
live_range_t p;
aclass = ALLOCNO_CLASS (a);
pclass = ira_pressure_class_translate[aclass];
for (i = 0;
(cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
i++)
{
if (! ira_reg_pressure_class_p[cl])
continue;
if (high_pressure_start_point[cl] < 0)
continue;
p = OBJECT_LIVE_RANGES (obj);
ira_assert (p != NULL);
start = (high_pressure_start_point[cl] > p->start
? high_pressure_start_point[cl] : p->start);
ALLOCNO_EXCESS_PRESSURE_POINTS_NUM (a) += curr_point - start + 1;
}
} | [
"static",
"void",
"update_allocno_pressure_excess_length",
"(",
"ira_object_t",
"obj",
")",
"{",
"ira_allocno_t",
"a",
"=",
"OBJECT_ALLOCNO",
"(",
"obj",
")",
";",
"int",
"start",
",",
"i",
";",
"enum",
"reg_class",
"aclass",
",",
"pclass",
",",
"cl",
";",
"live_range_t",
"p",
";",
"aclass",
"=",
"ALLOCNO_CLASS",
"(",
"a",
")",
";",
"pclass",
"=",
"ira_pressure_class_translate",
"[",
"aclass",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"(",
"cl",
"=",
"ira_reg_class_super_classes",
"[",
"pclass",
"]",
"[",
"i",
"]",
")",
"!=",
"LIM_REG_CLASSES",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"ira_reg_pressure_class_p",
"[",
"cl",
"]",
")",
"continue",
";",
"if",
"(",
"high_pressure_start_point",
"[",
"cl",
"]",
"<",
"0",
")",
"continue",
";",
"p",
"=",
"OBJECT_LIVE_RANGES",
"(",
"obj",
")",
";",
"ira_assert",
"(",
"p",
"!=",
"NULL",
")",
";",
"start",
"=",
"(",
"high_pressure_start_point",
"[",
"cl",
"]",
">",
"p",
"->",
"start",
"?",
"high_pressure_start_point",
"[",
"cl",
"]",
":",
"p",
"->",
"start",
")",
";",
"ALLOCNO_EXCESS_PRESSURE_POINTS_NUM",
"(",
"a",
")",
"+=",
"curr_point",
"-",
"start",
"+",
"1",
";",
"}",
"}"
] | Update ALLOCNO_EXCESS_PRESSURE_POINTS_NUM for the allocno
associated with object OBJ. | [
"Update",
"ALLOCNO_EXCESS_PRESSURE_POINTS_NUM",
"for",
"the",
"allocno",
"associated",
"with",
"object",
"OBJ",
"."
] | [] | [
{
"param": "obj",
"type": "ira_object_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "ira_object_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | make_object_dead | void | static void
make_object_dead (ira_object_t obj)
{
live_range_t lr;
sparseset_clear_bit (objects_live, OBJECT_CONFLICT_ID (obj));
lr = OBJECT_LIVE_RANGES (obj);
ira_assert (lr != NULL);
lr->finish = curr_point;
update_allocno_pressure_excess_length (obj);
} | /* Process the death of object OBJ, which is associated with allocno
A. This finishes the current live range for it. */ | Process the death of object OBJ, which is associated with allocno
A. This finishes the current live range for it. | [
"Process",
"the",
"death",
"of",
"object",
"OBJ",
"which",
"is",
"associated",
"with",
"allocno",
"A",
".",
"This",
"finishes",
"the",
"current",
"live",
"range",
"for",
"it",
"."
] | static void
make_object_dead (ira_object_t obj)
{
live_range_t lr;
sparseset_clear_bit (objects_live, OBJECT_CONFLICT_ID (obj));
lr = OBJECT_LIVE_RANGES (obj);
ira_assert (lr != NULL);
lr->finish = curr_point;
update_allocno_pressure_excess_length (obj);
} | [
"static",
"void",
"make_object_dead",
"(",
"ira_object_t",
"obj",
")",
"{",
"live_range_t",
"lr",
";",
"sparseset_clear_bit",
"(",
"objects_live",
",",
"OBJECT_CONFLICT_ID",
"(",
"obj",
")",
")",
";",
"lr",
"=",
"OBJECT_LIVE_RANGES",
"(",
"obj",
")",
";",
"ira_assert",
"(",
"lr",
"!=",
"NULL",
")",
";",
"lr",
"->",
"finish",
"=",
"curr_point",
";",
"update_allocno_pressure_excess_length",
"(",
"obj",
")",
";",
"}"
] | Process the death of object OBJ, which is associated with allocno
A. | [
"Process",
"the",
"death",
"of",
"object",
"OBJ",
"which",
"is",
"associated",
"with",
"allocno",
"A",
"."
] | [] | [
{
"param": "obj",
"type": "ira_object_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "ira_object_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | inc_register_pressure | void | static void
inc_register_pressure (enum reg_class pclass, int n)
{
int i;
enum reg_class cl;
for (i = 0;
(cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
i++)
{
if (! ira_reg_pressure_class_p[cl])
continue;
curr_reg_pressure[cl] += n;
if (high_pressure_start_point[cl] < 0
&& (curr_reg_pressure[cl] > ira_available_class_regs[cl]))
high_pressure_start_point[cl] = curr_point;
if (curr_bb_node->reg_pressure[cl] < curr_reg_pressure[cl])
curr_bb_node->reg_pressure[cl] = curr_reg_pressure[cl];
}
} | /* Record that register pressure for PCLASS increased by N registers.
Update the current register pressure, maximal register pressure for
the current BB and the start point of the register pressure
excess. */ | Record that register pressure for PCLASS increased by N registers.
Update the current register pressure, maximal register pressure for
the current BB and the start point of the register pressure
excess. | [
"Record",
"that",
"register",
"pressure",
"for",
"PCLASS",
"increased",
"by",
"N",
"registers",
".",
"Update",
"the",
"current",
"register",
"pressure",
"maximal",
"register",
"pressure",
"for",
"the",
"current",
"BB",
"and",
"the",
"start",
"point",
"of",
"the",
"register",
"pressure",
"excess",
"."
] | static void
inc_register_pressure (enum reg_class pclass, int n)
{
int i;
enum reg_class cl;
for (i = 0;
(cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
i++)
{
if (! ira_reg_pressure_class_p[cl])
continue;
curr_reg_pressure[cl] += n;
if (high_pressure_start_point[cl] < 0
&& (curr_reg_pressure[cl] > ira_available_class_regs[cl]))
high_pressure_start_point[cl] = curr_point;
if (curr_bb_node->reg_pressure[cl] < curr_reg_pressure[cl])
curr_bb_node->reg_pressure[cl] = curr_reg_pressure[cl];
}
} | [
"static",
"void",
"inc_register_pressure",
"(",
"enum",
"reg_class",
"pclass",
",",
"int",
"n",
")",
"{",
"int",
"i",
";",
"enum",
"reg_class",
"cl",
";",
"for",
"(",
"i",
"=",
"0",
";",
"(",
"cl",
"=",
"ira_reg_class_super_classes",
"[",
"pclass",
"]",
"[",
"i",
"]",
")",
"!=",
"LIM_REG_CLASSES",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"ira_reg_pressure_class_p",
"[",
"cl",
"]",
")",
"continue",
";",
"curr_reg_pressure",
"[",
"cl",
"]",
"+=",
"n",
";",
"if",
"(",
"high_pressure_start_point",
"[",
"cl",
"]",
"<",
"0",
"&&",
"(",
"curr_reg_pressure",
"[",
"cl",
"]",
">",
"ira_available_class_regs",
"[",
"cl",
"]",
")",
")",
"high_pressure_start_point",
"[",
"cl",
"]",
"=",
"curr_point",
";",
"if",
"(",
"curr_bb_node",
"->",
"reg_pressure",
"[",
"cl",
"]",
"<",
"curr_reg_pressure",
"[",
"cl",
"]",
")",
"curr_bb_node",
"->",
"reg_pressure",
"[",
"cl",
"]",
"=",
"curr_reg_pressure",
"[",
"cl",
"]",
";",
"}",
"}"
] | Record that register pressure for PCLASS increased by N registers. | [
"Record",
"that",
"register",
"pressure",
"for",
"PCLASS",
"increased",
"by",
"N",
"registers",
"."
] | [] | [
{
"param": "pclass",
"type": "enum reg_class"
},
{
"param": "n",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pclass",
"type": "enum reg_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "n",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | dec_register_pressure | void | static void
dec_register_pressure (enum reg_class pclass, int nregs)
{
int i;
unsigned int j;
enum reg_class cl;
bool set_p = false;
for (i = 0;
(cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
i++)
{
if (! ira_reg_pressure_class_p[cl])
continue;
curr_reg_pressure[cl] -= nregs;
ira_assert (curr_reg_pressure[cl] >= 0);
if (high_pressure_start_point[cl] >= 0
&& curr_reg_pressure[cl] <= ira_available_class_regs[cl])
set_p = true;
}
if (set_p)
{
EXECUTE_IF_SET_IN_SPARSESET (objects_live, j)
update_allocno_pressure_excess_length (ira_object_id_map[j]);
for (i = 0;
(cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
i++)
{
if (! ira_reg_pressure_class_p[cl])
continue;
if (high_pressure_start_point[cl] >= 0
&& curr_reg_pressure[cl] <= ira_available_class_regs[cl])
high_pressure_start_point[cl] = -1;
}
}
} | /* Record that register pressure for PCLASS has decreased by NREGS
registers; update current register pressure, start point of the
register pressure excess, and register pressure excess length for
living allocnos. */ | Record that register pressure for PCLASS has decreased by NREGS
registers; update current register pressure, start point of the
register pressure excess, and register pressure excess length for
living allocnos. | [
"Record",
"that",
"register",
"pressure",
"for",
"PCLASS",
"has",
"decreased",
"by",
"NREGS",
"registers",
";",
"update",
"current",
"register",
"pressure",
"start",
"point",
"of",
"the",
"register",
"pressure",
"excess",
"and",
"register",
"pressure",
"excess",
"length",
"for",
"living",
"allocnos",
"."
] | static void
dec_register_pressure (enum reg_class pclass, int nregs)
{
int i;
unsigned int j;
enum reg_class cl;
bool set_p = false;
for (i = 0;
(cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
i++)
{
if (! ira_reg_pressure_class_p[cl])
continue;
curr_reg_pressure[cl] -= nregs;
ira_assert (curr_reg_pressure[cl] >= 0);
if (high_pressure_start_point[cl] >= 0
&& curr_reg_pressure[cl] <= ira_available_class_regs[cl])
set_p = true;
}
if (set_p)
{
EXECUTE_IF_SET_IN_SPARSESET (objects_live, j)
update_allocno_pressure_excess_length (ira_object_id_map[j]);
for (i = 0;
(cl = ira_reg_class_super_classes[pclass][i]) != LIM_REG_CLASSES;
i++)
{
if (! ira_reg_pressure_class_p[cl])
continue;
if (high_pressure_start_point[cl] >= 0
&& curr_reg_pressure[cl] <= ira_available_class_regs[cl])
high_pressure_start_point[cl] = -1;
}
}
} | [
"static",
"void",
"dec_register_pressure",
"(",
"enum",
"reg_class",
"pclass",
",",
"int",
"nregs",
")",
"{",
"int",
"i",
";",
"unsigned",
"int",
"j",
";",
"enum",
"reg_class",
"cl",
";",
"bool",
"set_p",
"=",
"false",
";",
"for",
"(",
"i",
"=",
"0",
";",
"(",
"cl",
"=",
"ira_reg_class_super_classes",
"[",
"pclass",
"]",
"[",
"i",
"]",
")",
"!=",
"LIM_REG_CLASSES",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"ira_reg_pressure_class_p",
"[",
"cl",
"]",
")",
"continue",
";",
"curr_reg_pressure",
"[",
"cl",
"]",
"-=",
"nregs",
";",
"ira_assert",
"(",
"curr_reg_pressure",
"[",
"cl",
"]",
">=",
"0",
")",
";",
"if",
"(",
"high_pressure_start_point",
"[",
"cl",
"]",
">=",
"0",
"&&",
"curr_reg_pressure",
"[",
"cl",
"]",
"<=",
"ira_available_class_regs",
"[",
"cl",
"]",
")",
"set_p",
"=",
"true",
";",
"}",
"if",
"(",
"set_p",
")",
"{",
"EXECUTE_IF_SET_IN_SPARSESET",
"(",
"objects_live",
",",
"j",
")",
"",
"update_allocno_pressure_excess_length",
"(",
"ira_object_id_map",
"[",
"j",
"]",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"(",
"cl",
"=",
"ira_reg_class_super_classes",
"[",
"pclass",
"]",
"[",
"i",
"]",
")",
"!=",
"LIM_REG_CLASSES",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"ira_reg_pressure_class_p",
"[",
"cl",
"]",
")",
"continue",
";",
"if",
"(",
"high_pressure_start_point",
"[",
"cl",
"]",
">=",
"0",
"&&",
"curr_reg_pressure",
"[",
"cl",
"]",
"<=",
"ira_available_class_regs",
"[",
"cl",
"]",
")",
"high_pressure_start_point",
"[",
"cl",
"]",
"=",
"-1",
";",
"}",
"}",
"}"
] | Record that register pressure for PCLASS has decreased by NREGS
registers; update current register pressure, start point of the
register pressure excess, and register pressure excess length for
living allocnos. | [
"Record",
"that",
"register",
"pressure",
"for",
"PCLASS",
"has",
"decreased",
"by",
"NREGS",
"registers",
";",
"update",
"current",
"register",
"pressure",
"start",
"point",
"of",
"the",
"register",
"pressure",
"excess",
"and",
"register",
"pressure",
"excess",
"length",
"for",
"living",
"allocnos",
"."
] | [] | [
{
"param": "pclass",
"type": "enum reg_class"
},
{
"param": "nregs",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pclass",
"type": "enum reg_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nregs",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_pseudo_regno_live | void | static void
mark_pseudo_regno_live (int regno)
{
ira_allocno_t a = ira_curr_regno_allocno_map[regno];
enum reg_class pclass;
int i, n, nregs;
if (a == NULL)
return;
/* Invalidate because it is referenced. */
allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
n = ALLOCNO_NUM_OBJECTS (a);
pclass = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
nregs = ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)];
if (n > 1)
{
/* We track every subobject separately. */
gcc_assert (nregs == n);
nregs = 1;
}
for (i = 0; i < n; i++)
{
ira_object_t obj = ALLOCNO_OBJECT (a, i);
if (sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
continue;
inc_register_pressure (pclass, nregs);
make_object_born (obj);
}
} | /* Mark the pseudo register REGNO as live. Update all information about
live ranges and register pressure. */ | Mark the pseudo register REGNO as live. Update all information about
live ranges and register pressure. | [
"Mark",
"the",
"pseudo",
"register",
"REGNO",
"as",
"live",
".",
"Update",
"all",
"information",
"about",
"live",
"ranges",
"and",
"register",
"pressure",
"."
] | static void
mark_pseudo_regno_live (int regno)
{
ira_allocno_t a = ira_curr_regno_allocno_map[regno];
enum reg_class pclass;
int i, n, nregs;
if (a == NULL)
return;
allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
n = ALLOCNO_NUM_OBJECTS (a);
pclass = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
nregs = ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)];
if (n > 1)
{
gcc_assert (nregs == n);
nregs = 1;
}
for (i = 0; i < n; i++)
{
ira_object_t obj = ALLOCNO_OBJECT (a, i);
if (sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
continue;
inc_register_pressure (pclass, nregs);
make_object_born (obj);
}
} | [
"static",
"void",
"mark_pseudo_regno_live",
"(",
"int",
"regno",
")",
"{",
"ira_allocno_t",
"a",
"=",
"ira_curr_regno_allocno_map",
"[",
"regno",
"]",
";",
"enum",
"reg_class",
"pclass",
";",
"int",
"i",
",",
"n",
",",
"nregs",
";",
"if",
"(",
"a",
"==",
"NULL",
")",
"return",
";",
"allocno_saved_at_call",
"[",
"ALLOCNO_NUM",
"(",
"a",
")",
"]",
"=",
"0",
";",
"n",
"=",
"ALLOCNO_NUM_OBJECTS",
"(",
"a",
")",
";",
"pclass",
"=",
"ira_pressure_class_translate",
"[",
"ALLOCNO_CLASS",
"(",
"a",
")",
"]",
";",
"nregs",
"=",
"ira_reg_class_max_nregs",
"[",
"ALLOCNO_CLASS",
"(",
"a",
")",
"]",
"[",
"ALLOCNO_MODE",
"(",
"a",
")",
"]",
";",
"if",
"(",
"n",
">",
"1",
")",
"{",
"gcc_assert",
"(",
"nregs",
"==",
"n",
")",
";",
"nregs",
"=",
"1",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"ira_object_t",
"obj",
"=",
"ALLOCNO_OBJECT",
"(",
"a",
",",
"i",
")",
";",
"if",
"(",
"sparseset_bit_p",
"(",
"objects_live",
",",
"OBJECT_CONFLICT_ID",
"(",
"obj",
")",
")",
")",
"continue",
";",
"inc_register_pressure",
"(",
"pclass",
",",
"nregs",
")",
";",
"make_object_born",
"(",
"obj",
")",
";",
"}",
"}"
] | Mark the pseudo register REGNO as live. | [
"Mark",
"the",
"pseudo",
"register",
"REGNO",
"as",
"live",
"."
] | [
"/* Invalidate because it is referenced. */",
"/* We track every subobject separately. */"
] | [
{
"param": "regno",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regno",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_pseudo_regno_subword_live | void | static void
mark_pseudo_regno_subword_live (int regno, int subword)
{
ira_allocno_t a = ira_curr_regno_allocno_map[regno];
int n;
enum reg_class pclass;
ira_object_t obj;
if (a == NULL)
return;
/* Invalidate because it is referenced. */
allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
n = ALLOCNO_NUM_OBJECTS (a);
if (n == 1)
{
mark_pseudo_regno_live (regno);
return;
}
pclass = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
gcc_assert
(n == ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)]);
obj = ALLOCNO_OBJECT (a, subword);
if (sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
return;
inc_register_pressure (pclass, 1);
make_object_born (obj);
} | /* Like mark_pseudo_regno_live, but try to only mark one subword of
the pseudo as live. SUBWORD indicates which; a value of 0
indicates the low part. */ | Like mark_pseudo_regno_live, but try to only mark one subword of
the pseudo as live. SUBWORD indicates which; a value of 0
indicates the low part. | [
"Like",
"mark_pseudo_regno_live",
"but",
"try",
"to",
"only",
"mark",
"one",
"subword",
"of",
"the",
"pseudo",
"as",
"live",
".",
"SUBWORD",
"indicates",
"which",
";",
"a",
"value",
"of",
"0",
"indicates",
"the",
"low",
"part",
"."
] | static void
mark_pseudo_regno_subword_live (int regno, int subword)
{
ira_allocno_t a = ira_curr_regno_allocno_map[regno];
int n;
enum reg_class pclass;
ira_object_t obj;
if (a == NULL)
return;
allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
n = ALLOCNO_NUM_OBJECTS (a);
if (n == 1)
{
mark_pseudo_regno_live (regno);
return;
}
pclass = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
gcc_assert
(n == ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)]);
obj = ALLOCNO_OBJECT (a, subword);
if (sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
return;
inc_register_pressure (pclass, 1);
make_object_born (obj);
} | [
"static",
"void",
"mark_pseudo_regno_subword_live",
"(",
"int",
"regno",
",",
"int",
"subword",
")",
"{",
"ira_allocno_t",
"a",
"=",
"ira_curr_regno_allocno_map",
"[",
"regno",
"]",
";",
"int",
"n",
";",
"enum",
"reg_class",
"pclass",
";",
"ira_object_t",
"obj",
";",
"if",
"(",
"a",
"==",
"NULL",
")",
"return",
";",
"allocno_saved_at_call",
"[",
"ALLOCNO_NUM",
"(",
"a",
")",
"]",
"=",
"0",
";",
"n",
"=",
"ALLOCNO_NUM_OBJECTS",
"(",
"a",
")",
";",
"if",
"(",
"n",
"==",
"1",
")",
"{",
"mark_pseudo_regno_live",
"(",
"regno",
")",
";",
"return",
";",
"}",
"pclass",
"=",
"ira_pressure_class_translate",
"[",
"ALLOCNO_CLASS",
"(",
"a",
")",
"]",
";",
"gcc_assert",
"(",
"n",
"==",
"ira_reg_class_max_nregs",
"[",
"ALLOCNO_CLASS",
"(",
"a",
")",
"]",
"[",
"ALLOCNO_MODE",
"(",
"a",
")",
"]",
")",
";",
"obj",
"=",
"ALLOCNO_OBJECT",
"(",
"a",
",",
"subword",
")",
";",
"if",
"(",
"sparseset_bit_p",
"(",
"objects_live",
",",
"OBJECT_CONFLICT_ID",
"(",
"obj",
")",
")",
")",
"return",
";",
"inc_register_pressure",
"(",
"pclass",
",",
"1",
")",
";",
"make_object_born",
"(",
"obj",
")",
";",
"}"
] | Like mark_pseudo_regno_live, but try to only mark one subword of
the pseudo as live. | [
"Like",
"mark_pseudo_regno_live",
"but",
"try",
"to",
"only",
"mark",
"one",
"subword",
"of",
"the",
"pseudo",
"as",
"live",
"."
] | [
"/* Invalidate because it is referenced. */"
] | [
{
"param": "regno",
"type": "int"
},
{
"param": "subword",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regno",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "subword",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_hard_reg_live | void | static void
mark_hard_reg_live (rtx reg)
{
int regno = REGNO (reg);
if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
{
int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
enum reg_class aclass, pclass;
while (regno < last)
{
if (! TEST_HARD_REG_BIT (hard_regs_live, regno)
&& ! TEST_HARD_REG_BIT (eliminable_regset, regno))
{
aclass = ira_hard_regno_allocno_class[regno];
pclass = ira_pressure_class_translate[aclass];
inc_register_pressure (pclass, 1);
make_hard_regno_born (regno);
}
regno++;
}
}
} | /* Mark the register REG as live. Store a 1 in hard_regs_live for
this register, record how many consecutive hardware registers it
actually needs. */ | Mark the register REG as live. Store a 1 in hard_regs_live for
this register, record how many consecutive hardware registers it
actually needs. | [
"Mark",
"the",
"register",
"REG",
"as",
"live",
".",
"Store",
"a",
"1",
"in",
"hard_regs_live",
"for",
"this",
"register",
"record",
"how",
"many",
"consecutive",
"hardware",
"registers",
"it",
"actually",
"needs",
"."
] | static void
mark_hard_reg_live (rtx reg)
{
int regno = REGNO (reg);
if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
{
int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
enum reg_class aclass, pclass;
while (regno < last)
{
if (! TEST_HARD_REG_BIT (hard_regs_live, regno)
&& ! TEST_HARD_REG_BIT (eliminable_regset, regno))
{
aclass = ira_hard_regno_allocno_class[regno];
pclass = ira_pressure_class_translate[aclass];
inc_register_pressure (pclass, 1);
make_hard_regno_born (regno);
}
regno++;
}
}
} | [
"static",
"void",
"mark_hard_reg_live",
"(",
"rtx",
"reg",
")",
"{",
"int",
"regno",
"=",
"REGNO",
"(",
"reg",
")",
";",
"if",
"(",
"!",
"TEST_HARD_REG_BIT",
"(",
"ira_no_alloc_regs",
",",
"regno",
")",
")",
"{",
"int",
"last",
"=",
"regno",
"+",
"hard_regno_nregs",
"[",
"regno",
"]",
"[",
"GET_MODE",
"(",
"reg",
")",
"]",
";",
"enum",
"reg_class",
"aclass",
",",
"pclass",
";",
"while",
"(",
"regno",
"<",
"last",
")",
"{",
"if",
"(",
"!",
"TEST_HARD_REG_BIT",
"(",
"hard_regs_live",
",",
"regno",
")",
"&&",
"!",
"TEST_HARD_REG_BIT",
"(",
"eliminable_regset",
",",
"regno",
")",
")",
"{",
"aclass",
"=",
"ira_hard_regno_allocno_class",
"[",
"regno",
"]",
";",
"pclass",
"=",
"ira_pressure_class_translate",
"[",
"aclass",
"]",
";",
"inc_register_pressure",
"(",
"pclass",
",",
"1",
")",
";",
"make_hard_regno_born",
"(",
"regno",
")",
";",
"}",
"regno",
"++",
";",
"}",
"}",
"}"
] | Mark the register REG as live. | [
"Mark",
"the",
"register",
"REG",
"as",
"live",
"."
] | [] | [
{
"param": "reg",
"type": "rtx"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "reg",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_pseudo_reg_live | void | static void
mark_pseudo_reg_live (rtx orig_reg, unsigned regno)
{
if (df_read_modify_subreg_p (orig_reg))
{
mark_pseudo_regno_subword_live (regno,
subreg_lowpart_p (orig_reg) ? 0 : 1);
}
else
mark_pseudo_regno_live (regno);
} | /* Mark a pseudo, or one of its subwords, as live. REGNO is the pseudo's
register number; ORIG_REG is the access in the insn, which may be a
subreg. */ | Mark a pseudo, or one of its subwords, as live. REGNO is the pseudo's
register number; ORIG_REG is the access in the insn, which may be a
subreg. | [
"Mark",
"a",
"pseudo",
"or",
"one",
"of",
"its",
"subwords",
"as",
"live",
".",
"REGNO",
"is",
"the",
"pseudo",
"'",
"s",
"register",
"number",
";",
"ORIG_REG",
"is",
"the",
"access",
"in",
"the",
"insn",
"which",
"may",
"be",
"a",
"subreg",
"."
] | static void
mark_pseudo_reg_live (rtx orig_reg, unsigned regno)
{
if (df_read_modify_subreg_p (orig_reg))
{
mark_pseudo_regno_subword_live (regno,
subreg_lowpart_p (orig_reg) ? 0 : 1);
}
else
mark_pseudo_regno_live (regno);
} | [
"static",
"void",
"mark_pseudo_reg_live",
"(",
"rtx",
"orig_reg",
",",
"unsigned",
"regno",
")",
"{",
"if",
"(",
"df_read_modify_subreg_p",
"(",
"orig_reg",
")",
")",
"{",
"mark_pseudo_regno_subword_live",
"(",
"regno",
",",
"subreg_lowpart_p",
"(",
"orig_reg",
")",
"?",
"0",
":",
"1",
")",
";",
"}",
"else",
"mark_pseudo_regno_live",
"(",
"regno",
")",
";",
"}"
] | Mark a pseudo, or one of its subwords, as live. | [
"Mark",
"a",
"pseudo",
"or",
"one",
"of",
"its",
"subwords",
"as",
"live",
"."
] | [] | [
{
"param": "orig_reg",
"type": "rtx"
},
{
"param": "regno",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "orig_reg",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regno",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_ref_live | void | static void
mark_ref_live (df_ref ref)
{
rtx reg = DF_REF_REG (ref);
rtx orig_reg = reg;
if (GET_CODE (reg) == SUBREG)
reg = SUBREG_REG (reg);
if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
mark_pseudo_reg_live (orig_reg, REGNO (reg));
else
mark_hard_reg_live (reg);
} | /* Mark the register referenced by use or def REF as live. */ | Mark the register referenced by use or def REF as live. | [
"Mark",
"the",
"register",
"referenced",
"by",
"use",
"or",
"def",
"REF",
"as",
"live",
"."
] | static void
mark_ref_live (df_ref ref)
{
rtx reg = DF_REF_REG (ref);
rtx orig_reg = reg;
if (GET_CODE (reg) == SUBREG)
reg = SUBREG_REG (reg);
if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
mark_pseudo_reg_live (orig_reg, REGNO (reg));
else
mark_hard_reg_live (reg);
} | [
"static",
"void",
"mark_ref_live",
"(",
"df_ref",
"ref",
")",
"{",
"rtx",
"reg",
"=",
"DF_REF_REG",
"(",
"ref",
")",
";",
"rtx",
"orig_reg",
"=",
"reg",
";",
"if",
"(",
"GET_CODE",
"(",
"reg",
")",
"==",
"SUBREG",
")",
"reg",
"=",
"SUBREG_REG",
"(",
"reg",
")",
";",
"if",
"(",
"REGNO",
"(",
"reg",
")",
">=",
"FIRST_PSEUDO_REGISTER",
")",
"mark_pseudo_reg_live",
"(",
"orig_reg",
",",
"REGNO",
"(",
"reg",
")",
")",
";",
"else",
"mark_hard_reg_live",
"(",
"reg",
")",
";",
"}"
] | Mark the register referenced by use or def REF as live. | [
"Mark",
"the",
"register",
"referenced",
"by",
"use",
"or",
"def",
"REF",
"as",
"live",
"."
] | [] | [
{
"param": "ref",
"type": "df_ref"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ref",
"type": "df_ref",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_pseudo_regno_dead | void | static void
mark_pseudo_regno_dead (int regno)
{
ira_allocno_t a = ira_curr_regno_allocno_map[regno];
int n, i, nregs;
enum reg_class cl;
if (a == NULL)
return;
/* Invalidate because it is referenced. */
allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
n = ALLOCNO_NUM_OBJECTS (a);
cl = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
nregs = ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)];
if (n > 1)
{
/* We track every subobject separately. */
gcc_assert (nregs == n);
nregs = 1;
}
for (i = 0; i < n; i++)
{
ira_object_t obj = ALLOCNO_OBJECT (a, i);
if (!sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
continue;
dec_register_pressure (cl, nregs);
make_object_dead (obj);
}
} | /* Mark the pseudo register REGNO as dead. Update all information about
live ranges and register pressure. */ | Mark the pseudo register REGNO as dead. Update all information about
live ranges and register pressure. | [
"Mark",
"the",
"pseudo",
"register",
"REGNO",
"as",
"dead",
".",
"Update",
"all",
"information",
"about",
"live",
"ranges",
"and",
"register",
"pressure",
"."
] | static void
mark_pseudo_regno_dead (int regno)
{
ira_allocno_t a = ira_curr_regno_allocno_map[regno];
int n, i, nregs;
enum reg_class cl;
if (a == NULL)
return;
allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
n = ALLOCNO_NUM_OBJECTS (a);
cl = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
nregs = ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)];
if (n > 1)
{
gcc_assert (nregs == n);
nregs = 1;
}
for (i = 0; i < n; i++)
{
ira_object_t obj = ALLOCNO_OBJECT (a, i);
if (!sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
continue;
dec_register_pressure (cl, nregs);
make_object_dead (obj);
}
} | [
"static",
"void",
"mark_pseudo_regno_dead",
"(",
"int",
"regno",
")",
"{",
"ira_allocno_t",
"a",
"=",
"ira_curr_regno_allocno_map",
"[",
"regno",
"]",
";",
"int",
"n",
",",
"i",
",",
"nregs",
";",
"enum",
"reg_class",
"cl",
";",
"if",
"(",
"a",
"==",
"NULL",
")",
"return",
";",
"allocno_saved_at_call",
"[",
"ALLOCNO_NUM",
"(",
"a",
")",
"]",
"=",
"0",
";",
"n",
"=",
"ALLOCNO_NUM_OBJECTS",
"(",
"a",
")",
";",
"cl",
"=",
"ira_pressure_class_translate",
"[",
"ALLOCNO_CLASS",
"(",
"a",
")",
"]",
";",
"nregs",
"=",
"ira_reg_class_max_nregs",
"[",
"ALLOCNO_CLASS",
"(",
"a",
")",
"]",
"[",
"ALLOCNO_MODE",
"(",
"a",
")",
"]",
";",
"if",
"(",
"n",
">",
"1",
")",
"{",
"gcc_assert",
"(",
"nregs",
"==",
"n",
")",
";",
"nregs",
"=",
"1",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"ira_object_t",
"obj",
"=",
"ALLOCNO_OBJECT",
"(",
"a",
",",
"i",
")",
";",
"if",
"(",
"!",
"sparseset_bit_p",
"(",
"objects_live",
",",
"OBJECT_CONFLICT_ID",
"(",
"obj",
")",
")",
")",
"continue",
";",
"dec_register_pressure",
"(",
"cl",
",",
"nregs",
")",
";",
"make_object_dead",
"(",
"obj",
")",
";",
"}",
"}"
] | Mark the pseudo register REGNO as dead. | [
"Mark",
"the",
"pseudo",
"register",
"REGNO",
"as",
"dead",
"."
] | [
"/* Invalidate because it is referenced. */",
"/* We track every subobject separately. */"
] | [
{
"param": "regno",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regno",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_pseudo_regno_subword_dead | void | static void
mark_pseudo_regno_subword_dead (int regno, int subword)
{
ira_allocno_t a = ira_curr_regno_allocno_map[regno];
int n;
enum reg_class cl;
ira_object_t obj;
if (a == NULL)
return;
/* Invalidate because it is referenced. */
allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
n = ALLOCNO_NUM_OBJECTS (a);
if (n == 1)
/* The allocno as a whole doesn't die in this case. */
return;
cl = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
gcc_assert
(n == ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)]);
obj = ALLOCNO_OBJECT (a, subword);
if (!sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
return;
dec_register_pressure (cl, 1);
make_object_dead (obj);
} | /* Like mark_pseudo_regno_dead, but called when we know that only part of the
register dies. SUBWORD indicates which; a value of 0 indicates the low part. */ | Like mark_pseudo_regno_dead, but called when we know that only part of the
register dies. SUBWORD indicates which; a value of 0 indicates the low part. | [
"Like",
"mark_pseudo_regno_dead",
"but",
"called",
"when",
"we",
"know",
"that",
"only",
"part",
"of",
"the",
"register",
"dies",
".",
"SUBWORD",
"indicates",
"which",
";",
"a",
"value",
"of",
"0",
"indicates",
"the",
"low",
"part",
"."
] | static void
mark_pseudo_regno_subword_dead (int regno, int subword)
{
ira_allocno_t a = ira_curr_regno_allocno_map[regno];
int n;
enum reg_class cl;
ira_object_t obj;
if (a == NULL)
return;
allocno_saved_at_call[ALLOCNO_NUM (a)] = 0;
n = ALLOCNO_NUM_OBJECTS (a);
if (n == 1)
return;
cl = ira_pressure_class_translate[ALLOCNO_CLASS (a)];
gcc_assert
(n == ira_reg_class_max_nregs[ALLOCNO_CLASS (a)][ALLOCNO_MODE (a)]);
obj = ALLOCNO_OBJECT (a, subword);
if (!sparseset_bit_p (objects_live, OBJECT_CONFLICT_ID (obj)))
return;
dec_register_pressure (cl, 1);
make_object_dead (obj);
} | [
"static",
"void",
"mark_pseudo_regno_subword_dead",
"(",
"int",
"regno",
",",
"int",
"subword",
")",
"{",
"ira_allocno_t",
"a",
"=",
"ira_curr_regno_allocno_map",
"[",
"regno",
"]",
";",
"int",
"n",
";",
"enum",
"reg_class",
"cl",
";",
"ira_object_t",
"obj",
";",
"if",
"(",
"a",
"==",
"NULL",
")",
"return",
";",
"allocno_saved_at_call",
"[",
"ALLOCNO_NUM",
"(",
"a",
")",
"]",
"=",
"0",
";",
"n",
"=",
"ALLOCNO_NUM_OBJECTS",
"(",
"a",
")",
";",
"if",
"(",
"n",
"==",
"1",
")",
"return",
";",
"cl",
"=",
"ira_pressure_class_translate",
"[",
"ALLOCNO_CLASS",
"(",
"a",
")",
"]",
";",
"gcc_assert",
"(",
"n",
"==",
"ira_reg_class_max_nregs",
"[",
"ALLOCNO_CLASS",
"(",
"a",
")",
"]",
"[",
"ALLOCNO_MODE",
"(",
"a",
")",
"]",
")",
";",
"obj",
"=",
"ALLOCNO_OBJECT",
"(",
"a",
",",
"subword",
")",
";",
"if",
"(",
"!",
"sparseset_bit_p",
"(",
"objects_live",
",",
"OBJECT_CONFLICT_ID",
"(",
"obj",
")",
")",
")",
"return",
";",
"dec_register_pressure",
"(",
"cl",
",",
"1",
")",
";",
"make_object_dead",
"(",
"obj",
")",
";",
"}"
] | Like mark_pseudo_regno_dead, but called when we know that only part of the
register dies. | [
"Like",
"mark_pseudo_regno_dead",
"but",
"called",
"when",
"we",
"know",
"that",
"only",
"part",
"of",
"the",
"register",
"dies",
"."
] | [
"/* Invalidate because it is referenced. */",
"/* The allocno as a whole doesn't die in this case. */"
] | [
{
"param": "regno",
"type": "int"
},
{
"param": "subword",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "regno",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "subword",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_hard_reg_dead | void | static void
mark_hard_reg_dead (rtx reg)
{
int regno = REGNO (reg);
if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
{
int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
enum reg_class aclass, pclass;
while (regno < last)
{
if (TEST_HARD_REG_BIT (hard_regs_live, regno))
{
aclass = ira_hard_regno_allocno_class[regno];
pclass = ira_pressure_class_translate[aclass];
dec_register_pressure (pclass, 1);
make_hard_regno_dead (regno);
}
regno++;
}
}
} | /* Mark the hard register REG as dead. Store a 0 in hard_regs_live for the
register. */ | Mark the hard register REG as dead. Store a 0 in hard_regs_live for the
register. | [
"Mark",
"the",
"hard",
"register",
"REG",
"as",
"dead",
".",
"Store",
"a",
"0",
"in",
"hard_regs_live",
"for",
"the",
"register",
"."
] | static void
mark_hard_reg_dead (rtx reg)
{
int regno = REGNO (reg);
if (! TEST_HARD_REG_BIT (ira_no_alloc_regs, regno))
{
int last = regno + hard_regno_nregs[regno][GET_MODE (reg)];
enum reg_class aclass, pclass;
while (regno < last)
{
if (TEST_HARD_REG_BIT (hard_regs_live, regno))
{
aclass = ira_hard_regno_allocno_class[regno];
pclass = ira_pressure_class_translate[aclass];
dec_register_pressure (pclass, 1);
make_hard_regno_dead (regno);
}
regno++;
}
}
} | [
"static",
"void",
"mark_hard_reg_dead",
"(",
"rtx",
"reg",
")",
"{",
"int",
"regno",
"=",
"REGNO",
"(",
"reg",
")",
";",
"if",
"(",
"!",
"TEST_HARD_REG_BIT",
"(",
"ira_no_alloc_regs",
",",
"regno",
")",
")",
"{",
"int",
"last",
"=",
"regno",
"+",
"hard_regno_nregs",
"[",
"regno",
"]",
"[",
"GET_MODE",
"(",
"reg",
")",
"]",
";",
"enum",
"reg_class",
"aclass",
",",
"pclass",
";",
"while",
"(",
"regno",
"<",
"last",
")",
"{",
"if",
"(",
"TEST_HARD_REG_BIT",
"(",
"hard_regs_live",
",",
"regno",
")",
")",
"{",
"aclass",
"=",
"ira_hard_regno_allocno_class",
"[",
"regno",
"]",
";",
"pclass",
"=",
"ira_pressure_class_translate",
"[",
"aclass",
"]",
";",
"dec_register_pressure",
"(",
"pclass",
",",
"1",
")",
";",
"make_hard_regno_dead",
"(",
"regno",
")",
";",
"}",
"regno",
"++",
";",
"}",
"}",
"}"
] | Mark the hard register REG as dead. | [
"Mark",
"the",
"hard",
"register",
"REG",
"as",
"dead",
"."
] | [] | [
{
"param": "reg",
"type": "rtx"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "reg",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_pseudo_reg_dead | void | static void
mark_pseudo_reg_dead (rtx orig_reg, unsigned regno)
{
if (df_read_modify_subreg_p (orig_reg))
{
mark_pseudo_regno_subword_dead (regno,
subreg_lowpart_p (orig_reg) ? 0 : 1);
}
else
mark_pseudo_regno_dead (regno);
} | /* Mark a pseudo, or one of its subwords, as dead. REGNO is the pseudo's
register number; ORIG_REG is the access in the insn, which may be a
subreg. */ | Mark a pseudo, or one of its subwords, as dead. REGNO is the pseudo's
register number; ORIG_REG is the access in the insn, which may be a
subreg. | [
"Mark",
"a",
"pseudo",
"or",
"one",
"of",
"its",
"subwords",
"as",
"dead",
".",
"REGNO",
"is",
"the",
"pseudo",
"'",
"s",
"register",
"number",
";",
"ORIG_REG",
"is",
"the",
"access",
"in",
"the",
"insn",
"which",
"may",
"be",
"a",
"subreg",
"."
] | static void
mark_pseudo_reg_dead (rtx orig_reg, unsigned regno)
{
if (df_read_modify_subreg_p (orig_reg))
{
mark_pseudo_regno_subword_dead (regno,
subreg_lowpart_p (orig_reg) ? 0 : 1);
}
else
mark_pseudo_regno_dead (regno);
} | [
"static",
"void",
"mark_pseudo_reg_dead",
"(",
"rtx",
"orig_reg",
",",
"unsigned",
"regno",
")",
"{",
"if",
"(",
"df_read_modify_subreg_p",
"(",
"orig_reg",
")",
")",
"{",
"mark_pseudo_regno_subword_dead",
"(",
"regno",
",",
"subreg_lowpart_p",
"(",
"orig_reg",
")",
"?",
"0",
":",
"1",
")",
";",
"}",
"else",
"mark_pseudo_regno_dead",
"(",
"regno",
")",
";",
"}"
] | Mark a pseudo, or one of its subwords, as dead. | [
"Mark",
"a",
"pseudo",
"or",
"one",
"of",
"its",
"subwords",
"as",
"dead",
"."
] | [] | [
{
"param": "orig_reg",
"type": "rtx"
},
{
"param": "regno",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "orig_reg",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regno",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_ref_dead | void | static void
mark_ref_dead (df_ref def)
{
rtx reg = DF_REF_REG (def);
rtx orig_reg = reg;
if (DF_REF_FLAGS_IS_SET (def, DF_REF_CONDITIONAL))
return;
if (GET_CODE (reg) == SUBREG)
reg = SUBREG_REG (reg);
if (DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL)
&& (GET_CODE (orig_reg) != SUBREG
|| REGNO (reg) < FIRST_PSEUDO_REGISTER
|| !df_read_modify_subreg_p (orig_reg)))
return;
if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
mark_pseudo_reg_dead (orig_reg, REGNO (reg));
else
mark_hard_reg_dead (reg);
} | /* Mark the register referenced by definition DEF as dead, if the
definition is a total one. */ | Mark the register referenced by definition DEF as dead, if the
definition is a total one. | [
"Mark",
"the",
"register",
"referenced",
"by",
"definition",
"DEF",
"as",
"dead",
"if",
"the",
"definition",
"is",
"a",
"total",
"one",
"."
] | static void
mark_ref_dead (df_ref def)
{
rtx reg = DF_REF_REG (def);
rtx orig_reg = reg;
if (DF_REF_FLAGS_IS_SET (def, DF_REF_CONDITIONAL))
return;
if (GET_CODE (reg) == SUBREG)
reg = SUBREG_REG (reg);
if (DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL)
&& (GET_CODE (orig_reg) != SUBREG
|| REGNO (reg) < FIRST_PSEUDO_REGISTER
|| !df_read_modify_subreg_p (orig_reg)))
return;
if (REGNO (reg) >= FIRST_PSEUDO_REGISTER)
mark_pseudo_reg_dead (orig_reg, REGNO (reg));
else
mark_hard_reg_dead (reg);
} | [
"static",
"void",
"mark_ref_dead",
"(",
"df_ref",
"def",
")",
"{",
"rtx",
"reg",
"=",
"DF_REF_REG",
"(",
"def",
")",
";",
"rtx",
"orig_reg",
"=",
"reg",
";",
"if",
"(",
"DF_REF_FLAGS_IS_SET",
"(",
"def",
",",
"DF_REF_CONDITIONAL",
")",
")",
"return",
";",
"if",
"(",
"GET_CODE",
"(",
"reg",
")",
"==",
"SUBREG",
")",
"reg",
"=",
"SUBREG_REG",
"(",
"reg",
")",
";",
"if",
"(",
"DF_REF_FLAGS_IS_SET",
"(",
"def",
",",
"DF_REF_PARTIAL",
")",
"&&",
"(",
"GET_CODE",
"(",
"orig_reg",
")",
"!=",
"SUBREG",
"||",
"REGNO",
"(",
"reg",
")",
"<",
"FIRST_PSEUDO_REGISTER",
"||",
"!",
"df_read_modify_subreg_p",
"(",
"orig_reg",
")",
")",
")",
"return",
";",
"if",
"(",
"REGNO",
"(",
"reg",
")",
">=",
"FIRST_PSEUDO_REGISTER",
")",
"mark_pseudo_reg_dead",
"(",
"orig_reg",
",",
"REGNO",
"(",
"reg",
")",
")",
";",
"else",
"mark_hard_reg_dead",
"(",
"reg",
")",
";",
"}"
] | Mark the register referenced by definition DEF as dead, if the
definition is a total one. | [
"Mark",
"the",
"register",
"referenced",
"by",
"definition",
"DEF",
"as",
"dead",
"if",
"the",
"definition",
"is",
"a",
"total",
"one",
"."
] | [] | [
{
"param": "def",
"type": "df_ref"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "def",
"type": "df_ref",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | make_pseudo_conflict | bool | static bool
make_pseudo_conflict (rtx reg, enum reg_class cl, rtx dreg, rtx orig_dreg,
bool advance_p)
{
rtx orig_reg = reg;
ira_allocno_t a;
if (GET_CODE (reg) == SUBREG)
reg = SUBREG_REG (reg);
if (! REG_P (reg) || REGNO (reg) < FIRST_PSEUDO_REGISTER)
return advance_p;
a = ira_curr_regno_allocno_map[REGNO (reg)];
if (! reg_classes_intersect_p (cl, ALLOCNO_CLASS (a)))
return advance_p;
if (advance_p)
curr_point++;
mark_pseudo_reg_live (orig_reg, REGNO (reg));
mark_pseudo_reg_live (orig_dreg, REGNO (dreg));
mark_pseudo_reg_dead (orig_reg, REGNO (reg));
mark_pseudo_reg_dead (orig_dreg, REGNO (dreg));
return false;
} | /* If REG is a pseudo or a subreg of it, and the class of its allocno
intersects CL, make a conflict with pseudo DREG. ORIG_DREG is the
rtx actually accessed, it may be indentical to DREG or a subreg of it.
Advance the current program point before making the conflict if
ADVANCE_P. Return TRUE if we will need to advance the current
program point. */ | If REG is a pseudo or a subreg of it, and the class of its allocno
intersects CL, make a conflict with pseudo DREG. ORIG_DREG is the
rtx actually accessed, it may be indentical to DREG or a subreg of it.
Advance the current program point before making the conflict if
ADVANCE_P. Return TRUE if we will need to advance the current
program point. | [
"If",
"REG",
"is",
"a",
"pseudo",
"or",
"a",
"subreg",
"of",
"it",
"and",
"the",
"class",
"of",
"its",
"allocno",
"intersects",
"CL",
"make",
"a",
"conflict",
"with",
"pseudo",
"DREG",
".",
"ORIG_DREG",
"is",
"the",
"rtx",
"actually",
"accessed",
"it",
"may",
"be",
"indentical",
"to",
"DREG",
"or",
"a",
"subreg",
"of",
"it",
".",
"Advance",
"the",
"current",
"program",
"point",
"before",
"making",
"the",
"conflict",
"if",
"ADVANCE_P",
".",
"Return",
"TRUE",
"if",
"we",
"will",
"need",
"to",
"advance",
"the",
"current",
"program",
"point",
"."
] | static bool
make_pseudo_conflict (rtx reg, enum reg_class cl, rtx dreg, rtx orig_dreg,
bool advance_p)
{
rtx orig_reg = reg;
ira_allocno_t a;
if (GET_CODE (reg) == SUBREG)
reg = SUBREG_REG (reg);
if (! REG_P (reg) || REGNO (reg) < FIRST_PSEUDO_REGISTER)
return advance_p;
a = ira_curr_regno_allocno_map[REGNO (reg)];
if (! reg_classes_intersect_p (cl, ALLOCNO_CLASS (a)))
return advance_p;
if (advance_p)
curr_point++;
mark_pseudo_reg_live (orig_reg, REGNO (reg));
mark_pseudo_reg_live (orig_dreg, REGNO (dreg));
mark_pseudo_reg_dead (orig_reg, REGNO (reg));
mark_pseudo_reg_dead (orig_dreg, REGNO (dreg));
return false;
} | [
"static",
"bool",
"make_pseudo_conflict",
"(",
"rtx",
"reg",
",",
"enum",
"reg_class",
"cl",
",",
"rtx",
"dreg",
",",
"rtx",
"orig_dreg",
",",
"bool",
"advance_p",
")",
"{",
"rtx",
"orig_reg",
"=",
"reg",
";",
"ira_allocno_t",
"a",
";",
"if",
"(",
"GET_CODE",
"(",
"reg",
")",
"==",
"SUBREG",
")",
"reg",
"=",
"SUBREG_REG",
"(",
"reg",
")",
";",
"if",
"(",
"!",
"REG_P",
"(",
"reg",
")",
"||",
"REGNO",
"(",
"reg",
")",
"<",
"FIRST_PSEUDO_REGISTER",
")",
"return",
"advance_p",
";",
"a",
"=",
"ira_curr_regno_allocno_map",
"[",
"REGNO",
"(",
"reg",
")",
"]",
";",
"if",
"(",
"!",
"reg_classes_intersect_p",
"(",
"cl",
",",
"ALLOCNO_CLASS",
"(",
"a",
")",
")",
")",
"return",
"advance_p",
";",
"if",
"(",
"advance_p",
")",
"curr_point",
"++",
";",
"mark_pseudo_reg_live",
"(",
"orig_reg",
",",
"REGNO",
"(",
"reg",
")",
")",
";",
"mark_pseudo_reg_live",
"(",
"orig_dreg",
",",
"REGNO",
"(",
"dreg",
")",
")",
";",
"mark_pseudo_reg_dead",
"(",
"orig_reg",
",",
"REGNO",
"(",
"reg",
")",
")",
";",
"mark_pseudo_reg_dead",
"(",
"orig_dreg",
",",
"REGNO",
"(",
"dreg",
")",
")",
";",
"return",
"false",
";",
"}"
] | If REG is a pseudo or a subreg of it, and the class of its allocno
intersects CL, make a conflict with pseudo DREG. | [
"If",
"REG",
"is",
"a",
"pseudo",
"or",
"a",
"subreg",
"of",
"it",
"and",
"the",
"class",
"of",
"its",
"allocno",
"intersects",
"CL",
"make",
"a",
"conflict",
"with",
"pseudo",
"DREG",
"."
] | [] | [
{
"param": "reg",
"type": "rtx"
},
{
"param": "cl",
"type": "enum reg_class"
},
{
"param": "dreg",
"type": "rtx"
},
{
"param": "orig_dreg",
"type": "rtx"
},
{
"param": "advance_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "reg",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cl",
"type": "enum reg_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dreg",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "orig_dreg",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "advance_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | check_and_make_def_use_conflict | bool | static bool
check_and_make_def_use_conflict (rtx dreg, rtx orig_dreg,
enum reg_class def_cl, int use,
enum reg_class use_cl, bool advance_p)
{
if (! reg_classes_intersect_p (def_cl, use_cl))
return advance_p;
advance_p = make_pseudo_conflict (recog_data.operand[use],
use_cl, dreg, orig_dreg, advance_p);
/* Reload may end up swapping commutative operands, so you
have to take both orderings into account. The
constraints for the two operands can be completely
different. (Indeed, if the constraints for the two
operands are the same for all alternatives, there's no
point marking them as commutative.) */
if (use < recog_data.n_operands - 1
&& recog_data.constraints[use][0] == '%')
advance_p
= make_pseudo_conflict (recog_data.operand[use + 1],
use_cl, dreg, orig_dreg, advance_p);
if (use >= 1
&& recog_data.constraints[use - 1][0] == '%')
advance_p
= make_pseudo_conflict (recog_data.operand[use - 1],
use_cl, dreg, orig_dreg, advance_p);
return advance_p;
} | /* Check and make if necessary conflicts for pseudo DREG of class
DEF_CL of the current insn with input operand USE of class USE_CL.
ORIG_DREG is the rtx actually accessed, it may be indentical to
DREG or a subreg of it. Advance the current program point before
making the conflict if ADVANCE_P. Return TRUE if we will need to
advance the current program point. */ | Check and make if necessary conflicts for pseudo DREG of class
DEF_CL of the current insn with input operand USE of class USE_CL.
ORIG_DREG is the rtx actually accessed, it may be indentical to
DREG or a subreg of it. Advance the current program point before
making the conflict if ADVANCE_P. Return TRUE if we will need to
advance the current program point. | [
"Check",
"and",
"make",
"if",
"necessary",
"conflicts",
"for",
"pseudo",
"DREG",
"of",
"class",
"DEF_CL",
"of",
"the",
"current",
"insn",
"with",
"input",
"operand",
"USE",
"of",
"class",
"USE_CL",
".",
"ORIG_DREG",
"is",
"the",
"rtx",
"actually",
"accessed",
"it",
"may",
"be",
"indentical",
"to",
"DREG",
"or",
"a",
"subreg",
"of",
"it",
".",
"Advance",
"the",
"current",
"program",
"point",
"before",
"making",
"the",
"conflict",
"if",
"ADVANCE_P",
".",
"Return",
"TRUE",
"if",
"we",
"will",
"need",
"to",
"advance",
"the",
"current",
"program",
"point",
"."
] | static bool
check_and_make_def_use_conflict (rtx dreg, rtx orig_dreg,
enum reg_class def_cl, int use,
enum reg_class use_cl, bool advance_p)
{
if (! reg_classes_intersect_p (def_cl, use_cl))
return advance_p;
advance_p = make_pseudo_conflict (recog_data.operand[use],
use_cl, dreg, orig_dreg, advance_p);
if (use < recog_data.n_operands - 1
&& recog_data.constraints[use][0] == '%')
advance_p
= make_pseudo_conflict (recog_data.operand[use + 1],
use_cl, dreg, orig_dreg, advance_p);
if (use >= 1
&& recog_data.constraints[use - 1][0] == '%')
advance_p
= make_pseudo_conflict (recog_data.operand[use - 1],
use_cl, dreg, orig_dreg, advance_p);
return advance_p;
} | [
"static",
"bool",
"check_and_make_def_use_conflict",
"(",
"rtx",
"dreg",
",",
"rtx",
"orig_dreg",
",",
"enum",
"reg_class",
"def_cl",
",",
"int",
"use",
",",
"enum",
"reg_class",
"use_cl",
",",
"bool",
"advance_p",
")",
"{",
"if",
"(",
"!",
"reg_classes_intersect_p",
"(",
"def_cl",
",",
"use_cl",
")",
")",
"return",
"advance_p",
";",
"advance_p",
"=",
"make_pseudo_conflict",
"(",
"recog_data",
".",
"operand",
"[",
"use",
"]",
",",
"use_cl",
",",
"dreg",
",",
"orig_dreg",
",",
"advance_p",
")",
";",
"if",
"(",
"use",
"<",
"recog_data",
".",
"n_operands",
"-",
"1",
"&&",
"recog_data",
".",
"constraints",
"[",
"use",
"]",
"[",
"0",
"]",
"==",
"'",
"'",
")",
"advance_p",
"=",
"make_pseudo_conflict",
"(",
"recog_data",
".",
"operand",
"[",
"use",
"+",
"1",
"]",
",",
"use_cl",
",",
"dreg",
",",
"orig_dreg",
",",
"advance_p",
")",
";",
"if",
"(",
"use",
">=",
"1",
"&&",
"recog_data",
".",
"constraints",
"[",
"use",
"-",
"1",
"]",
"[",
"0",
"]",
"==",
"'",
"'",
")",
"advance_p",
"=",
"make_pseudo_conflict",
"(",
"recog_data",
".",
"operand",
"[",
"use",
"-",
"1",
"]",
",",
"use_cl",
",",
"dreg",
",",
"orig_dreg",
",",
"advance_p",
")",
";",
"return",
"advance_p",
";",
"}"
] | Check and make if necessary conflicts for pseudo DREG of class
DEF_CL of the current insn with input operand USE of class USE_CL. | [
"Check",
"and",
"make",
"if",
"necessary",
"conflicts",
"for",
"pseudo",
"DREG",
"of",
"class",
"DEF_CL",
"of",
"the",
"current",
"insn",
"with",
"input",
"operand",
"USE",
"of",
"class",
"USE_CL",
"."
] | [
"/* Reload may end up swapping commutative operands, so you\n have to take both orderings into account. The\n constraints for the two operands can be completely\n different. (Indeed, if the constraints for the two\n operands are the same for all alternatives, there's no\n point marking them as commutative.) */"
] | [
{
"param": "dreg",
"type": "rtx"
},
{
"param": "orig_dreg",
"type": "rtx"
},
{
"param": "def_cl",
"type": "enum reg_class"
},
{
"param": "use",
"type": "int"
},
{
"param": "use_cl",
"type": "enum reg_class"
},
{
"param": "advance_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dreg",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "orig_dreg",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "def_cl",
"type": "enum reg_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "use",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "use_cl",
"type": "enum reg_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "advance_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | check_and_make_def_conflict | void | static void
check_and_make_def_conflict (int alt, int def, enum reg_class def_cl)
{
int use, use_match;
ira_allocno_t a;
enum reg_class use_cl, acl;
bool advance_p;
rtx dreg = recog_data.operand[def];
rtx orig_dreg = dreg;
if (def_cl == NO_REGS)
return;
if (GET_CODE (dreg) == SUBREG)
dreg = SUBREG_REG (dreg);
if (! REG_P (dreg) || REGNO (dreg) < FIRST_PSEUDO_REGISTER)
return;
a = ira_curr_regno_allocno_map[REGNO (dreg)];
acl = ALLOCNO_CLASS (a);
if (! reg_classes_intersect_p (acl, def_cl))
return;
advance_p = true;
for (use = 0; use < recog_data.n_operands; use++)
{
int alt1;
if (use == def || recog_data.operand_type[use] == OP_OUT)
continue;
if (recog_op_alt[use][alt].anything_ok)
use_cl = ALL_REGS;
else
use_cl = recog_op_alt[use][alt].cl;
/* If there's any alternative that allows USE to match DEF, do not
record a conflict. If that causes us to create an invalid
instruction due to the earlyclobber, reload must fix it up. */
for (alt1 = 0; alt1 < recog_data.n_alternatives; alt1++)
if (recog_op_alt[use][alt1].matches == def
|| (use < recog_data.n_operands - 1
&& recog_data.constraints[use][0] == '%'
&& recog_op_alt[use + 1][alt1].matches == def)
|| (use >= 1
&& recog_data.constraints[use - 1][0] == '%'
&& recog_op_alt[use - 1][alt1].matches == def))
break;
if (alt1 < recog_data.n_alternatives)
continue;
advance_p = check_and_make_def_use_conflict (dreg, orig_dreg, def_cl,
use, use_cl, advance_p);
if ((use_match = recog_op_alt[use][alt].matches) >= 0)
{
if (use_match == def)
continue;
if (recog_op_alt[use_match][alt].anything_ok)
use_cl = ALL_REGS;
else
use_cl = recog_op_alt[use_match][alt].cl;
advance_p = check_and_make_def_use_conflict (dreg, orig_dreg, def_cl,
use, use_cl, advance_p);
}
}
} | /* Check and make if necessary conflicts for definition DEF of class
DEF_CL of the current insn with input operands. Process only
constraints of alternative ALT. */ | Check and make if necessary conflicts for definition DEF of class
DEF_CL of the current insn with input operands. Process only
constraints of alternative ALT. | [
"Check",
"and",
"make",
"if",
"necessary",
"conflicts",
"for",
"definition",
"DEF",
"of",
"class",
"DEF_CL",
"of",
"the",
"current",
"insn",
"with",
"input",
"operands",
".",
"Process",
"only",
"constraints",
"of",
"alternative",
"ALT",
"."
] | static void
check_and_make_def_conflict (int alt, int def, enum reg_class def_cl)
{
int use, use_match;
ira_allocno_t a;
enum reg_class use_cl, acl;
bool advance_p;
rtx dreg = recog_data.operand[def];
rtx orig_dreg = dreg;
if (def_cl == NO_REGS)
return;
if (GET_CODE (dreg) == SUBREG)
dreg = SUBREG_REG (dreg);
if (! REG_P (dreg) || REGNO (dreg) < FIRST_PSEUDO_REGISTER)
return;
a = ira_curr_regno_allocno_map[REGNO (dreg)];
acl = ALLOCNO_CLASS (a);
if (! reg_classes_intersect_p (acl, def_cl))
return;
advance_p = true;
for (use = 0; use < recog_data.n_operands; use++)
{
int alt1;
if (use == def || recog_data.operand_type[use] == OP_OUT)
continue;
if (recog_op_alt[use][alt].anything_ok)
use_cl = ALL_REGS;
else
use_cl = recog_op_alt[use][alt].cl;
for (alt1 = 0; alt1 < recog_data.n_alternatives; alt1++)
if (recog_op_alt[use][alt1].matches == def
|| (use < recog_data.n_operands - 1
&& recog_data.constraints[use][0] == '%'
&& recog_op_alt[use + 1][alt1].matches == def)
|| (use >= 1
&& recog_data.constraints[use - 1][0] == '%'
&& recog_op_alt[use - 1][alt1].matches == def))
break;
if (alt1 < recog_data.n_alternatives)
continue;
advance_p = check_and_make_def_use_conflict (dreg, orig_dreg, def_cl,
use, use_cl, advance_p);
if ((use_match = recog_op_alt[use][alt].matches) >= 0)
{
if (use_match == def)
continue;
if (recog_op_alt[use_match][alt].anything_ok)
use_cl = ALL_REGS;
else
use_cl = recog_op_alt[use_match][alt].cl;
advance_p = check_and_make_def_use_conflict (dreg, orig_dreg, def_cl,
use, use_cl, advance_p);
}
}
} | [
"static",
"void",
"check_and_make_def_conflict",
"(",
"int",
"alt",
",",
"int",
"def",
",",
"enum",
"reg_class",
"def_cl",
")",
"{",
"int",
"use",
",",
"use_match",
";",
"ira_allocno_t",
"a",
";",
"enum",
"reg_class",
"use_cl",
",",
"acl",
";",
"bool",
"advance_p",
";",
"rtx",
"dreg",
"=",
"recog_data",
".",
"operand",
"[",
"def",
"]",
";",
"rtx",
"orig_dreg",
"=",
"dreg",
";",
"if",
"(",
"def_cl",
"==",
"NO_REGS",
")",
"return",
";",
"if",
"(",
"GET_CODE",
"(",
"dreg",
")",
"==",
"SUBREG",
")",
"dreg",
"=",
"SUBREG_REG",
"(",
"dreg",
")",
";",
"if",
"(",
"!",
"REG_P",
"(",
"dreg",
")",
"||",
"REGNO",
"(",
"dreg",
")",
"<",
"FIRST_PSEUDO_REGISTER",
")",
"return",
";",
"a",
"=",
"ira_curr_regno_allocno_map",
"[",
"REGNO",
"(",
"dreg",
")",
"]",
";",
"acl",
"=",
"ALLOCNO_CLASS",
"(",
"a",
")",
";",
"if",
"(",
"!",
"reg_classes_intersect_p",
"(",
"acl",
",",
"def_cl",
")",
")",
"return",
";",
"advance_p",
"=",
"true",
";",
"for",
"(",
"use",
"=",
"0",
";",
"use",
"<",
"recog_data",
".",
"n_operands",
";",
"use",
"++",
")",
"{",
"int",
"alt1",
";",
"if",
"(",
"use",
"==",
"def",
"||",
"recog_data",
".",
"operand_type",
"[",
"use",
"]",
"==",
"OP_OUT",
")",
"continue",
";",
"if",
"(",
"recog_op_alt",
"[",
"use",
"]",
"[",
"alt",
"]",
".",
"anything_ok",
")",
"use_cl",
"=",
"ALL_REGS",
";",
"else",
"use_cl",
"=",
"recog_op_alt",
"[",
"use",
"]",
"[",
"alt",
"]",
".",
"cl",
";",
"for",
"(",
"alt1",
"=",
"0",
";",
"alt1",
"<",
"recog_data",
".",
"n_alternatives",
";",
"alt1",
"++",
")",
"if",
"(",
"recog_op_alt",
"[",
"use",
"]",
"[",
"alt1",
"]",
".",
"matches",
"==",
"def",
"||",
"(",
"use",
"<",
"recog_data",
".",
"n_operands",
"-",
"1",
"&&",
"recog_data",
".",
"constraints",
"[",
"use",
"]",
"[",
"0",
"]",
"==",
"'",
"'",
"&&",
"recog_op_alt",
"[",
"use",
"+",
"1",
"]",
"[",
"alt1",
"]",
".",
"matches",
"==",
"def",
")",
"||",
"(",
"use",
">=",
"1",
"&&",
"recog_data",
".",
"constraints",
"[",
"use",
"-",
"1",
"]",
"[",
"0",
"]",
"==",
"'",
"'",
"&&",
"recog_op_alt",
"[",
"use",
"-",
"1",
"]",
"[",
"alt1",
"]",
".",
"matches",
"==",
"def",
")",
")",
"break",
";",
"if",
"(",
"alt1",
"<",
"recog_data",
".",
"n_alternatives",
")",
"continue",
";",
"advance_p",
"=",
"check_and_make_def_use_conflict",
"(",
"dreg",
",",
"orig_dreg",
",",
"def_cl",
",",
"use",
",",
"use_cl",
",",
"advance_p",
")",
";",
"if",
"(",
"(",
"use_match",
"=",
"recog_op_alt",
"[",
"use",
"]",
"[",
"alt",
"]",
".",
"matches",
")",
">=",
"0",
")",
"{",
"if",
"(",
"use_match",
"==",
"def",
")",
"continue",
";",
"if",
"(",
"recog_op_alt",
"[",
"use_match",
"]",
"[",
"alt",
"]",
".",
"anything_ok",
")",
"use_cl",
"=",
"ALL_REGS",
";",
"else",
"use_cl",
"=",
"recog_op_alt",
"[",
"use_match",
"]",
"[",
"alt",
"]",
".",
"cl",
";",
"advance_p",
"=",
"check_and_make_def_use_conflict",
"(",
"dreg",
",",
"orig_dreg",
",",
"def_cl",
",",
"use",
",",
"use_cl",
",",
"advance_p",
")",
";",
"}",
"}",
"}"
] | Check and make if necessary conflicts for definition DEF of class
DEF_CL of the current insn with input operands. | [
"Check",
"and",
"make",
"if",
"necessary",
"conflicts",
"for",
"definition",
"DEF",
"of",
"class",
"DEF_CL",
"of",
"the",
"current",
"insn",
"with",
"input",
"operands",
"."
] | [
"/* If there's any alternative that allows USE to match DEF, do not\n\t record a conflict. If that causes us to create an invalid\n\t instruction due to the earlyclobber, reload must fix it up. */"
] | [
{
"param": "alt",
"type": "int"
},
{
"param": "def",
"type": "int"
},
{
"param": "def_cl",
"type": "enum reg_class"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "alt",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "def",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "def_cl",
"type": "enum reg_class",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | make_early_clobber_and_input_conflicts | void | static void
make_early_clobber_and_input_conflicts (void)
{
int alt;
int def, def_match;
enum reg_class def_cl;
for (alt = 0; alt < recog_data.n_alternatives; alt++)
for (def = 0; def < recog_data.n_operands; def++)
{
def_cl = NO_REGS;
if (recog_op_alt[def][alt].earlyclobber)
{
if (recog_op_alt[def][alt].anything_ok)
def_cl = ALL_REGS;
else
def_cl = recog_op_alt[def][alt].cl;
check_and_make_def_conflict (alt, def, def_cl);
}
if ((def_match = recog_op_alt[def][alt].matches) >= 0
&& (recog_op_alt[def_match][alt].earlyclobber
|| recog_op_alt[def][alt].earlyclobber))
{
if (recog_op_alt[def_match][alt].anything_ok)
def_cl = ALL_REGS;
else
def_cl = recog_op_alt[def_match][alt].cl;
check_and_make_def_conflict (alt, def, def_cl);
}
}
} | /* Make conflicts of early clobber pseudo registers of the current
insn with its inputs. Avoid introducing unnecessary conflicts by
checking classes of the constraints and pseudos because otherwise
significant code degradation is possible for some targets. */ | Make conflicts of early clobber pseudo registers of the current
insn with its inputs. Avoid introducing unnecessary conflicts by
checking classes of the constraints and pseudos because otherwise
significant code degradation is possible for some targets. | [
"Make",
"conflicts",
"of",
"early",
"clobber",
"pseudo",
"registers",
"of",
"the",
"current",
"insn",
"with",
"its",
"inputs",
".",
"Avoid",
"introducing",
"unnecessary",
"conflicts",
"by",
"checking",
"classes",
"of",
"the",
"constraints",
"and",
"pseudos",
"because",
"otherwise",
"significant",
"code",
"degradation",
"is",
"possible",
"for",
"some",
"targets",
"."
] | static void
make_early_clobber_and_input_conflicts (void)
{
int alt;
int def, def_match;
enum reg_class def_cl;
for (alt = 0; alt < recog_data.n_alternatives; alt++)
for (def = 0; def < recog_data.n_operands; def++)
{
def_cl = NO_REGS;
if (recog_op_alt[def][alt].earlyclobber)
{
if (recog_op_alt[def][alt].anything_ok)
def_cl = ALL_REGS;
else
def_cl = recog_op_alt[def][alt].cl;
check_and_make_def_conflict (alt, def, def_cl);
}
if ((def_match = recog_op_alt[def][alt].matches) >= 0
&& (recog_op_alt[def_match][alt].earlyclobber
|| recog_op_alt[def][alt].earlyclobber))
{
if (recog_op_alt[def_match][alt].anything_ok)
def_cl = ALL_REGS;
else
def_cl = recog_op_alt[def_match][alt].cl;
check_and_make_def_conflict (alt, def, def_cl);
}
}
} | [
"static",
"void",
"make_early_clobber_and_input_conflicts",
"(",
"void",
")",
"{",
"int",
"alt",
";",
"int",
"def",
",",
"def_match",
";",
"enum",
"reg_class",
"def_cl",
";",
"for",
"(",
"alt",
"=",
"0",
";",
"alt",
"<",
"recog_data",
".",
"n_alternatives",
";",
"alt",
"++",
")",
"for",
"(",
"def",
"=",
"0",
";",
"def",
"<",
"recog_data",
".",
"n_operands",
";",
"def",
"++",
")",
"{",
"def_cl",
"=",
"NO_REGS",
";",
"if",
"(",
"recog_op_alt",
"[",
"def",
"]",
"[",
"alt",
"]",
".",
"earlyclobber",
")",
"{",
"if",
"(",
"recog_op_alt",
"[",
"def",
"]",
"[",
"alt",
"]",
".",
"anything_ok",
")",
"def_cl",
"=",
"ALL_REGS",
";",
"else",
"def_cl",
"=",
"recog_op_alt",
"[",
"def",
"]",
"[",
"alt",
"]",
".",
"cl",
";",
"check_and_make_def_conflict",
"(",
"alt",
",",
"def",
",",
"def_cl",
")",
";",
"}",
"if",
"(",
"(",
"def_match",
"=",
"recog_op_alt",
"[",
"def",
"]",
"[",
"alt",
"]",
".",
"matches",
")",
">=",
"0",
"&&",
"(",
"recog_op_alt",
"[",
"def_match",
"]",
"[",
"alt",
"]",
".",
"earlyclobber",
"||",
"recog_op_alt",
"[",
"def",
"]",
"[",
"alt",
"]",
".",
"earlyclobber",
")",
")",
"{",
"if",
"(",
"recog_op_alt",
"[",
"def_match",
"]",
"[",
"alt",
"]",
".",
"anything_ok",
")",
"def_cl",
"=",
"ALL_REGS",
";",
"else",
"def_cl",
"=",
"recog_op_alt",
"[",
"def_match",
"]",
"[",
"alt",
"]",
".",
"cl",
";",
"check_and_make_def_conflict",
"(",
"alt",
",",
"def",
",",
"def_cl",
")",
";",
"}",
"}",
"}"
] | Make conflicts of early clobber pseudo registers of the current
insn with its inputs. | [
"Make",
"conflicts",
"of",
"early",
"clobber",
"pseudo",
"registers",
"of",
"the",
"current",
"insn",
"with",
"its",
"inputs",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | mark_hard_reg_early_clobbers | bool | static bool
mark_hard_reg_early_clobbers (rtx insn, bool live_p)
{
df_ref *def_rec;
bool set_p = false;
for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
if (DF_REF_FLAGS_IS_SET (*def_rec, DF_REF_MUST_CLOBBER))
{
rtx dreg = DF_REF_REG (*def_rec);
if (GET_CODE (dreg) == SUBREG)
dreg = SUBREG_REG (dreg);
if (! REG_P (dreg) || REGNO (dreg) >= FIRST_PSEUDO_REGISTER)
continue;
/* Hard register clobbers are believed to be early clobber
because there is no way to say that non-operand hard
register clobbers are not early ones. */
if (live_p)
mark_ref_live (*def_rec);
else
mark_ref_dead (*def_rec);
set_p = true;
}
return set_p;
} | /* Mark early clobber hard registers of the current INSN as live (if
LIVE_P) or dead. Return true if there are such registers. */ | Mark early clobber hard registers of the current INSN as live (if
LIVE_P) or dead. Return true if there are such registers. | [
"Mark",
"early",
"clobber",
"hard",
"registers",
"of",
"the",
"current",
"INSN",
"as",
"live",
"(",
"if",
"LIVE_P",
")",
"or",
"dead",
".",
"Return",
"true",
"if",
"there",
"are",
"such",
"registers",
"."
] | static bool
mark_hard_reg_early_clobbers (rtx insn, bool live_p)
{
df_ref *def_rec;
bool set_p = false;
for (def_rec = DF_INSN_DEFS (insn); *def_rec; def_rec++)
if (DF_REF_FLAGS_IS_SET (*def_rec, DF_REF_MUST_CLOBBER))
{
rtx dreg = DF_REF_REG (*def_rec);
if (GET_CODE (dreg) == SUBREG)
dreg = SUBREG_REG (dreg);
if (! REG_P (dreg) || REGNO (dreg) >= FIRST_PSEUDO_REGISTER)
continue;
if (live_p)
mark_ref_live (*def_rec);
else
mark_ref_dead (*def_rec);
set_p = true;
}
return set_p;
} | [
"static",
"bool",
"mark_hard_reg_early_clobbers",
"(",
"rtx",
"insn",
",",
"bool",
"live_p",
")",
"{",
"df_ref",
"*",
"def_rec",
";",
"bool",
"set_p",
"=",
"false",
";",
"for",
"(",
"def_rec",
"=",
"DF_INSN_DEFS",
"(",
"insn",
")",
";",
"*",
"def_rec",
";",
"def_rec",
"++",
")",
"if",
"(",
"DF_REF_FLAGS_IS_SET",
"(",
"*",
"def_rec",
",",
"DF_REF_MUST_CLOBBER",
")",
")",
"{",
"rtx",
"dreg",
"=",
"DF_REF_REG",
"(",
"*",
"def_rec",
")",
";",
"if",
"(",
"GET_CODE",
"(",
"dreg",
")",
"==",
"SUBREG",
")",
"dreg",
"=",
"SUBREG_REG",
"(",
"dreg",
")",
";",
"if",
"(",
"!",
"REG_P",
"(",
"dreg",
")",
"||",
"REGNO",
"(",
"dreg",
")",
">=",
"FIRST_PSEUDO_REGISTER",
")",
"continue",
";",
"if",
"(",
"live_p",
")",
"mark_ref_live",
"(",
"*",
"def_rec",
")",
";",
"else",
"mark_ref_dead",
"(",
"*",
"def_rec",
")",
";",
"set_p",
"=",
"true",
";",
"}",
"return",
"set_p",
";",
"}"
] | Mark early clobber hard registers of the current INSN as live (if
LIVE_P) or dead. | [
"Mark",
"early",
"clobber",
"hard",
"registers",
"of",
"the",
"current",
"INSN",
"as",
"live",
"(",
"if",
"LIVE_P",
")",
"or",
"dead",
"."
] | [
"/* Hard register clobbers are believed to be early clobber\n\t because there is no way to say that non-operand hard\n\t register clobbers are not early ones. */"
] | [
{
"param": "insn",
"type": "rtx"
},
{
"param": "live_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "insn",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "live_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | single_reg_class | null | static enum reg_class
single_reg_class (const char *constraints, rtx op, rtx equiv_const)
{
int curr_alt, c;
bool ignore_p;
enum reg_class cl, next_cl;
cl = NO_REGS;
for (ignore_p = false, curr_alt = 0;
(c = *constraints);
constraints += CONSTRAINT_LEN (c, constraints))
if (c == '#' || !recog_data.alternative_enabled_p[curr_alt])
ignore_p = true;
else if (c == ',')
{
curr_alt++;
ignore_p = false;
}
else if (! ignore_p)
switch (c)
{
case ' ':
case '\t':
case '=':
case '+':
case '*':
case '&':
case '%':
case '!':
case '?':
break;
case 'i':
if (CONSTANT_P (op)
|| (equiv_const != NULL_RTX && CONSTANT_P (equiv_const)))
return NO_REGS;
break;
case 'n':
if (CONST_INT_P (op)
|| (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode)
|| (equiv_const != NULL_RTX
&& (CONST_INT_P (equiv_const)
|| (GET_CODE (equiv_const) == CONST_DOUBLE
&& GET_MODE (equiv_const) == VOIDmode))))
return NO_REGS;
break;
case 's':
if ((CONSTANT_P (op) && !CONST_INT_P (op)
&& (GET_CODE (op) != CONST_DOUBLE || GET_MODE (op) != VOIDmode))
|| (equiv_const != NULL_RTX
&& CONSTANT_P (equiv_const)
&& !CONST_INT_P (equiv_const)
&& (GET_CODE (equiv_const) != CONST_DOUBLE
|| GET_MODE (equiv_const) != VOIDmode)))
return NO_REGS;
break;
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
if ((CONST_INT_P (op)
&& CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), c, constraints))
|| (equiv_const != NULL_RTX
&& CONST_INT_P (equiv_const)
&& CONST_OK_FOR_CONSTRAINT_P (INTVAL (equiv_const),
c, constraints)))
return NO_REGS;
break;
case 'E':
case 'F':
if (GET_CODE (op) == CONST_DOUBLE
|| (GET_CODE (op) == CONST_VECTOR
&& GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT)
|| (equiv_const != NULL_RTX
&& (GET_CODE (equiv_const) == CONST_DOUBLE
|| (GET_CODE (equiv_const) == CONST_VECTOR
&& (GET_MODE_CLASS (GET_MODE (equiv_const))
== MODE_VECTOR_FLOAT)))))
return NO_REGS;
break;
case 'G':
case 'H':
if ((GET_CODE (op) == CONST_DOUBLE
&& CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, c, constraints))
|| (equiv_const != NULL_RTX
&& GET_CODE (equiv_const) == CONST_DOUBLE
&& CONST_DOUBLE_OK_FOR_CONSTRAINT_P (equiv_const,
c, constraints)))
return NO_REGS;
/* ??? what about memory */
case 'r':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'h': case 'j': case 'k': case 'l':
case 'q': case 't': case 'u':
case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D':
case 'Q': case 'R': case 'S': case 'T': case 'U':
case 'W': case 'Y': case 'Z':
next_cl = (c == 'r'
? GENERAL_REGS
: REG_CLASS_FROM_CONSTRAINT (c, constraints));
if ((cl != NO_REGS && next_cl != cl)
|| (ira_available_class_regs[next_cl]
> ira_reg_class_max_nregs[next_cl][GET_MODE (op)]))
return NO_REGS;
cl = next_cl;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
next_cl
= single_reg_class (recog_data.constraints[c - '0'],
recog_data.operand[c - '0'], NULL_RTX);
if ((cl != NO_REGS && next_cl != cl)
|| next_cl == NO_REGS
|| (ira_available_class_regs[next_cl]
> ira_reg_class_max_nregs[next_cl][GET_MODE (op)]))
return NO_REGS;
cl = next_cl;
break;
default:
return NO_REGS;
}
return cl;
} | /* Checks that CONSTRAINTS permits to use only one hard register. If
it is so, the function returns the class of the hard register.
Otherwise it returns NO_REGS. */ | Checks that CONSTRAINTS permits to use only one hard register. If
it is so, the function returns the class of the hard register.
Otherwise it returns NO_REGS. | [
"Checks",
"that",
"CONSTRAINTS",
"permits",
"to",
"use",
"only",
"one",
"hard",
"register",
".",
"If",
"it",
"is",
"so",
"the",
"function",
"returns",
"the",
"class",
"of",
"the",
"hard",
"register",
".",
"Otherwise",
"it",
"returns",
"NO_REGS",
"."
] | static enum reg_class
single_reg_class (const char *constraints, rtx op, rtx equiv_const)
{
int curr_alt, c;
bool ignore_p;
enum reg_class cl, next_cl;
cl = NO_REGS;
for (ignore_p = false, curr_alt = 0;
(c = *constraints);
constraints += CONSTRAINT_LEN (c, constraints))
if (c == '#' || !recog_data.alternative_enabled_p[curr_alt])
ignore_p = true;
else if (c == ',')
{
curr_alt++;
ignore_p = false;
}
else if (! ignore_p)
switch (c)
{
case ' ':
case '\t':
case '=':
case '+':
case '*':
case '&':
case '%':
case '!':
case '?':
break;
case 'i':
if (CONSTANT_P (op)
|| (equiv_const != NULL_RTX && CONSTANT_P (equiv_const)))
return NO_REGS;
break;
case 'n':
if (CONST_INT_P (op)
|| (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == VOIDmode)
|| (equiv_const != NULL_RTX
&& (CONST_INT_P (equiv_const)
|| (GET_CODE (equiv_const) == CONST_DOUBLE
&& GET_MODE (equiv_const) == VOIDmode))))
return NO_REGS;
break;
case 's':
if ((CONSTANT_P (op) && !CONST_INT_P (op)
&& (GET_CODE (op) != CONST_DOUBLE || GET_MODE (op) != VOIDmode))
|| (equiv_const != NULL_RTX
&& CONSTANT_P (equiv_const)
&& !CONST_INT_P (equiv_const)
&& (GET_CODE (equiv_const) != CONST_DOUBLE
|| GET_MODE (equiv_const) != VOIDmode)))
return NO_REGS;
break;
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
if ((CONST_INT_P (op)
&& CONST_OK_FOR_CONSTRAINT_P (INTVAL (op), c, constraints))
|| (equiv_const != NULL_RTX
&& CONST_INT_P (equiv_const)
&& CONST_OK_FOR_CONSTRAINT_P (INTVAL (equiv_const),
c, constraints)))
return NO_REGS;
break;
case 'E':
case 'F':
if (GET_CODE (op) == CONST_DOUBLE
|| (GET_CODE (op) == CONST_VECTOR
&& GET_MODE_CLASS (GET_MODE (op)) == MODE_VECTOR_FLOAT)
|| (equiv_const != NULL_RTX
&& (GET_CODE (equiv_const) == CONST_DOUBLE
|| (GET_CODE (equiv_const) == CONST_VECTOR
&& (GET_MODE_CLASS (GET_MODE (equiv_const))
== MODE_VECTOR_FLOAT)))))
return NO_REGS;
break;
case 'G':
case 'H':
if ((GET_CODE (op) == CONST_DOUBLE
&& CONST_DOUBLE_OK_FOR_CONSTRAINT_P (op, c, constraints))
|| (equiv_const != NULL_RTX
&& GET_CODE (equiv_const) == CONST_DOUBLE
&& CONST_DOUBLE_OK_FOR_CONSTRAINT_P (equiv_const,
c, constraints)))
return NO_REGS;
case 'r':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'h': case 'j': case 'k': case 'l':
case 'q': case 't': case 'u':
case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D':
case 'Q': case 'R': case 'S': case 'T': case 'U':
case 'W': case 'Y': case 'Z':
next_cl = (c == 'r'
? GENERAL_REGS
: REG_CLASS_FROM_CONSTRAINT (c, constraints));
if ((cl != NO_REGS && next_cl != cl)
|| (ira_available_class_regs[next_cl]
> ira_reg_class_max_nregs[next_cl][GET_MODE (op)]))
return NO_REGS;
cl = next_cl;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
next_cl
= single_reg_class (recog_data.constraints[c - '0'],
recog_data.operand[c - '0'], NULL_RTX);
if ((cl != NO_REGS && next_cl != cl)
|| next_cl == NO_REGS
|| (ira_available_class_regs[next_cl]
> ira_reg_class_max_nregs[next_cl][GET_MODE (op)]))
return NO_REGS;
cl = next_cl;
break;
default:
return NO_REGS;
}
return cl;
} | [
"static",
"enum",
"reg_class",
"single_reg_class",
"(",
"const",
"char",
"*",
"constraints",
",",
"rtx",
"op",
",",
"rtx",
"equiv_const",
")",
"{",
"int",
"curr_alt",
",",
"c",
";",
"bool",
"ignore_p",
";",
"enum",
"reg_class",
"cl",
",",
"next_cl",
";",
"cl",
"=",
"NO_REGS",
";",
"for",
"(",
"ignore_p",
"=",
"false",
",",
"curr_alt",
"=",
"0",
";",
"(",
"c",
"=",
"*",
"constraints",
")",
";",
"constraints",
"+=",
"CONSTRAINT_LEN",
"(",
"c",
",",
"constraints",
")",
")",
"if",
"(",
"c",
"==",
"'",
"'",
"||",
"!",
"recog_data",
".",
"alternative_enabled_p",
"[",
"curr_alt",
"]",
")",
"ignore_p",
"=",
"true",
";",
"else",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"curr_alt",
"++",
";",
"ignore_p",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"!",
"ignore_p",
")",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"case",
"'",
"\\t",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"CONSTANT_P",
"(",
"op",
")",
"||",
"(",
"equiv_const",
"!=",
"NULL_RTX",
"&&",
"CONSTANT_P",
"(",
"equiv_const",
")",
")",
")",
"return",
"NO_REGS",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"CONST_INT_P",
"(",
"op",
")",
"||",
"(",
"GET_CODE",
"(",
"op",
")",
"==",
"CONST_DOUBLE",
"&&",
"GET_MODE",
"(",
"op",
")",
"==",
"VOIDmode",
")",
"||",
"(",
"equiv_const",
"!=",
"NULL_RTX",
"&&",
"(",
"CONST_INT_P",
"(",
"equiv_const",
")",
"||",
"(",
"GET_CODE",
"(",
"equiv_const",
")",
"==",
"CONST_DOUBLE",
"&&",
"GET_MODE",
"(",
"equiv_const",
")",
"==",
"VOIDmode",
")",
")",
")",
")",
"return",
"NO_REGS",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"(",
"CONSTANT_P",
"(",
"op",
")",
"&&",
"!",
"CONST_INT_P",
"(",
"op",
")",
"&&",
"(",
"GET_CODE",
"(",
"op",
")",
"!=",
"CONST_DOUBLE",
"||",
"GET_MODE",
"(",
"op",
")",
"!=",
"VOIDmode",
")",
")",
"||",
"(",
"equiv_const",
"!=",
"NULL_RTX",
"&&",
"CONSTANT_P",
"(",
"equiv_const",
")",
"&&",
"!",
"CONST_INT_P",
"(",
"equiv_const",
")",
"&&",
"(",
"GET_CODE",
"(",
"equiv_const",
")",
"!=",
"CONST_DOUBLE",
"||",
"GET_MODE",
"(",
"equiv_const",
")",
"!=",
"VOIDmode",
")",
")",
")",
"return",
"NO_REGS",
";",
"break",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"if",
"(",
"(",
"CONST_INT_P",
"(",
"op",
")",
"&&",
"CONST_OK_FOR_CONSTRAINT_P",
"(",
"INTVAL",
"(",
"op",
")",
",",
"c",
",",
"constraints",
")",
")",
"||",
"(",
"equiv_const",
"!=",
"NULL_RTX",
"&&",
"CONST_INT_P",
"(",
"equiv_const",
")",
"&&",
"CONST_OK_FOR_CONSTRAINT_P",
"(",
"INTVAL",
"(",
"equiv_const",
")",
",",
"c",
",",
"constraints",
")",
")",
")",
"return",
"NO_REGS",
";",
"break",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"if",
"(",
"GET_CODE",
"(",
"op",
")",
"==",
"CONST_DOUBLE",
"||",
"(",
"GET_CODE",
"(",
"op",
")",
"==",
"CONST_VECTOR",
"&&",
"GET_MODE_CLASS",
"(",
"GET_MODE",
"(",
"op",
")",
")",
"==",
"MODE_VECTOR_FLOAT",
")",
"||",
"(",
"equiv_const",
"!=",
"NULL_RTX",
"&&",
"(",
"GET_CODE",
"(",
"equiv_const",
")",
"==",
"CONST_DOUBLE",
"||",
"(",
"GET_CODE",
"(",
"equiv_const",
")",
"==",
"CONST_VECTOR",
"&&",
"(",
"GET_MODE_CLASS",
"(",
"GET_MODE",
"(",
"equiv_const",
")",
")",
"==",
"MODE_VECTOR_FLOAT",
")",
")",
")",
")",
")",
"return",
"NO_REGS",
";",
"break",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"if",
"(",
"(",
"GET_CODE",
"(",
"op",
")",
"==",
"CONST_DOUBLE",
"&&",
"CONST_DOUBLE_OK_FOR_CONSTRAINT_P",
"(",
"op",
",",
"c",
",",
"constraints",
")",
")",
"||",
"(",
"equiv_const",
"!=",
"NULL_RTX",
"&&",
"GET_CODE",
"(",
"equiv_const",
")",
"==",
"CONST_DOUBLE",
"&&",
"CONST_DOUBLE_OK_FOR_CONSTRAINT_P",
"(",
"equiv_const",
",",
"c",
",",
"constraints",
")",
")",
")",
"return",
"NO_REGS",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"next_cl",
"=",
"(",
"c",
"==",
"'",
"'",
"?",
"GENERAL_REGS",
":",
"REG_CLASS_FROM_CONSTRAINT",
"(",
"c",
",",
"constraints",
")",
")",
";",
"if",
"(",
"(",
"cl",
"!=",
"NO_REGS",
"&&",
"next_cl",
"!=",
"cl",
")",
"||",
"(",
"ira_available_class_regs",
"[",
"next_cl",
"]",
">",
"ira_reg_class_max_nregs",
"[",
"next_cl",
"]",
"[",
"GET_MODE",
"(",
"op",
")",
"]",
")",
")",
"return",
"NO_REGS",
";",
"cl",
"=",
"next_cl",
";",
"break",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"next_cl",
"=",
"single_reg_class",
"(",
"recog_data",
".",
"constraints",
"[",
"c",
"-",
"'",
"'",
"]",
",",
"recog_data",
".",
"operand",
"[",
"c",
"-",
"'",
"'",
"]",
",",
"NULL_RTX",
")",
";",
"if",
"(",
"(",
"cl",
"!=",
"NO_REGS",
"&&",
"next_cl",
"!=",
"cl",
")",
"||",
"next_cl",
"==",
"NO_REGS",
"||",
"(",
"ira_available_class_regs",
"[",
"next_cl",
"]",
">",
"ira_reg_class_max_nregs",
"[",
"next_cl",
"]",
"[",
"GET_MODE",
"(",
"op",
")",
"]",
")",
")",
"return",
"NO_REGS",
";",
"cl",
"=",
"next_cl",
";",
"break",
";",
"default",
":",
"return",
"NO_REGS",
";",
"}",
"return",
"cl",
";",
"}"
] | Checks that CONSTRAINTS permits to use only one hard register. | [
"Checks",
"that",
"CONSTRAINTS",
"permits",
"to",
"use",
"only",
"one",
"hard",
"register",
"."
] | [
"/* ??? what about memory */"
] | [
{
"param": "constraints",
"type": "char"
},
{
"param": "op",
"type": "rtx"
},
{
"param": "equiv_const",
"type": "rtx"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "constraints",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "equiv_const",
"type": "rtx",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | single_reg_operand_class | null | static enum reg_class
single_reg_operand_class (int op_num)
{
if (op_num < 0 || recog_data.n_alternatives == 0)
return NO_REGS;
return single_reg_class (recog_data.constraints[op_num],
recog_data.operand[op_num], NULL_RTX);
} | /* The function checks that operand OP_NUM of the current insn can use
only one hard register. If it is so, the function returns the
class of the hard register. Otherwise it returns NO_REGS. */ | The function checks that operand OP_NUM of the current insn can use
only one hard register. If it is so, the function returns the
class of the hard register. Otherwise it returns NO_REGS. | [
"The",
"function",
"checks",
"that",
"operand",
"OP_NUM",
"of",
"the",
"current",
"insn",
"can",
"use",
"only",
"one",
"hard",
"register",
".",
"If",
"it",
"is",
"so",
"the",
"function",
"returns",
"the",
"class",
"of",
"the",
"hard",
"register",
".",
"Otherwise",
"it",
"returns",
"NO_REGS",
"."
] | static enum reg_class
single_reg_operand_class (int op_num)
{
if (op_num < 0 || recog_data.n_alternatives == 0)
return NO_REGS;
return single_reg_class (recog_data.constraints[op_num],
recog_data.operand[op_num], NULL_RTX);
} | [
"static",
"enum",
"reg_class",
"single_reg_operand_class",
"(",
"int",
"op_num",
")",
"{",
"if",
"(",
"op_num",
"<",
"0",
"||",
"recog_data",
".",
"n_alternatives",
"==",
"0",
")",
"return",
"NO_REGS",
";",
"return",
"single_reg_class",
"(",
"recog_data",
".",
"constraints",
"[",
"op_num",
"]",
",",
"recog_data",
".",
"operand",
"[",
"op_num",
"]",
",",
"NULL_RTX",
")",
";",
"}"
] | The function checks that operand OP_NUM of the current insn can use
only one hard register. | [
"The",
"function",
"checks",
"that",
"operand",
"OP_NUM",
"of",
"the",
"current",
"insn",
"can",
"use",
"only",
"one",
"hard",
"register",
"."
] | [] | [
{
"param": "op_num",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "op_num",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | ira_implicitly_set_insn_hard_regs | void | void
ira_implicitly_set_insn_hard_regs (HARD_REG_SET *set)
{
int i, curr_alt, c, regno = 0;
bool ignore_p;
enum reg_class cl;
rtx op;
enum machine_mode mode;
CLEAR_HARD_REG_SET (*set);
for (i = 0; i < recog_data.n_operands; i++)
{
op = recog_data.operand[i];
if (GET_CODE (op) == SUBREG)
op = SUBREG_REG (op);
if (GET_CODE (op) == SCRATCH
|| (REG_P (op) && (regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER))
{
const char *p = recog_data.constraints[i];
mode = (GET_CODE (op) == SCRATCH
? GET_MODE (op) : PSEUDO_REGNO_MODE (regno));
cl = NO_REGS;
for (ignore_p = false, curr_alt = 0;
(c = *p);
p += CONSTRAINT_LEN (c, p))
if (c == '#' || !recog_data.alternative_enabled_p[curr_alt])
ignore_p = true;
else if (c == ',')
{
curr_alt++;
ignore_p = false;
}
else if (! ignore_p)
switch (c)
{
case 'r':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'h': case 'j': case 'k': case 'l':
case 'q': case 't': case 'u':
case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D':
case 'Q': case 'R': case 'S': case 'T': case 'U':
case 'W': case 'Y': case 'Z':
cl = (c == 'r'
? GENERAL_REGS
: REG_CLASS_FROM_CONSTRAINT (c, p));
if (cl != NO_REGS
/* There is no register pressure problem if all of the
regs in this class are fixed. */
&& ira_available_class_regs[cl] != 0
&& (ira_available_class_regs[cl]
<= ira_reg_class_max_nregs[cl][mode]))
IOR_HARD_REG_SET (*set, reg_class_contents[cl]);
break;
}
}
}
} | /* The function sets up hard register set *SET to hard registers which
might be used by insn reloads because the constraints are too
strict. */ | The function sets up hard register set *SET to hard registers which
might be used by insn reloads because the constraints are too
strict. | [
"The",
"function",
"sets",
"up",
"hard",
"register",
"set",
"*",
"SET",
"to",
"hard",
"registers",
"which",
"might",
"be",
"used",
"by",
"insn",
"reloads",
"because",
"the",
"constraints",
"are",
"too",
"strict",
"."
] | void
ira_implicitly_set_insn_hard_regs (HARD_REG_SET *set)
{
int i, curr_alt, c, regno = 0;
bool ignore_p;
enum reg_class cl;
rtx op;
enum machine_mode mode;
CLEAR_HARD_REG_SET (*set);
for (i = 0; i < recog_data.n_operands; i++)
{
op = recog_data.operand[i];
if (GET_CODE (op) == SUBREG)
op = SUBREG_REG (op);
if (GET_CODE (op) == SCRATCH
|| (REG_P (op) && (regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER))
{
const char *p = recog_data.constraints[i];
mode = (GET_CODE (op) == SCRATCH
? GET_MODE (op) : PSEUDO_REGNO_MODE (regno));
cl = NO_REGS;
for (ignore_p = false, curr_alt = 0;
(c = *p);
p += CONSTRAINT_LEN (c, p))
if (c == '#' || !recog_data.alternative_enabled_p[curr_alt])
ignore_p = true;
else if (c == ',')
{
curr_alt++;
ignore_p = false;
}
else if (! ignore_p)
switch (c)
{
case 'r':
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
case 'h': case 'j': case 'k': case 'l':
case 'q': case 't': case 'u':
case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D':
case 'Q': case 'R': case 'S': case 'T': case 'U':
case 'W': case 'Y': case 'Z':
cl = (c == 'r'
? GENERAL_REGS
: REG_CLASS_FROM_CONSTRAINT (c, p));
if (cl != NO_REGS
&& ira_available_class_regs[cl] != 0
&& (ira_available_class_regs[cl]
<= ira_reg_class_max_nregs[cl][mode]))
IOR_HARD_REG_SET (*set, reg_class_contents[cl]);
break;
}
}
}
} | [
"void",
"ira_implicitly_set_insn_hard_regs",
"(",
"HARD_REG_SET",
"*",
"set",
")",
"{",
"int",
"i",
",",
"curr_alt",
",",
"c",
",",
"regno",
"=",
"0",
";",
"bool",
"ignore_p",
";",
"enum",
"reg_class",
"cl",
";",
"rtx",
"op",
";",
"enum",
"machine_mode",
"mode",
";",
"CLEAR_HARD_REG_SET",
"(",
"*",
"set",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"recog_data",
".",
"n_operands",
";",
"i",
"++",
")",
"{",
"op",
"=",
"recog_data",
".",
"operand",
"[",
"i",
"]",
";",
"if",
"(",
"GET_CODE",
"(",
"op",
")",
"==",
"SUBREG",
")",
"op",
"=",
"SUBREG_REG",
"(",
"op",
")",
";",
"if",
"(",
"GET_CODE",
"(",
"op",
")",
"==",
"SCRATCH",
"||",
"(",
"REG_P",
"(",
"op",
")",
"&&",
"(",
"regno",
"=",
"REGNO",
"(",
"op",
")",
")",
">=",
"FIRST_PSEUDO_REGISTER",
")",
")",
"{",
"const",
"char",
"*",
"p",
"=",
"recog_data",
".",
"constraints",
"[",
"i",
"]",
";",
"mode",
"=",
"(",
"GET_CODE",
"(",
"op",
")",
"==",
"SCRATCH",
"?",
"GET_MODE",
"(",
"op",
")",
":",
"PSEUDO_REGNO_MODE",
"(",
"regno",
")",
")",
";",
"cl",
"=",
"NO_REGS",
";",
"for",
"(",
"ignore_p",
"=",
"false",
",",
"curr_alt",
"=",
"0",
";",
"(",
"c",
"=",
"*",
"p",
")",
";",
"p",
"+=",
"CONSTRAINT_LEN",
"(",
"c",
",",
"p",
")",
")",
"if",
"(",
"c",
"==",
"'",
"'",
"||",
"!",
"recog_data",
".",
"alternative_enabled_p",
"[",
"curr_alt",
"]",
")",
"ignore_p",
"=",
"true",
";",
"else",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"curr_alt",
"++",
";",
"ignore_p",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"!",
"ignore_p",
")",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"cl",
"=",
"(",
"c",
"==",
"'",
"'",
"?",
"GENERAL_REGS",
":",
"REG_CLASS_FROM_CONSTRAINT",
"(",
"c",
",",
"p",
")",
")",
";",
"if",
"(",
"cl",
"!=",
"NO_REGS",
"&&",
"ira_available_class_regs",
"[",
"cl",
"]",
"!=",
"0",
"&&",
"(",
"ira_available_class_regs",
"[",
"cl",
"]",
"<=",
"ira_reg_class_max_nregs",
"[",
"cl",
"]",
"[",
"mode",
"]",
")",
")",
"IOR_HARD_REG_SET",
"(",
"*",
"set",
",",
"reg_class_contents",
"[",
"cl",
"]",
")",
";",
"break",
";",
"}",
"}",
"}",
"}"
] | The function sets up hard register set *SET to hard registers which
might be used by insn reloads because the constraints are too
strict. | [
"The",
"function",
"sets",
"up",
"hard",
"register",
"set",
"*",
"SET",
"to",
"hard",
"registers",
"which",
"might",
"be",
"used",
"by",
"insn",
"reloads",
"because",
"the",
"constraints",
"are",
"too",
"strict",
"."
] | [
"/* There is no register pressure problem if all of the\n\t\t\t regs in this class are fixed. */"
] | [
{
"param": "set",
"type": "HARD_REG_SET"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "set",
"type": "HARD_REG_SET",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | process_single_reg_class_operands | void | static void
process_single_reg_class_operands (bool in_p, int freq)
{
int i, regno;
unsigned int px;
enum reg_class cl;
rtx operand;
ira_allocno_t operand_a, a;
for (i = 0; i < recog_data.n_operands; i++)
{
operand = recog_data.operand[i];
if (in_p && recog_data.operand_type[i] != OP_IN
&& recog_data.operand_type[i] != OP_INOUT)
continue;
if (! in_p && recog_data.operand_type[i] != OP_OUT
&& recog_data.operand_type[i] != OP_INOUT)
continue;
cl = single_reg_operand_class (i);
if (cl == NO_REGS)
continue;
operand_a = NULL;
if (GET_CODE (operand) == SUBREG)
operand = SUBREG_REG (operand);
if (REG_P (operand)
&& (regno = REGNO (operand)) >= FIRST_PSEUDO_REGISTER)
{
enum reg_class aclass;
operand_a = ira_curr_regno_allocno_map[regno];
aclass = ALLOCNO_CLASS (operand_a);
if (ira_class_subset_p[cl][aclass]
&& ira_class_hard_regs_num[cl] != 0)
{
/* View the desired allocation of OPERAND as:
(REG:YMODE YREGNO),
a simplification of:
(subreg:YMODE (reg:XMODE XREGNO) OFFSET). */
enum machine_mode ymode, xmode;
int xregno, yregno;
HOST_WIDE_INT offset;
xmode = recog_data.operand_mode[i];
xregno = ira_class_hard_regs[cl][0];
ymode = ALLOCNO_MODE (operand_a);
offset = subreg_lowpart_offset (ymode, xmode);
yregno = simplify_subreg_regno (xregno, xmode, offset, ymode);
if (yregno >= 0
&& ira_class_hard_reg_index[aclass][yregno] >= 0)
{
int cost;
ira_allocate_and_set_costs
(&ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a),
aclass, 0);
ira_init_register_move_cost_if_necessary (xmode);
cost = freq * (in_p
? ira_register_move_cost[xmode][aclass][cl]
: ira_register_move_cost[xmode][cl][aclass]);
ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a)
[ira_class_hard_reg_index[aclass][yregno]] -= cost;
}
}
}
EXECUTE_IF_SET_IN_SPARSESET (objects_live, px)
{
ira_object_t obj = ira_object_id_map[px];
a = OBJECT_ALLOCNO (obj);
if (a != operand_a)
{
/* We could increase costs of A instead of making it
conflicting with the hard register. But it works worse
because it will be spilled in reload in anyway. */
IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj),
reg_class_contents[cl]);
IOR_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj),
reg_class_contents[cl]);
}
}
}
} | /* Processes input operands, if IN_P, or output operands otherwise of
the current insn with FREQ to find allocno which can use only one
hard register and makes other currently living allocnos conflicting
with the hard register. */ | Processes input operands, if IN_P, or output operands otherwise of
the current insn with FREQ to find allocno which can use only one
hard register and makes other currently living allocnos conflicting
with the hard register. | [
"Processes",
"input",
"operands",
"if",
"IN_P",
"or",
"output",
"operands",
"otherwise",
"of",
"the",
"current",
"insn",
"with",
"FREQ",
"to",
"find",
"allocno",
"which",
"can",
"use",
"only",
"one",
"hard",
"register",
"and",
"makes",
"other",
"currently",
"living",
"allocnos",
"conflicting",
"with",
"the",
"hard",
"register",
"."
] | static void
process_single_reg_class_operands (bool in_p, int freq)
{
int i, regno;
unsigned int px;
enum reg_class cl;
rtx operand;
ira_allocno_t operand_a, a;
for (i = 0; i < recog_data.n_operands; i++)
{
operand = recog_data.operand[i];
if (in_p && recog_data.operand_type[i] != OP_IN
&& recog_data.operand_type[i] != OP_INOUT)
continue;
if (! in_p && recog_data.operand_type[i] != OP_OUT
&& recog_data.operand_type[i] != OP_INOUT)
continue;
cl = single_reg_operand_class (i);
if (cl == NO_REGS)
continue;
operand_a = NULL;
if (GET_CODE (operand) == SUBREG)
operand = SUBREG_REG (operand);
if (REG_P (operand)
&& (regno = REGNO (operand)) >= FIRST_PSEUDO_REGISTER)
{
enum reg_class aclass;
operand_a = ira_curr_regno_allocno_map[regno];
aclass = ALLOCNO_CLASS (operand_a);
if (ira_class_subset_p[cl][aclass]
&& ira_class_hard_regs_num[cl] != 0)
{
enum machine_mode ymode, xmode;
int xregno, yregno;
HOST_WIDE_INT offset;
xmode = recog_data.operand_mode[i];
xregno = ira_class_hard_regs[cl][0];
ymode = ALLOCNO_MODE (operand_a);
offset = subreg_lowpart_offset (ymode, xmode);
yregno = simplify_subreg_regno (xregno, xmode, offset, ymode);
if (yregno >= 0
&& ira_class_hard_reg_index[aclass][yregno] >= 0)
{
int cost;
ira_allocate_and_set_costs
(&ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a),
aclass, 0);
ira_init_register_move_cost_if_necessary (xmode);
cost = freq * (in_p
? ira_register_move_cost[xmode][aclass][cl]
: ira_register_move_cost[xmode][cl][aclass]);
ALLOCNO_CONFLICT_HARD_REG_COSTS (operand_a)
[ira_class_hard_reg_index[aclass][yregno]] -= cost;
}
}
}
EXECUTE_IF_SET_IN_SPARSESET (objects_live, px)
{
ira_object_t obj = ira_object_id_map[px];
a = OBJECT_ALLOCNO (obj);
if (a != operand_a)
{
IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj),
reg_class_contents[cl]);
IOR_HARD_REG_SET (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj),
reg_class_contents[cl]);
}
}
}
} | [
"static",
"void",
"process_single_reg_class_operands",
"(",
"bool",
"in_p",
",",
"int",
"freq",
")",
"{",
"int",
"i",
",",
"regno",
";",
"unsigned",
"int",
"px",
";",
"enum",
"reg_class",
"cl",
";",
"rtx",
"operand",
";",
"ira_allocno_t",
"operand_a",
",",
"a",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"recog_data",
".",
"n_operands",
";",
"i",
"++",
")",
"{",
"operand",
"=",
"recog_data",
".",
"operand",
"[",
"i",
"]",
";",
"if",
"(",
"in_p",
"&&",
"recog_data",
".",
"operand_type",
"[",
"i",
"]",
"!=",
"OP_IN",
"&&",
"recog_data",
".",
"operand_type",
"[",
"i",
"]",
"!=",
"OP_INOUT",
")",
"continue",
";",
"if",
"(",
"!",
"in_p",
"&&",
"recog_data",
".",
"operand_type",
"[",
"i",
"]",
"!=",
"OP_OUT",
"&&",
"recog_data",
".",
"operand_type",
"[",
"i",
"]",
"!=",
"OP_INOUT",
")",
"continue",
";",
"cl",
"=",
"single_reg_operand_class",
"(",
"i",
")",
";",
"if",
"(",
"cl",
"==",
"NO_REGS",
")",
"continue",
";",
"operand_a",
"=",
"NULL",
";",
"if",
"(",
"GET_CODE",
"(",
"operand",
")",
"==",
"SUBREG",
")",
"operand",
"=",
"SUBREG_REG",
"(",
"operand",
")",
";",
"if",
"(",
"REG_P",
"(",
"operand",
")",
"&&",
"(",
"regno",
"=",
"REGNO",
"(",
"operand",
")",
")",
">=",
"FIRST_PSEUDO_REGISTER",
")",
"{",
"enum",
"reg_class",
"aclass",
";",
"operand_a",
"=",
"ira_curr_regno_allocno_map",
"[",
"regno",
"]",
";",
"aclass",
"=",
"ALLOCNO_CLASS",
"(",
"operand_a",
")",
";",
"if",
"(",
"ira_class_subset_p",
"[",
"cl",
"]",
"[",
"aclass",
"]",
"&&",
"ira_class_hard_regs_num",
"[",
"cl",
"]",
"!=",
"0",
")",
"{",
"enum",
"machine_mode",
"ymode",
",",
"xmode",
";",
"int",
"xregno",
",",
"yregno",
";",
"HOST_WIDE_INT",
"offset",
";",
"xmode",
"=",
"recog_data",
".",
"operand_mode",
"[",
"i",
"]",
";",
"xregno",
"=",
"ira_class_hard_regs",
"[",
"cl",
"]",
"[",
"0",
"]",
";",
"ymode",
"=",
"ALLOCNO_MODE",
"(",
"operand_a",
")",
";",
"offset",
"=",
"subreg_lowpart_offset",
"(",
"ymode",
",",
"xmode",
")",
";",
"yregno",
"=",
"simplify_subreg_regno",
"(",
"xregno",
",",
"xmode",
",",
"offset",
",",
"ymode",
")",
";",
"if",
"(",
"yregno",
">=",
"0",
"&&",
"ira_class_hard_reg_index",
"[",
"aclass",
"]",
"[",
"yregno",
"]",
">=",
"0",
")",
"{",
"int",
"cost",
";",
"ira_allocate_and_set_costs",
"(",
"&",
"ALLOCNO_CONFLICT_HARD_REG_COSTS",
"(",
"operand_a",
")",
",",
"aclass",
",",
"0",
")",
";",
"ira_init_register_move_cost_if_necessary",
"(",
"xmode",
")",
";",
"cost",
"=",
"freq",
"*",
"(",
"in_p",
"?",
"ira_register_move_cost",
"[",
"xmode",
"]",
"[",
"aclass",
"]",
"[",
"cl",
"]",
":",
"ira_register_move_cost",
"[",
"xmode",
"]",
"[",
"cl",
"]",
"[",
"aclass",
"]",
")",
";",
"ALLOCNO_CONFLICT_HARD_REG_COSTS",
"(",
"operand_a",
")",
"[",
"ira_class_hard_reg_index",
"[",
"aclass",
"]",
"[",
"yregno",
"]",
"]",
"-=",
"cost",
";",
"}",
"}",
"}",
"EXECUTE_IF_SET_IN_SPARSESET",
"(",
"objects_live",
",",
"px",
")",
"",
"{",
"ira_object_t",
"obj",
"=",
"ira_object_id_map",
"[",
"px",
"]",
";",
"a",
"=",
"OBJECT_ALLOCNO",
"(",
"obj",
")",
";",
"if",
"(",
"a",
"!=",
"operand_a",
")",
"{",
"IOR_HARD_REG_SET",
"(",
"OBJECT_CONFLICT_HARD_REGS",
"(",
"obj",
")",
",",
"reg_class_contents",
"[",
"cl",
"]",
")",
";",
"IOR_HARD_REG_SET",
"(",
"OBJECT_TOTAL_CONFLICT_HARD_REGS",
"(",
"obj",
")",
",",
"reg_class_contents",
"[",
"cl",
"]",
")",
";",
"}",
"}",
"}",
"}"
] | Processes input operands, if IN_P, or output operands otherwise of
the current insn with FREQ to find allocno which can use only one
hard register and makes other currently living allocnos conflicting
with the hard register. | [
"Processes",
"input",
"operands",
"if",
"IN_P",
"or",
"output",
"operands",
"otherwise",
"of",
"the",
"current",
"insn",
"with",
"FREQ",
"to",
"find",
"allocno",
"which",
"can",
"use",
"only",
"one",
"hard",
"register",
"and",
"makes",
"other",
"currently",
"living",
"allocnos",
"conflicting",
"with",
"the",
"hard",
"register",
"."
] | [
"/* View the desired allocation of OPERAND as:\n\n\t\t (REG:YMODE YREGNO),\n\n\t\t a simplification of:\n\n\t\t (subreg:YMODE (reg:XMODE XREGNO) OFFSET). */",
"/* We could increase costs of A instead of making it\n\t\t conflicting with the hard register. But it works worse\n\t\t because it will be spilled in reload in anyway. */"
] | [
{
"param": "in_p",
"type": "bool"
},
{
"param": "freq",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "in_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "freq",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | bb_has_abnormal_call_pred | bool | static bool
bb_has_abnormal_call_pred (basic_block bb)
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->preds)
{
if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
return true;
}
return false;
} | /* Return true when one of the predecessor edges of BB is marked with
EDGE_ABNORMAL_CALL or EDGE_EH. */ | Return true when one of the predecessor edges of BB is marked with
EDGE_ABNORMAL_CALL or EDGE_EH. | [
"Return",
"true",
"when",
"one",
"of",
"the",
"predecessor",
"edges",
"of",
"BB",
"is",
"marked",
"with",
"EDGE_ABNORMAL_CALL",
"or",
"EDGE_EH",
"."
] | static bool
bb_has_abnormal_call_pred (basic_block bb)
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->preds)
{
if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
return true;
}
return false;
} | [
"static",
"bool",
"bb_has_abnormal_call_pred",
"(",
"basic_block",
"bb",
")",
"{",
"edge",
"e",
";",
"edge_iterator",
"ei",
";",
"FOR_EACH_EDGE",
"(",
"e",
",",
"ei",
",",
"bb",
"->",
"preds",
")",
"",
"{",
"if",
"(",
"e",
"->",
"flags",
"&",
"(",
"EDGE_ABNORMAL_CALL",
"|",
"EDGE_EH",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Return true when one of the predecessor edges of BB is marked with
EDGE_ABNORMAL_CALL or EDGE_EH. | [
"Return",
"true",
"when",
"one",
"of",
"the",
"predecessor",
"edges",
"of",
"BB",
"is",
"marked",
"with",
"EDGE_ABNORMAL_CALL",
"or",
"EDGE_EH",
"."
] | [] | [
{
"param": "bb",
"type": "basic_block"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bb",
"type": "basic_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | ira_rebuild_start_finish_chains | void | void
ira_rebuild_start_finish_chains (void)
{
ira_free (ira_finish_point_ranges);
ira_free (ira_start_point_ranges);
create_start_finish_chains ();
} | /* Rebuild IRA_START_POINT_RANGES and IRA_FINISH_POINT_RANGES after
new live ranges and program points were added as a result if new
insn generation. */ | Rebuild IRA_START_POINT_RANGES and IRA_FINISH_POINT_RANGES after
new live ranges and program points were added as a result if new
insn generation. | [
"Rebuild",
"IRA_START_POINT_RANGES",
"and",
"IRA_FINISH_POINT_RANGES",
"after",
"new",
"live",
"ranges",
"and",
"program",
"points",
"were",
"added",
"as",
"a",
"result",
"if",
"new",
"insn",
"generation",
"."
] | void
ira_rebuild_start_finish_chains (void)
{
ira_free (ira_finish_point_ranges);
ira_free (ira_start_point_ranges);
create_start_finish_chains ();
} | [
"void",
"ira_rebuild_start_finish_chains",
"(",
"void",
")",
"{",
"ira_free",
"(",
"ira_finish_point_ranges",
")",
";",
"ira_free",
"(",
"ira_start_point_ranges",
")",
";",
"create_start_finish_chains",
"(",
")",
";",
"}"
] | Rebuild IRA_START_POINT_RANGES and IRA_FINISH_POINT_RANGES after
new live ranges and program points were added as a result if new
insn generation. | [
"Rebuild",
"IRA_START_POINT_RANGES",
"and",
"IRA_FINISH_POINT_RANGES",
"after",
"new",
"live",
"ranges",
"and",
"program",
"points",
"were",
"added",
"as",
"a",
"result",
"if",
"new",
"insn",
"generation",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | remove_some_program_points_and_update_live_ranges | void | static void
remove_some_program_points_and_update_live_ranges (void)
{
unsigned i;
int n;
int *map;
ira_object_t obj;
ira_object_iterator oi;
live_range_t r;
sbitmap born_or_dead, born, dead;
sbitmap_iterator sbi;
bool born_p, dead_p, prev_born_p, prev_dead_p;
born = sbitmap_alloc (ira_max_point);
dead = sbitmap_alloc (ira_max_point);
sbitmap_zero (born);
sbitmap_zero (dead);
FOR_EACH_OBJECT (obj, oi)
for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
{
ira_assert (r->start <= r->finish);
SET_BIT (born, r->start);
SET_BIT (dead, r->finish);
}
born_or_dead = sbitmap_alloc (ira_max_point);
sbitmap_a_or_b (born_or_dead, born, dead);
map = (int *) ira_allocate (sizeof (int) * ira_max_point);
n = -1;
prev_born_p = prev_dead_p = false;
EXECUTE_IF_SET_IN_SBITMAP (born_or_dead, 0, i, sbi)
{
born_p = TEST_BIT (born, i);
dead_p = TEST_BIT (dead, i);
if ((prev_born_p && ! prev_dead_p && born_p && ! dead_p)
|| (prev_dead_p && ! prev_born_p && dead_p && ! born_p))
map[i] = n;
else
map[i] = ++n;
prev_born_p = born_p;
prev_dead_p = dead_p;
}
sbitmap_free (born_or_dead);
sbitmap_free (born);
sbitmap_free (dead);
n++;
if (internal_flag_ira_verbose > 1 && ira_dump_file != NULL)
fprintf (ira_dump_file, "Compressing live ranges: from %d to %d - %d%%\n",
ira_max_point, n, 100 * n / ira_max_point);
ira_max_point = n;
FOR_EACH_OBJECT (obj, oi)
for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
{
r->start = map[r->start];
r->finish = map[r->finish];
}
ira_free (map);
} | /* Compress allocno live ranges by removing program points where
nothing happens. */ | Compress allocno live ranges by removing program points where
nothing happens. | [
"Compress",
"allocno",
"live",
"ranges",
"by",
"removing",
"program",
"points",
"where",
"nothing",
"happens",
"."
] | static void
remove_some_program_points_and_update_live_ranges (void)
{
unsigned i;
int n;
int *map;
ira_object_t obj;
ira_object_iterator oi;
live_range_t r;
sbitmap born_or_dead, born, dead;
sbitmap_iterator sbi;
bool born_p, dead_p, prev_born_p, prev_dead_p;
born = sbitmap_alloc (ira_max_point);
dead = sbitmap_alloc (ira_max_point);
sbitmap_zero (born);
sbitmap_zero (dead);
FOR_EACH_OBJECT (obj, oi)
for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
{
ira_assert (r->start <= r->finish);
SET_BIT (born, r->start);
SET_BIT (dead, r->finish);
}
born_or_dead = sbitmap_alloc (ira_max_point);
sbitmap_a_or_b (born_or_dead, born, dead);
map = (int *) ira_allocate (sizeof (int) * ira_max_point);
n = -1;
prev_born_p = prev_dead_p = false;
EXECUTE_IF_SET_IN_SBITMAP (born_or_dead, 0, i, sbi)
{
born_p = TEST_BIT (born, i);
dead_p = TEST_BIT (dead, i);
if ((prev_born_p && ! prev_dead_p && born_p && ! dead_p)
|| (prev_dead_p && ! prev_born_p && dead_p && ! born_p))
map[i] = n;
else
map[i] = ++n;
prev_born_p = born_p;
prev_dead_p = dead_p;
}
sbitmap_free (born_or_dead);
sbitmap_free (born);
sbitmap_free (dead);
n++;
if (internal_flag_ira_verbose > 1 && ira_dump_file != NULL)
fprintf (ira_dump_file, "Compressing live ranges: from %d to %d - %d%%\n",
ira_max_point, n, 100 * n / ira_max_point);
ira_max_point = n;
FOR_EACH_OBJECT (obj, oi)
for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
{
r->start = map[r->start];
r->finish = map[r->finish];
}
ira_free (map);
} | [
"static",
"void",
"remove_some_program_points_and_update_live_ranges",
"(",
"void",
")",
"{",
"unsigned",
"i",
";",
"int",
"n",
";",
"int",
"*",
"map",
";",
"ira_object_t",
"obj",
";",
"ira_object_iterator",
"oi",
";",
"live_range_t",
"r",
";",
"sbitmap",
"born_or_dead",
",",
"born",
",",
"dead",
";",
"sbitmap_iterator",
"sbi",
";",
"bool",
"born_p",
",",
"dead_p",
",",
"prev_born_p",
",",
"prev_dead_p",
";",
"born",
"=",
"sbitmap_alloc",
"(",
"ira_max_point",
")",
";",
"dead",
"=",
"sbitmap_alloc",
"(",
"ira_max_point",
")",
";",
"sbitmap_zero",
"(",
"born",
")",
";",
"sbitmap_zero",
"(",
"dead",
")",
";",
"FOR_EACH_OBJECT",
"(",
"obj",
",",
"oi",
")",
"",
"for",
"(",
"r",
"=",
"OBJECT_LIVE_RANGES",
"(",
"obj",
")",
";",
"r",
"!=",
"NULL",
";",
"r",
"=",
"r",
"->",
"next",
")",
"{",
"ira_assert",
"(",
"r",
"->",
"start",
"<=",
"r",
"->",
"finish",
")",
";",
"SET_BIT",
"(",
"born",
",",
"r",
"->",
"start",
")",
";",
"SET_BIT",
"(",
"dead",
",",
"r",
"->",
"finish",
")",
";",
"}",
"born_or_dead",
"=",
"sbitmap_alloc",
"(",
"ira_max_point",
")",
";",
"sbitmap_a_or_b",
"(",
"born_or_dead",
",",
"born",
",",
"dead",
")",
";",
"map",
"=",
"(",
"int",
"*",
")",
"ira_allocate",
"(",
"sizeof",
"(",
"int",
")",
"*",
"ira_max_point",
")",
";",
"n",
"=",
"-1",
";",
"prev_born_p",
"=",
"prev_dead_p",
"=",
"false",
";",
"EXECUTE_IF_SET_IN_SBITMAP",
"(",
"born_or_dead",
",",
"0",
",",
"i",
",",
"sbi",
")",
"",
"{",
"born_p",
"=",
"TEST_BIT",
"(",
"born",
",",
"i",
")",
";",
"dead_p",
"=",
"TEST_BIT",
"(",
"dead",
",",
"i",
")",
";",
"if",
"(",
"(",
"prev_born_p",
"&&",
"!",
"prev_dead_p",
"&&",
"born_p",
"&&",
"!",
"dead_p",
")",
"||",
"(",
"prev_dead_p",
"&&",
"!",
"prev_born_p",
"&&",
"dead_p",
"&&",
"!",
"born_p",
")",
")",
"map",
"[",
"i",
"]",
"=",
"n",
";",
"else",
"map",
"[",
"i",
"]",
"=",
"++",
"n",
";",
"prev_born_p",
"=",
"born_p",
";",
"prev_dead_p",
"=",
"dead_p",
";",
"}",
"sbitmap_free",
"(",
"born_or_dead",
")",
";",
"sbitmap_free",
"(",
"born",
")",
";",
"sbitmap_free",
"(",
"dead",
")",
";",
"n",
"++",
";",
"if",
"(",
"internal_flag_ira_verbose",
">",
"1",
"&&",
"ira_dump_file",
"!=",
"NULL",
")",
"fprintf",
"(",
"ira_dump_file",
",",
"\"",
"\\n",
"\"",
",",
"ira_max_point",
",",
"n",
",",
"100",
"*",
"n",
"/",
"ira_max_point",
")",
";",
"ira_max_point",
"=",
"n",
";",
"FOR_EACH_OBJECT",
"(",
"obj",
",",
"oi",
")",
"",
"for",
"(",
"r",
"=",
"OBJECT_LIVE_RANGES",
"(",
"obj",
")",
";",
"r",
"!=",
"NULL",
";",
"r",
"=",
"r",
"->",
"next",
")",
"{",
"r",
"->",
"start",
"=",
"map",
"[",
"r",
"->",
"start",
"]",
";",
"r",
"->",
"finish",
"=",
"map",
"[",
"r",
"->",
"finish",
"]",
";",
"}",
"ira_free",
"(",
"map",
")",
";",
"}"
] | Compress allocno live ranges by removing program points where
nothing happens. | [
"Compress",
"allocno",
"live",
"ranges",
"by",
"removing",
"program",
"points",
"where",
"nothing",
"happens",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | ira_print_live_range_list | void | void
ira_print_live_range_list (FILE *f, live_range_t r)
{
for (; r != NULL; r = r->next)
fprintf (f, " [%d..%d]", r->start, r->finish);
fprintf (f, "\n");
} | /* Print live ranges R to file F. */ | Print live ranges R to file F. | [
"Print",
"live",
"ranges",
"R",
"to",
"file",
"F",
"."
] | void
ira_print_live_range_list (FILE *f, live_range_t r)
{
for (; r != NULL; r = r->next)
fprintf (f, " [%d..%d]", r->start, r->finish);
fprintf (f, "\n");
} | [
"void",
"ira_print_live_range_list",
"(",
"FILE",
"*",
"f",
",",
"live_range_t",
"r",
")",
"{",
"for",
"(",
";",
"r",
"!=",
"NULL",
";",
"r",
"=",
"r",
"->",
"next",
")",
"fprintf",
"(",
"f",
",",
"\"",
"\"",
",",
"r",
"->",
"start",
",",
"r",
"->",
"finish",
")",
";",
"fprintf",
"(",
"f",
",",
"\"",
"\\n",
"\"",
")",
";",
"}"
] | Print live ranges R to file F. | [
"Print",
"live",
"ranges",
"R",
"to",
"file",
"F",
"."
] | [] | [
{
"param": "f",
"type": "FILE"
},
{
"param": "r",
"type": "live_range_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r",
"type": "live_range_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | ira_debug_live_range_list | void | void
ira_debug_live_range_list (live_range_t r)
{
ira_print_live_range_list (stderr, r);
} | /* Print live ranges R to stderr. */ | Print live ranges R to stderr. | [
"Print",
"live",
"ranges",
"R",
"to",
"stderr",
"."
] | void
ira_debug_live_range_list (live_range_t r)
{
ira_print_live_range_list (stderr, r);
} | [
"void",
"ira_debug_live_range_list",
"(",
"live_range_t",
"r",
")",
"{",
"ira_print_live_range_list",
"(",
"stderr",
",",
"r",
")",
";",
"}"
] | Print live ranges R to stderr. | [
"Print",
"live",
"ranges",
"R",
"to",
"stderr",
"."
] | [] | [
{
"param": "r",
"type": "live_range_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "r",
"type": "live_range_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | print_object_live_ranges | void | static void
print_object_live_ranges (FILE *f, ira_object_t obj)
{
ira_print_live_range_list (f, OBJECT_LIVE_RANGES (obj));
} | /* Print live ranges of object OBJ to file F. */ | Print live ranges of object OBJ to file F. | [
"Print",
"live",
"ranges",
"of",
"object",
"OBJ",
"to",
"file",
"F",
"."
] | static void
print_object_live_ranges (FILE *f, ira_object_t obj)
{
ira_print_live_range_list (f, OBJECT_LIVE_RANGES (obj));
} | [
"static",
"void",
"print_object_live_ranges",
"(",
"FILE",
"*",
"f",
",",
"ira_object_t",
"obj",
")",
"{",
"ira_print_live_range_list",
"(",
"f",
",",
"OBJECT_LIVE_RANGES",
"(",
"obj",
")",
")",
";",
"}"
] | Print live ranges of object OBJ to file F. | [
"Print",
"live",
"ranges",
"of",
"object",
"OBJ",
"to",
"file",
"F",
"."
] | [] | [
{
"param": "f",
"type": "FILE"
},
{
"param": "obj",
"type": "ira_object_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "obj",
"type": "ira_object_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | print_allocno_live_ranges | void | static void
print_allocno_live_ranges (FILE *f, ira_allocno_t a)
{
int n = ALLOCNO_NUM_OBJECTS (a);
int i;
for (i = 0; i < n; i++)
{
fprintf (f, " a%d(r%d", ALLOCNO_NUM (a), ALLOCNO_REGNO (a));
if (n > 1)
fprintf (f, " [%d]", i);
fprintf (f, "):");
print_object_live_ranges (f, ALLOCNO_OBJECT (a, i));
}
} | /* Print live ranges of allocno A to file F. */ | Print live ranges of allocno A to file F. | [
"Print",
"live",
"ranges",
"of",
"allocno",
"A",
"to",
"file",
"F",
"."
] | static void
print_allocno_live_ranges (FILE *f, ira_allocno_t a)
{
int n = ALLOCNO_NUM_OBJECTS (a);
int i;
for (i = 0; i < n; i++)
{
fprintf (f, " a%d(r%d", ALLOCNO_NUM (a), ALLOCNO_REGNO (a));
if (n > 1)
fprintf (f, " [%d]", i);
fprintf (f, "):");
print_object_live_ranges (f, ALLOCNO_OBJECT (a, i));
}
} | [
"static",
"void",
"print_allocno_live_ranges",
"(",
"FILE",
"*",
"f",
",",
"ira_allocno_t",
"a",
")",
"{",
"int",
"n",
"=",
"ALLOCNO_NUM_OBJECTS",
"(",
"a",
")",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"fprintf",
"(",
"f",
",",
"\"",
"\"",
",",
"ALLOCNO_NUM",
"(",
"a",
")",
",",
"ALLOCNO_REGNO",
"(",
"a",
")",
")",
";",
"if",
"(",
"n",
">",
"1",
")",
"fprintf",
"(",
"f",
",",
"\"",
"\"",
",",
"i",
")",
";",
"fprintf",
"(",
"f",
",",
"\"",
"\"",
")",
";",
"print_object_live_ranges",
"(",
"f",
",",
"ALLOCNO_OBJECT",
"(",
"a",
",",
"i",
")",
")",
";",
"}",
"}"
] | Print live ranges of allocno A to file F. | [
"Print",
"live",
"ranges",
"of",
"allocno",
"A",
"to",
"file",
"F",
"."
] | [] | [
{
"param": "f",
"type": "FILE"
},
{
"param": "a",
"type": "ira_allocno_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "a",
"type": "ira_allocno_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | ira_debug_allocno_live_ranges | void | void
ira_debug_allocno_live_ranges (ira_allocno_t a)
{
print_allocno_live_ranges (stderr, a);
} | /* Print live ranges of allocno A to stderr. */ | Print live ranges of allocno A to stderr. | [
"Print",
"live",
"ranges",
"of",
"allocno",
"A",
"to",
"stderr",
"."
] | void
ira_debug_allocno_live_ranges (ira_allocno_t a)
{
print_allocno_live_ranges (stderr, a);
} | [
"void",
"ira_debug_allocno_live_ranges",
"(",
"ira_allocno_t",
"a",
")",
"{",
"print_allocno_live_ranges",
"(",
"stderr",
",",
"a",
")",
";",
"}"
] | Print live ranges of allocno A to stderr. | [
"Print",
"live",
"ranges",
"of",
"allocno",
"A",
"to",
"stderr",
"."
] | [] | [
{
"param": "a",
"type": "ira_allocno_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": "ira_allocno_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | print_live_ranges | void | static void
print_live_ranges (FILE *f)
{
ira_allocno_t a;
ira_allocno_iterator ai;
FOR_EACH_ALLOCNO (a, ai)
print_allocno_live_ranges (f, a);
} | /* Print live ranges of all allocnos to file F. */ | Print live ranges of all allocnos to file F. | [
"Print",
"live",
"ranges",
"of",
"all",
"allocnos",
"to",
"file",
"F",
"."
] | static void
print_live_ranges (FILE *f)
{
ira_allocno_t a;
ira_allocno_iterator ai;
FOR_EACH_ALLOCNO (a, ai)
print_allocno_live_ranges (f, a);
} | [
"static",
"void",
"print_live_ranges",
"(",
"FILE",
"*",
"f",
")",
"{",
"ira_allocno_t",
"a",
";",
"ira_allocno_iterator",
"ai",
";",
"FOR_EACH_ALLOCNO",
"(",
"a",
",",
"ai",
")",
"",
"print_allocno_live_ranges",
"(",
"f",
",",
"a",
")",
";",
"}"
] | Print live ranges of all allocnos to file F. | [
"Print",
"live",
"ranges",
"of",
"all",
"allocnos",
"to",
"file",
"F",
"."
] | [] | [
{
"param": "f",
"type": "FILE"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | ira_debug_live_ranges | void | void
ira_debug_live_ranges (void)
{
print_live_ranges (stderr);
} | /* Print live ranges of all allocnos to stderr. */ | Print live ranges of all allocnos to stderr. | [
"Print",
"live",
"ranges",
"of",
"all",
"allocnos",
"to",
"stderr",
"."
] | void
ira_debug_live_ranges (void)
{
print_live_ranges (stderr);
} | [
"void",
"ira_debug_live_ranges",
"(",
"void",
")",
"{",
"print_live_ranges",
"(",
"stderr",
")",
";",
"}"
] | Print live ranges of all allocnos to stderr. | [
"Print",
"live",
"ranges",
"of",
"all",
"allocnos",
"to",
"stderr",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f639e12449bdc1365f16bc4410707ff4310a4d32 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/ira-lives.c | [
"BSD-3-Clause"
] | C | ira_create_allocno_live_ranges | void | void
ira_create_allocno_live_ranges (void)
{
objects_live = sparseset_alloc (ira_objects_num);
allocnos_processed = sparseset_alloc (ira_allocnos_num);
curr_point = 0;
last_call_num = 0;
allocno_saved_at_call
= (int *) ira_allocate (ira_allocnos_num * sizeof (int));
memset (allocno_saved_at_call, 0, ira_allocnos_num * sizeof (int));
ira_traverse_loop_tree (true, ira_loop_tree_root, NULL,
process_bb_node_lives);
ira_max_point = curr_point;
create_start_finish_chains ();
if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
print_live_ranges (ira_dump_file);
/* Clean up. */
ira_free (allocno_saved_at_call);
sparseset_free (objects_live);
sparseset_free (allocnos_processed);
} | /* The main entry function creates live ranges, set up
CONFLICT_HARD_REGS and TOTAL_CONFLICT_HARD_REGS for objects, and
calculate register pressure info. */ | The main entry function creates live ranges, set up
CONFLICT_HARD_REGS and TOTAL_CONFLICT_HARD_REGS for objects, and
calculate register pressure info. | [
"The",
"main",
"entry",
"function",
"creates",
"live",
"ranges",
"set",
"up",
"CONFLICT_HARD_REGS",
"and",
"TOTAL_CONFLICT_HARD_REGS",
"for",
"objects",
"and",
"calculate",
"register",
"pressure",
"info",
"."
] | void
ira_create_allocno_live_ranges (void)
{
objects_live = sparseset_alloc (ira_objects_num);
allocnos_processed = sparseset_alloc (ira_allocnos_num);
curr_point = 0;
last_call_num = 0;
allocno_saved_at_call
= (int *) ira_allocate (ira_allocnos_num * sizeof (int));
memset (allocno_saved_at_call, 0, ira_allocnos_num * sizeof (int));
ira_traverse_loop_tree (true, ira_loop_tree_root, NULL,
process_bb_node_lives);
ira_max_point = curr_point;
create_start_finish_chains ();
if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
print_live_ranges (ira_dump_file);
ira_free (allocno_saved_at_call);
sparseset_free (objects_live);
sparseset_free (allocnos_processed);
} | [
"void",
"ira_create_allocno_live_ranges",
"(",
"void",
")",
"{",
"objects_live",
"=",
"sparseset_alloc",
"(",
"ira_objects_num",
")",
";",
"allocnos_processed",
"=",
"sparseset_alloc",
"(",
"ira_allocnos_num",
")",
";",
"curr_point",
"=",
"0",
";",
"last_call_num",
"=",
"0",
";",
"allocno_saved_at_call",
"=",
"(",
"int",
"*",
")",
"ira_allocate",
"(",
"ira_allocnos_num",
"*",
"sizeof",
"(",
"int",
")",
")",
";",
"memset",
"(",
"allocno_saved_at_call",
",",
"0",
",",
"ira_allocnos_num",
"*",
"sizeof",
"(",
"int",
")",
")",
";",
"ira_traverse_loop_tree",
"(",
"true",
",",
"ira_loop_tree_root",
",",
"NULL",
",",
"process_bb_node_lives",
")",
";",
"ira_max_point",
"=",
"curr_point",
";",
"create_start_finish_chains",
"(",
")",
";",
"if",
"(",
"internal_flag_ira_verbose",
">",
"2",
"&&",
"ira_dump_file",
"!=",
"NULL",
")",
"print_live_ranges",
"(",
"ira_dump_file",
")",
";",
"ira_free",
"(",
"allocno_saved_at_call",
")",
";",
"sparseset_free",
"(",
"objects_live",
")",
";",
"sparseset_free",
"(",
"allocnos_processed",
")",
";",
"}"
] | The main entry function creates live ranges, set up
CONFLICT_HARD_REGS and TOTAL_CONFLICT_HARD_REGS for objects, and
calculate register pressure info. | [
"The",
"main",
"entry",
"function",
"creates",
"live",
"ranges",
"set",
"up",
"CONFLICT_HARD_REGS",
"and",
"TOTAL_CONFLICT_HARD_REGS",
"for",
"objects",
"and",
"calculate",
"register",
"pressure",
"info",
"."
] | [
"/* Clean up. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/python/py-symtab.c | [
"BSD-3-Clause"
] | C | stpy_global_block | PyObject | static PyObject *
stpy_global_block (PyObject *self, PyObject *args)
{
struct symtab *symtab = NULL;
struct block *block = NULL;
struct blockvector *blockvector;
STPY_REQUIRE_VALID (self, symtab);
blockvector = BLOCKVECTOR (symtab);
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
return block_to_block_object (block, symtab->objfile);
} | /* Return the GLOBAL_BLOCK of the underlying symtab. */ | Return the GLOBAL_BLOCK of the underlying symtab. | [
"Return",
"the",
"GLOBAL_BLOCK",
"of",
"the",
"underlying",
"symtab",
"."
] | static PyObject *
stpy_global_block (PyObject *self, PyObject *args)
{
struct symtab *symtab = NULL;
struct block *block = NULL;
struct blockvector *blockvector;
STPY_REQUIRE_VALID (self, symtab);
blockvector = BLOCKVECTOR (symtab);
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
return block_to_block_object (block, symtab->objfile);
} | [
"static",
"PyObject",
"*",
"stpy_global_block",
"(",
"PyObject",
"*",
"self",
",",
"PyObject",
"*",
"args",
")",
"{",
"struct",
"symtab",
"*",
"symtab",
"=",
"NULL",
";",
"struct",
"block",
"*",
"block",
"=",
"NULL",
";",
"struct",
"blockvector",
"*",
"blockvector",
";",
"STPY_REQUIRE_VALID",
"(",
"self",
",",
"symtab",
")",
";",
"blockvector",
"=",
"BLOCKVECTOR",
"(",
"symtab",
")",
";",
"block",
"=",
"BLOCKVECTOR_BLOCK",
"(",
"blockvector",
",",
"GLOBAL_BLOCK",
")",
";",
"return",
"block_to_block_object",
"(",
"block",
",",
"symtab",
"->",
"objfile",
")",
";",
"}"
] | Return the GLOBAL_BLOCK of the underlying symtab. | [
"Return",
"the",
"GLOBAL_BLOCK",
"of",
"the",
"underlying",
"symtab",
"."
] | [] | [
{
"param": "self",
"type": "PyObject"
},
{
"param": "args",
"type": "PyObject"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": "PyObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": "PyObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/python/py-symtab.c | [
"BSD-3-Clause"
] | C | stpy_static_block | PyObject | static PyObject *
stpy_static_block (PyObject *self, PyObject *args)
{
struct symtab *symtab = NULL;
struct block *block = NULL;
struct blockvector *blockvector;
STPY_REQUIRE_VALID (self, symtab);
blockvector = BLOCKVECTOR (symtab);
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
return block_to_block_object (block, symtab->objfile);
} | /* Return the STATIC_BLOCK of the underlying symtab. */ | Return the STATIC_BLOCK of the underlying symtab. | [
"Return",
"the",
"STATIC_BLOCK",
"of",
"the",
"underlying",
"symtab",
"."
] | static PyObject *
stpy_static_block (PyObject *self, PyObject *args)
{
struct symtab *symtab = NULL;
struct block *block = NULL;
struct blockvector *blockvector;
STPY_REQUIRE_VALID (self, symtab);
blockvector = BLOCKVECTOR (symtab);
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
return block_to_block_object (block, symtab->objfile);
} | [
"static",
"PyObject",
"*",
"stpy_static_block",
"(",
"PyObject",
"*",
"self",
",",
"PyObject",
"*",
"args",
")",
"{",
"struct",
"symtab",
"*",
"symtab",
"=",
"NULL",
";",
"struct",
"block",
"*",
"block",
"=",
"NULL",
";",
"struct",
"blockvector",
"*",
"blockvector",
";",
"STPY_REQUIRE_VALID",
"(",
"self",
",",
"symtab",
")",
";",
"blockvector",
"=",
"BLOCKVECTOR",
"(",
"symtab",
")",
";",
"block",
"=",
"BLOCKVECTOR_BLOCK",
"(",
"blockvector",
",",
"STATIC_BLOCK",
")",
";",
"return",
"block_to_block_object",
"(",
"block",
",",
"symtab",
"->",
"objfile",
")",
";",
"}"
] | Return the STATIC_BLOCK of the underlying symtab. | [
"Return",
"the",
"STATIC_BLOCK",
"of",
"the",
"underlying",
"symtab",
"."
] | [] | [
{
"param": "self",
"type": "PyObject"
},
{
"param": "args",
"type": "PyObject"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": "PyObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": "PyObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/python/py-symtab.c | [
"BSD-3-Clause"
] | C | salpy_get_last | PyObject | static PyObject *
salpy_get_last (PyObject *self, void *closure)
{
struct symtab_and_line *sal = NULL;
SALPY_REQUIRE_VALID (self, sal);
if (sal->end > 0)
return gdb_py_long_from_ulongest (sal->end - 1);
else
Py_RETURN_NONE;
} | /* Implementation of the get method for the 'last' attribute of
gdb.Symtab_and_line. */ | Implementation of the get method for the 'last' attribute of
gdb.Symtab_and_line. | [
"Implementation",
"of",
"the",
"get",
"method",
"for",
"the",
"'",
"last",
"'",
"attribute",
"of",
"gdb",
".",
"Symtab_and_line",
"."
] | static PyObject *
salpy_get_last (PyObject *self, void *closure)
{
struct symtab_and_line *sal = NULL;
SALPY_REQUIRE_VALID (self, sal);
if (sal->end > 0)
return gdb_py_long_from_ulongest (sal->end - 1);
else
Py_RETURN_NONE;
} | [
"static",
"PyObject",
"*",
"salpy_get_last",
"(",
"PyObject",
"*",
"self",
",",
"void",
"*",
"closure",
")",
"{",
"struct",
"symtab_and_line",
"*",
"sal",
"=",
"NULL",
";",
"SALPY_REQUIRE_VALID",
"(",
"self",
",",
"sal",
")",
";",
"if",
"(",
"sal",
"->",
"end",
">",
"0",
")",
"return",
"gdb_py_long_from_ulongest",
"(",
"sal",
"->",
"end",
"-",
"1",
")",
";",
"else",
"Py_RETURN_NONE",
";",
"}"
] | Implementation of the get method for the 'last' attribute of
gdb.Symtab_and_line. | [
"Implementation",
"of",
"the",
"get",
"method",
"for",
"the",
"'",
"last",
"'",
"attribute",
"of",
"gdb",
".",
"Symtab_and_line",
"."
] | [] | [
{
"param": "self",
"type": "PyObject"
},
{
"param": "closure",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": "PyObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "closure",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/python/py-symtab.c | [
"BSD-3-Clause"
] | C | symtab_to_symtab_object | PyObject | PyObject *
symtab_to_symtab_object (struct symtab *symtab)
{
symtab_object *symtab_obj;
symtab_obj = PyObject_New (symtab_object, &symtab_object_type);
if (symtab_obj)
set_symtab (symtab_obj, symtab);
return (PyObject *) symtab_obj;
} | /* Create a new symbol table (gdb.Symtab) object that encapsulates the
symtab structure from GDB. */ | Create a new symbol table (gdb.Symtab) object that encapsulates the
symtab structure from GDB. | [
"Create",
"a",
"new",
"symbol",
"table",
"(",
"gdb",
".",
"Symtab",
")",
"object",
"that",
"encapsulates",
"the",
"symtab",
"structure",
"from",
"GDB",
"."
] | PyObject *
symtab_to_symtab_object (struct symtab *symtab)
{
symtab_object *symtab_obj;
symtab_obj = PyObject_New (symtab_object, &symtab_object_type);
if (symtab_obj)
set_symtab (symtab_obj, symtab);
return (PyObject *) symtab_obj;
} | [
"PyObject",
"*",
"symtab_to_symtab_object",
"(",
"struct",
"symtab",
"*",
"symtab",
")",
"{",
"symtab_object",
"*",
"symtab_obj",
";",
"symtab_obj",
"=",
"PyObject_New",
"(",
"symtab_object",
",",
"&",
"symtab_object_type",
")",
";",
"if",
"(",
"symtab_obj",
")",
"set_symtab",
"(",
"symtab_obj",
",",
"symtab",
")",
";",
"return",
"(",
"PyObject",
"*",
")",
"symtab_obj",
";",
"}"
] | Create a new symbol table (gdb.Symtab) object that encapsulates the
symtab structure from GDB. | [
"Create",
"a",
"new",
"symbol",
"table",
"(",
"gdb",
".",
"Symtab",
")",
"object",
"that",
"encapsulates",
"the",
"symtab",
"structure",
"from",
"GDB",
"."
] | [] | [
{
"param": "symtab",
"type": "struct symtab"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "symtab",
"type": "struct symtab",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/python/py-symtab.c | [
"BSD-3-Clause"
] | C | symtab_and_line_to_sal_object | PyObject | PyObject *
symtab_and_line_to_sal_object (struct symtab_and_line sal)
{
sal_object *sal_obj;
int success = 0;
sal_obj = PyObject_New (sal_object, &sal_object_type);
if (sal_obj)
{
success = set_sal (sal_obj, sal);
if (!success)
{
Py_DECREF (sal_obj);
return NULL;
}
}
return (PyObject *) sal_obj;
} | /* Create a new symtab and line (gdb.Symtab_and_line) object
that encapsulates the symtab_and_line structure from GDB. */ | Create a new symtab and line (gdb.Symtab_and_line) object
that encapsulates the symtab_and_line structure from GDB. | [
"Create",
"a",
"new",
"symtab",
"and",
"line",
"(",
"gdb",
".",
"Symtab_and_line",
")",
"object",
"that",
"encapsulates",
"the",
"symtab_and_line",
"structure",
"from",
"GDB",
"."
] | PyObject *
symtab_and_line_to_sal_object (struct symtab_and_line sal)
{
sal_object *sal_obj;
int success = 0;
sal_obj = PyObject_New (sal_object, &sal_object_type);
if (sal_obj)
{
success = set_sal (sal_obj, sal);
if (!success)
{
Py_DECREF (sal_obj);
return NULL;
}
}
return (PyObject *) sal_obj;
} | [
"PyObject",
"*",
"symtab_and_line_to_sal_object",
"(",
"struct",
"symtab_and_line",
"sal",
")",
"{",
"sal_object",
"*",
"sal_obj",
";",
"int",
"success",
"=",
"0",
";",
"sal_obj",
"=",
"PyObject_New",
"(",
"sal_object",
",",
"&",
"sal_object_type",
")",
";",
"if",
"(",
"sal_obj",
")",
"{",
"success",
"=",
"set_sal",
"(",
"sal_obj",
",",
"sal",
")",
";",
"if",
"(",
"!",
"success",
")",
"{",
"Py_DECREF",
"(",
"sal_obj",
")",
";",
"return",
"NULL",
";",
"}",
"}",
"return",
"(",
"PyObject",
"*",
")",
"sal_obj",
";",
"}"
] | Create a new symtab and line (gdb.Symtab_and_line) object
that encapsulates the symtab_and_line structure from GDB. | [
"Create",
"a",
"new",
"symtab",
"and",
"line",
"(",
"gdb",
".",
"Symtab_and_line",
")",
"object",
"that",
"encapsulates",
"the",
"symtab_and_line",
"structure",
"from",
"GDB",
"."
] | [] | [
{
"param": "sal",
"type": "struct symtab_and_line"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sal",
"type": "struct symtab_and_line",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/python/py-symtab.c | [
"BSD-3-Clause"
] | C | sal_object_to_symtab_and_line | null | struct symtab_and_line *
sal_object_to_symtab_and_line (PyObject *obj)
{
if (! PyObject_TypeCheck (obj, &sal_object_type))
return NULL;
return ((sal_object *) obj)->sal;
} | /* Return struct symtab_and_line reference that is wrapped by this
object. */ | Return struct symtab_and_line reference that is wrapped by this
object. | [
"Return",
"struct",
"symtab_and_line",
"reference",
"that",
"is",
"wrapped",
"by",
"this",
"object",
"."
] | struct symtab_and_line *
sal_object_to_symtab_and_line (PyObject *obj)
{
if (! PyObject_TypeCheck (obj, &sal_object_type))
return NULL;
return ((sal_object *) obj)->sal;
} | [
"struct",
"symtab_and_line",
"*",
"sal_object_to_symtab_and_line",
"(",
"PyObject",
"*",
"obj",
")",
"{",
"if",
"(",
"!",
"PyObject_TypeCheck",
"(",
"obj",
",",
"&",
"sal_object_type",
")",
")",
"return",
"NULL",
";",
"return",
"(",
"(",
"sal_object",
"*",
")",
"obj",
")",
"->",
"sal",
";",
"}"
] | Return struct symtab_and_line reference that is wrapped by this
object. | [
"Return",
"struct",
"symtab_and_line",
"reference",
"that",
"is",
"wrapped",
"by",
"this",
"object",
"."
] | [] | [
{
"param": "obj",
"type": "PyObject"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "PyObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/python/py-symtab.c | [
"BSD-3-Clause"
] | C | symtab_object_to_symtab | null | struct symtab *
symtab_object_to_symtab (PyObject *obj)
{
if (! PyObject_TypeCheck (obj, &symtab_object_type))
return NULL;
return ((symtab_object *) obj)->symtab;
} | /* Return struct symtab reference that is wrapped by this object. */ | Return struct symtab reference that is wrapped by this object. | [
"Return",
"struct",
"symtab",
"reference",
"that",
"is",
"wrapped",
"by",
"this",
"object",
"."
] | struct symtab *
symtab_object_to_symtab (PyObject *obj)
{
if (! PyObject_TypeCheck (obj, &symtab_object_type))
return NULL;
return ((symtab_object *) obj)->symtab;
} | [
"struct",
"symtab",
"*",
"symtab_object_to_symtab",
"(",
"PyObject",
"*",
"obj",
")",
"{",
"if",
"(",
"!",
"PyObject_TypeCheck",
"(",
"obj",
",",
"&",
"symtab_object_type",
")",
")",
"return",
"NULL",
";",
"return",
"(",
"(",
"symtab_object",
"*",
")",
"obj",
")",
"->",
"symtab",
";",
"}"
] | Return struct symtab reference that is wrapped by this object. | [
"Return",
"struct",
"symtab",
"reference",
"that",
"is",
"wrapped",
"by",
"this",
"object",
"."
] | [] | [
{
"param": "obj",
"type": "PyObject"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "obj",
"type": "PyObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/python/py-symtab.c | [
"BSD-3-Clause"
] | C | del_objfile_symtab | void | static void
del_objfile_symtab (struct objfile *objfile, void *datum)
{
symtab_object *obj = datum;
while (obj)
{
symtab_object *next = obj->next;
obj->symtab = NULL;
obj->next = NULL;
obj->prev = NULL;
obj = next;
}
} | /* This function is called when an objfile is about to be freed.
Invalidate the symbol table as further actions on the symbol table
would result in bad data. All access to obj->symtab should be
gated by STPY_REQUIRE_VALID which will raise an exception on
invalid symbol tables. */ | This function is called when an objfile is about to be freed.
Invalidate the symbol table as further actions on the symbol table
would result in bad data. All access to obj->symtab should be
gated by STPY_REQUIRE_VALID which will raise an exception on
invalid symbol tables. | [
"This",
"function",
"is",
"called",
"when",
"an",
"objfile",
"is",
"about",
"to",
"be",
"freed",
".",
"Invalidate",
"the",
"symbol",
"table",
"as",
"further",
"actions",
"on",
"the",
"symbol",
"table",
"would",
"result",
"in",
"bad",
"data",
".",
"All",
"access",
"to",
"obj",
"-",
">",
"symtab",
"should",
"be",
"gated",
"by",
"STPY_REQUIRE_VALID",
"which",
"will",
"raise",
"an",
"exception",
"on",
"invalid",
"symbol",
"tables",
"."
] | static void
del_objfile_symtab (struct objfile *objfile, void *datum)
{
symtab_object *obj = datum;
while (obj)
{
symtab_object *next = obj->next;
obj->symtab = NULL;
obj->next = NULL;
obj->prev = NULL;
obj = next;
}
} | [
"static",
"void",
"del_objfile_symtab",
"(",
"struct",
"objfile",
"*",
"objfile",
",",
"void",
"*",
"datum",
")",
"{",
"symtab_object",
"*",
"obj",
"=",
"datum",
";",
"while",
"(",
"obj",
")",
"{",
"symtab_object",
"*",
"next",
"=",
"obj",
"->",
"next",
";",
"obj",
"->",
"symtab",
"=",
"NULL",
";",
"obj",
"->",
"next",
"=",
"NULL",
";",
"obj",
"->",
"prev",
"=",
"NULL",
";",
"obj",
"=",
"next",
";",
"}",
"}"
] | This function is called when an objfile is about to be freed. | [
"This",
"function",
"is",
"called",
"when",
"an",
"objfile",
"is",
"about",
"to",
"be",
"freed",
"."
] | [] | [
{
"param": "objfile",
"type": "struct objfile"
},
{
"param": "datum",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "objfile",
"type": "struct objfile",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "datum",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6fa8ecb8f0759ed4fdfa3c3f5f3143cdb07b32d4 | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/python/py-symtab.c | [
"BSD-3-Clause"
] | C | del_objfile_sal | void | static void
del_objfile_sal (struct objfile *objfile, void *datum)
{
sal_object *obj = datum;
while (obj)
{
sal_object *next = obj->next;
Py_DECREF (obj->symtab);
obj->symtab = (symtab_object *) Py_None;
Py_INCREF (Py_None);
obj->next = NULL;
obj->prev = NULL;
xfree (obj->sal);
obj->sal = NULL;
obj = next;
}
} | /* This function is called when an objfile is about to be freed.
Invalidate the sal object as further actions on the sal
would result in bad data. All access to obj->sal should be
gated by SALPY_REQUIRE_VALID which will raise an exception on
invalid symbol table and line objects. */ | This function is called when an objfile is about to be freed.
Invalidate the sal object as further actions on the sal
would result in bad data. All access to obj->sal should be
gated by SALPY_REQUIRE_VALID which will raise an exception on
invalid symbol table and line objects. | [
"This",
"function",
"is",
"called",
"when",
"an",
"objfile",
"is",
"about",
"to",
"be",
"freed",
".",
"Invalidate",
"the",
"sal",
"object",
"as",
"further",
"actions",
"on",
"the",
"sal",
"would",
"result",
"in",
"bad",
"data",
".",
"All",
"access",
"to",
"obj",
"-",
">",
"sal",
"should",
"be",
"gated",
"by",
"SALPY_REQUIRE_VALID",
"which",
"will",
"raise",
"an",
"exception",
"on",
"invalid",
"symbol",
"table",
"and",
"line",
"objects",
"."
] | static void
del_objfile_sal (struct objfile *objfile, void *datum)
{
sal_object *obj = datum;
while (obj)
{
sal_object *next = obj->next;
Py_DECREF (obj->symtab);
obj->symtab = (symtab_object *) Py_None;
Py_INCREF (Py_None);
obj->next = NULL;
obj->prev = NULL;
xfree (obj->sal);
obj->sal = NULL;
obj = next;
}
} | [
"static",
"void",
"del_objfile_sal",
"(",
"struct",
"objfile",
"*",
"objfile",
",",
"void",
"*",
"datum",
")",
"{",
"sal_object",
"*",
"obj",
"=",
"datum",
";",
"while",
"(",
"obj",
")",
"{",
"sal_object",
"*",
"next",
"=",
"obj",
"->",
"next",
";",
"Py_DECREF",
"(",
"obj",
"->",
"symtab",
")",
";",
"obj",
"->",
"symtab",
"=",
"(",
"symtab_object",
"*",
")",
"Py_None",
";",
"Py_INCREF",
"(",
"Py_None",
")",
";",
"obj",
"->",
"next",
"=",
"NULL",
";",
"obj",
"->",
"prev",
"=",
"NULL",
";",
"xfree",
"(",
"obj",
"->",
"sal",
")",
";",
"obj",
"->",
"sal",
"=",
"NULL",
";",
"obj",
"=",
"next",
";",
"}",
"}"
] | This function is called when an objfile is about to be freed. | [
"This",
"function",
"is",
"called",
"when",
"an",
"objfile",
"is",
"about",
"to",
"be",
"freed",
"."
] | [] | [
{
"param": "objfile",
"type": "struct objfile"
},
{
"param": "datum",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "objfile",
"type": "struct objfile",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "datum",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a7f1b78499553f5360d0df5dd4e2ea3b4a904bb9 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/binutils/version.c | [
"BSD-3-Clause"
] | C | print_version | void | void
print_version (const char *name)
{
/* This output is intended to follow the GNU standards document. */
/* xgettext:c-format */
printf ("GNU %s %s\n", name, BFD_VERSION_STRING);
printf (_("Copyright (C) 2020 Free Software Foundation, Inc.\n"));
printf (_("\
This program is free software; you may redistribute it under the terms of\n\
the GNU General Public License version 3 or (at your option) any later version.\n\
This program has absolutely no warranty.\n"));
exit (0);
} | /* Print the version number and copyright information, and exit.
This implements the --version option for the various programs. */ | Print the version number and copyright information, and exit.
This implements the --version option for the various programs. | [
"Print",
"the",
"version",
"number",
"and",
"copyright",
"information",
"and",
"exit",
".",
"This",
"implements",
"the",
"--",
"version",
"option",
"for",
"the",
"various",
"programs",
"."
] | void
print_version (const char *name)
{
printf ("GNU %s %s\n", name, BFD_VERSION_STRING);
printf (_("Copyright (C) 2020 Free Software Foundation, Inc.\n"));
printf (_("\
This program is free software; you may redistribute it under the terms of\n\
the GNU General Public License version 3 or (at your option) any later version.\n\
This program has absolutely no warranty.\n"));
exit (0);
} | [
"void",
"print_version",
"(",
"const",
"char",
"*",
"name",
")",
"{",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"name",
",",
"BFD_VERSION_STRING",
")",
";",
"printf",
"(",
"_",
"(",
"\"",
"\\n",
"\"",
")",
")",
";",
"printf",
"(",
"_",
"(",
"\"",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\"",
")",
")",
";",
"exit",
"(",
"0",
")",
";",
"}"
] | Print the version number and copyright information, and exit. | [
"Print",
"the",
"version",
"number",
"and",
"copyright",
"information",
"and",
"exit",
"."
] | [
"/* This output is intended to follow the GNU standards document. */",
"/* xgettext:c-format */"
] | [
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | build_replicated_const | tree | static tree
build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value)
{
int width = tree_low_cst (TYPE_SIZE (inner_type), 1);
int n = HOST_BITS_PER_WIDE_INT / width;
unsigned HOST_WIDE_INT low, high, mask;
tree ret;
gcc_assert (n);
if (width == HOST_BITS_PER_WIDE_INT)
low = value;
else
{
mask = ((HOST_WIDE_INT)1 << width) - 1;
low = (unsigned HOST_WIDE_INT) ~0 / mask * (value & mask);
}
if (TYPE_PRECISION (type) < HOST_BITS_PER_WIDE_INT)
low &= ((HOST_WIDE_INT)1 << TYPE_PRECISION (type)) - 1, high = 0;
else if (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT)
high = 0;
else if (TYPE_PRECISION (type) == 2 * HOST_BITS_PER_WIDE_INT)
high = low;
else
gcc_unreachable ();
ret = build_int_cst_wide (type, low, high);
return ret;
} | /* Build a constant of type TYPE, made of VALUE's bits replicated
every TYPE_SIZE (INNER_TYPE) bits to fit TYPE's precision. */ | Build a constant of type TYPE, made of VALUE's bits replicated
every TYPE_SIZE (INNER_TYPE) bits to fit TYPE's precision. | [
"Build",
"a",
"constant",
"of",
"type",
"TYPE",
"made",
"of",
"VALUE",
"'",
"s",
"bits",
"replicated",
"every",
"TYPE_SIZE",
"(",
"INNER_TYPE",
")",
"bits",
"to",
"fit",
"TYPE",
"'",
"s",
"precision",
"."
] | static tree
build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value)
{
int width = tree_low_cst (TYPE_SIZE (inner_type), 1);
int n = HOST_BITS_PER_WIDE_INT / width;
unsigned HOST_WIDE_INT low, high, mask;
tree ret;
gcc_assert (n);
if (width == HOST_BITS_PER_WIDE_INT)
low = value;
else
{
mask = ((HOST_WIDE_INT)1 << width) - 1;
low = (unsigned HOST_WIDE_INT) ~0 / mask * (value & mask);
}
if (TYPE_PRECISION (type) < HOST_BITS_PER_WIDE_INT)
low &= ((HOST_WIDE_INT)1 << TYPE_PRECISION (type)) - 1, high = 0;
else if (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT)
high = 0;
else if (TYPE_PRECISION (type) == 2 * HOST_BITS_PER_WIDE_INT)
high = low;
else
gcc_unreachable ();
ret = build_int_cst_wide (type, low, high);
return ret;
} | [
"static",
"tree",
"build_replicated_const",
"(",
"tree",
"type",
",",
"tree",
"inner_type",
",",
"HOST_WIDE_INT",
"value",
")",
"{",
"int",
"width",
"=",
"tree_low_cst",
"(",
"TYPE_SIZE",
"(",
"inner_type",
")",
",",
"1",
")",
";",
"int",
"n",
"=",
"HOST_BITS_PER_WIDE_INT",
"/",
"width",
";",
"unsigned",
"HOST_WIDE_INT",
"low",
",",
"high",
",",
"mask",
";",
"tree",
"ret",
";",
"gcc_assert",
"(",
"n",
")",
";",
"if",
"(",
"width",
"==",
"HOST_BITS_PER_WIDE_INT",
")",
"low",
"=",
"value",
";",
"else",
"{",
"mask",
"=",
"(",
"(",
"HOST_WIDE_INT",
")",
"1",
"<<",
"width",
")",
"-",
"1",
";",
"low",
"=",
"(",
"unsigned",
"HOST_WIDE_INT",
")",
"~",
"0",
"/",
"mask",
"*",
"(",
"value",
"&",
"mask",
")",
";",
"}",
"if",
"(",
"TYPE_PRECISION",
"(",
"type",
")",
"<",
"HOST_BITS_PER_WIDE_INT",
")",
"low",
"&=",
"(",
"(",
"HOST_WIDE_INT",
")",
"1",
"<<",
"TYPE_PRECISION",
"(",
"type",
")",
")",
"-",
"1",
",",
"high",
"=",
"0",
";",
"else",
"if",
"(",
"TYPE_PRECISION",
"(",
"type",
")",
"==",
"HOST_BITS_PER_WIDE_INT",
")",
"high",
"=",
"0",
";",
"else",
"if",
"(",
"TYPE_PRECISION",
"(",
"type",
")",
"==",
"2",
"*",
"HOST_BITS_PER_WIDE_INT",
")",
"high",
"=",
"low",
";",
"else",
"gcc_unreachable",
"(",
")",
";",
"ret",
"=",
"build_int_cst_wide",
"(",
"type",
",",
"low",
",",
"high",
")",
";",
"return",
"ret",
";",
"}"
] | Build a constant of type TYPE, made of VALUE's bits replicated
every TYPE_SIZE (INNER_TYPE) bits to fit TYPE's precision. | [
"Build",
"a",
"constant",
"of",
"type",
"TYPE",
"made",
"of",
"VALUE",
"'",
"s",
"bits",
"replicated",
"every",
"TYPE_SIZE",
"(",
"INNER_TYPE",
")",
"bits",
"to",
"fit",
"TYPE",
"'",
"s",
"precision",
"."
] | [] | [
{
"param": "type",
"type": "tree"
},
{
"param": "inner_type",
"type": "tree"
},
{
"param": "value",
"type": "HOST_WIDE_INT"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inner_type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "HOST_WIDE_INT",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | build_word_mode_vector_type | tree | static tree
build_word_mode_vector_type (int nunits)
{
if (!vector_inner_type)
vector_inner_type = lang_hooks.types.type_for_mode (word_mode, 1);
else if (vector_last_nunits == nunits)
{
gcc_assert (TREE_CODE (vector_last_type) == VECTOR_TYPE);
return vector_last_type;
}
/* We build a new type, but we canonicalize it nevertheless,
because it still saves some memory. */
vector_last_nunits = nunits;
vector_last_type = type_hash_canon (nunits,
build_vector_type (vector_inner_type,
nunits));
return vector_last_type;
} | /* Return a suitable vector types made of SUBPARTS units each of mode
"word_mode" (the global variable). */ | Return a suitable vector types made of SUBPARTS units each of mode
"word_mode" (the global variable). | [
"Return",
"a",
"suitable",
"vector",
"types",
"made",
"of",
"SUBPARTS",
"units",
"each",
"of",
"mode",
"\"",
"word_mode",
"\"",
"(",
"the",
"global",
"variable",
")",
"."
] | static tree
build_word_mode_vector_type (int nunits)
{
if (!vector_inner_type)
vector_inner_type = lang_hooks.types.type_for_mode (word_mode, 1);
else if (vector_last_nunits == nunits)
{
gcc_assert (TREE_CODE (vector_last_type) == VECTOR_TYPE);
return vector_last_type;
}
vector_last_nunits = nunits;
vector_last_type = type_hash_canon (nunits,
build_vector_type (vector_inner_type,
nunits));
return vector_last_type;
} | [
"static",
"tree",
"build_word_mode_vector_type",
"(",
"int",
"nunits",
")",
"{",
"if",
"(",
"!",
"vector_inner_type",
")",
"vector_inner_type",
"=",
"lang_hooks",
".",
"types",
".",
"type_for_mode",
"(",
"word_mode",
",",
"1",
")",
";",
"else",
"if",
"(",
"vector_last_nunits",
"==",
"nunits",
")",
"{",
"gcc_assert",
"(",
"TREE_CODE",
"(",
"vector_last_type",
")",
"==",
"VECTOR_TYPE",
")",
";",
"return",
"vector_last_type",
";",
"}",
"vector_last_nunits",
"=",
"nunits",
";",
"vector_last_type",
"=",
"type_hash_canon",
"(",
"nunits",
",",
"build_vector_type",
"(",
"vector_inner_type",
",",
"nunits",
")",
")",
";",
"return",
"vector_last_type",
";",
"}"
] | Return a suitable vector types made of SUBPARTS units each of mode
"word_mode" (the global variable). | [
"Return",
"a",
"suitable",
"vector",
"types",
"made",
"of",
"SUBPARTS",
"units",
"each",
"of",
"mode",
"\"",
"word_mode",
"\"",
"(",
"the",
"global",
"variable",
")",
"."
] | [
"/* We build a new type, but we canonicalize it nevertheless,\n because it still saves some memory. */"
] | [
{
"param": "nunits",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "nunits",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | do_compare | tree | static tree
do_compare (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b,
tree bitpos, tree bitsize, enum tree_code code)
{
tree comp_type;
a = tree_vec_extract (gsi, inner_type, a, bitsize, bitpos);
b = tree_vec_extract (gsi, inner_type, b, bitsize, bitpos);
comp_type = build_nonstandard_integer_type
(GET_MODE_BITSIZE (TYPE_MODE (inner_type)), 0);
return gimplify_build3 (gsi, COND_EXPR, comp_type,
fold_build2 (code, boolean_type_node, a, b),
build_int_cst (comp_type, -1),
build_int_cst (comp_type, 0));
} | /* Construct expression (A[BITPOS] code B[BITPOS]) ? -1 : 0
INNER_TYPE is the type of A and B elements
returned expression is of signed integer type with the
size equal to the size of INNER_TYPE. */ | Construct expression (A[BITPOS] code B[BITPOS]) . -1 : 0
INNER_TYPE is the type of A and B elements
returned expression is of signed integer type with the
size equal to the size of INNER_TYPE. | [
"Construct",
"expression",
"(",
"A",
"[",
"BITPOS",
"]",
"code",
"B",
"[",
"BITPOS",
"]",
")",
".",
"-",
"1",
":",
"0",
"INNER_TYPE",
"is",
"the",
"type",
"of",
"A",
"and",
"B",
"elements",
"returned",
"expression",
"is",
"of",
"signed",
"integer",
"type",
"with",
"the",
"size",
"equal",
"to",
"the",
"size",
"of",
"INNER_TYPE",
"."
] | static tree
do_compare (gimple_stmt_iterator *gsi, tree inner_type, tree a, tree b,
tree bitpos, tree bitsize, enum tree_code code)
{
tree comp_type;
a = tree_vec_extract (gsi, inner_type, a, bitsize, bitpos);
b = tree_vec_extract (gsi, inner_type, b, bitsize, bitpos);
comp_type = build_nonstandard_integer_type
(GET_MODE_BITSIZE (TYPE_MODE (inner_type)), 0);
return gimplify_build3 (gsi, COND_EXPR, comp_type,
fold_build2 (code, boolean_type_node, a, b),
build_int_cst (comp_type, -1),
build_int_cst (comp_type, 0));
} | [
"static",
"tree",
"do_compare",
"(",
"gimple_stmt_iterator",
"*",
"gsi",
",",
"tree",
"inner_type",
",",
"tree",
"a",
",",
"tree",
"b",
",",
"tree",
"bitpos",
",",
"tree",
"bitsize",
",",
"enum",
"tree_code",
"code",
")",
"{",
"tree",
"comp_type",
";",
"a",
"=",
"tree_vec_extract",
"(",
"gsi",
",",
"inner_type",
",",
"a",
",",
"bitsize",
",",
"bitpos",
")",
";",
"b",
"=",
"tree_vec_extract",
"(",
"gsi",
",",
"inner_type",
",",
"b",
",",
"bitsize",
",",
"bitpos",
")",
";",
"comp_type",
"=",
"build_nonstandard_integer_type",
"(",
"GET_MODE_BITSIZE",
"(",
"TYPE_MODE",
"(",
"inner_type",
")",
")",
",",
"0",
")",
";",
"return",
"gimplify_build3",
"(",
"gsi",
",",
"COND_EXPR",
",",
"comp_type",
",",
"fold_build2",
"(",
"code",
",",
"boolean_type_node",
",",
"a",
",",
"b",
")",
",",
"build_int_cst",
"(",
"comp_type",
",",
"-1",
")",
",",
"build_int_cst",
"(",
"comp_type",
",",
"0",
")",
")",
";",
"}"
] | Construct expression (A[BITPOS] code B[BITPOS]) ? | [
"Construct",
"expression",
"(",
"A",
"[",
"BITPOS",
"]",
"code",
"B",
"[",
"BITPOS",
"]",
")",
"?"
] | [] | [
{
"param": "gsi",
"type": "gimple_stmt_iterator"
},
{
"param": "inner_type",
"type": "tree"
},
{
"param": "a",
"type": "tree"
},
{
"param": "b",
"type": "tree"
},
{
"param": "bitpos",
"type": "tree"
},
{
"param": "bitsize",
"type": "tree"
},
{
"param": "code",
"type": "enum tree_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gsi",
"type": "gimple_stmt_iterator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inner_type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "a",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitpos",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitsize",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | expand_vector_piecewise | tree | static tree
expand_vector_piecewise (gimple_stmt_iterator *gsi, elem_op_func f,
tree type, tree inner_type,
tree a, tree b, enum tree_code code)
{
VEC(constructor_elt,gc) *v;
tree part_width = TYPE_SIZE (inner_type);
tree index = bitsize_int (0);
int nunits = TYPE_VECTOR_SUBPARTS (type);
int delta = tree_low_cst (part_width, 1)
/ tree_low_cst (TYPE_SIZE (TREE_TYPE (type)), 1);
int i;
location_t loc = gimple_location (gsi_stmt (*gsi));
if (types_compatible_p (gimple_expr_type (gsi_stmt (*gsi)), type))
warning_at (loc, OPT_Wvector_operation_performance,
"vector operation will be expanded piecewise");
else
warning_at (loc, OPT_Wvector_operation_performance,
"vector operation will be expanded in parallel");
v = VEC_alloc(constructor_elt, gc, (nunits + delta - 1) / delta);
for (i = 0; i < nunits;
i += delta, index = int_const_binop (PLUS_EXPR, index, part_width))
{
tree result = f (gsi, inner_type, a, b, index, part_width, code);
constructor_elt *ce = VEC_quick_push (constructor_elt, v, NULL);
ce->index = NULL_TREE;
ce->value = result;
}
return build_constructor (type, v);
} | /* Expand a vector operation to scalars, by using many operations
whose type is the vector type's inner type. */ | Expand a vector operation to scalars, by using many operations
whose type is the vector type's inner type. | [
"Expand",
"a",
"vector",
"operation",
"to",
"scalars",
"by",
"using",
"many",
"operations",
"whose",
"type",
"is",
"the",
"vector",
"type",
"'",
"s",
"inner",
"type",
"."
] | static tree
expand_vector_piecewise (gimple_stmt_iterator *gsi, elem_op_func f,
tree type, tree inner_type,
tree a, tree b, enum tree_code code)
{
VEC(constructor_elt,gc) *v;
tree part_width = TYPE_SIZE (inner_type);
tree index = bitsize_int (0);
int nunits = TYPE_VECTOR_SUBPARTS (type);
int delta = tree_low_cst (part_width, 1)
/ tree_low_cst (TYPE_SIZE (TREE_TYPE (type)), 1);
int i;
location_t loc = gimple_location (gsi_stmt (*gsi));
if (types_compatible_p (gimple_expr_type (gsi_stmt (*gsi)), type))
warning_at (loc, OPT_Wvector_operation_performance,
"vector operation will be expanded piecewise");
else
warning_at (loc, OPT_Wvector_operation_performance,
"vector operation will be expanded in parallel");
v = VEC_alloc(constructor_elt, gc, (nunits + delta - 1) / delta);
for (i = 0; i < nunits;
i += delta, index = int_const_binop (PLUS_EXPR, index, part_width))
{
tree result = f (gsi, inner_type, a, b, index, part_width, code);
constructor_elt *ce = VEC_quick_push (constructor_elt, v, NULL);
ce->index = NULL_TREE;
ce->value = result;
}
return build_constructor (type, v);
} | [
"static",
"tree",
"expand_vector_piecewise",
"(",
"gimple_stmt_iterator",
"*",
"gsi",
",",
"elem_op_func",
"f",
",",
"tree",
"type",
",",
"tree",
"inner_type",
",",
"tree",
"a",
",",
"tree",
"b",
",",
"enum",
"tree_code",
"code",
")",
"{",
"VEC",
"(",
"constructor_elt",
",",
"gc",
")",
"*",
"v",
";",
"tree",
"part_width",
"=",
"TYPE_SIZE",
"(",
"inner_type",
")",
";",
"tree",
"index",
"=",
"bitsize_int",
"(",
"0",
")",
";",
"int",
"nunits",
"=",
"TYPE_VECTOR_SUBPARTS",
"(",
"type",
")",
";",
"int",
"delta",
"=",
"tree_low_cst",
"(",
"part_width",
",",
"1",
")",
"/",
"tree_low_cst",
"(",
"TYPE_SIZE",
"(",
"TREE_TYPE",
"(",
"type",
")",
")",
",",
"1",
")",
";",
"int",
"i",
";",
"location_t",
"loc",
"=",
"gimple_location",
"(",
"gsi_stmt",
"(",
"*",
"gsi",
")",
")",
";",
"if",
"(",
"types_compatible_p",
"(",
"gimple_expr_type",
"(",
"gsi_stmt",
"(",
"*",
"gsi",
")",
")",
",",
"type",
")",
")",
"warning_at",
"(",
"loc",
",",
"OPT_Wvector_operation_performance",
",",
"\"",
"\"",
")",
";",
"else",
"warning_at",
"(",
"loc",
",",
"OPT_Wvector_operation_performance",
",",
"\"",
"\"",
")",
";",
"v",
"=",
"VEC_alloc",
"(",
"constructor_elt",
",",
"gc",
",",
"(",
"nunits",
"+",
"delta",
"-",
"1",
")",
"/",
"delta",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nunits",
";",
"i",
"+=",
"delta",
",",
"index",
"=",
"int_const_binop",
"(",
"PLUS_EXPR",
",",
"index",
",",
"part_width",
")",
")",
"{",
"tree",
"result",
"=",
"f",
"(",
"gsi",
",",
"inner_type",
",",
"a",
",",
"b",
",",
"index",
",",
"part_width",
",",
"code",
")",
";",
"constructor_elt",
"*",
"ce",
"=",
"VEC_quick_push",
"(",
"constructor_elt",
",",
"v",
",",
"NULL",
")",
";",
"ce",
"->",
"index",
"=",
"NULL_TREE",
";",
"ce",
"->",
"value",
"=",
"result",
";",
"}",
"return",
"build_constructor",
"(",
"type",
",",
"v",
")",
";",
"}"
] | Expand a vector operation to scalars, by using many operations
whose type is the vector type's inner type. | [
"Expand",
"a",
"vector",
"operation",
"to",
"scalars",
"by",
"using",
"many",
"operations",
"whose",
"type",
"is",
"the",
"vector",
"type",
"'",
"s",
"inner",
"type",
"."
] | [] | [
{
"param": "gsi",
"type": "gimple_stmt_iterator"
},
{
"param": "f",
"type": "elem_op_func"
},
{
"param": "type",
"type": "tree"
},
{
"param": "inner_type",
"type": "tree"
},
{
"param": "a",
"type": "tree"
},
{
"param": "b",
"type": "tree"
},
{
"param": "code",
"type": "enum tree_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gsi",
"type": "gimple_stmt_iterator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": "elem_op_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inner_type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "a",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | expand_vector_parallel | tree | static tree
expand_vector_parallel (gimple_stmt_iterator *gsi, elem_op_func f, tree type,
tree a, tree b,
enum tree_code code)
{
tree result, compute_type;
enum machine_mode mode;
int n_words = tree_low_cst (TYPE_SIZE_UNIT (type), 1) / UNITS_PER_WORD;
location_t loc = gimple_location (gsi_stmt (*gsi));
/* We have three strategies. If the type is already correct, just do
the operation an element at a time. Else, if the vector is wider than
one word, do it a word at a time; finally, if the vector is smaller
than one word, do it as a scalar. */
if (TYPE_MODE (TREE_TYPE (type)) == word_mode)
return expand_vector_piecewise (gsi, f,
type, TREE_TYPE (type),
a, b, code);
else if (n_words > 1)
{
tree word_type = build_word_mode_vector_type (n_words);
result = expand_vector_piecewise (gsi, f,
word_type, TREE_TYPE (word_type),
a, b, code);
result = force_gimple_operand_gsi (gsi, result, true, NULL, true,
GSI_SAME_STMT);
}
else
{
/* Use a single scalar operation with a mode no wider than word_mode. */
mode = mode_for_size (tree_low_cst (TYPE_SIZE (type), 1), MODE_INT, 0);
compute_type = lang_hooks.types.type_for_mode (mode, 1);
result = f (gsi, compute_type, a, b, NULL_TREE, NULL_TREE, code);
warning_at (loc, OPT_Wvector_operation_performance,
"vector operation will be expanded with a "
"single scalar operation");
}
return result;
} | /* Expand a vector operation to scalars with the freedom to use
a scalar integer type, or to use a different size for the items
in the vector type. */ | Expand a vector operation to scalars with the freedom to use
a scalar integer type, or to use a different size for the items
in the vector type. | [
"Expand",
"a",
"vector",
"operation",
"to",
"scalars",
"with",
"the",
"freedom",
"to",
"use",
"a",
"scalar",
"integer",
"type",
"or",
"to",
"use",
"a",
"different",
"size",
"for",
"the",
"items",
"in",
"the",
"vector",
"type",
"."
] | static tree
expand_vector_parallel (gimple_stmt_iterator *gsi, elem_op_func f, tree type,
tree a, tree b,
enum tree_code code)
{
tree result, compute_type;
enum machine_mode mode;
int n_words = tree_low_cst (TYPE_SIZE_UNIT (type), 1) / UNITS_PER_WORD;
location_t loc = gimple_location (gsi_stmt (*gsi));
if (TYPE_MODE (TREE_TYPE (type)) == word_mode)
return expand_vector_piecewise (gsi, f,
type, TREE_TYPE (type),
a, b, code);
else if (n_words > 1)
{
tree word_type = build_word_mode_vector_type (n_words);
result = expand_vector_piecewise (gsi, f,
word_type, TREE_TYPE (word_type),
a, b, code);
result = force_gimple_operand_gsi (gsi, result, true, NULL, true,
GSI_SAME_STMT);
}
else
{
mode = mode_for_size (tree_low_cst (TYPE_SIZE (type), 1), MODE_INT, 0);
compute_type = lang_hooks.types.type_for_mode (mode, 1);
result = f (gsi, compute_type, a, b, NULL_TREE, NULL_TREE, code);
warning_at (loc, OPT_Wvector_operation_performance,
"vector operation will be expanded with a "
"single scalar operation");
}
return result;
} | [
"static",
"tree",
"expand_vector_parallel",
"(",
"gimple_stmt_iterator",
"*",
"gsi",
",",
"elem_op_func",
"f",
",",
"tree",
"type",
",",
"tree",
"a",
",",
"tree",
"b",
",",
"enum",
"tree_code",
"code",
")",
"{",
"tree",
"result",
",",
"compute_type",
";",
"enum",
"machine_mode",
"mode",
";",
"int",
"n_words",
"=",
"tree_low_cst",
"(",
"TYPE_SIZE_UNIT",
"(",
"type",
")",
",",
"1",
")",
"/",
"UNITS_PER_WORD",
";",
"location_t",
"loc",
"=",
"gimple_location",
"(",
"gsi_stmt",
"(",
"*",
"gsi",
")",
")",
";",
"if",
"(",
"TYPE_MODE",
"(",
"TREE_TYPE",
"(",
"type",
")",
")",
"==",
"word_mode",
")",
"return",
"expand_vector_piecewise",
"(",
"gsi",
",",
"f",
",",
"type",
",",
"TREE_TYPE",
"(",
"type",
")",
",",
"a",
",",
"b",
",",
"code",
")",
";",
"else",
"if",
"(",
"n_words",
">",
"1",
")",
"{",
"tree",
"word_type",
"=",
"build_word_mode_vector_type",
"(",
"n_words",
")",
";",
"result",
"=",
"expand_vector_piecewise",
"(",
"gsi",
",",
"f",
",",
"word_type",
",",
"TREE_TYPE",
"(",
"word_type",
")",
",",
"a",
",",
"b",
",",
"code",
")",
";",
"result",
"=",
"force_gimple_operand_gsi",
"(",
"gsi",
",",
"result",
",",
"true",
",",
"NULL",
",",
"true",
",",
"GSI_SAME_STMT",
")",
";",
"}",
"else",
"{",
"mode",
"=",
"mode_for_size",
"(",
"tree_low_cst",
"(",
"TYPE_SIZE",
"(",
"type",
")",
",",
"1",
")",
",",
"MODE_INT",
",",
"0",
")",
";",
"compute_type",
"=",
"lang_hooks",
".",
"types",
".",
"type_for_mode",
"(",
"mode",
",",
"1",
")",
";",
"result",
"=",
"f",
"(",
"gsi",
",",
"compute_type",
",",
"a",
",",
"b",
",",
"NULL_TREE",
",",
"NULL_TREE",
",",
"code",
")",
";",
"warning_at",
"(",
"loc",
",",
"OPT_Wvector_operation_performance",
",",
"\"",
"\"",
"\"",
"\"",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Expand a vector operation to scalars with the freedom to use
a scalar integer type, or to use a different size for the items
in the vector type. | [
"Expand",
"a",
"vector",
"operation",
"to",
"scalars",
"with",
"the",
"freedom",
"to",
"use",
"a",
"scalar",
"integer",
"type",
"or",
"to",
"use",
"a",
"different",
"size",
"for",
"the",
"items",
"in",
"the",
"vector",
"type",
"."
] | [
"/* We have three strategies. If the type is already correct, just do\n the operation an element at a time. Else, if the vector is wider than\n one word, do it a word at a time; finally, if the vector is smaller\n than one word, do it as a scalar. */",
"/* Use a single scalar operation with a mode no wider than word_mode. */"
] | [
{
"param": "gsi",
"type": "gimple_stmt_iterator"
},
{
"param": "f",
"type": "elem_op_func"
},
{
"param": "type",
"type": "tree"
},
{
"param": "a",
"type": "tree"
},
{
"param": "b",
"type": "tree"
},
{
"param": "code",
"type": "enum tree_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gsi",
"type": "gimple_stmt_iterator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": "elem_op_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "a",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | expand_vector_addition | tree | static tree
expand_vector_addition (gimple_stmt_iterator *gsi,
elem_op_func f, elem_op_func f_parallel,
tree type, tree a, tree b, enum tree_code code)
{
int parts_per_word = UNITS_PER_WORD
/ tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (type)), 1);
if (INTEGRAL_TYPE_P (TREE_TYPE (type))
&& parts_per_word >= 4
&& TYPE_VECTOR_SUBPARTS (type) >= 4)
return expand_vector_parallel (gsi, f_parallel,
type, a, b, code);
else
return expand_vector_piecewise (gsi, f,
type, TREE_TYPE (type),
a, b, code);
} | /* Expand a vector operation to scalars; for integer types we can use
special bit twiddling tricks to do the sums a word at a time, using
function F_PARALLEL instead of F. These tricks are done only if
they can process at least four items, that is, only if the vector
holds at least four items and if a word can hold four items. */ | Expand a vector operation to scalars; for integer types we can use
special bit twiddling tricks to do the sums a word at a time, using
function F_PARALLEL instead of F. These tricks are done only if
they can process at least four items, that is, only if the vector
holds at least four items and if a word can hold four items. | [
"Expand",
"a",
"vector",
"operation",
"to",
"scalars",
";",
"for",
"integer",
"types",
"we",
"can",
"use",
"special",
"bit",
"twiddling",
"tricks",
"to",
"do",
"the",
"sums",
"a",
"word",
"at",
"a",
"time",
"using",
"function",
"F_PARALLEL",
"instead",
"of",
"F",
".",
"These",
"tricks",
"are",
"done",
"only",
"if",
"they",
"can",
"process",
"at",
"least",
"four",
"items",
"that",
"is",
"only",
"if",
"the",
"vector",
"holds",
"at",
"least",
"four",
"items",
"and",
"if",
"a",
"word",
"can",
"hold",
"four",
"items",
"."
] | static tree
expand_vector_addition (gimple_stmt_iterator *gsi,
elem_op_func f, elem_op_func f_parallel,
tree type, tree a, tree b, enum tree_code code)
{
int parts_per_word = UNITS_PER_WORD
/ tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (type)), 1);
if (INTEGRAL_TYPE_P (TREE_TYPE (type))
&& parts_per_word >= 4
&& TYPE_VECTOR_SUBPARTS (type) >= 4)
return expand_vector_parallel (gsi, f_parallel,
type, a, b, code);
else
return expand_vector_piecewise (gsi, f,
type, TREE_TYPE (type),
a, b, code);
} | [
"static",
"tree",
"expand_vector_addition",
"(",
"gimple_stmt_iterator",
"*",
"gsi",
",",
"elem_op_func",
"f",
",",
"elem_op_func",
"f_parallel",
",",
"tree",
"type",
",",
"tree",
"a",
",",
"tree",
"b",
",",
"enum",
"tree_code",
"code",
")",
"{",
"int",
"parts_per_word",
"=",
"UNITS_PER_WORD",
"/",
"tree_low_cst",
"(",
"TYPE_SIZE_UNIT",
"(",
"TREE_TYPE",
"(",
"type",
")",
")",
",",
"1",
")",
";",
"if",
"(",
"INTEGRAL_TYPE_P",
"(",
"TREE_TYPE",
"(",
"type",
")",
")",
"&&",
"parts_per_word",
">=",
"4",
"&&",
"TYPE_VECTOR_SUBPARTS",
"(",
"type",
")",
">=",
"4",
")",
"return",
"expand_vector_parallel",
"(",
"gsi",
",",
"f_parallel",
",",
"type",
",",
"a",
",",
"b",
",",
"code",
")",
";",
"else",
"return",
"expand_vector_piecewise",
"(",
"gsi",
",",
"f",
",",
"type",
",",
"TREE_TYPE",
"(",
"type",
")",
",",
"a",
",",
"b",
",",
"code",
")",
";",
"}"
] | Expand a vector operation to scalars; for integer types we can use
special bit twiddling tricks to do the sums a word at a time, using
function F_PARALLEL instead of F. These tricks are done only if
they can process at least four items, that is, only if the vector
holds at least four items and if a word can hold four items. | [
"Expand",
"a",
"vector",
"operation",
"to",
"scalars",
";",
"for",
"integer",
"types",
"we",
"can",
"use",
"special",
"bit",
"twiddling",
"tricks",
"to",
"do",
"the",
"sums",
"a",
"word",
"at",
"a",
"time",
"using",
"function",
"F_PARALLEL",
"instead",
"of",
"F",
".",
"These",
"tricks",
"are",
"done",
"only",
"if",
"they",
"can",
"process",
"at",
"least",
"four",
"items",
"that",
"is",
"only",
"if",
"the",
"vector",
"holds",
"at",
"least",
"four",
"items",
"and",
"if",
"a",
"word",
"can",
"hold",
"four",
"items",
"."
] | [] | [
{
"param": "gsi",
"type": "gimple_stmt_iterator"
},
{
"param": "f",
"type": "elem_op_func"
},
{
"param": "f_parallel",
"type": "elem_op_func"
},
{
"param": "type",
"type": "tree"
},
{
"param": "a",
"type": "tree"
},
{
"param": "b",
"type": "tree"
},
{
"param": "code",
"type": "enum tree_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gsi",
"type": "gimple_stmt_iterator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f",
"type": "elem_op_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f_parallel",
"type": "elem_op_func",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "a",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | uniform_vector_p | tree | static tree
uniform_vector_p (tree vec)
{
tree first, t, els;
unsigned i;
if (vec == NULL_TREE)
return NULL_TREE;
if (TREE_CODE (vec) == VECTOR_CST)
{
els = TREE_VECTOR_CST_ELTS (vec);
first = TREE_VALUE (els);
els = TREE_CHAIN (els);
for (t = els; t; t = TREE_CHAIN (t))
if (!operand_equal_p (first, TREE_VALUE (t), 0))
return NULL_TREE;
return first;
}
else if (TREE_CODE (vec) == CONSTRUCTOR)
{
first = error_mark_node;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (vec), i, t)
{
if (i == 0)
{
first = t;
continue;
}
if (!operand_equal_p (first, t, 0))
return NULL_TREE;
}
if (i != TYPE_VECTOR_SUBPARTS (TREE_TYPE (vec)))
return NULL_TREE;
return first;
}
return NULL_TREE;
} | /* Check if vector VEC consists of all the equal elements and
that the number of elements corresponds to the type of VEC.
The function returns first element of the vector
or NULL_TREE if the vector is not uniform. */ | Check if vector VEC consists of all the equal elements and
that the number of elements corresponds to the type of VEC.
The function returns first element of the vector
or NULL_TREE if the vector is not uniform. | [
"Check",
"if",
"vector",
"VEC",
"consists",
"of",
"all",
"the",
"equal",
"elements",
"and",
"that",
"the",
"number",
"of",
"elements",
"corresponds",
"to",
"the",
"type",
"of",
"VEC",
".",
"The",
"function",
"returns",
"first",
"element",
"of",
"the",
"vector",
"or",
"NULL_TREE",
"if",
"the",
"vector",
"is",
"not",
"uniform",
"."
] | static tree
uniform_vector_p (tree vec)
{
tree first, t, els;
unsigned i;
if (vec == NULL_TREE)
return NULL_TREE;
if (TREE_CODE (vec) == VECTOR_CST)
{
els = TREE_VECTOR_CST_ELTS (vec);
first = TREE_VALUE (els);
els = TREE_CHAIN (els);
for (t = els; t; t = TREE_CHAIN (t))
if (!operand_equal_p (first, TREE_VALUE (t), 0))
return NULL_TREE;
return first;
}
else if (TREE_CODE (vec) == CONSTRUCTOR)
{
first = error_mark_node;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (vec), i, t)
{
if (i == 0)
{
first = t;
continue;
}
if (!operand_equal_p (first, t, 0))
return NULL_TREE;
}
if (i != TYPE_VECTOR_SUBPARTS (TREE_TYPE (vec)))
return NULL_TREE;
return first;
}
return NULL_TREE;
} | [
"static",
"tree",
"uniform_vector_p",
"(",
"tree",
"vec",
")",
"{",
"tree",
"first",
",",
"t",
",",
"els",
";",
"unsigned",
"i",
";",
"if",
"(",
"vec",
"==",
"NULL_TREE",
")",
"return",
"NULL_TREE",
";",
"if",
"(",
"TREE_CODE",
"(",
"vec",
")",
"==",
"VECTOR_CST",
")",
"{",
"els",
"=",
"TREE_VECTOR_CST_ELTS",
"(",
"vec",
")",
";",
"first",
"=",
"TREE_VALUE",
"(",
"els",
")",
";",
"els",
"=",
"TREE_CHAIN",
"(",
"els",
")",
";",
"for",
"(",
"t",
"=",
"els",
";",
"t",
";",
"t",
"=",
"TREE_CHAIN",
"(",
"t",
")",
")",
"if",
"(",
"!",
"operand_equal_p",
"(",
"first",
",",
"TREE_VALUE",
"(",
"t",
")",
",",
"0",
")",
")",
"return",
"NULL_TREE",
";",
"return",
"first",
";",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"vec",
")",
"==",
"CONSTRUCTOR",
")",
"{",
"first",
"=",
"error_mark_node",
";",
"FOR_EACH_CONSTRUCTOR_VALUE",
"(",
"CONSTRUCTOR_ELTS",
"(",
"vec",
")",
",",
"i",
",",
"t",
")",
"",
"{",
"if",
"(",
"i",
"==",
"0",
")",
"{",
"first",
"=",
"t",
";",
"continue",
";",
"}",
"if",
"(",
"!",
"operand_equal_p",
"(",
"first",
",",
"t",
",",
"0",
")",
")",
"return",
"NULL_TREE",
";",
"}",
"if",
"(",
"i",
"!=",
"TYPE_VECTOR_SUBPARTS",
"(",
"TREE_TYPE",
"(",
"vec",
")",
")",
")",
"return",
"NULL_TREE",
";",
"return",
"first",
";",
"}",
"return",
"NULL_TREE",
";",
"}"
] | Check if vector VEC consists of all the equal elements and
that the number of elements corresponds to the type of VEC. | [
"Check",
"if",
"vector",
"VEC",
"consists",
"of",
"all",
"the",
"equal",
"elements",
"and",
"that",
"the",
"number",
"of",
"elements",
"corresponds",
"to",
"the",
"type",
"of",
"VEC",
"."
] | [] | [
{
"param": "vec",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vec",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | type_for_widest_vector_mode | tree | static tree
type_for_widest_vector_mode (tree type, optab op)
{
enum machine_mode inner_mode = TYPE_MODE (type);
enum machine_mode best_mode = VOIDmode, mode;
int best_nunits = 0;
if (SCALAR_FLOAT_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_FLOAT;
else if (SCALAR_FRACT_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_FRACT;
else if (SCALAR_UFRACT_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_UFRACT;
else if (SCALAR_ACCUM_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_ACCUM;
else if (SCALAR_UACCUM_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_UACCUM;
else
mode = MIN_MODE_VECTOR_INT;
for (; mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode))
if (GET_MODE_INNER (mode) == inner_mode
&& GET_MODE_NUNITS (mode) > best_nunits
&& optab_handler (op, mode) != CODE_FOR_nothing)
best_mode = mode, best_nunits = GET_MODE_NUNITS (mode);
if (best_mode == VOIDmode)
return NULL_TREE;
else
return build_vector_type_for_mode (type, best_mode);
} | /* Return a type for the widest vector mode whose components are of type
TYPE, or NULL_TREE if none is found. */ | Return a type for the widest vector mode whose components are of type
TYPE, or NULL_TREE if none is found. | [
"Return",
"a",
"type",
"for",
"the",
"widest",
"vector",
"mode",
"whose",
"components",
"are",
"of",
"type",
"TYPE",
"or",
"NULL_TREE",
"if",
"none",
"is",
"found",
"."
] | static tree
type_for_widest_vector_mode (tree type, optab op)
{
enum machine_mode inner_mode = TYPE_MODE (type);
enum machine_mode best_mode = VOIDmode, mode;
int best_nunits = 0;
if (SCALAR_FLOAT_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_FLOAT;
else if (SCALAR_FRACT_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_FRACT;
else if (SCALAR_UFRACT_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_UFRACT;
else if (SCALAR_ACCUM_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_ACCUM;
else if (SCALAR_UACCUM_MODE_P (inner_mode))
mode = MIN_MODE_VECTOR_UACCUM;
else
mode = MIN_MODE_VECTOR_INT;
for (; mode != VOIDmode; mode = GET_MODE_WIDER_MODE (mode))
if (GET_MODE_INNER (mode) == inner_mode
&& GET_MODE_NUNITS (mode) > best_nunits
&& optab_handler (op, mode) != CODE_FOR_nothing)
best_mode = mode, best_nunits = GET_MODE_NUNITS (mode);
if (best_mode == VOIDmode)
return NULL_TREE;
else
return build_vector_type_for_mode (type, best_mode);
} | [
"static",
"tree",
"type_for_widest_vector_mode",
"(",
"tree",
"type",
",",
"optab",
"op",
")",
"{",
"enum",
"machine_mode",
"inner_mode",
"=",
"TYPE_MODE",
"(",
"type",
")",
";",
"enum",
"machine_mode",
"best_mode",
"=",
"VOIDmode",
",",
"mode",
";",
"int",
"best_nunits",
"=",
"0",
";",
"if",
"(",
"SCALAR_FLOAT_MODE_P",
"(",
"inner_mode",
")",
")",
"mode",
"=",
"MIN_MODE_VECTOR_FLOAT",
";",
"else",
"if",
"(",
"SCALAR_FRACT_MODE_P",
"(",
"inner_mode",
")",
")",
"mode",
"=",
"MIN_MODE_VECTOR_FRACT",
";",
"else",
"if",
"(",
"SCALAR_UFRACT_MODE_P",
"(",
"inner_mode",
")",
")",
"mode",
"=",
"MIN_MODE_VECTOR_UFRACT",
";",
"else",
"if",
"(",
"SCALAR_ACCUM_MODE_P",
"(",
"inner_mode",
")",
")",
"mode",
"=",
"MIN_MODE_VECTOR_ACCUM",
";",
"else",
"if",
"(",
"SCALAR_UACCUM_MODE_P",
"(",
"inner_mode",
")",
")",
"mode",
"=",
"MIN_MODE_VECTOR_UACCUM",
";",
"else",
"mode",
"=",
"MIN_MODE_VECTOR_INT",
";",
"for",
"(",
";",
"mode",
"!=",
"VOIDmode",
";",
"mode",
"=",
"GET_MODE_WIDER_MODE",
"(",
"mode",
")",
")",
"if",
"(",
"GET_MODE_INNER",
"(",
"mode",
")",
"==",
"inner_mode",
"&&",
"GET_MODE_NUNITS",
"(",
"mode",
")",
">",
"best_nunits",
"&&",
"optab_handler",
"(",
"op",
",",
"mode",
")",
"!=",
"CODE_FOR_nothing",
")",
"best_mode",
"=",
"mode",
",",
"best_nunits",
"=",
"GET_MODE_NUNITS",
"(",
"mode",
")",
";",
"if",
"(",
"best_mode",
"==",
"VOIDmode",
")",
"return",
"NULL_TREE",
";",
"else",
"return",
"build_vector_type_for_mode",
"(",
"type",
",",
"best_mode",
")",
";",
"}"
] | Return a type for the widest vector mode whose components are of type
TYPE, or NULL_TREE if none is found. | [
"Return",
"a",
"type",
"for",
"the",
"widest",
"vector",
"mode",
"whose",
"components",
"are",
"of",
"type",
"TYPE",
"or",
"NULL_TREE",
"if",
"none",
"is",
"found",
"."
] | [] | [
{
"param": "type",
"type": "tree"
},
{
"param": "op",
"type": "optab"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op",
"type": "optab",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | vector_element | tree | static tree
vector_element (gimple_stmt_iterator *gsi, tree vect, tree idx, tree *ptmpvec)
{
tree vect_type, vect_elt_type;
gimple asgn;
tree tmpvec;
tree arraytype;
bool need_asgn = true;
unsigned int elements;
vect_type = TREE_TYPE (vect);
vect_elt_type = TREE_TYPE (vect_type);
elements = TYPE_VECTOR_SUBPARTS (vect_type);
if (TREE_CODE (idx) == INTEGER_CST)
{
unsigned HOST_WIDE_INT index;
/* Given that we're about to compute a binary modulus,
we don't care about the high bits of the value. */
index = TREE_INT_CST_LOW (idx);
if (!host_integerp (idx, 1) || index >= elements)
{
index &= elements - 1;
idx = build_int_cst (TREE_TYPE (idx), index);
}
/* When lowering a vector statement sequence do some easy
simplification by looking through intermediate vector results. */
if (TREE_CODE (vect) == SSA_NAME)
{
gimple def_stmt = SSA_NAME_DEF_STMT (vect);
if (is_gimple_assign (def_stmt)
&& (gimple_assign_rhs_code (def_stmt) == VECTOR_CST
|| gimple_assign_rhs_code (def_stmt) == CONSTRUCTOR))
vect = gimple_assign_rhs1 (def_stmt);
}
if (TREE_CODE (vect) == VECTOR_CST)
{
unsigned i;
tree vals = TREE_VECTOR_CST_ELTS (vect);
for (i = 0; vals; vals = TREE_CHAIN (vals), ++i)
if (i == index)
return TREE_VALUE (vals);
return build_zero_cst (vect_elt_type);
}
else if (TREE_CODE (vect) == CONSTRUCTOR)
{
unsigned i;
tree elt_i, elt_v;
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (vect), i, elt_i, elt_v)
if (operand_equal_p (elt_i, idx, 0))
return elt_v;
return build_zero_cst (vect_elt_type);
}
else
{
tree size = TYPE_SIZE (vect_elt_type);
tree pos = fold_build2 (MULT_EXPR, bitsizetype, bitsize_int (index),
size);
return fold_build3 (BIT_FIELD_REF, vect_elt_type, vect, size, pos);
}
}
if (!ptmpvec)
tmpvec = create_tmp_var (vect_type, "vectmp");
else if (!*ptmpvec)
tmpvec = *ptmpvec = create_tmp_var (vect_type, "vectmp");
else
{
tmpvec = *ptmpvec;
need_asgn = false;
}
if (need_asgn)
{
TREE_ADDRESSABLE (tmpvec) = 1;
asgn = gimple_build_assign (tmpvec, vect);
gsi_insert_before (gsi, asgn, GSI_SAME_STMT);
}
arraytype = build_array_type_nelts (vect_elt_type, elements);
return build4 (ARRAY_REF, vect_elt_type,
build1 (VIEW_CONVERT_EXPR, arraytype, tmpvec),
idx, NULL_TREE, NULL_TREE);
} | /* Build a reference to the element of the vector VECT. Function
returns either the element itself, either BIT_FIELD_REF, or an
ARRAY_REF expression.
GSI is requred to insert temporary variables while building a
refernece to the element of the vector VECT.
PTMPVEC is a pointer to the temporary variable for caching
purposes. In case when PTMPVEC is NULL new temporary variable
will be created. */ | Build a reference to the element of the vector VECT. Function
returns either the element itself, either BIT_FIELD_REF, or an
ARRAY_REF expression.
GSI is requred to insert temporary variables while building a
refernece to the element of the vector VECT.
PTMPVEC is a pointer to the temporary variable for caching
purposes. In case when PTMPVEC is NULL new temporary variable
will be created. | [
"Build",
"a",
"reference",
"to",
"the",
"element",
"of",
"the",
"vector",
"VECT",
".",
"Function",
"returns",
"either",
"the",
"element",
"itself",
"either",
"BIT_FIELD_REF",
"or",
"an",
"ARRAY_REF",
"expression",
".",
"GSI",
"is",
"requred",
"to",
"insert",
"temporary",
"variables",
"while",
"building",
"a",
"refernece",
"to",
"the",
"element",
"of",
"the",
"vector",
"VECT",
".",
"PTMPVEC",
"is",
"a",
"pointer",
"to",
"the",
"temporary",
"variable",
"for",
"caching",
"purposes",
".",
"In",
"case",
"when",
"PTMPVEC",
"is",
"NULL",
"new",
"temporary",
"variable",
"will",
"be",
"created",
"."
] | static tree
vector_element (gimple_stmt_iterator *gsi, tree vect, tree idx, tree *ptmpvec)
{
tree vect_type, vect_elt_type;
gimple asgn;
tree tmpvec;
tree arraytype;
bool need_asgn = true;
unsigned int elements;
vect_type = TREE_TYPE (vect);
vect_elt_type = TREE_TYPE (vect_type);
elements = TYPE_VECTOR_SUBPARTS (vect_type);
if (TREE_CODE (idx) == INTEGER_CST)
{
unsigned HOST_WIDE_INT index;
index = TREE_INT_CST_LOW (idx);
if (!host_integerp (idx, 1) || index >= elements)
{
index &= elements - 1;
idx = build_int_cst (TREE_TYPE (idx), index);
}
if (TREE_CODE (vect) == SSA_NAME)
{
gimple def_stmt = SSA_NAME_DEF_STMT (vect);
if (is_gimple_assign (def_stmt)
&& (gimple_assign_rhs_code (def_stmt) == VECTOR_CST
|| gimple_assign_rhs_code (def_stmt) == CONSTRUCTOR))
vect = gimple_assign_rhs1 (def_stmt);
}
if (TREE_CODE (vect) == VECTOR_CST)
{
unsigned i;
tree vals = TREE_VECTOR_CST_ELTS (vect);
for (i = 0; vals; vals = TREE_CHAIN (vals), ++i)
if (i == index)
return TREE_VALUE (vals);
return build_zero_cst (vect_elt_type);
}
else if (TREE_CODE (vect) == CONSTRUCTOR)
{
unsigned i;
tree elt_i, elt_v;
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (vect), i, elt_i, elt_v)
if (operand_equal_p (elt_i, idx, 0))
return elt_v;
return build_zero_cst (vect_elt_type);
}
else
{
tree size = TYPE_SIZE (vect_elt_type);
tree pos = fold_build2 (MULT_EXPR, bitsizetype, bitsize_int (index),
size);
return fold_build3 (BIT_FIELD_REF, vect_elt_type, vect, size, pos);
}
}
if (!ptmpvec)
tmpvec = create_tmp_var (vect_type, "vectmp");
else if (!*ptmpvec)
tmpvec = *ptmpvec = create_tmp_var (vect_type, "vectmp");
else
{
tmpvec = *ptmpvec;
need_asgn = false;
}
if (need_asgn)
{
TREE_ADDRESSABLE (tmpvec) = 1;
asgn = gimple_build_assign (tmpvec, vect);
gsi_insert_before (gsi, asgn, GSI_SAME_STMT);
}
arraytype = build_array_type_nelts (vect_elt_type, elements);
return build4 (ARRAY_REF, vect_elt_type,
build1 (VIEW_CONVERT_EXPR, arraytype, tmpvec),
idx, NULL_TREE, NULL_TREE);
} | [
"static",
"tree",
"vector_element",
"(",
"gimple_stmt_iterator",
"*",
"gsi",
",",
"tree",
"vect",
",",
"tree",
"idx",
",",
"tree",
"*",
"ptmpvec",
")",
"{",
"tree",
"vect_type",
",",
"vect_elt_type",
";",
"gimple",
"asgn",
";",
"tree",
"tmpvec",
";",
"tree",
"arraytype",
";",
"bool",
"need_asgn",
"=",
"true",
";",
"unsigned",
"int",
"elements",
";",
"vect_type",
"=",
"TREE_TYPE",
"(",
"vect",
")",
";",
"vect_elt_type",
"=",
"TREE_TYPE",
"(",
"vect_type",
")",
";",
"elements",
"=",
"TYPE_VECTOR_SUBPARTS",
"(",
"vect_type",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"idx",
")",
"==",
"INTEGER_CST",
")",
"{",
"unsigned",
"HOST_WIDE_INT",
"index",
";",
"index",
"=",
"TREE_INT_CST_LOW",
"(",
"idx",
")",
";",
"if",
"(",
"!",
"host_integerp",
"(",
"idx",
",",
"1",
")",
"||",
"index",
">=",
"elements",
")",
"{",
"index",
"&=",
"elements",
"-",
"1",
";",
"idx",
"=",
"build_int_cst",
"(",
"TREE_TYPE",
"(",
"idx",
")",
",",
"index",
")",
";",
"}",
"if",
"(",
"TREE_CODE",
"(",
"vect",
")",
"==",
"SSA_NAME",
")",
"{",
"gimple",
"def_stmt",
"=",
"SSA_NAME_DEF_STMT",
"(",
"vect",
")",
";",
"if",
"(",
"is_gimple_assign",
"(",
"def_stmt",
")",
"&&",
"(",
"gimple_assign_rhs_code",
"(",
"def_stmt",
")",
"==",
"VECTOR_CST",
"||",
"gimple_assign_rhs_code",
"(",
"def_stmt",
")",
"==",
"CONSTRUCTOR",
")",
")",
"vect",
"=",
"gimple_assign_rhs1",
"(",
"def_stmt",
")",
";",
"}",
"if",
"(",
"TREE_CODE",
"(",
"vect",
")",
"==",
"VECTOR_CST",
")",
"{",
"unsigned",
"i",
";",
"tree",
"vals",
"=",
"TREE_VECTOR_CST_ELTS",
"(",
"vect",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"vals",
";",
"vals",
"=",
"TREE_CHAIN",
"(",
"vals",
")",
",",
"++",
"i",
")",
"if",
"(",
"i",
"==",
"index",
")",
"return",
"TREE_VALUE",
"(",
"vals",
")",
";",
"return",
"build_zero_cst",
"(",
"vect_elt_type",
")",
";",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"vect",
")",
"==",
"CONSTRUCTOR",
")",
"{",
"unsigned",
"i",
";",
"tree",
"elt_i",
",",
"elt_v",
";",
"FOR_EACH_CONSTRUCTOR_ELT",
"(",
"CONSTRUCTOR_ELTS",
"(",
"vect",
")",
",",
"i",
",",
"elt_i",
",",
"elt_v",
")",
"",
"if",
"(",
"operand_equal_p",
"(",
"elt_i",
",",
"idx",
",",
"0",
")",
")",
"return",
"elt_v",
";",
"return",
"build_zero_cst",
"(",
"vect_elt_type",
")",
";",
"}",
"else",
"{",
"tree",
"size",
"=",
"TYPE_SIZE",
"(",
"vect_elt_type",
")",
";",
"tree",
"pos",
"=",
"fold_build2",
"(",
"MULT_EXPR",
",",
"bitsizetype",
",",
"bitsize_int",
"(",
"index",
")",
",",
"size",
")",
";",
"return",
"fold_build3",
"(",
"BIT_FIELD_REF",
",",
"vect_elt_type",
",",
"vect",
",",
"size",
",",
"pos",
")",
";",
"}",
"}",
"if",
"(",
"!",
"ptmpvec",
")",
"tmpvec",
"=",
"create_tmp_var",
"(",
"vect_type",
",",
"\"",
"\"",
")",
";",
"else",
"if",
"(",
"!",
"*",
"ptmpvec",
")",
"tmpvec",
"=",
"*",
"ptmpvec",
"=",
"create_tmp_var",
"(",
"vect_type",
",",
"\"",
"\"",
")",
";",
"else",
"{",
"tmpvec",
"=",
"*",
"ptmpvec",
";",
"need_asgn",
"=",
"false",
";",
"}",
"if",
"(",
"need_asgn",
")",
"{",
"TREE_ADDRESSABLE",
"(",
"tmpvec",
")",
"=",
"1",
";",
"asgn",
"=",
"gimple_build_assign",
"(",
"tmpvec",
",",
"vect",
")",
";",
"gsi_insert_before",
"(",
"gsi",
",",
"asgn",
",",
"GSI_SAME_STMT",
")",
";",
"}",
"arraytype",
"=",
"build_array_type_nelts",
"(",
"vect_elt_type",
",",
"elements",
")",
";",
"return",
"build4",
"(",
"ARRAY_REF",
",",
"vect_elt_type",
",",
"build1",
"(",
"VIEW_CONVERT_EXPR",
",",
"arraytype",
",",
"tmpvec",
")",
",",
"idx",
",",
"NULL_TREE",
",",
"NULL_TREE",
")",
";",
"}"
] | Build a reference to the element of the vector VECT. | [
"Build",
"a",
"reference",
"to",
"the",
"element",
"of",
"the",
"vector",
"VECT",
"."
] | [
"/* Given that we're about to compute a binary modulus,\n\t we don't care about the high bits of the value. */",
"/* When lowering a vector statement sequence do some easy\n simplification by looking through intermediate vector results. */"
] | [
{
"param": "gsi",
"type": "gimple_stmt_iterator"
},
{
"param": "vect",
"type": "tree"
},
{
"param": "idx",
"type": "tree"
},
{
"param": "ptmpvec",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gsi",
"type": "gimple_stmt_iterator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vect",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "idx",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ptmpvec",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | expand_vector_operations_1 | void | static void
expand_vector_operations_1 (gimple_stmt_iterator *gsi)
{
gimple stmt = gsi_stmt (*gsi);
tree lhs, rhs1, rhs2 = NULL, type, compute_type;
enum tree_code code;
enum machine_mode compute_mode;
optab op = NULL;
enum gimple_rhs_class rhs_class;
tree new_rhs;
if (gimple_code (stmt) != GIMPLE_ASSIGN)
return;
code = gimple_assign_rhs_code (stmt);
rhs_class = get_gimple_rhs_class (code);
lhs = gimple_assign_lhs (stmt);
if (code == VEC_PERM_EXPR)
{
lower_vec_perm (gsi);
return;
}
if (rhs_class != GIMPLE_UNARY_RHS && rhs_class != GIMPLE_BINARY_RHS)
return;
rhs1 = gimple_assign_rhs1 (stmt);
type = gimple_expr_type (stmt);
if (rhs_class == GIMPLE_BINARY_RHS)
rhs2 = gimple_assign_rhs2 (stmt);
if (TREE_CODE (type) != VECTOR_TYPE)
return;
if (code == NOP_EXPR
|| code == FLOAT_EXPR
|| code == FIX_TRUNC_EXPR
|| code == VIEW_CONVERT_EXPR)
return;
gcc_assert (code != CONVERT_EXPR);
/* The signedness is determined from input argument. */
if (code == VEC_UNPACK_FLOAT_HI_EXPR
|| code == VEC_UNPACK_FLOAT_LO_EXPR)
type = TREE_TYPE (rhs1);
/* Choose between vector shift/rotate by vector and vector shift/rotate by
scalar */
if (code == LSHIFT_EXPR
|| code == RSHIFT_EXPR
|| code == LROTATE_EXPR
|| code == RROTATE_EXPR)
{
optab opv;
/* Check whether we have vector <op> {x,x,x,x} where x
could be a scalar variable or a constant. Transform
vector <op> {x,x,x,x} ==> vector <op> scalar. */
if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
{
tree first;
gimple def_stmt;
if ((TREE_CODE (rhs2) == VECTOR_CST
&& (first = uniform_vector_p (rhs2)) != NULL_TREE)
|| (TREE_CODE (rhs2) == SSA_NAME
&& (def_stmt = SSA_NAME_DEF_STMT (rhs2))
&& gimple_assign_single_p (def_stmt)
&& (first = uniform_vector_p
(gimple_assign_rhs1 (def_stmt))) != NULL_TREE))
{
gimple_assign_set_rhs2 (stmt, first);
update_stmt (stmt);
rhs2 = first;
}
}
opv = optab_for_tree_code (code, type, optab_vector);
if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
op = opv;
else
{
op = optab_for_tree_code (code, type, optab_scalar);
/* The rtl expander will expand vector/scalar as vector/vector
if necessary. Don't bother converting the stmt here. */
if (optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing
&& optab_handler (opv, TYPE_MODE (type)) != CODE_FOR_nothing)
return;
}
}
else
op = optab_for_tree_code (code, type, optab_default);
/* For widening/narrowing vector operations, the relevant type is of the
arguments, not the widened result. VEC_UNPACK_FLOAT_*_EXPR is
calculated in the same way above. */
if (code == WIDEN_SUM_EXPR
|| code == VEC_WIDEN_MULT_HI_EXPR
|| code == VEC_WIDEN_MULT_LO_EXPR
|| code == VEC_UNPACK_HI_EXPR
|| code == VEC_UNPACK_LO_EXPR
|| code == VEC_PACK_TRUNC_EXPR
|| code == VEC_PACK_SAT_EXPR
|| code == VEC_PACK_FIX_TRUNC_EXPR
|| code == VEC_WIDEN_LSHIFT_HI_EXPR
|| code == VEC_WIDEN_LSHIFT_LO_EXPR)
type = TREE_TYPE (rhs1);
/* Optabs will try converting a negation into a subtraction, so
look for it as well. TODO: negation of floating-point vectors
might be turned into an exclusive OR toggling the sign bit. */
if (op == NULL
&& code == NEGATE_EXPR
&& INTEGRAL_TYPE_P (TREE_TYPE (type)))
op = optab_for_tree_code (MINUS_EXPR, type, optab_default);
/* For very wide vectors, try using a smaller vector mode. */
compute_type = type;
if (!VECTOR_MODE_P (TYPE_MODE (type)) && op)
{
tree vector_compute_type
= type_for_widest_vector_mode (TREE_TYPE (type), op);
if (vector_compute_type != NULL_TREE
&& (TYPE_VECTOR_SUBPARTS (vector_compute_type)
< TYPE_VECTOR_SUBPARTS (compute_type))
&& (optab_handler (op, TYPE_MODE (vector_compute_type))
!= CODE_FOR_nothing))
compute_type = vector_compute_type;
}
/* If we are breaking a BLKmode vector into smaller pieces,
type_for_widest_vector_mode has already looked into the optab,
so skip these checks. */
if (compute_type == type)
{
compute_mode = TYPE_MODE (compute_type);
if (VECTOR_MODE_P (compute_mode)
&& op != NULL
&& optab_handler (op, compute_mode) != CODE_FOR_nothing)
return;
else
/* There is no operation in hardware, so fall back to scalars. */
compute_type = TREE_TYPE (type);
}
gcc_assert (code != VEC_LSHIFT_EXPR && code != VEC_RSHIFT_EXPR);
new_rhs = expand_vector_operation (gsi, type, compute_type, stmt, code);
/* Leave expression untouched for later expansion. */
if (new_rhs == NULL_TREE)
return;
if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (new_rhs)))
new_rhs = gimplify_build1 (gsi, VIEW_CONVERT_EXPR, TREE_TYPE (lhs),
new_rhs);
/* NOTE: We should avoid using gimple_assign_set_rhs_from_tree. One
way to do it is change expand_vector_operation and its callees to
return a tree_code, RHS1 and RHS2 instead of a tree. */
gimple_assign_set_rhs_from_tree (gsi, new_rhs);
update_stmt (gsi_stmt (*gsi));
} | /* Process one statement. If we identify a vector operation, expand it. */ | Process one statement. If we identify a vector operation, expand it. | [
"Process",
"one",
"statement",
".",
"If",
"we",
"identify",
"a",
"vector",
"operation",
"expand",
"it",
"."
] | static void
expand_vector_operations_1 (gimple_stmt_iterator *gsi)
{
gimple stmt = gsi_stmt (*gsi);
tree lhs, rhs1, rhs2 = NULL, type, compute_type;
enum tree_code code;
enum machine_mode compute_mode;
optab op = NULL;
enum gimple_rhs_class rhs_class;
tree new_rhs;
if (gimple_code (stmt) != GIMPLE_ASSIGN)
return;
code = gimple_assign_rhs_code (stmt);
rhs_class = get_gimple_rhs_class (code);
lhs = gimple_assign_lhs (stmt);
if (code == VEC_PERM_EXPR)
{
lower_vec_perm (gsi);
return;
}
if (rhs_class != GIMPLE_UNARY_RHS && rhs_class != GIMPLE_BINARY_RHS)
return;
rhs1 = gimple_assign_rhs1 (stmt);
type = gimple_expr_type (stmt);
if (rhs_class == GIMPLE_BINARY_RHS)
rhs2 = gimple_assign_rhs2 (stmt);
if (TREE_CODE (type) != VECTOR_TYPE)
return;
if (code == NOP_EXPR
|| code == FLOAT_EXPR
|| code == FIX_TRUNC_EXPR
|| code == VIEW_CONVERT_EXPR)
return;
gcc_assert (code != CONVERT_EXPR);
if (code == VEC_UNPACK_FLOAT_HI_EXPR
|| code == VEC_UNPACK_FLOAT_LO_EXPR)
type = TREE_TYPE (rhs1);
if (code == LSHIFT_EXPR
|| code == RSHIFT_EXPR
|| code == LROTATE_EXPR
|| code == RROTATE_EXPR)
{
optab opv;
if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
{
tree first;
gimple def_stmt;
if ((TREE_CODE (rhs2) == VECTOR_CST
&& (first = uniform_vector_p (rhs2)) != NULL_TREE)
|| (TREE_CODE (rhs2) == SSA_NAME
&& (def_stmt = SSA_NAME_DEF_STMT (rhs2))
&& gimple_assign_single_p (def_stmt)
&& (first = uniform_vector_p
(gimple_assign_rhs1 (def_stmt))) != NULL_TREE))
{
gimple_assign_set_rhs2 (stmt, first);
update_stmt (stmt);
rhs2 = first;
}
}
opv = optab_for_tree_code (code, type, optab_vector);
if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
op = opv;
else
{
op = optab_for_tree_code (code, type, optab_scalar);
if (optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing
&& optab_handler (opv, TYPE_MODE (type)) != CODE_FOR_nothing)
return;
}
}
else
op = optab_for_tree_code (code, type, optab_default);
if (code == WIDEN_SUM_EXPR
|| code == VEC_WIDEN_MULT_HI_EXPR
|| code == VEC_WIDEN_MULT_LO_EXPR
|| code == VEC_UNPACK_HI_EXPR
|| code == VEC_UNPACK_LO_EXPR
|| code == VEC_PACK_TRUNC_EXPR
|| code == VEC_PACK_SAT_EXPR
|| code == VEC_PACK_FIX_TRUNC_EXPR
|| code == VEC_WIDEN_LSHIFT_HI_EXPR
|| code == VEC_WIDEN_LSHIFT_LO_EXPR)
type = TREE_TYPE (rhs1);
if (op == NULL
&& code == NEGATE_EXPR
&& INTEGRAL_TYPE_P (TREE_TYPE (type)))
op = optab_for_tree_code (MINUS_EXPR, type, optab_default);
compute_type = type;
if (!VECTOR_MODE_P (TYPE_MODE (type)) && op)
{
tree vector_compute_type
= type_for_widest_vector_mode (TREE_TYPE (type), op);
if (vector_compute_type != NULL_TREE
&& (TYPE_VECTOR_SUBPARTS (vector_compute_type)
< TYPE_VECTOR_SUBPARTS (compute_type))
&& (optab_handler (op, TYPE_MODE (vector_compute_type))
!= CODE_FOR_nothing))
compute_type = vector_compute_type;
}
if (compute_type == type)
{
compute_mode = TYPE_MODE (compute_type);
if (VECTOR_MODE_P (compute_mode)
&& op != NULL
&& optab_handler (op, compute_mode) != CODE_FOR_nothing)
return;
else
compute_type = TREE_TYPE (type);
}
gcc_assert (code != VEC_LSHIFT_EXPR && code != VEC_RSHIFT_EXPR);
new_rhs = expand_vector_operation (gsi, type, compute_type, stmt, code);
if (new_rhs == NULL_TREE)
return;
if (!useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (new_rhs)))
new_rhs = gimplify_build1 (gsi, VIEW_CONVERT_EXPR, TREE_TYPE (lhs),
new_rhs);
gimple_assign_set_rhs_from_tree (gsi, new_rhs);
update_stmt (gsi_stmt (*gsi));
} | [
"static",
"void",
"expand_vector_operations_1",
"(",
"gimple_stmt_iterator",
"*",
"gsi",
")",
"{",
"gimple",
"stmt",
"=",
"gsi_stmt",
"(",
"*",
"gsi",
")",
";",
"tree",
"lhs",
",",
"rhs1",
",",
"rhs2",
"=",
"NULL",
",",
"type",
",",
"compute_type",
";",
"enum",
"tree_code",
"code",
";",
"enum",
"machine_mode",
"compute_mode",
";",
"optab",
"op",
"=",
"NULL",
";",
"enum",
"gimple_rhs_class",
"rhs_class",
";",
"tree",
"new_rhs",
";",
"if",
"(",
"gimple_code",
"(",
"stmt",
")",
"!=",
"GIMPLE_ASSIGN",
")",
"return",
";",
"code",
"=",
"gimple_assign_rhs_code",
"(",
"stmt",
")",
";",
"rhs_class",
"=",
"get_gimple_rhs_class",
"(",
"code",
")",
";",
"lhs",
"=",
"gimple_assign_lhs",
"(",
"stmt",
")",
";",
"if",
"(",
"code",
"==",
"VEC_PERM_EXPR",
")",
"{",
"lower_vec_perm",
"(",
"gsi",
")",
";",
"return",
";",
"}",
"if",
"(",
"rhs_class",
"!=",
"GIMPLE_UNARY_RHS",
"&&",
"rhs_class",
"!=",
"GIMPLE_BINARY_RHS",
")",
"return",
";",
"rhs1",
"=",
"gimple_assign_rhs1",
"(",
"stmt",
")",
";",
"type",
"=",
"gimple_expr_type",
"(",
"stmt",
")",
";",
"if",
"(",
"rhs_class",
"==",
"GIMPLE_BINARY_RHS",
")",
"rhs2",
"=",
"gimple_assign_rhs2",
"(",
"stmt",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"type",
")",
"!=",
"VECTOR_TYPE",
")",
"return",
";",
"if",
"(",
"code",
"==",
"NOP_EXPR",
"||",
"code",
"==",
"FLOAT_EXPR",
"||",
"code",
"==",
"FIX_TRUNC_EXPR",
"||",
"code",
"==",
"VIEW_CONVERT_EXPR",
")",
"return",
";",
"gcc_assert",
"(",
"code",
"!=",
"CONVERT_EXPR",
")",
";",
"if",
"(",
"code",
"==",
"VEC_UNPACK_FLOAT_HI_EXPR",
"||",
"code",
"==",
"VEC_UNPACK_FLOAT_LO_EXPR",
")",
"type",
"=",
"TREE_TYPE",
"(",
"rhs1",
")",
";",
"if",
"(",
"code",
"==",
"LSHIFT_EXPR",
"||",
"code",
"==",
"RSHIFT_EXPR",
"||",
"code",
"==",
"LROTATE_EXPR",
"||",
"code",
"==",
"RROTATE_EXPR",
")",
"{",
"optab",
"opv",
";",
"if",
"(",
"VECTOR_INTEGER_TYPE_P",
"(",
"TREE_TYPE",
"(",
"rhs2",
")",
")",
")",
"{",
"tree",
"first",
";",
"gimple",
"def_stmt",
";",
"if",
"(",
"(",
"TREE_CODE",
"(",
"rhs2",
")",
"==",
"VECTOR_CST",
"&&",
"(",
"first",
"=",
"uniform_vector_p",
"(",
"rhs2",
")",
")",
"!=",
"NULL_TREE",
")",
"||",
"(",
"TREE_CODE",
"(",
"rhs2",
")",
"==",
"SSA_NAME",
"&&",
"(",
"def_stmt",
"=",
"SSA_NAME_DEF_STMT",
"(",
"rhs2",
")",
")",
"&&",
"gimple_assign_single_p",
"(",
"def_stmt",
")",
"&&",
"(",
"first",
"=",
"uniform_vector_p",
"(",
"gimple_assign_rhs1",
"(",
"def_stmt",
")",
")",
")",
"!=",
"NULL_TREE",
")",
")",
"{",
"gimple_assign_set_rhs2",
"(",
"stmt",
",",
"first",
")",
";",
"update_stmt",
"(",
"stmt",
")",
";",
"rhs2",
"=",
"first",
";",
"}",
"}",
"opv",
"=",
"optab_for_tree_code",
"(",
"code",
",",
"type",
",",
"optab_vector",
")",
";",
"if",
"(",
"VECTOR_INTEGER_TYPE_P",
"(",
"TREE_TYPE",
"(",
"rhs2",
")",
")",
")",
"op",
"=",
"opv",
";",
"else",
"{",
"op",
"=",
"optab_for_tree_code",
"(",
"code",
",",
"type",
",",
"optab_scalar",
")",
";",
"if",
"(",
"optab_handler",
"(",
"op",
",",
"TYPE_MODE",
"(",
"type",
")",
")",
"==",
"CODE_FOR_nothing",
"&&",
"optab_handler",
"(",
"opv",
",",
"TYPE_MODE",
"(",
"type",
")",
")",
"!=",
"CODE_FOR_nothing",
")",
"return",
";",
"}",
"}",
"else",
"op",
"=",
"optab_for_tree_code",
"(",
"code",
",",
"type",
",",
"optab_default",
")",
";",
"if",
"(",
"code",
"==",
"WIDEN_SUM_EXPR",
"||",
"code",
"==",
"VEC_WIDEN_MULT_HI_EXPR",
"||",
"code",
"==",
"VEC_WIDEN_MULT_LO_EXPR",
"||",
"code",
"==",
"VEC_UNPACK_HI_EXPR",
"||",
"code",
"==",
"VEC_UNPACK_LO_EXPR",
"||",
"code",
"==",
"VEC_PACK_TRUNC_EXPR",
"||",
"code",
"==",
"VEC_PACK_SAT_EXPR",
"||",
"code",
"==",
"VEC_PACK_FIX_TRUNC_EXPR",
"||",
"code",
"==",
"VEC_WIDEN_LSHIFT_HI_EXPR",
"||",
"code",
"==",
"VEC_WIDEN_LSHIFT_LO_EXPR",
")",
"type",
"=",
"TREE_TYPE",
"(",
"rhs1",
")",
";",
"if",
"(",
"op",
"==",
"NULL",
"&&",
"code",
"==",
"NEGATE_EXPR",
"&&",
"INTEGRAL_TYPE_P",
"(",
"TREE_TYPE",
"(",
"type",
")",
")",
")",
"op",
"=",
"optab_for_tree_code",
"(",
"MINUS_EXPR",
",",
"type",
",",
"optab_default",
")",
";",
"compute_type",
"=",
"type",
";",
"if",
"(",
"!",
"VECTOR_MODE_P",
"(",
"TYPE_MODE",
"(",
"type",
")",
")",
"&&",
"op",
")",
"{",
"tree",
"vector_compute_type",
"=",
"type_for_widest_vector_mode",
"(",
"TREE_TYPE",
"(",
"type",
")",
",",
"op",
")",
";",
"if",
"(",
"vector_compute_type",
"!=",
"NULL_TREE",
"&&",
"(",
"TYPE_VECTOR_SUBPARTS",
"(",
"vector_compute_type",
")",
"<",
"TYPE_VECTOR_SUBPARTS",
"(",
"compute_type",
")",
")",
"&&",
"(",
"optab_handler",
"(",
"op",
",",
"TYPE_MODE",
"(",
"vector_compute_type",
")",
")",
"!=",
"CODE_FOR_nothing",
")",
")",
"compute_type",
"=",
"vector_compute_type",
";",
"}",
"if",
"(",
"compute_type",
"==",
"type",
")",
"{",
"compute_mode",
"=",
"TYPE_MODE",
"(",
"compute_type",
")",
";",
"if",
"(",
"VECTOR_MODE_P",
"(",
"compute_mode",
")",
"&&",
"op",
"!=",
"NULL",
"&&",
"optab_handler",
"(",
"op",
",",
"compute_mode",
")",
"!=",
"CODE_FOR_nothing",
")",
"return",
";",
"else",
"compute_type",
"=",
"TREE_TYPE",
"(",
"type",
")",
";",
"}",
"gcc_assert",
"(",
"code",
"!=",
"VEC_LSHIFT_EXPR",
"&&",
"code",
"!=",
"VEC_RSHIFT_EXPR",
")",
";",
"new_rhs",
"=",
"expand_vector_operation",
"(",
"gsi",
",",
"type",
",",
"compute_type",
",",
"stmt",
",",
"code",
")",
";",
"if",
"(",
"new_rhs",
"==",
"NULL_TREE",
")",
"return",
";",
"if",
"(",
"!",
"useless_type_conversion_p",
"(",
"TREE_TYPE",
"(",
"lhs",
")",
",",
"TREE_TYPE",
"(",
"new_rhs",
")",
")",
")",
"new_rhs",
"=",
"gimplify_build1",
"(",
"gsi",
",",
"VIEW_CONVERT_EXPR",
",",
"TREE_TYPE",
"(",
"lhs",
")",
",",
"new_rhs",
")",
";",
"gimple_assign_set_rhs_from_tree",
"(",
"gsi",
",",
"new_rhs",
")",
";",
"update_stmt",
"(",
"gsi_stmt",
"(",
"*",
"gsi",
")",
")",
";",
"}"
] | Process one statement. | [
"Process",
"one",
"statement",
"."
] | [
"/* The signedness is determined from input argument. */",
"/* Choose between vector shift/rotate by vector and vector shift/rotate by\n scalar */",
"/* Check whether we have vector <op> {x,x,x,x} where x\n could be a scalar variable or a constant. Transform\n vector <op> {x,x,x,x} ==> vector <op> scalar. */",
"/* The rtl expander will expand vector/scalar as vector/vector\n\t if necessary. Don't bother converting the stmt here. */",
"/* For widening/narrowing vector operations, the relevant type is of the\n arguments, not the widened result. VEC_UNPACK_FLOAT_*_EXPR is\n calculated in the same way above. */",
"/* Optabs will try converting a negation into a subtraction, so\n look for it as well. TODO: negation of floating-point vectors\n might be turned into an exclusive OR toggling the sign bit. */",
"/* For very wide vectors, try using a smaller vector mode. */",
"/* If we are breaking a BLKmode vector into smaller pieces,\n type_for_widest_vector_mode has already looked into the optab,\n so skip these checks. */",
"/* There is no operation in hardware, so fall back to scalars. */",
"/* Leave expression untouched for later expansion. */",
"/* NOTE: We should avoid using gimple_assign_set_rhs_from_tree. One\n way to do it is change expand_vector_operation and its callees to\n return a tree_code, RHS1 and RHS2 instead of a tree. */"
] | [
{
"param": "gsi",
"type": "gimple_stmt_iterator"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gsi",
"type": "gimple_stmt_iterator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb64065f2e84759b04dd7e6e62b82d6145f38155 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-vect-generic.c | [
"BSD-3-Clause"
] | C | gate_expand_vector_operations_ssa | bool | static bool
gate_expand_vector_operations_ssa (void)
{
return optimize == 0;
} | /* Use this to lower vector operations introduced by the vectorizer,
if it may need the bit-twiddling tricks implemented in this file. */ | Use this to lower vector operations introduced by the vectorizer,
if it may need the bit-twiddling tricks implemented in this file. | [
"Use",
"this",
"to",
"lower",
"vector",
"operations",
"introduced",
"by",
"the",
"vectorizer",
"if",
"it",
"may",
"need",
"the",
"bit",
"-",
"twiddling",
"tricks",
"implemented",
"in",
"this",
"file",
"."
] | static bool
gate_expand_vector_operations_ssa (void)
{
return optimize == 0;
} | [
"static",
"bool",
"gate_expand_vector_operations_ssa",
"(",
"void",
")",
"{",
"return",
"optimize",
"==",
"0",
";",
"}"
] | Use this to lower vector operations introduced by the vectorizer,
if it may need the bit-twiddling tricks implemented in this file. | [
"Use",
"this",
"to",
"lower",
"vector",
"operations",
"introduced",
"by",
"the",
"vectorizer",
"if",
"it",
"may",
"need",
"the",
"bit",
"-",
"twiddling",
"tricks",
"implemented",
"in",
"this",
"file",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
5de6c4897d1ca64aa61ab07b19e98bdb115d1c63 | atrens/DragonFlyBSD-src | sys/vfs/ufs/ffs_subr.c | [
"BSD-3-Clause"
] | C | ffs_blkatoff | int | int
ffs_blkatoff(struct vnode *vp, off_t uoffset, char **res, struct buf **bpp)
{
struct inode *ip;
struct fs *fs;
struct buf *bp;
ufs_daddr_t lbn;
int bsize, error;
ip = VTOI(vp);
fs = ip->i_fs;
lbn = lblkno(fs, uoffset);
bsize = blksize(fs, ip, lbn);
*bpp = NULL;
error = bread(vp, lblktodoff(fs, lbn), bsize, &bp);
if (error) {
brelse(bp);
return (error);
}
if (res)
*res = (char *)bp->b_data + blkoff(fs, uoffset);
*bpp = bp;
return (0);
} | /*
* Return buffer with the contents of block "offset" from the beginning of
* vnode "vp". If "res" is non-zero, fill it in with a pointer to the
* remaining space in the vnode.
*/ | Return buffer with the contents of block "offset" from the beginning of
vnode "vp". If "res" is non-zero, fill it in with a pointer to the
remaining space in the vnode. | [
"Return",
"buffer",
"with",
"the",
"contents",
"of",
"block",
"\"",
"offset",
"\"",
"from",
"the",
"beginning",
"of",
"vnode",
"\"",
"vp",
"\"",
".",
"If",
"\"",
"res",
"\"",
"is",
"non",
"-",
"zero",
"fill",
"it",
"in",
"with",
"a",
"pointer",
"to",
"the",
"remaining",
"space",
"in",
"the",
"vnode",
"."
] | int
ffs_blkatoff(struct vnode *vp, off_t uoffset, char **res, struct buf **bpp)
{
struct inode *ip;
struct fs *fs;
struct buf *bp;
ufs_daddr_t lbn;
int bsize, error;
ip = VTOI(vp);
fs = ip->i_fs;
lbn = lblkno(fs, uoffset);
bsize = blksize(fs, ip, lbn);
*bpp = NULL;
error = bread(vp, lblktodoff(fs, lbn), bsize, &bp);
if (error) {
brelse(bp);
return (error);
}
if (res)
*res = (char *)bp->b_data + blkoff(fs, uoffset);
*bpp = bp;
return (0);
} | [
"int",
"ffs_blkatoff",
"(",
"struct",
"vnode",
"*",
"vp",
",",
"off_t",
"uoffset",
",",
"char",
"*",
"*",
"res",
",",
"struct",
"buf",
"*",
"*",
"bpp",
")",
"{",
"struct",
"inode",
"*",
"ip",
";",
"struct",
"fs",
"*",
"fs",
";",
"struct",
"buf",
"*",
"bp",
";",
"ufs_daddr_t",
"lbn",
";",
"int",
"bsize",
",",
"error",
";",
"ip",
"=",
"VTOI",
"(",
"vp",
")",
";",
"fs",
"=",
"ip",
"->",
"i_fs",
";",
"lbn",
"=",
"lblkno",
"(",
"fs",
",",
"uoffset",
")",
";",
"bsize",
"=",
"blksize",
"(",
"fs",
",",
"ip",
",",
"lbn",
")",
";",
"*",
"bpp",
"=",
"NULL",
";",
"error",
"=",
"bread",
"(",
"vp",
",",
"lblktodoff",
"(",
"fs",
",",
"lbn",
")",
",",
"bsize",
",",
"&",
"bp",
")",
";",
"if",
"(",
"error",
")",
"{",
"brelse",
"(",
"bp",
")",
";",
"return",
"(",
"error",
")",
";",
"}",
"if",
"(",
"res",
")",
"*",
"res",
"=",
"(",
"char",
"*",
")",
"bp",
"->",
"b_data",
"+",
"blkoff",
"(",
"fs",
",",
"uoffset",
")",
";",
"*",
"bpp",
"=",
"bp",
";",
"return",
"(",
"0",
")",
";",
"}"
] | Return buffer with the contents of block "offset" from the beginning of
vnode "vp". | [
"Return",
"buffer",
"with",
"the",
"contents",
"of",
"block",
"\"",
"offset",
"\"",
"from",
"the",
"beginning",
"of",
"vnode",
"\"",
"vp",
"\"",
"."
] | [] | [
{
"param": "vp",
"type": "struct vnode"
},
{
"param": "uoffset",
"type": "off_t"
},
{
"param": "res",
"type": "char"
},
{
"param": "bpp",
"type": "struct buf"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vp",
"type": "struct vnode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "uoffset",
"type": "off_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "res",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bpp",
"type": "struct buf",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5de6c4897d1ca64aa61ab07b19e98bdb115d1c63 | atrens/DragonFlyBSD-src | sys/vfs/ufs/ffs_subr.c | [
"BSD-3-Clause"
] | C | ffs_blkatoff_ra | int | int
ffs_blkatoff_ra(struct vnode *vp, off_t uoffset, char **res, struct buf **bpp,
int seqcount)
{
struct inode *ip;
struct fs *fs;
struct buf *bp;
ufs_daddr_t lbn;
ufs_daddr_t nextlbn;
off_t base_loffset;
off_t next_loffset;
int bsize, error;
int nextbsize;
ip = VTOI(vp);
fs = ip->i_fs;
lbn = lblkno(fs, uoffset);
base_loffset = lblktodoff(fs, lbn);
bsize = blksize(fs, ip, lbn);
nextlbn = lbn + 1;
next_loffset = lblktodoff(fs, nextlbn);
*bpp = NULL;
if (next_loffset >= ip->i_size) {
/*
* Do not do readahead if this is the last block,
* bsize might represent a fragment.
*/
error = bread(vp, base_loffset, bsize, &bp);
} else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
/*
* Try to cluster if we allowed to.
*/
error = cluster_read(vp, (off_t)ip->i_size,
base_loffset, bsize,
bsize, seqcount * MAXBSIZE, &bp);
} else if (seqcount > 1) {
/*
* Faked read ahead
*/
nextbsize = blksize(fs, ip, nextlbn);
error = breadn(vp, base_loffset, bsize,
&next_loffset, &nextbsize, 1, &bp);
} else {
/*
* Failing all of the above, just read what the
* user asked for. Interestingly, the same as
* the first option above.
*/
error = bread(vp, base_loffset, bsize, &bp);
}
if (error) {
brelse(bp);
return (error);
}
if (res)
*res = (char *)bp->b_data + (int)(uoffset - base_loffset);
*bpp = bp;
return (0);
} | /*
* Return buffer with the contents of block "offset" from the beginning of
* vnode "vp". If "res" is non-zero, fill it in with a pointer to the
* remaining space in the vnode.
*
* This version includes a read-ahead optimization.
*/ | Return buffer with the contents of block "offset" from the beginning of
vnode "vp". If "res" is non-zero, fill it in with a pointer to the
remaining space in the vnode.
This version includes a read-ahead optimization. | [
"Return",
"buffer",
"with",
"the",
"contents",
"of",
"block",
"\"",
"offset",
"\"",
"from",
"the",
"beginning",
"of",
"vnode",
"\"",
"vp",
"\"",
".",
"If",
"\"",
"res",
"\"",
"is",
"non",
"-",
"zero",
"fill",
"it",
"in",
"with",
"a",
"pointer",
"to",
"the",
"remaining",
"space",
"in",
"the",
"vnode",
".",
"This",
"version",
"includes",
"a",
"read",
"-",
"ahead",
"optimization",
"."
] | int
ffs_blkatoff_ra(struct vnode *vp, off_t uoffset, char **res, struct buf **bpp,
int seqcount)
{
struct inode *ip;
struct fs *fs;
struct buf *bp;
ufs_daddr_t lbn;
ufs_daddr_t nextlbn;
off_t base_loffset;
off_t next_loffset;
int bsize, error;
int nextbsize;
ip = VTOI(vp);
fs = ip->i_fs;
lbn = lblkno(fs, uoffset);
base_loffset = lblktodoff(fs, lbn);
bsize = blksize(fs, ip, lbn);
nextlbn = lbn + 1;
next_loffset = lblktodoff(fs, nextlbn);
*bpp = NULL;
if (next_loffset >= ip->i_size) {
error = bread(vp, base_loffset, bsize, &bp);
} else if ((vp->v_mount->mnt_flag & MNT_NOCLUSTERR) == 0) {
error = cluster_read(vp, (off_t)ip->i_size,
base_loffset, bsize,
bsize, seqcount * MAXBSIZE, &bp);
} else if (seqcount > 1) {
nextbsize = blksize(fs, ip, nextlbn);
error = breadn(vp, base_loffset, bsize,
&next_loffset, &nextbsize, 1, &bp);
} else {
error = bread(vp, base_loffset, bsize, &bp);
}
if (error) {
brelse(bp);
return (error);
}
if (res)
*res = (char *)bp->b_data + (int)(uoffset - base_loffset);
*bpp = bp;
return (0);
} | [
"int",
"ffs_blkatoff_ra",
"(",
"struct",
"vnode",
"*",
"vp",
",",
"off_t",
"uoffset",
",",
"char",
"*",
"*",
"res",
",",
"struct",
"buf",
"*",
"*",
"bpp",
",",
"int",
"seqcount",
")",
"{",
"struct",
"inode",
"*",
"ip",
";",
"struct",
"fs",
"*",
"fs",
";",
"struct",
"buf",
"*",
"bp",
";",
"ufs_daddr_t",
"lbn",
";",
"ufs_daddr_t",
"nextlbn",
";",
"off_t",
"base_loffset",
";",
"off_t",
"next_loffset",
";",
"int",
"bsize",
",",
"error",
";",
"int",
"nextbsize",
";",
"ip",
"=",
"VTOI",
"(",
"vp",
")",
";",
"fs",
"=",
"ip",
"->",
"i_fs",
";",
"lbn",
"=",
"lblkno",
"(",
"fs",
",",
"uoffset",
")",
";",
"base_loffset",
"=",
"lblktodoff",
"(",
"fs",
",",
"lbn",
")",
";",
"bsize",
"=",
"blksize",
"(",
"fs",
",",
"ip",
",",
"lbn",
")",
";",
"nextlbn",
"=",
"lbn",
"+",
"1",
";",
"next_loffset",
"=",
"lblktodoff",
"(",
"fs",
",",
"nextlbn",
")",
";",
"*",
"bpp",
"=",
"NULL",
";",
"if",
"(",
"next_loffset",
">=",
"ip",
"->",
"i_size",
")",
"{",
"error",
"=",
"bread",
"(",
"vp",
",",
"base_loffset",
",",
"bsize",
",",
"&",
"bp",
")",
";",
"}",
"else",
"if",
"(",
"(",
"vp",
"->",
"v_mount",
"->",
"mnt_flag",
"&",
"MNT_NOCLUSTERR",
")",
"==",
"0",
")",
"{",
"error",
"=",
"cluster_read",
"(",
"vp",
",",
"(",
"off_t",
")",
"ip",
"->",
"i_size",
",",
"base_loffset",
",",
"bsize",
",",
"bsize",
",",
"seqcount",
"*",
"MAXBSIZE",
",",
"&",
"bp",
")",
";",
"}",
"else",
"if",
"(",
"seqcount",
">",
"1",
")",
"{",
"nextbsize",
"=",
"blksize",
"(",
"fs",
",",
"ip",
",",
"nextlbn",
")",
";",
"error",
"=",
"breadn",
"(",
"vp",
",",
"base_loffset",
",",
"bsize",
",",
"&",
"next_loffset",
",",
"&",
"nextbsize",
",",
"1",
",",
"&",
"bp",
")",
";",
"}",
"else",
"{",
"error",
"=",
"bread",
"(",
"vp",
",",
"base_loffset",
",",
"bsize",
",",
"&",
"bp",
")",
";",
"}",
"if",
"(",
"error",
")",
"{",
"brelse",
"(",
"bp",
")",
";",
"return",
"(",
"error",
")",
";",
"}",
"if",
"(",
"res",
")",
"*",
"res",
"=",
"(",
"char",
"*",
")",
"bp",
"->",
"b_data",
"+",
"(",
"int",
")",
"(",
"uoffset",
"-",
"base_loffset",
")",
";",
"*",
"bpp",
"=",
"bp",
";",
"return",
"(",
"0",
")",
";",
"}"
] | Return buffer with the contents of block "offset" from the beginning of
vnode "vp". | [
"Return",
"buffer",
"with",
"the",
"contents",
"of",
"block",
"\"",
"offset",
"\"",
"from",
"the",
"beginning",
"of",
"vnode",
"\"",
"vp",
"\"",
"."
] | [
"/*\n\t\t * Do not do readahead if this is the last block,\n\t\t * bsize might represent a fragment.\n\t\t */",
"/*\n\t\t * Try to cluster if we allowed to.\n\t\t */",
"/*\n\t\t * Faked read ahead\n\t\t */",
"/*\n\t\t * Failing all of the above, just read what the\n\t\t * user asked for. Interestingly, the same as\n\t\t * the first option above.\n\t\t */"
] | [
{
"param": "vp",
"type": "struct vnode"
},
{
"param": "uoffset",
"type": "off_t"
},
{
"param": "res",
"type": "char"
},
{
"param": "bpp",
"type": "struct buf"
},
{
"param": "seqcount",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vp",
"type": "struct vnode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "uoffset",
"type": "off_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "res",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bpp",
"type": "struct buf",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seqcount",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5de6c4897d1ca64aa61ab07b19e98bdb115d1c63 | atrens/DragonFlyBSD-src | sys/vfs/ufs/ffs_subr.c | [
"BSD-3-Clause"
] | C | ffs_fragacct | void | void
ffs_fragacct(struct fs *fs, int fragmap, int32_t fraglist[], int cnt)
{
int inblk;
int field, subfield;
int siz, pos;
/*
* inblk represents a bitmap of fragment sizes which may be
* contained in the data 'fragmap'. e.g. if a fragment of size
* 1 is available, bit 0 would be set. inblk is shifted left
* by one so we do not have to calculate (1 << (siz - 1)).
*
* fragment represents the data pattern we are trying to decipher,
* we shift it left by one to align it with the 'around' and 'inside'
* masks.
*
* around represents the bits around the subfield and is a mask.
* inside represents what we must match within the mask, it is
* basically the mask with the first and last bit set to 0, allowing
* us to represent a whole fragment.
*
* When we find a match we bump our position by the size of the
* matching fragment, then bump the position again:
*
* 010101010 fragmap (shifted left by 1)
* 111 around mask
* 010 inside mask
* 111 (shifted by siz)
* 010
* 111 (shifted again)
* 010
*/
inblk = (int)(fragtbl[fs->fs_frag][fragmap]) << 1;
fragmap <<= 1;
for (siz = 1; siz < fs->fs_frag; siz++) {
if ((inblk & (1 << (siz + (fs->fs_frag % NBBY)))) == 0)
continue;
field = around[siz];
subfield = inside[siz];
for (pos = siz; pos <= fs->fs_frag; pos++) {
if ((fragmap & field) == subfield) {
fraglist[siz] += cnt;
pos += siz;
field <<= siz;
subfield <<= siz;
}
field <<= 1;
subfield <<= 1;
}
}
} | /*
* Update the frsum fields to reflect addition or deletion
* of some frags.
*/ | Update the frsum fields to reflect addition or deletion
of some frags. | [
"Update",
"the",
"frsum",
"fields",
"to",
"reflect",
"addition",
"or",
"deletion",
"of",
"some",
"frags",
"."
] | void
ffs_fragacct(struct fs *fs, int fragmap, int32_t fraglist[], int cnt)
{
int inblk;
int field, subfield;
int siz, pos;
inblk = (int)(fragtbl[fs->fs_frag][fragmap]) << 1;
fragmap <<= 1;
for (siz = 1; siz < fs->fs_frag; siz++) {
if ((inblk & (1 << (siz + (fs->fs_frag % NBBY)))) == 0)
continue;
field = around[siz];
subfield = inside[siz];
for (pos = siz; pos <= fs->fs_frag; pos++) {
if ((fragmap & field) == subfield) {
fraglist[siz] += cnt;
pos += siz;
field <<= siz;
subfield <<= siz;
}
field <<= 1;
subfield <<= 1;
}
}
} | [
"void",
"ffs_fragacct",
"(",
"struct",
"fs",
"*",
"fs",
",",
"int",
"fragmap",
",",
"int32_t",
"fraglist",
"[",
"]",
",",
"int",
"cnt",
")",
"{",
"int",
"inblk",
";",
"int",
"field",
",",
"subfield",
";",
"int",
"siz",
",",
"pos",
";",
"inblk",
"=",
"(",
"int",
")",
"(",
"fragtbl",
"[",
"fs",
"->",
"fs_frag",
"]",
"[",
"fragmap",
"]",
")",
"<<",
"1",
";",
"fragmap",
"<<=",
"1",
";",
"for",
"(",
"siz",
"=",
"1",
";",
"siz",
"<",
"fs",
"->",
"fs_frag",
";",
"siz",
"++",
")",
"{",
"if",
"(",
"(",
"inblk",
"&",
"(",
"1",
"<<",
"(",
"siz",
"+",
"(",
"fs",
"->",
"fs_frag",
"%",
"NBBY",
")",
")",
")",
")",
"==",
"0",
")",
"continue",
";",
"field",
"=",
"around",
"[",
"siz",
"]",
";",
"subfield",
"=",
"inside",
"[",
"siz",
"]",
";",
"for",
"(",
"pos",
"=",
"siz",
";",
"pos",
"<=",
"fs",
"->",
"fs_frag",
";",
"pos",
"++",
")",
"{",
"if",
"(",
"(",
"fragmap",
"&",
"field",
")",
"==",
"subfield",
")",
"{",
"fraglist",
"[",
"siz",
"]",
"+=",
"cnt",
";",
"pos",
"+=",
"siz",
";",
"field",
"<<=",
"siz",
";",
"subfield",
"<<=",
"siz",
";",
"}",
"field",
"<<=",
"1",
";",
"subfield",
"<<=",
"1",
";",
"}",
"}",
"}"
] | Update the frsum fields to reflect addition or deletion
of some frags. | [
"Update",
"the",
"frsum",
"fields",
"to",
"reflect",
"addition",
"or",
"deletion",
"of",
"some",
"frags",
"."
] | [
"/*\n\t * inblk represents a bitmap of fragment sizes which may be\n\t * contained in the data 'fragmap'. e.g. if a fragment of size\n\t * 1 is available, bit 0 would be set. inblk is shifted left\n\t * by one so we do not have to calculate (1 << (siz - 1)).\n\t *\n\t * fragment represents the data pattern we are trying to decipher,\n\t * we shift it left by one to align it with the 'around' and 'inside'\n\t * masks.\n\t *\n\t * around represents the bits around the subfield and is a mask.\n\t * inside represents what we must match within the mask, it is\n\t * basically the mask with the first and last bit set to 0, allowing\n\t * us to represent a whole fragment.\n\t *\n\t * When we find a match we bump our position by the size of the\n\t * matching fragment, then bump the position again:\n\t *\n\t * 010101010 fragmap (shifted left by 1)\n\t * 111 around mask\n\t * 010 inside mask\n\t * 111 (shifted by siz)\n\t *\t010\n\t * 111\t(shifted again)\n\t * 010\n\t */"
] | [
{
"param": "fs",
"type": "struct fs"
},
{
"param": "fragmap",
"type": "int"
},
{
"param": "fraglist",
"type": "int32_t"
},
{
"param": "cnt",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fs",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fragmap",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fraglist",
"type": "int32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cnt",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5de6c4897d1ca64aa61ab07b19e98bdb115d1c63 | atrens/DragonFlyBSD-src | sys/vfs/ufs/ffs_subr.c | [
"BSD-3-Clause"
] | C | ffs_isblock | int | int
ffs_isblock(struct fs *fs, unsigned char *cp, ufs_daddr_t h)
{
unsigned char mask;
switch ((int)fs->fs_frag) {
case 8:
return (cp[h] == 0xff);
case 4:
mask = 0x0f << ((h & 0x1) << 2);
return ((cp[h >> 1] & mask) == mask);
case 2:
mask = 0x03 << ((h & 0x3) << 1);
return ((cp[h >> 2] & mask) == mask);
case 1:
mask = 0x01 << (h & 0x7);
return ((cp[h >> 3] & mask) == mask);
default:
panic("ffs_isblock");
}
} | /*
* block operations
*
* check if a block is available
*/ | block operations
check if a block is available | [
"block",
"operations",
"check",
"if",
"a",
"block",
"is",
"available"
] | int
ffs_isblock(struct fs *fs, unsigned char *cp, ufs_daddr_t h)
{
unsigned char mask;
switch ((int)fs->fs_frag) {
case 8:
return (cp[h] == 0xff);
case 4:
mask = 0x0f << ((h & 0x1) << 2);
return ((cp[h >> 1] & mask) == mask);
case 2:
mask = 0x03 << ((h & 0x3) << 1);
return ((cp[h >> 2] & mask) == mask);
case 1:
mask = 0x01 << (h & 0x7);
return ((cp[h >> 3] & mask) == mask);
default:
panic("ffs_isblock");
}
} | [
"int",
"ffs_isblock",
"(",
"struct",
"fs",
"*",
"fs",
",",
"unsigned",
"char",
"*",
"cp",
",",
"ufs_daddr_t",
"h",
")",
"{",
"unsigned",
"char",
"mask",
";",
"switch",
"(",
"(",
"int",
")",
"fs",
"->",
"fs_frag",
")",
"{",
"case",
"8",
":",
"return",
"(",
"cp",
"[",
"h",
"]",
"==",
"0xff",
")",
";",
"case",
"4",
":",
"mask",
"=",
"0x0f",
"<<",
"(",
"(",
"h",
"&",
"0x1",
")",
"<<",
"2",
")",
";",
"return",
"(",
"(",
"cp",
"[",
"h",
">>",
"1",
"]",
"&",
"mask",
")",
"==",
"mask",
")",
";",
"case",
"2",
":",
"mask",
"=",
"0x03",
"<<",
"(",
"(",
"h",
"&",
"0x3",
")",
"<<",
"1",
")",
";",
"return",
"(",
"(",
"cp",
"[",
"h",
">>",
"2",
"]",
"&",
"mask",
")",
"==",
"mask",
")",
";",
"case",
"1",
":",
"mask",
"=",
"0x01",
"<<",
"(",
"h",
"&",
"0x7",
")",
";",
"return",
"(",
"(",
"cp",
"[",
"h",
">>",
"3",
"]",
"&",
"mask",
")",
"==",
"mask",
")",
";",
"default",
":",
"panic",
"(",
"\"",
"\"",
")",
";",
"}",
"}"
] | block operations
check if a block is available | [
"block",
"operations",
"check",
"if",
"a",
"block",
"is",
"available"
] | [] | [
{
"param": "fs",
"type": "struct fs"
},
{
"param": "cp",
"type": "unsigned char"
},
{
"param": "h",
"type": "ufs_daddr_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fs",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cp",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "h",
"type": "ufs_daddr_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5de6c4897d1ca64aa61ab07b19e98bdb115d1c63 | atrens/DragonFlyBSD-src | sys/vfs/ufs/ffs_subr.c | [
"BSD-3-Clause"
] | C | ffs_isfreeblock | int | int
ffs_isfreeblock(struct fs *fs, unsigned char *cp, ufs_daddr_t h)
{
switch ((int)fs->fs_frag) {
case 8:
return (cp[h] == 0);
case 4:
return ((cp[h >> 1] & (0x0f << ((h & 0x1) << 2))) == 0);
case 2:
return ((cp[h >> 2] & (0x03 << ((h & 0x3) << 1))) == 0);
case 1:
return ((cp[h >> 3] & (0x01 << (h & 0x7))) == 0);
default:
panic("ffs_isfreeblock");
}
} | /*
* check if a block is free
*/ | check if a block is free | [
"check",
"if",
"a",
"block",
"is",
"free"
] | int
ffs_isfreeblock(struct fs *fs, unsigned char *cp, ufs_daddr_t h)
{
switch ((int)fs->fs_frag) {
case 8:
return (cp[h] == 0);
case 4:
return ((cp[h >> 1] & (0x0f << ((h & 0x1) << 2))) == 0);
case 2:
return ((cp[h >> 2] & (0x03 << ((h & 0x3) << 1))) == 0);
case 1:
return ((cp[h >> 3] & (0x01 << (h & 0x7))) == 0);
default:
panic("ffs_isfreeblock");
}
} | [
"int",
"ffs_isfreeblock",
"(",
"struct",
"fs",
"*",
"fs",
",",
"unsigned",
"char",
"*",
"cp",
",",
"ufs_daddr_t",
"h",
")",
"{",
"switch",
"(",
"(",
"int",
")",
"fs",
"->",
"fs_frag",
")",
"{",
"case",
"8",
":",
"return",
"(",
"cp",
"[",
"h",
"]",
"==",
"0",
")",
";",
"case",
"4",
":",
"return",
"(",
"(",
"cp",
"[",
"h",
">>",
"1",
"]",
"&",
"(",
"0x0f",
"<<",
"(",
"(",
"h",
"&",
"0x1",
")",
"<<",
"2",
")",
")",
")",
"==",
"0",
")",
";",
"case",
"2",
":",
"return",
"(",
"(",
"cp",
"[",
"h",
">>",
"2",
"]",
"&",
"(",
"0x03",
"<<",
"(",
"(",
"h",
"&",
"0x3",
")",
"<<",
"1",
")",
")",
")",
"==",
"0",
")",
";",
"case",
"1",
":",
"return",
"(",
"(",
"cp",
"[",
"h",
">>",
"3",
"]",
"&",
"(",
"0x01",
"<<",
"(",
"h",
"&",
"0x7",
")",
")",
")",
"==",
"0",
")",
";",
"default",
":",
"panic",
"(",
"\"",
"\"",
")",
";",
"}",
"}"
] | check if a block is free | [
"check",
"if",
"a",
"block",
"is",
"free"
] | [] | [
{
"param": "fs",
"type": "struct fs"
},
{
"param": "cp",
"type": "unsigned char"
},
{
"param": "h",
"type": "ufs_daddr_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fs",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cp",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "h",
"type": "ufs_daddr_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5de6c4897d1ca64aa61ab07b19e98bdb115d1c63 | atrens/DragonFlyBSD-src | sys/vfs/ufs/ffs_subr.c | [
"BSD-3-Clause"
] | C | ffs_clrblock | void | void
ffs_clrblock(struct fs *fs, u_char *cp, ufs_daddr_t h)
{
switch ((int)fs->fs_frag) {
case 8:
cp[h] = 0;
return;
case 4:
cp[h >> 1] &= ~(0x0f << ((h & 0x1) << 2));
return;
case 2:
cp[h >> 2] &= ~(0x03 << ((h & 0x3) << 1));
return;
case 1:
cp[h >> 3] &= ~(0x01 << (h & 0x7));
return;
default:
panic("ffs_clrblock");
}
} | /*
* take a block out of the map
*/ | take a block out of the map | [
"take",
"a",
"block",
"out",
"of",
"the",
"map"
] | void
ffs_clrblock(struct fs *fs, u_char *cp, ufs_daddr_t h)
{
switch ((int)fs->fs_frag) {
case 8:
cp[h] = 0;
return;
case 4:
cp[h >> 1] &= ~(0x0f << ((h & 0x1) << 2));
return;
case 2:
cp[h >> 2] &= ~(0x03 << ((h & 0x3) << 1));
return;
case 1:
cp[h >> 3] &= ~(0x01 << (h & 0x7));
return;
default:
panic("ffs_clrblock");
}
} | [
"void",
"ffs_clrblock",
"(",
"struct",
"fs",
"*",
"fs",
",",
"u_char",
"*",
"cp",
",",
"ufs_daddr_t",
"h",
")",
"{",
"switch",
"(",
"(",
"int",
")",
"fs",
"->",
"fs_frag",
")",
"{",
"case",
"8",
":",
"cp",
"[",
"h",
"]",
"=",
"0",
";",
"return",
";",
"case",
"4",
":",
"cp",
"[",
"h",
">>",
"1",
"]",
"&=",
"~",
"(",
"0x0f",
"<<",
"(",
"(",
"h",
"&",
"0x1",
")",
"<<",
"2",
")",
")",
";",
"return",
";",
"case",
"2",
":",
"cp",
"[",
"h",
">>",
"2",
"]",
"&=",
"~",
"(",
"0x03",
"<<",
"(",
"(",
"h",
"&",
"0x3",
")",
"<<",
"1",
")",
")",
";",
"return",
";",
"case",
"1",
":",
"cp",
"[",
"h",
">>",
"3",
"]",
"&=",
"~",
"(",
"0x01",
"<<",
"(",
"h",
"&",
"0x7",
")",
")",
";",
"return",
";",
"default",
":",
"panic",
"(",
"\"",
"\"",
")",
";",
"}",
"}"
] | take a block out of the map | [
"take",
"a",
"block",
"out",
"of",
"the",
"map"
] | [] | [
{
"param": "fs",
"type": "struct fs"
},
{
"param": "cp",
"type": "u_char"
},
{
"param": "h",
"type": "ufs_daddr_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fs",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cp",
"type": "u_char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "h",
"type": "ufs_daddr_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5de6c4897d1ca64aa61ab07b19e98bdb115d1c63 | atrens/DragonFlyBSD-src | sys/vfs/ufs/ffs_subr.c | [
"BSD-3-Clause"
] | C | ffs_setblock | void | void
ffs_setblock(struct fs *fs, unsigned char *cp, ufs_daddr_t h)
{
switch ((int)fs->fs_frag) {
case 8:
cp[h] = 0xff;
return;
case 4:
cp[h >> 1] |= (0x0f << ((h & 0x1) << 2));
return;
case 2:
cp[h >> 2] |= (0x03 << ((h & 0x3) << 1));
return;
case 1:
cp[h >> 3] |= (0x01 << (h & 0x7));
return;
default:
panic("ffs_setblock");
}
} | /*
* put a block into the map
*/ | put a block into the map | [
"put",
"a",
"block",
"into",
"the",
"map"
] | void
ffs_setblock(struct fs *fs, unsigned char *cp, ufs_daddr_t h)
{
switch ((int)fs->fs_frag) {
case 8:
cp[h] = 0xff;
return;
case 4:
cp[h >> 1] |= (0x0f << ((h & 0x1) << 2));
return;
case 2:
cp[h >> 2] |= (0x03 << ((h & 0x3) << 1));
return;
case 1:
cp[h >> 3] |= (0x01 << (h & 0x7));
return;
default:
panic("ffs_setblock");
}
} | [
"void",
"ffs_setblock",
"(",
"struct",
"fs",
"*",
"fs",
",",
"unsigned",
"char",
"*",
"cp",
",",
"ufs_daddr_t",
"h",
")",
"{",
"switch",
"(",
"(",
"int",
")",
"fs",
"->",
"fs_frag",
")",
"{",
"case",
"8",
":",
"cp",
"[",
"h",
"]",
"=",
"0xff",
";",
"return",
";",
"case",
"4",
":",
"cp",
"[",
"h",
">>",
"1",
"]",
"|=",
"(",
"0x0f",
"<<",
"(",
"(",
"h",
"&",
"0x1",
")",
"<<",
"2",
")",
")",
";",
"return",
";",
"case",
"2",
":",
"cp",
"[",
"h",
">>",
"2",
"]",
"|=",
"(",
"0x03",
"<<",
"(",
"(",
"h",
"&",
"0x3",
")",
"<<",
"1",
")",
")",
";",
"return",
";",
"case",
"1",
":",
"cp",
"[",
"h",
">>",
"3",
"]",
"|=",
"(",
"0x01",
"<<",
"(",
"h",
"&",
"0x7",
")",
")",
";",
"return",
";",
"default",
":",
"panic",
"(",
"\"",
"\"",
")",
";",
"}",
"}"
] | put a block into the map | [
"put",
"a",
"block",
"into",
"the",
"map"
] | [] | [
{
"param": "fs",
"type": "struct fs"
},
{
"param": "cp",
"type": "unsigned char"
},
{
"param": "h",
"type": "ufs_daddr_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fs",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cp",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "h",
"type": "ufs_daddr_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d276e635a28d4cb75d410456d0543c4f43760e3e | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c/c-fold.c | [
"BSD-3-Clause"
] | C | c_disable_warnings | void | static void
c_disable_warnings (bool disable)
{
if (disable)
{
++c_inhibit_evaluation_warnings;
fold_defer_overflow_warnings ();
}
} | /* If DISABLE is true, stop issuing warnings. This is used when
parsing code that we know will not be executed. This function may
be called multiple times, and works as a stack. */ | If DISABLE is true, stop issuing warnings. This is used when
parsing code that we know will not be executed. This function may
be called multiple times, and works as a stack. | [
"If",
"DISABLE",
"is",
"true",
"stop",
"issuing",
"warnings",
".",
"This",
"is",
"used",
"when",
"parsing",
"code",
"that",
"we",
"know",
"will",
"not",
"be",
"executed",
".",
"This",
"function",
"may",
"be",
"called",
"multiple",
"times",
"and",
"works",
"as",
"a",
"stack",
"."
] | static void
c_disable_warnings (bool disable)
{
if (disable)
{
++c_inhibit_evaluation_warnings;
fold_defer_overflow_warnings ();
}
} | [
"static",
"void",
"c_disable_warnings",
"(",
"bool",
"disable",
")",
"{",
"if",
"(",
"disable",
")",
"{",
"++",
"c_inhibit_evaluation_warnings",
";",
"fold_defer_overflow_warnings",
"(",
")",
";",
"}",
"}"
] | If DISABLE is true, stop issuing warnings. | [
"If",
"DISABLE",
"is",
"true",
"stop",
"issuing",
"warnings",
"."
] | [] | [
{
"param": "disable",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "disable",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d276e635a28d4cb75d410456d0543c4f43760e3e | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c/c-fold.c | [
"BSD-3-Clause"
] | C | c_enable_warnings | void | static void
c_enable_warnings (bool enable)
{
if (enable)
{
--c_inhibit_evaluation_warnings;
fold_undefer_and_ignore_overflow_warnings ();
}
} | /* If ENABLE is true, reenable issuing warnings. */ | If ENABLE is true, reenable issuing warnings. | [
"If",
"ENABLE",
"is",
"true",
"reenable",
"issuing",
"warnings",
"."
] | static void
c_enable_warnings (bool enable)
{
if (enable)
{
--c_inhibit_evaluation_warnings;
fold_undefer_and_ignore_overflow_warnings ();
}
} | [
"static",
"void",
"c_enable_warnings",
"(",
"bool",
"enable",
")",
"{",
"if",
"(",
"enable",
")",
"{",
"--",
"c_inhibit_evaluation_warnings",
";",
"fold_undefer_and_ignore_overflow_warnings",
"(",
")",
";",
"}",
"}"
] | If ENABLE is true, reenable issuing warnings. | [
"If",
"ENABLE",
"is",
"true",
"reenable",
"issuing",
"warnings",
"."
] | [] | [
{
"param": "enable",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "enable",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d276e635a28d4cb75d410456d0543c4f43760e3e | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c/c-fold.c | [
"BSD-3-Clause"
] | C | c_fold_array_ref | tree | static tree
c_fold_array_ref (tree type, tree ary, tree index)
{
if (TREE_CODE (ary) != STRING_CST
|| TREE_CODE (index) != INTEGER_CST
|| TREE_OVERFLOW (index)
|| TREE_CODE (TREE_TYPE (ary)) != ARRAY_TYPE
|| !tree_fits_uhwi_p (index))
return NULL_TREE;
tree elem_type = TREE_TYPE (TREE_TYPE (ary));
unsigned elem_nchars = (TYPE_PRECISION (elem_type)
/ TYPE_PRECISION (char_type_node));
unsigned len = (unsigned) TREE_STRING_LENGTH (ary) / elem_nchars;
tree nelts = array_type_nelts (TREE_TYPE (ary));
bool dummy1 = true, dummy2 = true;
nelts = c_fully_fold_internal (nelts, true, &dummy1, &dummy2, false, false);
unsigned HOST_WIDE_INT i = tree_to_uhwi (index);
if (!tree_int_cst_le (index, nelts)
|| i >= len
|| i + elem_nchars > len)
return NULL_TREE;
if (elem_nchars == 1)
return build_int_cst (type, TREE_STRING_POINTER (ary)[i]);
const unsigned char *ptr
= ((const unsigned char *)TREE_STRING_POINTER (ary) + i * elem_nchars);
return native_interpret_expr (type, ptr, elem_nchars);
} | /* Try to fold ARRAY_REF ary[index] if possible and not handled by
normal fold, return NULL_TREE otherwise. */ | Try to fold ARRAY_REF ary[index] if possible and not handled by
normal fold, return NULL_TREE otherwise. | [
"Try",
"to",
"fold",
"ARRAY_REF",
"ary",
"[",
"index",
"]",
"if",
"possible",
"and",
"not",
"handled",
"by",
"normal",
"fold",
"return",
"NULL_TREE",
"otherwise",
"."
] | static tree
c_fold_array_ref (tree type, tree ary, tree index)
{
if (TREE_CODE (ary) != STRING_CST
|| TREE_CODE (index) != INTEGER_CST
|| TREE_OVERFLOW (index)
|| TREE_CODE (TREE_TYPE (ary)) != ARRAY_TYPE
|| !tree_fits_uhwi_p (index))
return NULL_TREE;
tree elem_type = TREE_TYPE (TREE_TYPE (ary));
unsigned elem_nchars = (TYPE_PRECISION (elem_type)
/ TYPE_PRECISION (char_type_node));
unsigned len = (unsigned) TREE_STRING_LENGTH (ary) / elem_nchars;
tree nelts = array_type_nelts (TREE_TYPE (ary));
bool dummy1 = true, dummy2 = true;
nelts = c_fully_fold_internal (nelts, true, &dummy1, &dummy2, false, false);
unsigned HOST_WIDE_INT i = tree_to_uhwi (index);
if (!tree_int_cst_le (index, nelts)
|| i >= len
|| i + elem_nchars > len)
return NULL_TREE;
if (elem_nchars == 1)
return build_int_cst (type, TREE_STRING_POINTER (ary)[i]);
const unsigned char *ptr
= ((const unsigned char *)TREE_STRING_POINTER (ary) + i * elem_nchars);
return native_interpret_expr (type, ptr, elem_nchars);
} | [
"static",
"tree",
"c_fold_array_ref",
"(",
"tree",
"type",
",",
"tree",
"ary",
",",
"tree",
"index",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"ary",
")",
"!=",
"STRING_CST",
"||",
"TREE_CODE",
"(",
"index",
")",
"!=",
"INTEGER_CST",
"||",
"TREE_OVERFLOW",
"(",
"index",
")",
"||",
"TREE_CODE",
"(",
"TREE_TYPE",
"(",
"ary",
")",
")",
"!=",
"ARRAY_TYPE",
"||",
"!",
"tree_fits_uhwi_p",
"(",
"index",
")",
")",
"return",
"NULL_TREE",
";",
"tree",
"elem_type",
"=",
"TREE_TYPE",
"(",
"TREE_TYPE",
"(",
"ary",
")",
")",
";",
"unsigned",
"elem_nchars",
"=",
"(",
"TYPE_PRECISION",
"(",
"elem_type",
")",
"/",
"TYPE_PRECISION",
"(",
"char_type_node",
")",
")",
";",
"unsigned",
"len",
"=",
"(",
"unsigned",
")",
"TREE_STRING_LENGTH",
"(",
"ary",
")",
"/",
"elem_nchars",
";",
"tree",
"nelts",
"=",
"array_type_nelts",
"(",
"TREE_TYPE",
"(",
"ary",
")",
")",
";",
"bool",
"dummy1",
"=",
"true",
",",
"dummy2",
"=",
"true",
";",
"nelts",
"=",
"c_fully_fold_internal",
"(",
"nelts",
",",
"true",
",",
"&",
"dummy1",
",",
"&",
"dummy2",
",",
"false",
",",
"false",
")",
";",
"unsigned",
"HOST_WIDE_INT",
"i",
"=",
"tree_to_uhwi",
"(",
"index",
")",
";",
"if",
"(",
"!",
"tree_int_cst_le",
"(",
"index",
",",
"nelts",
")",
"||",
"i",
">=",
"len",
"||",
"i",
"+",
"elem_nchars",
">",
"len",
")",
"return",
"NULL_TREE",
";",
"if",
"(",
"elem_nchars",
"==",
"1",
")",
"return",
"build_int_cst",
"(",
"type",
",",
"TREE_STRING_POINTER",
"(",
"ary",
")",
"[",
"i",
"]",
")",
";",
"const",
"unsigned",
"char",
"*",
"ptr",
"=",
"(",
"(",
"const",
"unsigned",
"char",
"*",
")",
"TREE_STRING_POINTER",
"(",
"ary",
")",
"+",
"i",
"*",
"elem_nchars",
")",
";",
"return",
"native_interpret_expr",
"(",
"type",
",",
"ptr",
",",
"elem_nchars",
")",
";",
"}"
] | Try to fold ARRAY_REF ary[index] if possible and not handled by
normal fold, return NULL_TREE otherwise. | [
"Try",
"to",
"fold",
"ARRAY_REF",
"ary",
"[",
"index",
"]",
"if",
"possible",
"and",
"not",
"handled",
"by",
"normal",
"fold",
"return",
"NULL_TREE",
"otherwise",
"."
] | [] | [
{
"param": "type",
"type": "tree"
},
{
"param": "ary",
"type": "tree"
},
{
"param": "index",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ary",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d276e635a28d4cb75d410456d0543c4f43760e3e | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c/c-fold.c | [
"BSD-3-Clause"
] | C | c_fully_fold | tree | tree
c_fully_fold (tree expr, bool in_init, bool *maybe_const, bool lval)
{
tree ret;
tree eptype = NULL_TREE;
bool dummy = true;
bool maybe_const_itself = true;
location_t loc = EXPR_LOCATION (expr);
if (!maybe_const)
maybe_const = &dummy;
if (TREE_CODE (expr) == EXCESS_PRECISION_EXPR)
{
eptype = TREE_TYPE (expr);
expr = TREE_OPERAND (expr, 0);
}
ret = c_fully_fold_internal (expr, in_init, maybe_const,
&maybe_const_itself, false, lval);
if (eptype)
ret = fold_convert_loc (loc, eptype, ret);
*maybe_const &= maybe_const_itself;
return ret;
} | /* Fully fold EXPR, an expression that was not folded (beyond integer
constant expressions and null pointer constants) when being built
up. If IN_INIT, this is in a static initializer and certain
changes are made to the folding done. Clear *MAYBE_CONST if
MAYBE_CONST is not NULL and EXPR is definitely not a constant
expression because it contains an evaluated operator (in C99) or an
operator outside of sizeof returning an integer constant (in C90)
not permitted in constant expressions, or because it contains an
evaluated arithmetic overflow. (*MAYBE_CONST should typically be
set to true by callers before calling this function.) Return the
folded expression. Function arguments have already been folded
before calling this function, as have the contents of SAVE_EXPR,
TARGET_EXPR, BIND_EXPR, VA_ARG_EXPR, OBJ_TYPE_REF and
C_MAYBE_CONST_EXPR. LVAL is true if it should be treated as an
lvalue. */ | Fully fold EXPR, an expression that was not folded (beyond integer
constant expressions and null pointer constants) when being built
up. If IN_INIT, this is in a static initializer and certain
changes are made to the folding done. Clear *MAYBE_CONST if
MAYBE_CONST is not NULL and EXPR is definitely not a constant
expression because it contains an evaluated operator (in C99) or an
operator outside of sizeof returning an integer constant (in C90)
not permitted in constant expressions, or because it contains an
evaluated arithmetic overflow. (*MAYBE_CONST should typically be
set to true by callers before calling this function.) Return the
folded expression. Function arguments have already been folded
before calling this function, as have the contents of SAVE_EXPR,
TARGET_EXPR, BIND_EXPR, VA_ARG_EXPR, OBJ_TYPE_REF and
C_MAYBE_CONST_EXPR. LVAL is true if it should be treated as an
lvalue. | [
"Fully",
"fold",
"EXPR",
"an",
"expression",
"that",
"was",
"not",
"folded",
"(",
"beyond",
"integer",
"constant",
"expressions",
"and",
"null",
"pointer",
"constants",
")",
"when",
"being",
"built",
"up",
".",
"If",
"IN_INIT",
"this",
"is",
"in",
"a",
"static",
"initializer",
"and",
"certain",
"changes",
"are",
"made",
"to",
"the",
"folding",
"done",
".",
"Clear",
"*",
"MAYBE_CONST",
"if",
"MAYBE_CONST",
"is",
"not",
"NULL",
"and",
"EXPR",
"is",
"definitely",
"not",
"a",
"constant",
"expression",
"because",
"it",
"contains",
"an",
"evaluated",
"operator",
"(",
"in",
"C99",
")",
"or",
"an",
"operator",
"outside",
"of",
"sizeof",
"returning",
"an",
"integer",
"constant",
"(",
"in",
"C90",
")",
"not",
"permitted",
"in",
"constant",
"expressions",
"or",
"because",
"it",
"contains",
"an",
"evaluated",
"arithmetic",
"overflow",
".",
"(",
"*",
"MAYBE_CONST",
"should",
"typically",
"be",
"set",
"to",
"true",
"by",
"callers",
"before",
"calling",
"this",
"function",
".",
")",
"Return",
"the",
"folded",
"expression",
".",
"Function",
"arguments",
"have",
"already",
"been",
"folded",
"before",
"calling",
"this",
"function",
"as",
"have",
"the",
"contents",
"of",
"SAVE_EXPR",
"TARGET_EXPR",
"BIND_EXPR",
"VA_ARG_EXPR",
"OBJ_TYPE_REF",
"and",
"C_MAYBE_CONST_EXPR",
".",
"LVAL",
"is",
"true",
"if",
"it",
"should",
"be",
"treated",
"as",
"an",
"lvalue",
"."
] | tree
c_fully_fold (tree expr, bool in_init, bool *maybe_const, bool lval)
{
tree ret;
tree eptype = NULL_TREE;
bool dummy = true;
bool maybe_const_itself = true;
location_t loc = EXPR_LOCATION (expr);
if (!maybe_const)
maybe_const = &dummy;
if (TREE_CODE (expr) == EXCESS_PRECISION_EXPR)
{
eptype = TREE_TYPE (expr);
expr = TREE_OPERAND (expr, 0);
}
ret = c_fully_fold_internal (expr, in_init, maybe_const,
&maybe_const_itself, false, lval);
if (eptype)
ret = fold_convert_loc (loc, eptype, ret);
*maybe_const &= maybe_const_itself;
return ret;
} | [
"tree",
"c_fully_fold",
"(",
"tree",
"expr",
",",
"bool",
"in_init",
",",
"bool",
"*",
"maybe_const",
",",
"bool",
"lval",
")",
"{",
"tree",
"ret",
";",
"tree",
"eptype",
"=",
"NULL_TREE",
";",
"bool",
"dummy",
"=",
"true",
";",
"bool",
"maybe_const_itself",
"=",
"true",
";",
"location_t",
"loc",
"=",
"EXPR_LOCATION",
"(",
"expr",
")",
";",
"if",
"(",
"!",
"maybe_const",
")",
"maybe_const",
"=",
"&",
"dummy",
";",
"if",
"(",
"TREE_CODE",
"(",
"expr",
")",
"==",
"EXCESS_PRECISION_EXPR",
")",
"{",
"eptype",
"=",
"TREE_TYPE",
"(",
"expr",
")",
";",
"expr",
"=",
"TREE_OPERAND",
"(",
"expr",
",",
"0",
")",
";",
"}",
"ret",
"=",
"c_fully_fold_internal",
"(",
"expr",
",",
"in_init",
",",
"maybe_const",
",",
"&",
"maybe_const_itself",
",",
"false",
",",
"lval",
")",
";",
"if",
"(",
"eptype",
")",
"ret",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"eptype",
",",
"ret",
")",
";",
"*",
"maybe_const",
"&=",
"maybe_const_itself",
";",
"return",
"ret",
";",
"}"
] | Fully fold EXPR, an expression that was not folded (beyond integer
constant expressions and null pointer constants) when being built
up. | [
"Fully",
"fold",
"EXPR",
"an",
"expression",
"that",
"was",
"not",
"folded",
"(",
"beyond",
"integer",
"constant",
"expressions",
"and",
"null",
"pointer",
"constants",
")",
"when",
"being",
"built",
"up",
"."
] | [] | [
{
"param": "expr",
"type": "tree"
},
{
"param": "in_init",
"type": "bool"
},
{
"param": "maybe_const",
"type": "bool"
},
{
"param": "lval",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "expr",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "in_init",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "maybe_const",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lval",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d276e635a28d4cb75d410456d0543c4f43760e3e | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c/c-fold.c | [
"BSD-3-Clause"
] | C | fold_for_warn | tree | tree
fold_for_warn (tree x)
{
/* The C front-end has already folded X appropriately. */
return x;
} | /* Fold X for consideration by one of the warning functions when checking
whether an expression has a constant value. */ | Fold X for consideration by one of the warning functions when checking
whether an expression has a constant value. | [
"Fold",
"X",
"for",
"consideration",
"by",
"one",
"of",
"the",
"warning",
"functions",
"when",
"checking",
"whether",
"an",
"expression",
"has",
"a",
"constant",
"value",
"."
] | tree
fold_for_warn (tree x)
{
return x;
} | [
"tree",
"fold_for_warn",
"(",
"tree",
"x",
")",
"{",
"return",
"x",
";",
"}"
] | Fold X for consideration by one of the warning functions when checking
whether an expression has a constant value. | [
"Fold",
"X",
"for",
"consideration",
"by",
"one",
"of",
"the",
"warning",
"functions",
"when",
"checking",
"whether",
"an",
"expression",
"has",
"a",
"constant",
"value",
"."
] | [
"/* The C front-end has already folded X appropriately. */"
] | [
{
"param": "x",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31ec4bd6f66c7a2f04f947f5cc5a91a49206cc1a | atrens/DragonFlyBSD-src | usr.sbin/installer/libinstaller/mount.c | [
"BSD-3-Clause"
] | C | unmount_all_under | void | void
unmount_all_under(struct i_fn_args *a, struct commands *cmds, const char *fmt, ...)
{
struct statfs *mt_array;
int count, i;
char *mtpt;
va_list args;
va_start(args, fmt);
vasprintf(&mtpt, fmt, args);
va_end(args);
count = getmntinfo(&mt_array, MNT_WAIT);
/* Order mount points in reverse lexicographically order. */
qsort((void*)mt_array, count, sizeof(struct statfs), compare);
for (i = 0; i < count; i++) {
if (strncmp(mtpt, mt_array[i].f_mntonname, strlen(mtpt)) != 0)
continue;
if (strlen(mtpt) > strlen(mt_array[i].f_mntonname))
continue;
command_add(cmds, "%s%s %s",
a->os_root, cmd_name(a, "UMOUNT"), mt_array[i].f_mntonname);
}
free(mtpt);
} | /*
* Unmount all mountpoints under a given mountpoint in order (e.g. /var/tmp is
* unmounted before /var).
*/ | Unmount all mountpoints under a given mountpoint in order . | [
"Unmount",
"all",
"mountpoints",
"under",
"a",
"given",
"mountpoint",
"in",
"order",
"."
] | void
unmount_all_under(struct i_fn_args *a, struct commands *cmds, const char *fmt, ...)
{
struct statfs *mt_array;
int count, i;
char *mtpt;
va_list args;
va_start(args, fmt);
vasprintf(&mtpt, fmt, args);
va_end(args);
count = getmntinfo(&mt_array, MNT_WAIT);
qsort((void*)mt_array, count, sizeof(struct statfs), compare);
for (i = 0; i < count; i++) {
if (strncmp(mtpt, mt_array[i].f_mntonname, strlen(mtpt)) != 0)
continue;
if (strlen(mtpt) > strlen(mt_array[i].f_mntonname))
continue;
command_add(cmds, "%s%s %s",
a->os_root, cmd_name(a, "UMOUNT"), mt_array[i].f_mntonname);
}
free(mtpt);
} | [
"void",
"unmount_all_under",
"(",
"struct",
"i_fn_args",
"*",
"a",
",",
"struct",
"commands",
"*",
"cmds",
",",
"const",
"char",
"*",
"fmt",
",",
"...",
")",
"{",
"struct",
"statfs",
"*",
"mt_array",
";",
"int",
"count",
",",
"i",
";",
"char",
"*",
"mtpt",
";",
"va_list",
"args",
";",
"va_start",
"(",
"args",
",",
"fmt",
")",
";",
"vasprintf",
"(",
"&",
"mtpt",
",",
"fmt",
",",
"args",
")",
";",
"va_end",
"(",
"args",
")",
";",
"count",
"=",
"getmntinfo",
"(",
"&",
"mt_array",
",",
"MNT_WAIT",
")",
";",
"qsort",
"(",
"(",
"void",
"*",
")",
"mt_array",
",",
"count",
",",
"sizeof",
"(",
"struct",
"statfs",
")",
",",
"compare",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"if",
"(",
"strncmp",
"(",
"mtpt",
",",
"mt_array",
"[",
"i",
"]",
".",
"f_mntonname",
",",
"strlen",
"(",
"mtpt",
")",
")",
"!=",
"0",
")",
"continue",
";",
"if",
"(",
"strlen",
"(",
"mtpt",
")",
">",
"strlen",
"(",
"mt_array",
"[",
"i",
"]",
".",
"f_mntonname",
")",
")",
"continue",
";",
"command_add",
"(",
"cmds",
",",
"\"",
"\"",
",",
"a",
"->",
"os_root",
",",
"cmd_name",
"(",
"a",
",",
"\"",
"\"",
")",
",",
"mt_array",
"[",
"i",
"]",
".",
"f_mntonname",
")",
";",
"}",
"free",
"(",
"mtpt",
")",
";",
"}"
] | Unmount all mountpoints under a given mountpoint in order (e.g. | [
"Unmount",
"all",
"mountpoints",
"under",
"a",
"given",
"mountpoint",
"in",
"order",
"(",
"e",
".",
"g",
"."
] | [
"/* Order mount points in reverse lexicographically order. */"
] | [
{
"param": "a",
"type": "struct i_fn_args"
},
{
"param": "cmds",
"type": "struct commands"
},
{
"param": "fmt",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": "struct i_fn_args",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cmds",
"type": "struct commands",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fmt",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d246bceb4de22ed487b05b1a688a381c0cda0d4f | atrens/DragonFlyBSD-src | sys/dev/powermng/intpm/intpm.c | [
"BSD-3-Clause"
] | C | intsmb_stop_poll | int | static int
intsmb_stop_poll(struct intsmb_softc *sc)
{
int error, i, status, tmp;
INTSMB_LOCK_ASSERT(sc);
/* First, wait for busy to be set. */
for (i = 0; i < 0x7fff; i++)
if (bus_read_1(sc->io_res, PIIX4_SMBHSTSTS) &
PIIX4_SMBHSTSTAT_BUSY)
break;
/* Wait for busy to clear. */
for (i = 0; i < 0x7fff; i++) {
status = bus_read_1(sc->io_res, PIIX4_SMBHSTSTS);
if (!(status & PIIX4_SMBHSTSTAT_BUSY)) {
sc->isbusy = 0;
error = intsmb_error(sc->dev, status);
return (error);
}
}
/* Timed out waiting for busy to clear. */
sc->isbusy = 0;
tmp = bus_read_1(sc->io_res, PIIX4_SMBHSTCNT);
bus_write_1(sc->io_res, PIIX4_SMBHSTCNT, tmp & ~PIIX4_SMBHSTCNT_INTREN);
return (SMB_ETIMEOUT);
} | /*
* Polling Code.
*
* Polling is not encouraged because it requires waiting for the
* device if it is busy.
* (29063505.pdf from Intel) But during boot, interrupt cannot be used, so use
* polling code then.
*/ | Polling Code.
Polling is not encouraged because it requires waiting for the
device if it is busy.
(29063505.pdf from Intel) But during boot, interrupt cannot be used, so use
polling code then. | [
"Polling",
"Code",
".",
"Polling",
"is",
"not",
"encouraged",
"because",
"it",
"requires",
"waiting",
"for",
"the",
"device",
"if",
"it",
"is",
"busy",
".",
"(",
"29063505",
".",
"pdf",
"from",
"Intel",
")",
"But",
"during",
"boot",
"interrupt",
"cannot",
"be",
"used",
"so",
"use",
"polling",
"code",
"then",
"."
] | static int
intsmb_stop_poll(struct intsmb_softc *sc)
{
int error, i, status, tmp;
INTSMB_LOCK_ASSERT(sc);
for (i = 0; i < 0x7fff; i++)
if (bus_read_1(sc->io_res, PIIX4_SMBHSTSTS) &
PIIX4_SMBHSTSTAT_BUSY)
break;
for (i = 0; i < 0x7fff; i++) {
status = bus_read_1(sc->io_res, PIIX4_SMBHSTSTS);
if (!(status & PIIX4_SMBHSTSTAT_BUSY)) {
sc->isbusy = 0;
error = intsmb_error(sc->dev, status);
return (error);
}
}
sc->isbusy = 0;
tmp = bus_read_1(sc->io_res, PIIX4_SMBHSTCNT);
bus_write_1(sc->io_res, PIIX4_SMBHSTCNT, tmp & ~PIIX4_SMBHSTCNT_INTREN);
return (SMB_ETIMEOUT);
} | [
"static",
"int",
"intsmb_stop_poll",
"(",
"struct",
"intsmb_softc",
"*",
"sc",
")",
"{",
"int",
"error",
",",
"i",
",",
"status",
",",
"tmp",
";",
"INTSMB_LOCK_ASSERT",
"(",
"sc",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"0x7fff",
";",
"i",
"++",
")",
"if",
"(",
"bus_read_1",
"(",
"sc",
"->",
"io_res",
",",
"PIIX4_SMBHSTSTS",
")",
"&",
"PIIX4_SMBHSTSTAT_BUSY",
")",
"break",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"0x7fff",
";",
"i",
"++",
")",
"{",
"status",
"=",
"bus_read_1",
"(",
"sc",
"->",
"io_res",
",",
"PIIX4_SMBHSTSTS",
")",
";",
"if",
"(",
"!",
"(",
"status",
"&",
"PIIX4_SMBHSTSTAT_BUSY",
")",
")",
"{",
"sc",
"->",
"isbusy",
"=",
"0",
";",
"error",
"=",
"intsmb_error",
"(",
"sc",
"->",
"dev",
",",
"status",
")",
";",
"return",
"(",
"error",
")",
";",
"}",
"}",
"sc",
"->",
"isbusy",
"=",
"0",
";",
"tmp",
"=",
"bus_read_1",
"(",
"sc",
"->",
"io_res",
",",
"PIIX4_SMBHSTCNT",
")",
";",
"bus_write_1",
"(",
"sc",
"->",
"io_res",
",",
"PIIX4_SMBHSTCNT",
",",
"tmp",
"&",
"~",
"PIIX4_SMBHSTCNT_INTREN",
")",
";",
"return",
"(",
"SMB_ETIMEOUT",
")",
";",
"}"
] | Polling Code. | [
"Polling",
"Code",
"."
] | [
"/* First, wait for busy to be set. */",
"/* Wait for busy to clear. */",
"/* Timed out waiting for busy to clear. */"
] | [
{
"param": "sc",
"type": "struct intsmb_softc"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sc",
"type": "struct intsmb_softc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d246bceb4de22ed487b05b1a688a381c0cda0d4f | atrens/DragonFlyBSD-src | sys/dev/powermng/intpm/intpm.c | [
"BSD-3-Clause"
] | C | intsmb_stop | int | static int
intsmb_stop(struct intsmb_softc *sc)
{
int error, status;
INTSMB_LOCK_ASSERT(sc);
if (sc->poll || cold)
/* So that it can use device during device probe on SMBus. */
return (intsmb_stop_poll(sc));
error = lksleep(sc, &sc->lock, PCATCH, "SMBWAI", hz / 8);
if (error == 0) {
status = bus_read_1(sc->io_res, PIIX4_SMBHSTSTS);
if (!(status & PIIX4_SMBHSTSTAT_BUSY)) {
error = intsmb_error(sc->dev, status);
if (error == 0 && !(status & PIIX4_SMBHSTSTAT_INTR))
device_printf(sc->dev, "unknown cause why?\n");
#ifdef ENABLE_ALART
bus_write_1(sc->io_res, PIIX4_SMBSLVCNT,
PIIX4_SMBSLVCNT_ALTEN);
#endif
return (error);
}
}
/* Timeout Procedure. */
sc->isbusy = 0;
/* Re-enable suppressed interrupt from slave part. */
bus_write_1(sc->io_res, PIIX4_SMBSLVCNT, PIIX4_SMBSLVCNT_ALTEN);
if (error == EWOULDBLOCK)
return (SMB_ETIMEOUT);
else
return (SMB_EABORT);
} | /*
* Wait for completion and return result.
*/ | Wait for completion and return result. | [
"Wait",
"for",
"completion",
"and",
"return",
"result",
"."
] | static int
intsmb_stop(struct intsmb_softc *sc)
{
int error, status;
INTSMB_LOCK_ASSERT(sc);
if (sc->poll || cold)
return (intsmb_stop_poll(sc));
error = lksleep(sc, &sc->lock, PCATCH, "SMBWAI", hz / 8);
if (error == 0) {
status = bus_read_1(sc->io_res, PIIX4_SMBHSTSTS);
if (!(status & PIIX4_SMBHSTSTAT_BUSY)) {
error = intsmb_error(sc->dev, status);
if (error == 0 && !(status & PIIX4_SMBHSTSTAT_INTR))
device_printf(sc->dev, "unknown cause why?\n");
#ifdef ENABLE_ALART
bus_write_1(sc->io_res, PIIX4_SMBSLVCNT,
PIIX4_SMBSLVCNT_ALTEN);
#endif
return (error);
}
}
sc->isbusy = 0;
bus_write_1(sc->io_res, PIIX4_SMBSLVCNT, PIIX4_SMBSLVCNT_ALTEN);
if (error == EWOULDBLOCK)
return (SMB_ETIMEOUT);
else
return (SMB_EABORT);
} | [
"static",
"int",
"intsmb_stop",
"(",
"struct",
"intsmb_softc",
"*",
"sc",
")",
"{",
"int",
"error",
",",
"status",
";",
"INTSMB_LOCK_ASSERT",
"(",
"sc",
")",
";",
"if",
"(",
"sc",
"->",
"poll",
"||",
"cold",
")",
"return",
"(",
"intsmb_stop_poll",
"(",
"sc",
")",
")",
";",
"error",
"=",
"lksleep",
"(",
"sc",
",",
"&",
"sc",
"->",
"lock",
",",
"PCATCH",
",",
"\"",
"\"",
",",
"hz",
"/",
"8",
")",
";",
"if",
"(",
"error",
"==",
"0",
")",
"{",
"status",
"=",
"bus_read_1",
"(",
"sc",
"->",
"io_res",
",",
"PIIX4_SMBHSTSTS",
")",
";",
"if",
"(",
"!",
"(",
"status",
"&",
"PIIX4_SMBHSTSTAT_BUSY",
")",
")",
"{",
"error",
"=",
"intsmb_error",
"(",
"sc",
"->",
"dev",
",",
"status",
")",
";",
"if",
"(",
"error",
"==",
"0",
"&&",
"!",
"(",
"status",
"&",
"PIIX4_SMBHSTSTAT_INTR",
")",
")",
"device_printf",
"(",
"sc",
"->",
"dev",
",",
"\"",
"\\n",
"\"",
")",
";",
"#ifdef",
"ENABLE_ALART",
"bus_write_1",
"(",
"sc",
"->",
"io_res",
",",
"PIIX4_SMBSLVCNT",
",",
"PIIX4_SMBSLVCNT_ALTEN",
")",
";",
"#endif",
"return",
"(",
"error",
")",
";",
"}",
"}",
"sc",
"->",
"isbusy",
"=",
"0",
";",
"bus_write_1",
"(",
"sc",
"->",
"io_res",
",",
"PIIX4_SMBSLVCNT",
",",
"PIIX4_SMBSLVCNT_ALTEN",
")",
";",
"if",
"(",
"error",
"==",
"EWOULDBLOCK",
")",
"return",
"(",
"SMB_ETIMEOUT",
")",
";",
"else",
"return",
"(",
"SMB_EABORT",
")",
";",
"}"
] | Wait for completion and return result. | [
"Wait",
"for",
"completion",
"and",
"return",
"result",
"."
] | [
"/* So that it can use device during device probe on SMBus. */",
"/* Timeout Procedure. */",
"/* Re-enable suppressed interrupt from slave part. */"
] | [
{
"param": "sc",
"type": "struct intsmb_softc"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sc",
"type": "struct intsmb_softc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb138561f631fa95e87faeef57791e9733cc39d8 | atrens/DragonFlyBSD-src | contrib/cvs-1.12/src/tag.c | [
"BSD-3-Clause"
] | C | check_fileproc | int | static int
check_fileproc (void *callerdat, struct file_info *finfo)
{
const char *xdir;
Node *p;
Vers_TS *vers;
List *tlist;
struct tag_info *ti;
int addit = 1;
TRACE (TRACE_FUNCTION, "check_fileproc (%s, %s, %s)",
finfo->repository ? finfo->repository : "(null)",
finfo->fullname ? finfo->fullname : "(null)",
finfo->rcs ? (finfo->rcs->path ? finfo->rcs->path : "(null)")
: "NULL");
if (check_uptodate)
{
switch (Classify_File (finfo, NULL, NULL, NULL, 1, 0, &vers, 0))
{
case T_UPTODATE:
case T_CHECKOUT:
case T_PATCH:
case T_REMOVE_ENTRY:
break;
case T_UNKNOWN:
case T_CONFLICT:
case T_NEEDS_MERGE:
case T_MODIFIED:
case T_ADDED:
case T_REMOVED:
default:
error (0, 0, "%s is locally modified", finfo->fullname);
freevers_ts (&vers);
return 1;
}
}
else
vers = Version_TS (finfo, NULL, NULL, NULL, 0, 0);
if (finfo->update_dir[0] == '\0')
xdir = ".";
else
xdir = finfo->update_dir;
if ((p = findnode (mtlist, xdir)) != NULL)
{
tlist = ((struct master_lists *) p->data)->tlist;
}
else
{
struct master_lists *ml;
tlist = getlist ();
p = getnode ();
p->key = xstrdup (xdir);
p->type = UPDATE;
ml = xmalloc (sizeof (struct master_lists));
ml->tlist = tlist;
p->data = ml;
p->delproc = masterlist_delproc;
(void) addnode (mtlist, p);
}
/* do tlist */
p = getnode ();
p->key = xstrdup (finfo->file);
p->type = UPDATE;
p->delproc = tag_delproc;
if (vers->srcfile == NULL)
{
if (!really_quiet)
error (0, 0, "nothing known about %s", finfo->file);
freevers_ts (&vers);
freenode (p);
return 1;
}
/* Here we duplicate the calculation in tag_fileproc about which
version we are going to tag. There probably are some subtle races
(e.g. numtag is "foo" which gets moved between here and
tag_fileproc). */
p->data = ti = xmalloc (sizeof (struct tag_info));
ti->tag = xstrdup (numtag ? numtag : vers->tag);
if (!is_rtag && numtag == NULL && date == NULL)
ti->rev = xstrdup (vers->vn_user);
else
ti->rev = RCS_getversion (vers->srcfile, numtag, date,
force_tag_match, NULL);
if (ti->rev != NULL)
{
ti->oldrev = RCS_getversion (vers->srcfile, symtag, NULL, 1, NULL);
if (ti->oldrev == NULL)
{
if (delete_flag)
{
/* Deleting a tag which did not exist is a noop and
should not be logged. */
addit = 0;
}
}
else if (delete_flag)
{
free (ti->rev);
#ifdef SUPPORT_OLD_INFO_FMT_STRINGS
/* a hack since %v used to mean old or new rev */
ti->rev = xstrdup (ti->oldrev);
#else /* SUPPORT_OLD_INFO_FMT_STRINGS */
ti->rev = NULL;
#endif /* SUPPORT_OLD_INFO_FMT_STRINGS */
}
else if (strcmp(ti->oldrev, p->data) == 0)
addit = 0;
else if (!force_tag_move)
addit = 0;
}
else
addit = 0;
if (!addit)
{
free(p->data);
p->data = NULL;
}
freevers_ts (&vers);
(void)addnode (tlist, p);
return 0;
} | /* check file that is to be tagged */
/* All we do here is add it to our list */ | check file that is to be tagged
All we do here is add it to our list | [
"check",
"file",
"that",
"is",
"to",
"be",
"tagged",
"All",
"we",
"do",
"here",
"is",
"add",
"it",
"to",
"our",
"list"
] | static int
check_fileproc (void *callerdat, struct file_info *finfo)
{
const char *xdir;
Node *p;
Vers_TS *vers;
List *tlist;
struct tag_info *ti;
int addit = 1;
TRACE (TRACE_FUNCTION, "check_fileproc (%s, %s, %s)",
finfo->repository ? finfo->repository : "(null)",
finfo->fullname ? finfo->fullname : "(null)",
finfo->rcs ? (finfo->rcs->path ? finfo->rcs->path : "(null)")
: "NULL");
if (check_uptodate)
{
switch (Classify_File (finfo, NULL, NULL, NULL, 1, 0, &vers, 0))
{
case T_UPTODATE:
case T_CHECKOUT:
case T_PATCH:
case T_REMOVE_ENTRY:
break;
case T_UNKNOWN:
case T_CONFLICT:
case T_NEEDS_MERGE:
case T_MODIFIED:
case T_ADDED:
case T_REMOVED:
default:
error (0, 0, "%s is locally modified", finfo->fullname);
freevers_ts (&vers);
return 1;
}
}
else
vers = Version_TS (finfo, NULL, NULL, NULL, 0, 0);
if (finfo->update_dir[0] == '\0')
xdir = ".";
else
xdir = finfo->update_dir;
if ((p = findnode (mtlist, xdir)) != NULL)
{
tlist = ((struct master_lists *) p->data)->tlist;
}
else
{
struct master_lists *ml;
tlist = getlist ();
p = getnode ();
p->key = xstrdup (xdir);
p->type = UPDATE;
ml = xmalloc (sizeof (struct master_lists));
ml->tlist = tlist;
p->data = ml;
p->delproc = masterlist_delproc;
(void) addnode (mtlist, p);
}
p = getnode ();
p->key = xstrdup (finfo->file);
p->type = UPDATE;
p->delproc = tag_delproc;
if (vers->srcfile == NULL)
{
if (!really_quiet)
error (0, 0, "nothing known about %s", finfo->file);
freevers_ts (&vers);
freenode (p);
return 1;
}
p->data = ti = xmalloc (sizeof (struct tag_info));
ti->tag = xstrdup (numtag ? numtag : vers->tag);
if (!is_rtag && numtag == NULL && date == NULL)
ti->rev = xstrdup (vers->vn_user);
else
ti->rev = RCS_getversion (vers->srcfile, numtag, date,
force_tag_match, NULL);
if (ti->rev != NULL)
{
ti->oldrev = RCS_getversion (vers->srcfile, symtag, NULL, 1, NULL);
if (ti->oldrev == NULL)
{
if (delete_flag)
{
addit = 0;
}
}
else if (delete_flag)
{
free (ti->rev);
#ifdef SUPPORT_OLD_INFO_FMT_STRINGS
ti->rev = xstrdup (ti->oldrev);
#else
ti->rev = NULL;
#endif
}
else if (strcmp(ti->oldrev, p->data) == 0)
addit = 0;
else if (!force_tag_move)
addit = 0;
}
else
addit = 0;
if (!addit)
{
free(p->data);
p->data = NULL;
}
freevers_ts (&vers);
(void)addnode (tlist, p);
return 0;
} | [
"static",
"int",
"check_fileproc",
"(",
"void",
"*",
"callerdat",
",",
"struct",
"file_info",
"*",
"finfo",
")",
"{",
"const",
"char",
"*",
"xdir",
";",
"Node",
"*",
"p",
";",
"Vers_TS",
"*",
"vers",
";",
"List",
"*",
"tlist",
";",
"struct",
"tag_info",
"*",
"ti",
";",
"int",
"addit",
"=",
"1",
";",
"TRACE",
"(",
"TRACE_FUNCTION",
",",
"\"",
"\"",
",",
"finfo",
"->",
"repository",
"?",
"finfo",
"->",
"repository",
":",
"\"",
"\"",
",",
"finfo",
"->",
"fullname",
"?",
"finfo",
"->",
"fullname",
":",
"\"",
"\"",
",",
"finfo",
"->",
"rcs",
"?",
"(",
"finfo",
"->",
"rcs",
"->",
"path",
"?",
"finfo",
"->",
"rcs",
"->",
"path",
":",
"\"",
"\"",
")",
":",
"\"",
"\"",
")",
";",
"if",
"(",
"check_uptodate",
")",
"{",
"switch",
"(",
"Classify_File",
"(",
"finfo",
",",
"NULL",
",",
"NULL",
",",
"NULL",
",",
"1",
",",
"0",
",",
"&",
"vers",
",",
"0",
")",
")",
"{",
"case",
"T_UPTODATE",
":",
"case",
"T_CHECKOUT",
":",
"case",
"T_PATCH",
":",
"case",
"T_REMOVE_ENTRY",
":",
"break",
";",
"case",
"T_UNKNOWN",
":",
"case",
"T_CONFLICT",
":",
"case",
"T_NEEDS_MERGE",
":",
"case",
"T_MODIFIED",
":",
"case",
"T_ADDED",
":",
"case",
"T_REMOVED",
":",
"default",
":",
"error",
"(",
"0",
",",
"0",
",",
"\"",
"\"",
",",
"finfo",
"->",
"fullname",
")",
";",
"freevers_ts",
"(",
"&",
"vers",
")",
";",
"return",
"1",
";",
"}",
"}",
"else",
"vers",
"=",
"Version_TS",
"(",
"finfo",
",",
"NULL",
",",
"NULL",
",",
"NULL",
",",
"0",
",",
"0",
")",
";",
"if",
"(",
"finfo",
"->",
"update_dir",
"[",
"0",
"]",
"==",
"'",
"\\0",
"'",
")",
"xdir",
"=",
"\"",
"\"",
";",
"else",
"xdir",
"=",
"finfo",
"->",
"update_dir",
";",
"if",
"(",
"(",
"p",
"=",
"findnode",
"(",
"mtlist",
",",
"xdir",
")",
")",
"!=",
"NULL",
")",
"{",
"tlist",
"=",
"(",
"(",
"struct",
"master_lists",
"*",
")",
"p",
"->",
"data",
")",
"->",
"tlist",
";",
"}",
"else",
"{",
"struct",
"master_lists",
"*",
"ml",
";",
"tlist",
"=",
"getlist",
"(",
")",
";",
"p",
"=",
"getnode",
"(",
")",
";",
"p",
"->",
"key",
"=",
"xstrdup",
"(",
"xdir",
")",
";",
"p",
"->",
"type",
"=",
"UPDATE",
";",
"ml",
"=",
"xmalloc",
"(",
"sizeof",
"(",
"struct",
"master_lists",
")",
")",
";",
"ml",
"->",
"tlist",
"=",
"tlist",
";",
"p",
"->",
"data",
"=",
"ml",
";",
"p",
"->",
"delproc",
"=",
"masterlist_delproc",
";",
"(",
"void",
")",
"addnode",
"(",
"mtlist",
",",
"p",
")",
";",
"}",
"p",
"=",
"getnode",
"(",
")",
";",
"p",
"->",
"key",
"=",
"xstrdup",
"(",
"finfo",
"->",
"file",
")",
";",
"p",
"->",
"type",
"=",
"UPDATE",
";",
"p",
"->",
"delproc",
"=",
"tag_delproc",
";",
"if",
"(",
"vers",
"->",
"srcfile",
"==",
"NULL",
")",
"{",
"if",
"(",
"!",
"really_quiet",
")",
"error",
"(",
"0",
",",
"0",
",",
"\"",
"\"",
",",
"finfo",
"->",
"file",
")",
";",
"freevers_ts",
"(",
"&",
"vers",
")",
";",
"freenode",
"(",
"p",
")",
";",
"return",
"1",
";",
"}",
"p",
"->",
"data",
"=",
"ti",
"=",
"xmalloc",
"(",
"sizeof",
"(",
"struct",
"tag_info",
")",
")",
";",
"ti",
"->",
"tag",
"=",
"xstrdup",
"(",
"numtag",
"?",
"numtag",
":",
"vers",
"->",
"tag",
")",
";",
"if",
"(",
"!",
"is_rtag",
"&&",
"numtag",
"==",
"NULL",
"&&",
"date",
"==",
"NULL",
")",
"ti",
"->",
"rev",
"=",
"xstrdup",
"(",
"vers",
"->",
"vn_user",
")",
";",
"else",
"ti",
"->",
"rev",
"=",
"RCS_getversion",
"(",
"vers",
"->",
"srcfile",
",",
"numtag",
",",
"date",
",",
"force_tag_match",
",",
"NULL",
")",
";",
"if",
"(",
"ti",
"->",
"rev",
"!=",
"NULL",
")",
"{",
"ti",
"->",
"oldrev",
"=",
"RCS_getversion",
"(",
"vers",
"->",
"srcfile",
",",
"symtag",
",",
"NULL",
",",
"1",
",",
"NULL",
")",
";",
"if",
"(",
"ti",
"->",
"oldrev",
"==",
"NULL",
")",
"{",
"if",
"(",
"delete_flag",
")",
"{",
"addit",
"=",
"0",
";",
"}",
"}",
"else",
"if",
"(",
"delete_flag",
")",
"{",
"free",
"(",
"ti",
"->",
"rev",
")",
";",
"#ifdef",
"SUPPORT_OLD_INFO_FMT_STRINGS",
"ti",
"->",
"rev",
"=",
"xstrdup",
"(",
"ti",
"->",
"oldrev",
")",
";",
"#else",
"ti",
"->",
"rev",
"=",
"NULL",
";",
"#endif",
"}",
"else",
"if",
"(",
"strcmp",
"(",
"ti",
"->",
"oldrev",
",",
"p",
"->",
"data",
")",
"==",
"0",
")",
"addit",
"=",
"0",
";",
"else",
"if",
"(",
"!",
"force_tag_move",
")",
"addit",
"=",
"0",
";",
"}",
"else",
"addit",
"=",
"0",
";",
"if",
"(",
"!",
"addit",
")",
"{",
"free",
"(",
"p",
"->",
"data",
")",
";",
"p",
"->",
"data",
"=",
"NULL",
";",
"}",
"freevers_ts",
"(",
"&",
"vers",
")",
";",
"(",
"void",
")",
"addnode",
"(",
"tlist",
",",
"p",
")",
";",
"return",
"0",
";",
"}"
] | check file that is to be tagged
All we do here is add it to our list | [
"check",
"file",
"that",
"is",
"to",
"be",
"tagged",
"All",
"we",
"do",
"here",
"is",
"add",
"it",
"to",
"our",
"list"
] | [
"/* do tlist */",
"/* Here we duplicate the calculation in tag_fileproc about which\n version we are going to tag. There probably are some subtle races\n (e.g. numtag is \"foo\" which gets moved between here and\n tag_fileproc). */",
"/* Deleting a tag which did not exist is a noop and\n\t\t should not be logged. */",
"/* a hack since %v used to mean old or new rev */",
"/* SUPPORT_OLD_INFO_FMT_STRINGS */",
"/* SUPPORT_OLD_INFO_FMT_STRINGS */"
] | [
{
"param": "callerdat",
"type": "void"
},
{
"param": "finfo",
"type": "struct file_info"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "callerdat",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "finfo",
"type": "struct file_info",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb138561f631fa95e87faeef57791e9733cc39d8 | atrens/DragonFlyBSD-src | contrib/cvs-1.12/src/tag.c | [
"BSD-3-Clause"
] | C | pretag_list_to_args_proc | int | static int
pretag_list_to_args_proc (Node *p, void *closure)
{
struct tag_info *taginfo = (struct tag_info *)p->data;
struct format_cmdline_walklist_closure *c =
(struct format_cmdline_walklist_closure *)closure;
char *arg = NULL;
const char *f;
char *d;
size_t doff;
if (!p->data) return 1;
f = c->format;
d = *c->d;
/* foreach requested attribute */
while (*f)
{
switch (*f++)
{
case 's':
arg = p->key;
break;
case 'T':
arg = taginfo->tag ? taginfo->tag : "";
break;
case 'v':
arg = taginfo->rev ? taginfo->rev : "NONE";
break;
case 'V':
arg = taginfo->oldrev ? taginfo->oldrev : "NONE";
break;
default:
error(1,0,
"Unknown format character or not a list attribute: %c",
f[-1]);
break;
}
/* copy the attribute into an argument */
if (c->quotes)
{
arg = cmdlineescape (c->quotes, arg);
}
else
{
arg = cmdlinequote ('"', arg);
}
doff = d - *c->buf;
expand_string (c->buf, c->length, doff + strlen (arg));
d = *c->buf + doff;
strncpy (d, arg, strlen (arg));
d += strlen (arg);
free (arg);
/* and always put the extra space on. we'll have to back up a char when we're
* done, but that seems most efficient
*/
doff = d - *c->buf;
expand_string (c->buf, c->length, doff + 1);
d = *c->buf + doff;
*d++ = ' ';
}
/* correct our original pointer into the buff */
*c->d = d;
return 0;
} | /* to be passed into walklist with a list of tags
* p->key = tagname
* p->data = struct tag_info *
* p->data->oldrev = rev tag will be deleted from
* p->data->rev = rev tag will be added to
* p->data->tag = tag oldrev is attached to, if any
*
* closure will be a struct format_cmdline_walklist_closure
* where closure is undefined
*/ |
closure will be a struct format_cmdline_walklist_closure
where closure is undefined | [
"closure",
"will",
"be",
"a",
"struct",
"format_cmdline_walklist_closure",
"where",
"closure",
"is",
"undefined"
] | static int
pretag_list_to_args_proc (Node *p, void *closure)
{
struct tag_info *taginfo = (struct tag_info *)p->data;
struct format_cmdline_walklist_closure *c =
(struct format_cmdline_walklist_closure *)closure;
char *arg = NULL;
const char *f;
char *d;
size_t doff;
if (!p->data) return 1;
f = c->format;
d = *c->d;
while (*f)
{
switch (*f++)
{
case 's':
arg = p->key;
break;
case 'T':
arg = taginfo->tag ? taginfo->tag : "";
break;
case 'v':
arg = taginfo->rev ? taginfo->rev : "NONE";
break;
case 'V':
arg = taginfo->oldrev ? taginfo->oldrev : "NONE";
break;
default:
error(1,0,
"Unknown format character or not a list attribute: %c",
f[-1]);
break;
}
if (c->quotes)
{
arg = cmdlineescape (c->quotes, arg);
}
else
{
arg = cmdlinequote ('"', arg);
}
doff = d - *c->buf;
expand_string (c->buf, c->length, doff + strlen (arg));
d = *c->buf + doff;
strncpy (d, arg, strlen (arg));
d += strlen (arg);
free (arg);
doff = d - *c->buf;
expand_string (c->buf, c->length, doff + 1);
d = *c->buf + doff;
*d++ = ' ';
}
*c->d = d;
return 0;
} | [
"static",
"int",
"pretag_list_to_args_proc",
"(",
"Node",
"*",
"p",
",",
"void",
"*",
"closure",
")",
"{",
"struct",
"tag_info",
"*",
"taginfo",
"=",
"(",
"struct",
"tag_info",
"*",
")",
"p",
"->",
"data",
";",
"struct",
"format_cmdline_walklist_closure",
"*",
"c",
"=",
"(",
"struct",
"format_cmdline_walklist_closure",
"*",
")",
"closure",
";",
"char",
"*",
"arg",
"=",
"NULL",
";",
"const",
"char",
"*",
"f",
";",
"char",
"*",
"d",
";",
"size_t",
"doff",
";",
"if",
"(",
"!",
"p",
"->",
"data",
")",
"return",
"1",
";",
"f",
"=",
"c",
"->",
"format",
";",
"d",
"=",
"*",
"c",
"->",
"d",
";",
"while",
"(",
"*",
"f",
")",
"{",
"switch",
"(",
"*",
"f",
"++",
")",
"{",
"case",
"'",
"'",
":",
"arg",
"=",
"p",
"->",
"key",
";",
"break",
";",
"case",
"'",
"'",
":",
"arg",
"=",
"taginfo",
"->",
"tag",
"?",
"taginfo",
"->",
"tag",
":",
"\"",
"\"",
";",
"break",
";",
"case",
"'",
"'",
":",
"arg",
"=",
"taginfo",
"->",
"rev",
"?",
"taginfo",
"->",
"rev",
":",
"\"",
"\"",
";",
"break",
";",
"case",
"'",
"'",
":",
"arg",
"=",
"taginfo",
"->",
"oldrev",
"?",
"taginfo",
"->",
"oldrev",
":",
"\"",
"\"",
";",
"break",
";",
"default",
":",
"error",
"(",
"1",
",",
"0",
",",
"\"",
"\"",
",",
"f",
"[",
"-1",
"]",
")",
";",
"break",
";",
"}",
"if",
"(",
"c",
"->",
"quotes",
")",
"{",
"arg",
"=",
"cmdlineescape",
"(",
"c",
"->",
"quotes",
",",
"arg",
")",
";",
"}",
"else",
"{",
"arg",
"=",
"cmdlinequote",
"(",
"'",
"'",
",",
"arg",
")",
";",
"}",
"doff",
"=",
"d",
"-",
"*",
"c",
"->",
"buf",
";",
"expand_string",
"(",
"c",
"->",
"buf",
",",
"c",
"->",
"length",
",",
"doff",
"+",
"strlen",
"(",
"arg",
")",
")",
";",
"d",
"=",
"*",
"c",
"->",
"buf",
"+",
"doff",
";",
"strncpy",
"(",
"d",
",",
"arg",
",",
"strlen",
"(",
"arg",
")",
")",
";",
"d",
"+=",
"strlen",
"(",
"arg",
")",
";",
"free",
"(",
"arg",
")",
";",
"doff",
"=",
"d",
"-",
"*",
"c",
"->",
"buf",
";",
"expand_string",
"(",
"c",
"->",
"buf",
",",
"c",
"->",
"length",
",",
"doff",
"+",
"1",
")",
";",
"d",
"=",
"*",
"c",
"->",
"buf",
"+",
"doff",
";",
"*",
"d",
"++",
"=",
"'",
"'",
";",
"}",
"*",
"c",
"->",
"d",
"=",
"d",
";",
"return",
"0",
";",
"}"
] | to be passed into walklist with a list of tags
p->key = tagname
p->data = struct tag_info
p->data->oldrev = rev tag will be deleted from
p->data->rev = rev tag will be added to
p->data->tag = tag oldrev is attached to, if any | [
"to",
"be",
"passed",
"into",
"walklist",
"with",
"a",
"list",
"of",
"tags",
"p",
"-",
">",
"key",
"=",
"tagname",
"p",
"-",
">",
"data",
"=",
"struct",
"tag_info",
"p",
"-",
">",
"data",
"-",
">",
"oldrev",
"=",
"rev",
"tag",
"will",
"be",
"deleted",
"from",
"p",
"-",
">",
"data",
"-",
">",
"rev",
"=",
"rev",
"tag",
"will",
"be",
"added",
"to",
"p",
"-",
">",
"data",
"-",
">",
"tag",
"=",
"tag",
"oldrev",
"is",
"attached",
"to",
"if",
"any"
] | [
"/* foreach requested attribute */",
"/* copy the attribute into an argument */",
"/* and always put the extra space on. we'll have to back up a char when we're\n\t * done, but that seems most efficient\n\t */",
"/* correct our original pointer into the buff */"
] | [
{
"param": "p",
"type": "Node"
},
{
"param": "closure",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p",
"type": "Node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "closure",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb138561f631fa95e87faeef57791e9733cc39d8 | atrens/DragonFlyBSD-src | contrib/cvs-1.12/src/tag.c | [
"BSD-3-Clause"
] | C | rtag_delete | int | static int
rtag_delete (RCSNode *rcsfile)
{
char *version;
int retcode, isbranch;
if (numtag)
{
version = RCS_getversion (rcsfile, numtag, NULL, 1, NULL);
if (version == NULL)
return (0);
free (version);
}
version = RCS_getversion (rcsfile, symtag, NULL, 1, NULL);
if (version == NULL)
return 0;
free (version);
isbranch = RCS_nodeisbranch (rcsfile, symtag);
if ((isbranch && !disturb_branch_tags) ||
(!isbranch && disturb_branch_tags))
{
if (!quiet)
error (0, 0,
"Not removing %s tag `%s' from `%s'%s.",
isbranch ? "branch" : "non-branch",
symtag, rcsfile->path,
isbranch ? "" : " due to `-B' option");
return 1;
}
if ((retcode = RCS_deltag(rcsfile, symtag)) != 0)
{
if (!quiet)
error (0, retcode == -1 ? errno : 0,
"failed to remove tag `%s' from `%s'", symtag,
rcsfile->path);
return 1;
}
RCS_rewrite (rcsfile, NULL, NULL);
return 0;
} | /*
* If -d is specified, "force_tag_match" is set, so that this call to
* RCS_getversion() will return a NULL version string if the symbolic
* tag does not exist in the RCS file.
*
* If the -r flag was used, numtag is set, and we only delete the
* symtag from files that have numtag.
*
* This is done here because it's MUCH faster than just blindly calling
* "rcs" to remove the tag... trust me.
*/ | d is specified, "force_tag_match" is set, so that this call to
RCS_getversion() will return a NULL version string if the symbolic
tag does not exist in the RCS file.
If the -r flag was used, numtag is set, and we only delete the
symtag from files that have numtag.
This is done here because it's MUCH faster than just blindly calling
"rcs" to remove the tag... trust me. | [
"d",
"is",
"specified",
"\"",
"force_tag_match",
"\"",
"is",
"set",
"so",
"that",
"this",
"call",
"to",
"RCS_getversion",
"()",
"will",
"return",
"a",
"NULL",
"version",
"string",
"if",
"the",
"symbolic",
"tag",
"does",
"not",
"exist",
"in",
"the",
"RCS",
"file",
".",
"If",
"the",
"-",
"r",
"flag",
"was",
"used",
"numtag",
"is",
"set",
"and",
"we",
"only",
"delete",
"the",
"symtag",
"from",
"files",
"that",
"have",
"numtag",
".",
"This",
"is",
"done",
"here",
"because",
"it",
"'",
"s",
"MUCH",
"faster",
"than",
"just",
"blindly",
"calling",
"\"",
"rcs",
"\"",
"to",
"remove",
"the",
"tag",
"...",
"trust",
"me",
"."
] | static int
rtag_delete (RCSNode *rcsfile)
{
char *version;
int retcode, isbranch;
if (numtag)
{
version = RCS_getversion (rcsfile, numtag, NULL, 1, NULL);
if (version == NULL)
return (0);
free (version);
}
version = RCS_getversion (rcsfile, symtag, NULL, 1, NULL);
if (version == NULL)
return 0;
free (version);
isbranch = RCS_nodeisbranch (rcsfile, symtag);
if ((isbranch && !disturb_branch_tags) ||
(!isbranch && disturb_branch_tags))
{
if (!quiet)
error (0, 0,
"Not removing %s tag `%s' from `%s'%s.",
isbranch ? "branch" : "non-branch",
symtag, rcsfile->path,
isbranch ? "" : " due to `-B' option");
return 1;
}
if ((retcode = RCS_deltag(rcsfile, symtag)) != 0)
{
if (!quiet)
error (0, retcode == -1 ? errno : 0,
"failed to remove tag `%s' from `%s'", symtag,
rcsfile->path);
return 1;
}
RCS_rewrite (rcsfile, NULL, NULL);
return 0;
} | [
"static",
"int",
"rtag_delete",
"(",
"RCSNode",
"*",
"rcsfile",
")",
"{",
"char",
"*",
"version",
";",
"int",
"retcode",
",",
"isbranch",
";",
"if",
"(",
"numtag",
")",
"{",
"version",
"=",
"RCS_getversion",
"(",
"rcsfile",
",",
"numtag",
",",
"NULL",
",",
"1",
",",
"NULL",
")",
";",
"if",
"(",
"version",
"==",
"NULL",
")",
"return",
"(",
"0",
")",
";",
"free",
"(",
"version",
")",
";",
"}",
"version",
"=",
"RCS_getversion",
"(",
"rcsfile",
",",
"symtag",
",",
"NULL",
",",
"1",
",",
"NULL",
")",
";",
"if",
"(",
"version",
"==",
"NULL",
")",
"return",
"0",
";",
"free",
"(",
"version",
")",
";",
"isbranch",
"=",
"RCS_nodeisbranch",
"(",
"rcsfile",
",",
"symtag",
")",
";",
"if",
"(",
"(",
"isbranch",
"&&",
"!",
"disturb_branch_tags",
")",
"||",
"(",
"!",
"isbranch",
"&&",
"disturb_branch_tags",
")",
")",
"{",
"if",
"(",
"!",
"quiet",
")",
"error",
"(",
"0",
",",
"0",
",",
"\"",
"\"",
",",
"isbranch",
"?",
"\"",
"\"",
":",
"\"",
"\"",
",",
"symtag",
",",
"rcsfile",
"->",
"path",
",",
"isbranch",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"return",
"1",
";",
"}",
"if",
"(",
"(",
"retcode",
"=",
"RCS_deltag",
"(",
"rcsfile",
",",
"symtag",
")",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"!",
"quiet",
")",
"error",
"(",
"0",
",",
"retcode",
"==",
"-1",
"?",
"errno",
":",
"0",
",",
"\"",
"\"",
",",
"symtag",
",",
"rcsfile",
"->",
"path",
")",
";",
"return",
"1",
";",
"}",
"RCS_rewrite",
"(",
"rcsfile",
",",
"NULL",
",",
"NULL",
")",
";",
"return",
"0",
";",
"}"
] | If -d is specified, "force_tag_match" is set, so that this call to
RCS_getversion() will return a NULL version string if the symbolic
tag does not exist in the RCS file. | [
"If",
"-",
"d",
"is",
"specified",
"\"",
"force_tag_match",
"\"",
"is",
"set",
"so",
"that",
"this",
"call",
"to",
"RCS_getversion",
"()",
"will",
"return",
"a",
"NULL",
"version",
"string",
"if",
"the",
"symbolic",
"tag",
"does",
"not",
"exist",
"in",
"the",
"RCS",
"file",
"."
] | [] | [
{
"param": "rcsfile",
"type": "RCSNode"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rcsfile",
"type": "RCSNode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb138561f631fa95e87faeef57791e9733cc39d8 | atrens/DragonFlyBSD-src | contrib/cvs-1.12/src/tag.c | [
"BSD-3-Clause"
] | C | is_in_val_tags | int | static int is_in_val_tags (DBM **idb, const char *name)
{
DBM *db = NULL;
char *valtags_filename;
datum mytag;
int status;
/* Casting out const should be safe here - input datums are not
* written to by the myndbm functions.
*/
mytag.dptr = (char *)name;
mytag.dsize = strlen (name);
valtags_filename = Xasprintf ("%s/%s/%s", current_parsed_root->directory,
CVSROOTADM, CVSROOTADM_VALTAGS);
if (idb)
{
mode_t omask;
omask = umask (cvsumask);
db = dbm_open (valtags_filename, O_RDWR | O_CREAT, 0666);
umask (omask);
if (!db)
{
error (0, errno, "warning: cannot open `%s' read/write",
valtags_filename);
*idb = NULL;
return 1;
}
*idb = db;
}
else
{
db = dbm_open (valtags_filename, O_RDONLY, 0444);
if (!db && !existence_error (errno))
error (1, errno, "cannot read %s", valtags_filename);
}
/* If the file merely fails to exist, we just keep going and create
it later if need be. */
status = 0;
if (db)
{
datum val;
val = dbm_fetch (db, mytag);
if (val.dptr != NULL)
/* Found. The tag is valid. */
status = 1;
/* FIXME: should check errors somehow (add dbm_error to myndbm.c?). */
if (!idb) dbm_close (db);
}
free (valtags_filename);
return status;
} | /* This routine determines whether a tag appears in CVSROOT/val-tags.
*
* The val-tags file will be open read-only when IDB is NULL. Since writes to
* val-tags always append to it, the lack of locking is okay. The worst case
* race condition might misinterpret a partially written "foobar" matched, for
* instance, a request for "f", "foo", of "foob". Such a mismatch would be
* caught harmlessly later.
*
* Before CVS adds a tag to val-tags, it will lock val-tags for write and
* verify that the tag is still not present to avoid adding it twice.
*
* NOTES
* This function expects its parent to handle any necessary locking of the
* val-tags file.
*
* INPUTS
* idb When this value is NULL, the val-tags file is opened in
* in read-only mode. When present, the val-tags file is opened
* in read-write mode and the DBM handle is stored in *IDB.
* name The tag to search for.
*
* OUTPUTS
* *idb The val-tags file opened for read/write, or NULL if it couldn't
* be opened.
*
* ERRORS
* Exits with an error message if the val-tags file cannot be opened for
* read (failure to open val-tags read/write is harmless - see below).
*
* RETURNS
* true 1. If NAME exists in val-tags.
* 2. If IDB is non-NULL and val-tags cannot be opened for write.
* This allows callers to ignore the harmless inability to
* update the val-tags cache.
* false If the file could be opened and the tag is not present.
*/ | This routine determines whether a tag appears in CVSROOT/val-tags.
The val-tags file will be open read-only when IDB is NULL. Since writes to
val-tags always append to it, the lack of locking is okay.
Before CVS adds a tag to val-tags, it will lock val-tags for write and
verify that the tag is still not present to avoid adding it twice.
NOTES
This function expects its parent to handle any necessary locking of the
val-tags file.
INPUTS
idb When this value is NULL, the val-tags file is opened in
in read-only mode. When present, the val-tags file is opened
in read-write mode and the DBM handle is stored in *IDB.
name The tag to search for.
OUTPUTS
*idb The val-tags file opened for read/write, or NULL if it couldn't
be opened.
ERRORS
Exits with an error message if the val-tags file cannot be opened for
read (failure to open val-tags read/write is harmless - see below).
RETURNS
true 1. If NAME exists in val-tags.
2. If IDB is non-NULL and val-tags cannot be opened for write.
This allows callers to ignore the harmless inability to
update the val-tags cache.
false If the file could be opened and the tag is not present. | [
"This",
"routine",
"determines",
"whether",
"a",
"tag",
"appears",
"in",
"CVSROOT",
"/",
"val",
"-",
"tags",
".",
"The",
"val",
"-",
"tags",
"file",
"will",
"be",
"open",
"read",
"-",
"only",
"when",
"IDB",
"is",
"NULL",
".",
"Since",
"writes",
"to",
"val",
"-",
"tags",
"always",
"append",
"to",
"it",
"the",
"lack",
"of",
"locking",
"is",
"okay",
".",
"Before",
"CVS",
"adds",
"a",
"tag",
"to",
"val",
"-",
"tags",
"it",
"will",
"lock",
"val",
"-",
"tags",
"for",
"write",
"and",
"verify",
"that",
"the",
"tag",
"is",
"still",
"not",
"present",
"to",
"avoid",
"adding",
"it",
"twice",
".",
"NOTES",
"This",
"function",
"expects",
"its",
"parent",
"to",
"handle",
"any",
"necessary",
"locking",
"of",
"the",
"val",
"-",
"tags",
"file",
".",
"INPUTS",
"idb",
"When",
"this",
"value",
"is",
"NULL",
"the",
"val",
"-",
"tags",
"file",
"is",
"opened",
"in",
"in",
"read",
"-",
"only",
"mode",
".",
"When",
"present",
"the",
"val",
"-",
"tags",
"file",
"is",
"opened",
"in",
"read",
"-",
"write",
"mode",
"and",
"the",
"DBM",
"handle",
"is",
"stored",
"in",
"*",
"IDB",
".",
"name",
"The",
"tag",
"to",
"search",
"for",
".",
"OUTPUTS",
"*",
"idb",
"The",
"val",
"-",
"tags",
"file",
"opened",
"for",
"read",
"/",
"write",
"or",
"NULL",
"if",
"it",
"couldn",
"'",
"t",
"be",
"opened",
".",
"ERRORS",
"Exits",
"with",
"an",
"error",
"message",
"if",
"the",
"val",
"-",
"tags",
"file",
"cannot",
"be",
"opened",
"for",
"read",
"(",
"failure",
"to",
"open",
"val",
"-",
"tags",
"read",
"/",
"write",
"is",
"harmless",
"-",
"see",
"below",
")",
".",
"RETURNS",
"true",
"1",
".",
"If",
"NAME",
"exists",
"in",
"val",
"-",
"tags",
".",
"2",
".",
"If",
"IDB",
"is",
"non",
"-",
"NULL",
"and",
"val",
"-",
"tags",
"cannot",
"be",
"opened",
"for",
"write",
".",
"This",
"allows",
"callers",
"to",
"ignore",
"the",
"harmless",
"inability",
"to",
"update",
"the",
"val",
"-",
"tags",
"cache",
".",
"false",
"If",
"the",
"file",
"could",
"be",
"opened",
"and",
"the",
"tag",
"is",
"not",
"present",
"."
] | static int is_in_val_tags (DBM **idb, const char *name)
{
DBM *db = NULL;
char *valtags_filename;
datum mytag;
int status;
mytag.dptr = (char *)name;
mytag.dsize = strlen (name);
valtags_filename = Xasprintf ("%s/%s/%s", current_parsed_root->directory,
CVSROOTADM, CVSROOTADM_VALTAGS);
if (idb)
{
mode_t omask;
omask = umask (cvsumask);
db = dbm_open (valtags_filename, O_RDWR | O_CREAT, 0666);
umask (omask);
if (!db)
{
error (0, errno, "warning: cannot open `%s' read/write",
valtags_filename);
*idb = NULL;
return 1;
}
*idb = db;
}
else
{
db = dbm_open (valtags_filename, O_RDONLY, 0444);
if (!db && !existence_error (errno))
error (1, errno, "cannot read %s", valtags_filename);
}
status = 0;
if (db)
{
datum val;
val = dbm_fetch (db, mytag);
if (val.dptr != NULL)
status = 1;
if (!idb) dbm_close (db);
}
free (valtags_filename);
return status;
} | [
"static",
"int",
"is_in_val_tags",
"(",
"DBM",
"*",
"*",
"idb",
",",
"const",
"char",
"*",
"name",
")",
"{",
"DBM",
"*",
"db",
"=",
"NULL",
";",
"char",
"*",
"valtags_filename",
";",
"datum",
"mytag",
";",
"int",
"status",
";",
"mytag",
".",
"dptr",
"=",
"(",
"char",
"*",
")",
"name",
";",
"mytag",
".",
"dsize",
"=",
"strlen",
"(",
"name",
")",
";",
"valtags_filename",
"=",
"Xasprintf",
"(",
"\"",
"\"",
",",
"current_parsed_root",
"->",
"directory",
",",
"CVSROOTADM",
",",
"CVSROOTADM_VALTAGS",
")",
";",
"if",
"(",
"idb",
")",
"{",
"mode_t",
"omask",
";",
"omask",
"=",
"umask",
"(",
"cvsumask",
")",
";",
"db",
"=",
"dbm_open",
"(",
"valtags_filename",
",",
"O_RDWR",
"|",
"O_CREAT",
",",
"0666",
")",
";",
"umask",
"(",
"omask",
")",
";",
"if",
"(",
"!",
"db",
")",
"{",
"error",
"(",
"0",
",",
"errno",
",",
"\"",
"\"",
",",
"valtags_filename",
")",
";",
"*",
"idb",
"=",
"NULL",
";",
"return",
"1",
";",
"}",
"*",
"idb",
"=",
"db",
";",
"}",
"else",
"{",
"db",
"=",
"dbm_open",
"(",
"valtags_filename",
",",
"O_RDONLY",
",",
"0444",
")",
";",
"if",
"(",
"!",
"db",
"&&",
"!",
"existence_error",
"(",
"errno",
")",
")",
"error",
"(",
"1",
",",
"errno",
",",
"\"",
"\"",
",",
"valtags_filename",
")",
";",
"}",
"status",
"=",
"0",
";",
"if",
"(",
"db",
")",
"{",
"datum",
"val",
";",
"val",
"=",
"dbm_fetch",
"(",
"db",
",",
"mytag",
")",
";",
"if",
"(",
"val",
".",
"dptr",
"!=",
"NULL",
")",
"status",
"=",
"1",
";",
"if",
"(",
"!",
"idb",
")",
"dbm_close",
"(",
"db",
")",
";",
"}",
"free",
"(",
"valtags_filename",
")",
";",
"return",
"status",
";",
"}"
] | This routine determines whether a tag appears in CVSROOT/val-tags. | [
"This",
"routine",
"determines",
"whether",
"a",
"tag",
"appears",
"in",
"CVSROOT",
"/",
"val",
"-",
"tags",
"."
] | [
"/* Casting out const should be safe here - input datums are not\n * written to by the myndbm functions.\n */",
"/* If the file merely fails to exist, we just keep going and create\n it later if need be. */",
"/* Found. The tag is valid. */",
"/* FIXME: should check errors somehow (add dbm_error to myndbm.c?). */"
] | [
{
"param": "idb",
"type": "DBM"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "idb",
"type": "DBM",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb138561f631fa95e87faeef57791e9733cc39d8 | atrens/DragonFlyBSD-src | contrib/cvs-1.12/src/tag.c | [
"BSD-3-Clause"
] | C | add_to_val_tags | void | static void add_to_val_tags (const char *name)
{
DBM *db;
datum mytag;
datum value;
if (noexec || readonlyfs) return;
val_tags_lock (current_parsed_root->directory);
/* Check for presence again since we have a lock now. */
if (is_in_val_tags (&db, name)) return;
/* Casting out const should be safe here - input datums are not
* written to by the myndbm functions.
*/
mytag.dptr = (char *)name;
mytag.dsize = strlen (name);
value.dptr = "y";
value.dsize = 1;
if (dbm_store (db, mytag, value, DBM_REPLACE) < 0)
error (0, errno, "failed to store %s into val-tags", name);
dbm_close (db);
clear_val_tags_lock ();
} | /* Add a tag to the CVSROOT/val-tags cache. Establishes a write lock and
* reverifies that the tag does not exist before adding it.
*/ | Add a tag to the CVSROOT/val-tags cache. Establishes a write lock and
reverifies that the tag does not exist before adding it. | [
"Add",
"a",
"tag",
"to",
"the",
"CVSROOT",
"/",
"val",
"-",
"tags",
"cache",
".",
"Establishes",
"a",
"write",
"lock",
"and",
"reverifies",
"that",
"the",
"tag",
"does",
"not",
"exist",
"before",
"adding",
"it",
"."
] | static void add_to_val_tags (const char *name)
{
DBM *db;
datum mytag;
datum value;
if (noexec || readonlyfs) return;
val_tags_lock (current_parsed_root->directory);
if (is_in_val_tags (&db, name)) return;
mytag.dptr = (char *)name;
mytag.dsize = strlen (name);
value.dptr = "y";
value.dsize = 1;
if (dbm_store (db, mytag, value, DBM_REPLACE) < 0)
error (0, errno, "failed to store %s into val-tags", name);
dbm_close (db);
clear_val_tags_lock ();
} | [
"static",
"void",
"add_to_val_tags",
"(",
"const",
"char",
"*",
"name",
")",
"{",
"DBM",
"*",
"db",
";",
"datum",
"mytag",
";",
"datum",
"value",
";",
"if",
"(",
"noexec",
"||",
"readonlyfs",
")",
"return",
";",
"val_tags_lock",
"(",
"current_parsed_root",
"->",
"directory",
")",
";",
"if",
"(",
"is_in_val_tags",
"(",
"&",
"db",
",",
"name",
")",
")",
"return",
";",
"mytag",
".",
"dptr",
"=",
"(",
"char",
"*",
")",
"name",
";",
"mytag",
".",
"dsize",
"=",
"strlen",
"(",
"name",
")",
";",
"value",
".",
"dptr",
"=",
"\"",
"\"",
";",
"value",
".",
"dsize",
"=",
"1",
";",
"if",
"(",
"dbm_store",
"(",
"db",
",",
"mytag",
",",
"value",
",",
"DBM_REPLACE",
")",
"<",
"0",
")",
"error",
"(",
"0",
",",
"errno",
",",
"\"",
"\"",
",",
"name",
")",
";",
"dbm_close",
"(",
"db",
")",
";",
"clear_val_tags_lock",
"(",
")",
";",
"}"
] | Add a tag to the CVSROOT/val-tags cache. | [
"Add",
"a",
"tag",
"to",
"the",
"CVSROOT",
"/",
"val",
"-",
"tags",
"cache",
"."
] | [
"/* Check for presence again since we have a lock now. */",
"/* Casting out const should be safe here - input datums are not\n * written to by the myndbm functions.\n */"
] | [
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb138561f631fa95e87faeef57791e9733cc39d8 | atrens/DragonFlyBSD-src | contrib/cvs-1.12/src/tag.c | [
"BSD-3-Clause"
] | C | tag_check_valid | void | void
tag_check_valid (const char *name, int argc, char **argv, int local, int aflag,
char *repository, bool valid)
{
struct val_args the_val_args;
struct saved_cwd cwd;
int which;
#ifdef HAVE_PRINTF_PTR
TRACE (TRACE_FUNCTION,
"tag_check_valid (name=%s, argc=%d, argv=%p, local=%d,\n"
" aflag=%d, repository=%s, valid=%s)",
name ? name : "(name)", argc, (void *)argv, local, aflag,
repository ? repository : "(null)",
valid ? "true" : "false");
#else
TRACE (TRACE_FUNCTION,
"tag_check_valid (name=%s, argc=%d, argv=%lx, local=%d,\n"
" aflag=%d, repository=%s, valid=%s)",
name ? name : "(name)", argc, (unsigned long)argv, local, aflag,
repository ? repository : "(null)",
valid ? "true" : "false");
#endif
/* Numeric tags require only a syntactic check. */
if (isdigit ((unsigned char) name[0]))
{
/* insert is not possible for numeric revisions */
assert (!valid);
if (RCS_valid_rev (name)) return;
else
error (1, 0, "\
Numeric tag %s invalid. Numeric tags should be of the form X[.X]...", name);
}
/* Special tags are always valid. */
if (strcmp (name, TAG_BASE) == 0
|| strcmp (name, TAG_HEAD) == 0)
{
/* insert is not possible for numeric revisions */
assert (!valid);
return;
}
/* Verify that the tag is valid syntactically. Some later code once made
* assumptions about this.
*/
RCS_check_tag (name);
if (is_in_val_tags (NULL, name)) return;
if (!valid)
{
/* We didn't find the tag in val-tags, so look through all the RCS files
* to see whether it exists there. Yes, this is expensive, but there
* is no other way to cope with a tag which might have been created
* by an old version of CVS, from before val-tags was invented
*/
the_val_args.name = name;
the_val_args.found = 0;
which = W_REPOS | W_ATTIC;
if (repository == NULL || repository[0] == '\0')
which |= W_LOCAL;
else
{
if (save_cwd (&cwd))
error (1, errno, "Failed to save current directory.");
if (CVS_CHDIR (repository) < 0)
error (1, errno, "cannot change to %s directory", repository);
}
start_recursion
(val_fileproc, NULL, val_direntproc, NULL,
&the_val_args, argc, argv, local, which, aflag,
CVS_LOCK_READ, NULL, 1, repository);
if (repository != NULL && repository[0] != '\0')
{
if (restore_cwd (&cwd))
error (1, errno, "Failed to restore current directory, `%s'.",
cwd.name);
free_cwd (&cwd);
}
if (!the_val_args.found)
error (1, 0, "no such tag `%s'", name);
}
/* The tags is valid but not mentioned in val-tags. Add it. */
add_to_val_tags (name);
} | /* With VALID set, insert NAME into val-tags if it is not already present
* there.
*
* Without VALID set, check to see whether NAME is a valid tag. If so, return.
* If not print an error message and exit.
*
* INPUTS
*
* ARGC, ARGV, LOCAL, and AFLAG specify which files we will be operating on.
*
* REPOSITORY is the repository if we need to cd into it, or NULL if
* we are already there, or "" if we should do a W_LOCAL recursion.
* Sorry for three cases, but the "" case is needed in case the
* working directories come from diverse parts of the repository, the
* NULL case avoids an unneccesary chdir, and the non-NULL, non-""
* case is needed for checkout, where we don't want to chdir if the
* tag is found in CVSROOTADM_VALTAGS, but there is not (yet) any
* local directory.
*
* ERRORS
* Errors may be encountered opening and accessing the DBM file. Write
* errors generate warnings and read errors are fatal. When !VALID and NAME
* is not in val-tags, errors may also be generated as per start_recursion.
* When !VALID, non-existance of tags both in val-tags and in the archive
* files also causes a fatal error.
*
* RETURNS
* Nothing.
*/ | With VALID set, insert NAME into val-tags if it is not already present
there.
Without VALID set, check to see whether NAME is a valid tag. If so, return.
If not print an error message and exit.
INPUTS
ARGC, ARGV, LOCAL, and AFLAG specify which files we will be operating on.
REPOSITORY is the repository if we need to cd into it, or NULL if
we are already there, or "" if we should do a W_LOCAL recursion.
Sorry for three cases, but the "" case is needed in case the
working directories come from diverse parts of the repository, the
NULL case avoids an unneccesary chdir, and the non-NULL, non-""
case is needed for checkout, where we don't want to chdir if the
tag is found in CVSROOTADM_VALTAGS, but there is not (yet) any
local directory.
ERRORS
Errors may be encountered opening and accessing the DBM file. Write
errors generate warnings and read errors are fatal. When !VALID and NAME
is not in val-tags, errors may also be generated as per start_recursion.
When !VALID, non-existance of tags both in val-tags and in the archive
files also causes a fatal error.
RETURNS
Nothing. | [
"With",
"VALID",
"set",
"insert",
"NAME",
"into",
"val",
"-",
"tags",
"if",
"it",
"is",
"not",
"already",
"present",
"there",
".",
"Without",
"VALID",
"set",
"check",
"to",
"see",
"whether",
"NAME",
"is",
"a",
"valid",
"tag",
".",
"If",
"so",
"return",
".",
"If",
"not",
"print",
"an",
"error",
"message",
"and",
"exit",
".",
"INPUTS",
"ARGC",
"ARGV",
"LOCAL",
"and",
"AFLAG",
"specify",
"which",
"files",
"we",
"will",
"be",
"operating",
"on",
".",
"REPOSITORY",
"is",
"the",
"repository",
"if",
"we",
"need",
"to",
"cd",
"into",
"it",
"or",
"NULL",
"if",
"we",
"are",
"already",
"there",
"or",
"\"",
"\"",
"if",
"we",
"should",
"do",
"a",
"W_LOCAL",
"recursion",
".",
"Sorry",
"for",
"three",
"cases",
"but",
"the",
"\"",
"\"",
"case",
"is",
"needed",
"in",
"case",
"the",
"working",
"directories",
"come",
"from",
"diverse",
"parts",
"of",
"the",
"repository",
"the",
"NULL",
"case",
"avoids",
"an",
"unneccesary",
"chdir",
"and",
"the",
"non",
"-",
"NULL",
"non",
"-",
"\"",
"\"",
"case",
"is",
"needed",
"for",
"checkout",
"where",
"we",
"don",
"'",
"t",
"want",
"to",
"chdir",
"if",
"the",
"tag",
"is",
"found",
"in",
"CVSROOTADM_VALTAGS",
"but",
"there",
"is",
"not",
"(",
"yet",
")",
"any",
"local",
"directory",
".",
"ERRORS",
"Errors",
"may",
"be",
"encountered",
"opening",
"and",
"accessing",
"the",
"DBM",
"file",
".",
"Write",
"errors",
"generate",
"warnings",
"and",
"read",
"errors",
"are",
"fatal",
".",
"When",
"!VALID",
"and",
"NAME",
"is",
"not",
"in",
"val",
"-",
"tags",
"errors",
"may",
"also",
"be",
"generated",
"as",
"per",
"start_recursion",
".",
"When",
"!VALID",
"non",
"-",
"existance",
"of",
"tags",
"both",
"in",
"val",
"-",
"tags",
"and",
"in",
"the",
"archive",
"files",
"also",
"causes",
"a",
"fatal",
"error",
".",
"RETURNS",
"Nothing",
"."
] | void
tag_check_valid (const char *name, int argc, char **argv, int local, int aflag,
char *repository, bool valid)
{
struct val_args the_val_args;
struct saved_cwd cwd;
int which;
#ifdef HAVE_PRINTF_PTR
TRACE (TRACE_FUNCTION,
"tag_check_valid (name=%s, argc=%d, argv=%p, local=%d,\n"
" aflag=%d, repository=%s, valid=%s)",
name ? name : "(name)", argc, (void *)argv, local, aflag,
repository ? repository : "(null)",
valid ? "true" : "false");
#else
TRACE (TRACE_FUNCTION,
"tag_check_valid (name=%s, argc=%d, argv=%lx, local=%d,\n"
" aflag=%d, repository=%s, valid=%s)",
name ? name : "(name)", argc, (unsigned long)argv, local, aflag,
repository ? repository : "(null)",
valid ? "true" : "false");
#endif
if (isdigit ((unsigned char) name[0]))
{
assert (!valid);
if (RCS_valid_rev (name)) return;
else
error (1, 0, "\
Numeric tag %s invalid. Numeric tags should be of the form X[.X]...", name);
}
if (strcmp (name, TAG_BASE) == 0
|| strcmp (name, TAG_HEAD) == 0)
{
assert (!valid);
return;
}
RCS_check_tag (name);
if (is_in_val_tags (NULL, name)) return;
if (!valid)
{
the_val_args.name = name;
the_val_args.found = 0;
which = W_REPOS | W_ATTIC;
if (repository == NULL || repository[0] == '\0')
which |= W_LOCAL;
else
{
if (save_cwd (&cwd))
error (1, errno, "Failed to save current directory.");
if (CVS_CHDIR (repository) < 0)
error (1, errno, "cannot change to %s directory", repository);
}
start_recursion
(val_fileproc, NULL, val_direntproc, NULL,
&the_val_args, argc, argv, local, which, aflag,
CVS_LOCK_READ, NULL, 1, repository);
if (repository != NULL && repository[0] != '\0')
{
if (restore_cwd (&cwd))
error (1, errno, "Failed to restore current directory, `%s'.",
cwd.name);
free_cwd (&cwd);
}
if (!the_val_args.found)
error (1, 0, "no such tag `%s'", name);
}
add_to_val_tags (name);
} | [
"void",
"tag_check_valid",
"(",
"const",
"char",
"*",
"name",
",",
"int",
"argc",
",",
"char",
"*",
"*",
"argv",
",",
"int",
"local",
",",
"int",
"aflag",
",",
"char",
"*",
"repository",
",",
"bool",
"valid",
")",
"{",
"struct",
"val_args",
"the_val_args",
";",
"struct",
"saved_cwd",
"cwd",
";",
"int",
"which",
";",
"#ifdef",
"HAVE_PRINTF_PTR",
"TRACE",
"(",
"TRACE_FUNCTION",
",",
"\"",
"\\n",
"\"",
"\"",
"\"",
",",
"name",
"?",
"name",
":",
"\"",
"\"",
",",
"argc",
",",
"(",
"void",
"*",
")",
"argv",
",",
"local",
",",
"aflag",
",",
"repository",
"?",
"repository",
":",
"\"",
"\"",
",",
"valid",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"#else",
"TRACE",
"(",
"TRACE_FUNCTION",
",",
"\"",
"\\n",
"\"",
"\"",
"\"",
",",
"name",
"?",
"name",
":",
"\"",
"\"",
",",
"argc",
",",
"(",
"unsigned",
"long",
")",
"argv",
",",
"local",
",",
"aflag",
",",
"repository",
"?",
"repository",
":",
"\"",
"\"",
",",
"valid",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"#endif",
"if",
"(",
"isdigit",
"(",
"(",
"unsigned",
"char",
")",
"name",
"[",
"0",
"]",
")",
")",
"{",
"assert",
"(",
"!",
"valid",
")",
";",
"if",
"(",
"RCS_valid_rev",
"(",
"name",
")",
")",
"return",
";",
"else",
"error",
"(",
"1",
",",
"0",
",",
"\"",
"\\\n",
"\"",
",",
"name",
")",
";",
"}",
"if",
"(",
"strcmp",
"(",
"name",
",",
"TAG_BASE",
")",
"==",
"0",
"||",
"strcmp",
"(",
"name",
",",
"TAG_HEAD",
")",
"==",
"0",
")",
"{",
"assert",
"(",
"!",
"valid",
")",
";",
"return",
";",
"}",
"RCS_check_tag",
"(",
"name",
")",
";",
"if",
"(",
"is_in_val_tags",
"(",
"NULL",
",",
"name",
")",
")",
"return",
";",
"if",
"(",
"!",
"valid",
")",
"{",
"the_val_args",
".",
"name",
"=",
"name",
";",
"the_val_args",
".",
"found",
"=",
"0",
";",
"which",
"=",
"W_REPOS",
"|",
"W_ATTIC",
";",
"if",
"(",
"repository",
"==",
"NULL",
"||",
"repository",
"[",
"0",
"]",
"==",
"'",
"\\0",
"'",
")",
"which",
"|=",
"W_LOCAL",
";",
"else",
"{",
"if",
"(",
"save_cwd",
"(",
"&",
"cwd",
")",
")",
"error",
"(",
"1",
",",
"errno",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"CVS_CHDIR",
"(",
"repository",
")",
"<",
"0",
")",
"error",
"(",
"1",
",",
"errno",
",",
"\"",
"\"",
",",
"repository",
")",
";",
"}",
"start_recursion",
"(",
"val_fileproc",
",",
"NULL",
",",
"val_direntproc",
",",
"NULL",
",",
"&",
"the_val_args",
",",
"argc",
",",
"argv",
",",
"local",
",",
"which",
",",
"aflag",
",",
"CVS_LOCK_READ",
",",
"NULL",
",",
"1",
",",
"repository",
")",
";",
"if",
"(",
"repository",
"!=",
"NULL",
"&&",
"repository",
"[",
"0",
"]",
"!=",
"'",
"\\0",
"'",
")",
"{",
"if",
"(",
"restore_cwd",
"(",
"&",
"cwd",
")",
")",
"error",
"(",
"1",
",",
"errno",
",",
"\"",
"\"",
",",
"cwd",
".",
"name",
")",
";",
"free_cwd",
"(",
"&",
"cwd",
")",
";",
"}",
"if",
"(",
"!",
"the_val_args",
".",
"found",
")",
"error",
"(",
"1",
",",
"0",
",",
"\"",
"\"",
",",
"name",
")",
";",
"}",
"add_to_val_tags",
"(",
"name",
")",
";",
"}"
] | With VALID set, insert NAME into val-tags if it is not already present
there. | [
"With",
"VALID",
"set",
"insert",
"NAME",
"into",
"val",
"-",
"tags",
"if",
"it",
"is",
"not",
"already",
"present",
"there",
"."
] | [
"/* Numeric tags require only a syntactic check. */",
"/* insert is not possible for numeric revisions */",
"/* Special tags are always valid. */",
"/* insert is not possible for numeric revisions */",
"/* Verify that the tag is valid syntactically. Some later code once made\n * assumptions about this.\n */",
"/* We didn't find the tag in val-tags, so look through all the RCS files\n\t * to see whether it exists there. Yes, this is expensive, but there\n\t * is no other way to cope with a tag which might have been created\n\t * by an old version of CVS, from before val-tags was invented\n\t */",
"/* The tags is valid but not mentioned in val-tags. Add it. */"
] | [
{
"param": "name",
"type": "char"
},
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
},
{
"param": "local",
"type": "int"
},
{
"param": "aflag",
"type": "int"
},
{
"param": "repository",
"type": "char"
},
{
"param": "valid",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "local",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aflag",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "repository",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "valid",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ae25b74c6bc238ab9a708c9e56e175a4a302957 | atrens/DragonFlyBSD-src | sys/dev/netif/oce/oce_if.c | [
"BSD-3-Clause"
] | C | oce_if_deactivate | void | static void
oce_if_deactivate(POCE_SOFTC sc)
{
int i, mtime = 0;
int wait_req = 0;
struct oce_rq *rq;
struct oce_wq *wq;
struct oce_eq *eq;
sc->ifp->if_flags &= ~IFF_RUNNING;
ifq_clr_oactive(&sc->ifp->if_snd);
/*Wait for max of 400ms for TX completions to be done */
while (mtime < 400) {
wait_req = 0;
for_all_wq_queues(sc, wq, i) {
if (wq->ring->num_used) {
wait_req = 1;
DELAY(1);
break;
}
}
mtime += 1;
if (!wait_req)
break;
}
/* Stop intrs and finish any bottom halves pending */
oce_hw_intr_disable(sc);
/* Since taskqueue_drain takes a Gaint Lock, We should not acquire
any other lock. So unlock device lock and require after
completing taskqueue_drain.
*/
UNLOCK(&sc->dev_lock);
for (i = 0; i < sc->intr_count; i++) {
if (sc->intrs[i].tq != NULL) {
taskqueue_drain(sc->intrs[i].tq, &sc->intrs[i].task);
}
}
LOCK(&sc->dev_lock);
/* Delete RX queue in card with flush param */
oce_stop_rx(sc);
/* Invalidate any pending cq and eq entries*/
for_all_evnt_queues(sc, eq, i)
oce_drain_eq(eq);
for_all_rq_queues(sc, rq, i)
oce_drain_rq_cq(rq);
for_all_wq_queues(sc, wq, i)
oce_drain_wq_cq(wq);
/* But still we need to get MCC aync events.
So enable intrs and also arm first EQ
*/
oce_hw_intr_enable(sc);
oce_arm_eq(sc, sc->eq[0]->eq_id, 0, TRUE, FALSE);
DELAY(10);
} | /* NOTE : This should only be called holding
* DEVICE_LOCK.
*/ | NOTE : This should only be called holding
DEVICE_LOCK. | [
"NOTE",
":",
"This",
"should",
"only",
"be",
"called",
"holding",
"DEVICE_LOCK",
"."
] | static void
oce_if_deactivate(POCE_SOFTC sc)
{
int i, mtime = 0;
int wait_req = 0;
struct oce_rq *rq;
struct oce_wq *wq;
struct oce_eq *eq;
sc->ifp->if_flags &= ~IFF_RUNNING;
ifq_clr_oactive(&sc->ifp->if_snd);
while (mtime < 400) {
wait_req = 0;
for_all_wq_queues(sc, wq, i) {
if (wq->ring->num_used) {
wait_req = 1;
DELAY(1);
break;
}
}
mtime += 1;
if (!wait_req)
break;
}
oce_hw_intr_disable(sc);
UNLOCK(&sc->dev_lock);
for (i = 0; i < sc->intr_count; i++) {
if (sc->intrs[i].tq != NULL) {
taskqueue_drain(sc->intrs[i].tq, &sc->intrs[i].task);
}
}
LOCK(&sc->dev_lock);
oce_stop_rx(sc);
for_all_evnt_queues(sc, eq, i)
oce_drain_eq(eq);
for_all_rq_queues(sc, rq, i)
oce_drain_rq_cq(rq);
for_all_wq_queues(sc, wq, i)
oce_drain_wq_cq(wq);
oce_hw_intr_enable(sc);
oce_arm_eq(sc, sc->eq[0]->eq_id, 0, TRUE, FALSE);
DELAY(10);
} | [
"static",
"void",
"oce_if_deactivate",
"(",
"POCE_SOFTC",
"sc",
")",
"{",
"int",
"i",
",",
"mtime",
"=",
"0",
";",
"int",
"wait_req",
"=",
"0",
";",
"struct",
"oce_rq",
"*",
"rq",
";",
"struct",
"oce_wq",
"*",
"wq",
";",
"struct",
"oce_eq",
"*",
"eq",
";",
"sc",
"->",
"ifp",
"->",
"if_flags",
"&=",
"~",
"IFF_RUNNING",
";",
"ifq_clr_oactive",
"(",
"&",
"sc",
"->",
"ifp",
"->",
"if_snd",
")",
";",
"while",
"(",
"mtime",
"<",
"400",
")",
"{",
"wait_req",
"=",
"0",
";",
"for_all_wq_queues",
"(",
"sc",
",",
"wq",
",",
"i",
")",
"",
"{",
"if",
"(",
"wq",
"->",
"ring",
"->",
"num_used",
")",
"{",
"wait_req",
"=",
"1",
";",
"DELAY",
"(",
"1",
")",
";",
"break",
";",
"}",
"}",
"mtime",
"+=",
"1",
";",
"if",
"(",
"!",
"wait_req",
")",
"break",
";",
"}",
"oce_hw_intr_disable",
"(",
"sc",
")",
";",
"UNLOCK",
"(",
"&",
"sc",
"->",
"dev_lock",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"sc",
"->",
"intr_count",
";",
"i",
"++",
")",
"{",
"if",
"(",
"sc",
"->",
"intrs",
"[",
"i",
"]",
".",
"tq",
"!=",
"NULL",
")",
"{",
"taskqueue_drain",
"(",
"sc",
"->",
"intrs",
"[",
"i",
"]",
".",
"tq",
",",
"&",
"sc",
"->",
"intrs",
"[",
"i",
"]",
".",
"task",
")",
";",
"}",
"}",
"LOCK",
"(",
"&",
"sc",
"->",
"dev_lock",
")",
";",
"oce_stop_rx",
"(",
"sc",
")",
";",
"for_all_evnt_queues",
"(",
"sc",
",",
"eq",
",",
"i",
")",
"",
"oce_drain_eq",
"(",
"eq",
")",
";",
"for_all_rq_queues",
"(",
"sc",
",",
"rq",
",",
"i",
")",
"",
"oce_drain_rq_cq",
"(",
"rq",
")",
";",
"for_all_wq_queues",
"(",
"sc",
",",
"wq",
",",
"i",
")",
"",
"oce_drain_wq_cq",
"(",
"wq",
")",
";",
"oce_hw_intr_enable",
"(",
"sc",
")",
";",
"oce_arm_eq",
"(",
"sc",
",",
"sc",
"->",
"eq",
"[",
"0",
"]",
"->",
"eq_id",
",",
"0",
",",
"TRUE",
",",
"FALSE",
")",
";",
"DELAY",
"(",
"10",
")",
";",
"}"
] | NOTE : This should only be called holding
DEVICE_LOCK. | [
"NOTE",
":",
"This",
"should",
"only",
"be",
"called",
"holding",
"DEVICE_LOCK",
"."
] | [
"/*Wait for max of 400ms for TX completions to be done */",
"/* Stop intrs and finish any bottom halves pending */",
"/* Since taskqueue_drain takes a Gaint Lock, We should not acquire\n\t any other lock. So unlock device lock and require after\n\t completing taskqueue_drain.\n\t*/",
"/* Delete RX queue in card with flush param */",
"/* Invalidate any pending cq and eq entries*/",
"/* But still we need to get MCC aync events.\n\t So enable intrs and also arm first EQ\n\t*/"
] | [
{
"param": "sc",
"type": "POCE_SOFTC"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sc",
"type": "POCE_SOFTC",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
24ff89ea61d26ca9ff6a4aa44bc1eae835c17591 | atrens/DragonFlyBSD-src | sys/boot/common/module.c | [
"BSD-3-Clause"
] | C | mod_loadkld | int | int
mod_loadkld(const char *kldname, int argc, char *argv[])
{
struct preloaded_file *fp, *last_file;
int err;
char *filename;
/*
* Get fully qualified KLD name
*/
filename = file_search(kldname, kld_ext_list);
if (filename == NULL) {
snprintf(command_errbuf, sizeof(command_errbuf),
"can't find '%s'", kldname);
return (ENOENT);
}
/*
* Check if KLD already loaded
*/
fp = file_findfile(filename, NULL);
if (fp) {
snprintf(command_errbuf, sizeof(command_errbuf),
"warning: KLD '%s' already loaded", filename);
free(filename);
return (0);
}
for (last_file = preloaded_files;
last_file != NULL && last_file->f_next != NULL;
last_file = last_file->f_next)
;
do {
err = file_load(filename, loadaddr, &fp);
if (err)
break;
fp->f_args = unargv(argc, argv);
loadaddr = fp->f_addr + fp->f_size;
file_insert_tail(fp); /* Add to the list of loaded files */
if (file_load_dependencies(fp) != 0) {
err = ENOENT;
last_file->f_next = NULL;
loadaddr = last_file->f_addr + last_file->f_size;
fp = NULL;
break;
}
} while(0);
if (err == EFTYPE)
snprintf(command_errbuf, sizeof(command_errbuf),
"don't know how to load module '%s'", filename);
if (err && fp)
file_discard(fp);
free(filename);
return (err);
} | /*
* Load specified KLD. If path is omitted, then try to locate it via
* search path.
*/ | Load specified KLD. If path is omitted, then try to locate it via
search path. | [
"Load",
"specified",
"KLD",
".",
"If",
"path",
"is",
"omitted",
"then",
"try",
"to",
"locate",
"it",
"via",
"search",
"path",
"."
] | int
mod_loadkld(const char *kldname, int argc, char *argv[])
{
struct preloaded_file *fp, *last_file;
int err;
char *filename;
filename = file_search(kldname, kld_ext_list);
if (filename == NULL) {
snprintf(command_errbuf, sizeof(command_errbuf),
"can't find '%s'", kldname);
return (ENOENT);
}
fp = file_findfile(filename, NULL);
if (fp) {
snprintf(command_errbuf, sizeof(command_errbuf),
"warning: KLD '%s' already loaded", filename);
free(filename);
return (0);
}
for (last_file = preloaded_files;
last_file != NULL && last_file->f_next != NULL;
last_file = last_file->f_next)
;
do {
err = file_load(filename, loadaddr, &fp);
if (err)
break;
fp->f_args = unargv(argc, argv);
loadaddr = fp->f_addr + fp->f_size;
file_insert_tail(fp);
if (file_load_dependencies(fp) != 0) {
err = ENOENT;
last_file->f_next = NULL;
loadaddr = last_file->f_addr + last_file->f_size;
fp = NULL;
break;
}
} while(0);
if (err == EFTYPE)
snprintf(command_errbuf, sizeof(command_errbuf),
"don't know how to load module '%s'", filename);
if (err && fp)
file_discard(fp);
free(filename);
return (err);
} | [
"int",
"mod_loadkld",
"(",
"const",
"char",
"*",
"kldname",
",",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"struct",
"preloaded_file",
"*",
"fp",
",",
"*",
"last_file",
";",
"int",
"err",
";",
"char",
"*",
"filename",
";",
"filename",
"=",
"file_search",
"(",
"kldname",
",",
"kld_ext_list",
")",
";",
"if",
"(",
"filename",
"==",
"NULL",
")",
"{",
"snprintf",
"(",
"command_errbuf",
",",
"sizeof",
"(",
"command_errbuf",
")",
",",
"\"",
"\"",
",",
"kldname",
")",
";",
"return",
"(",
"ENOENT",
")",
";",
"}",
"fp",
"=",
"file_findfile",
"(",
"filename",
",",
"NULL",
")",
";",
"if",
"(",
"fp",
")",
"{",
"snprintf",
"(",
"command_errbuf",
",",
"sizeof",
"(",
"command_errbuf",
")",
",",
"\"",
"\"",
",",
"filename",
")",
";",
"free",
"(",
"filename",
")",
";",
"return",
"(",
"0",
")",
";",
"}",
"for",
"(",
"last_file",
"=",
"preloaded_files",
";",
"last_file",
"!=",
"NULL",
"&&",
"last_file",
"->",
"f_next",
"!=",
"NULL",
";",
"last_file",
"=",
"last_file",
"->",
"f_next",
")",
";",
"do",
"{",
"err",
"=",
"file_load",
"(",
"filename",
",",
"loadaddr",
",",
"&",
"fp",
")",
";",
"if",
"(",
"err",
")",
"break",
";",
"fp",
"->",
"f_args",
"=",
"unargv",
"(",
"argc",
",",
"argv",
")",
";",
"loadaddr",
"=",
"fp",
"->",
"f_addr",
"+",
"fp",
"->",
"f_size",
";",
"file_insert_tail",
"(",
"fp",
")",
";",
"if",
"(",
"file_load_dependencies",
"(",
"fp",
")",
"!=",
"0",
")",
"{",
"err",
"=",
"ENOENT",
";",
"last_file",
"->",
"f_next",
"=",
"NULL",
";",
"loadaddr",
"=",
"last_file",
"->",
"f_addr",
"+",
"last_file",
"->",
"f_size",
";",
"fp",
"=",
"NULL",
";",
"break",
";",
"}",
"}",
"while",
"(",
"0",
")",
";",
"if",
"(",
"err",
"==",
"EFTYPE",
")",
"snprintf",
"(",
"command_errbuf",
",",
"sizeof",
"(",
"command_errbuf",
")",
",",
"\"",
"\"",
",",
"filename",
")",
";",
"if",
"(",
"err",
"&&",
"fp",
")",
"file_discard",
"(",
"fp",
")",
";",
"free",
"(",
"filename",
")",
";",
"return",
"(",
"err",
")",
";",
"}"
] | Load specified KLD. | [
"Load",
"specified",
"KLD",
"."
] | [
"/*\n * Get fully qualified KLD name\n */",
"/*\n * Check if KLD already loaded\n */",
"/* Add to the list of loaded files */"
] | [
{
"param": "kldname",
"type": "char"
},
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "kldname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
24ff89ea61d26ca9ff6a4aa44bc1eae835c17591 | atrens/DragonFlyBSD-src | sys/boot/common/module.c | [
"BSD-3-Clause"
] | C | file_findmodule | null | struct kernel_module *
file_findmodule(struct preloaded_file *fp, char *modname,
struct mod_depend *verinfo)
{
struct kernel_module *mp, *best;
int bestver, mver;
if (fp == NULL) {
for (fp = preloaded_files; fp; fp = fp->f_next) {
mp = file_findmodule(fp, modname, verinfo);
if (mp)
return (mp);
}
return (NULL);
}
best = NULL;
bestver = 0;
for (mp = fp->f_modules; mp; mp = mp->m_next) {
if (strcmp(modname, mp->m_name) == 0) {
if (verinfo == NULL)
return (mp);
mver = mp->m_version;
if (mver == verinfo->md_ver_preferred)
return (mp);
if (mver >= verinfo->md_ver_minimum &&
mver <= verinfo->md_ver_maximum &&
mver > bestver) {
best = mp;
bestver = mver;
}
}
}
return (best);
} | /*
* Find a module matching (name) inside of given file.
* NULL may be passed as a wildcard.
*/ | Find a module matching (name) inside of given file.
NULL may be passed as a wildcard. | [
"Find",
"a",
"module",
"matching",
"(",
"name",
")",
"inside",
"of",
"given",
"file",
".",
"NULL",
"may",
"be",
"passed",
"as",
"a",
"wildcard",
"."
] | struct kernel_module *
file_findmodule(struct preloaded_file *fp, char *modname,
struct mod_depend *verinfo)
{
struct kernel_module *mp, *best;
int bestver, mver;
if (fp == NULL) {
for (fp = preloaded_files; fp; fp = fp->f_next) {
mp = file_findmodule(fp, modname, verinfo);
if (mp)
return (mp);
}
return (NULL);
}
best = NULL;
bestver = 0;
for (mp = fp->f_modules; mp; mp = mp->m_next) {
if (strcmp(modname, mp->m_name) == 0) {
if (verinfo == NULL)
return (mp);
mver = mp->m_version;
if (mver == verinfo->md_ver_preferred)
return (mp);
if (mver >= verinfo->md_ver_minimum &&
mver <= verinfo->md_ver_maximum &&
mver > bestver) {
best = mp;
bestver = mver;
}
}
}
return (best);
} | [
"struct",
"kernel_module",
"*",
"file_findmodule",
"(",
"struct",
"preloaded_file",
"*",
"fp",
",",
"char",
"*",
"modname",
",",
"struct",
"mod_depend",
"*",
"verinfo",
")",
"{",
"struct",
"kernel_module",
"*",
"mp",
",",
"*",
"best",
";",
"int",
"bestver",
",",
"mver",
";",
"if",
"(",
"fp",
"==",
"NULL",
")",
"{",
"for",
"(",
"fp",
"=",
"preloaded_files",
";",
"fp",
";",
"fp",
"=",
"fp",
"->",
"f_next",
")",
"{",
"mp",
"=",
"file_findmodule",
"(",
"fp",
",",
"modname",
",",
"verinfo",
")",
";",
"if",
"(",
"mp",
")",
"return",
"(",
"mp",
")",
";",
"}",
"return",
"(",
"NULL",
")",
";",
"}",
"best",
"=",
"NULL",
";",
"bestver",
"=",
"0",
";",
"for",
"(",
"mp",
"=",
"fp",
"->",
"f_modules",
";",
"mp",
";",
"mp",
"=",
"mp",
"->",
"m_next",
")",
"{",
"if",
"(",
"strcmp",
"(",
"modname",
",",
"mp",
"->",
"m_name",
")",
"==",
"0",
")",
"{",
"if",
"(",
"verinfo",
"==",
"NULL",
")",
"return",
"(",
"mp",
")",
";",
"mver",
"=",
"mp",
"->",
"m_version",
";",
"if",
"(",
"mver",
"==",
"verinfo",
"->",
"md_ver_preferred",
")",
"return",
"(",
"mp",
")",
";",
"if",
"(",
"mver",
">=",
"verinfo",
"->",
"md_ver_minimum",
"&&",
"mver",
"<=",
"verinfo",
"->",
"md_ver_maximum",
"&&",
"mver",
">",
"bestver",
")",
"{",
"best",
"=",
"mp",
";",
"bestver",
"=",
"mver",
";",
"}",
"}",
"}",
"return",
"(",
"best",
")",
";",
"}"
] | Find a module matching (name) inside of given file. | [
"Find",
"a",
"module",
"matching",
"(",
"name",
")",
"inside",
"of",
"given",
"file",
"."
] | [] | [
{
"param": "fp",
"type": "struct preloaded_file"
},
{
"param": "modname",
"type": "char"
},
{
"param": "verinfo",
"type": "struct mod_depend"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fp",
"type": "struct preloaded_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "modname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "verinfo",
"type": "struct mod_depend",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
24ff89ea61d26ca9ff6a4aa44bc1eae835c17591 | atrens/DragonFlyBSD-src | sys/boot/common/module.c | [
"BSD-3-Clause"
] | C | file_findmetadata | null | struct file_metadata *
file_findmetadata(struct preloaded_file *fp, int type)
{
struct file_metadata *md;
for (md = fp->f_metadata; md != NULL; md = md->md_next)
if (md->md_type == type)
break;
return(md);
} | /*
* Find a metadata object of (type) associated with the file (fp)
*/ | Find a metadata object of (type) associated with the file (fp) | [
"Find",
"a",
"metadata",
"object",
"of",
"(",
"type",
")",
"associated",
"with",
"the",
"file",
"(",
"fp",
")"
] | struct file_metadata *
file_findmetadata(struct preloaded_file *fp, int type)
{
struct file_metadata *md;
for (md = fp->f_metadata; md != NULL; md = md->md_next)
if (md->md_type == type)
break;
return(md);
} | [
"struct",
"file_metadata",
"*",
"file_findmetadata",
"(",
"struct",
"preloaded_file",
"*",
"fp",
",",
"int",
"type",
")",
"{",
"struct",
"file_metadata",
"*",
"md",
";",
"for",
"(",
"md",
"=",
"fp",
"->",
"f_metadata",
";",
"md",
"!=",
"NULL",
";",
"md",
"=",
"md",
"->",
"md_next",
")",
"if",
"(",
"md",
"->",
"md_type",
"==",
"type",
")",
"break",
";",
"return",
"(",
"md",
")",
";",
"}"
] | Find a metadata object of (type) associated with the file (fp) | [
"Find",
"a",
"metadata",
"object",
"of",
"(",
"type",
")",
"associated",
"with",
"the",
"file",
"(",
"fp",
")"
] | [] | [
{
"param": "fp",
"type": "struct preloaded_file"
},
{
"param": "type",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fp",
"type": "struct preloaded_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
24ff89ea61d26ca9ff6a4aa44bc1eae835c17591 | atrens/DragonFlyBSD-src | sys/boot/common/module.c | [
"BSD-3-Clause"
] | C | file_lookup | char | static char *
file_lookup(const char *path, const char *name, int namelen, char **extlist)
{
struct stat st;
char *result, *cp, **cpp;
size_t pathlen, extlen;
pathlen = strlen(path);
extlen = 0;
if (extlist == NULL)
extlist = emptyextlist;
for (cpp = extlist; *cpp; cpp++)
extlen = MAX(extlen, strlen(*cpp));
result = malloc(pathlen + namelen + extlen + 2 + 7 + 1);
if (result == NULL)
return (NULL);
bcopy(path, result, pathlen);
if (pathlen > 0 && result[pathlen - 1] != '/')
result[pathlen++] = '/';
cp = result + pathlen;
bcopy(name, cp, namelen);
cp += namelen;
for (cpp = extlist; *cpp; cpp++) {
strcpy(cp, *cpp);
if (rel_stat(result, &st) == 0) {
if (S_ISREG(st.st_mode)) {
return result;
} else if (S_ISDIR(st.st_mode)) {
strcat(result, "/kernel");
if (rel_stat(result, &st) == 0 && S_ISREG(st.st_mode)) {
return result;
}
}
}
}
free(result);
return NULL;
} | /*
* Check if the given file is in place and return full path to it.
*/ | Check if the given file is in place and return full path to it. | [
"Check",
"if",
"the",
"given",
"file",
"is",
"in",
"place",
"and",
"return",
"full",
"path",
"to",
"it",
"."
] | static char *
file_lookup(const char *path, const char *name, int namelen, char **extlist)
{
struct stat st;
char *result, *cp, **cpp;
size_t pathlen, extlen;
pathlen = strlen(path);
extlen = 0;
if (extlist == NULL)
extlist = emptyextlist;
for (cpp = extlist; *cpp; cpp++)
extlen = MAX(extlen, strlen(*cpp));
result = malloc(pathlen + namelen + extlen + 2 + 7 + 1);
if (result == NULL)
return (NULL);
bcopy(path, result, pathlen);
if (pathlen > 0 && result[pathlen - 1] != '/')
result[pathlen++] = '/';
cp = result + pathlen;
bcopy(name, cp, namelen);
cp += namelen;
for (cpp = extlist; *cpp; cpp++) {
strcpy(cp, *cpp);
if (rel_stat(result, &st) == 0) {
if (S_ISREG(st.st_mode)) {
return result;
} else if (S_ISDIR(st.st_mode)) {
strcat(result, "/kernel");
if (rel_stat(result, &st) == 0 && S_ISREG(st.st_mode)) {
return result;
}
}
}
}
free(result);
return NULL;
} | [
"static",
"char",
"*",
"file_lookup",
"(",
"const",
"char",
"*",
"path",
",",
"const",
"char",
"*",
"name",
",",
"int",
"namelen",
",",
"char",
"*",
"*",
"extlist",
")",
"{",
"struct",
"stat",
"st",
";",
"char",
"*",
"result",
",",
"*",
"cp",
",",
"*",
"*",
"cpp",
";",
"size_t",
"pathlen",
",",
"extlen",
";",
"pathlen",
"=",
"strlen",
"(",
"path",
")",
";",
"extlen",
"=",
"0",
";",
"if",
"(",
"extlist",
"==",
"NULL",
")",
"extlist",
"=",
"emptyextlist",
";",
"for",
"(",
"cpp",
"=",
"extlist",
";",
"*",
"cpp",
";",
"cpp",
"++",
")",
"extlen",
"=",
"MAX",
"(",
"extlen",
",",
"strlen",
"(",
"*",
"cpp",
")",
")",
";",
"result",
"=",
"malloc",
"(",
"pathlen",
"+",
"namelen",
"+",
"extlen",
"+",
"2",
"+",
"7",
"+",
"1",
")",
";",
"if",
"(",
"result",
"==",
"NULL",
")",
"return",
"(",
"NULL",
")",
";",
"bcopy",
"(",
"path",
",",
"result",
",",
"pathlen",
")",
";",
"if",
"(",
"pathlen",
">",
"0",
"&&",
"result",
"[",
"pathlen",
"-",
"1",
"]",
"!=",
"'",
"'",
")",
"result",
"[",
"pathlen",
"++",
"]",
"=",
"'",
"'",
";",
"cp",
"=",
"result",
"+",
"pathlen",
";",
"bcopy",
"(",
"name",
",",
"cp",
",",
"namelen",
")",
";",
"cp",
"+=",
"namelen",
";",
"for",
"(",
"cpp",
"=",
"extlist",
";",
"*",
"cpp",
";",
"cpp",
"++",
")",
"{",
"strcpy",
"(",
"cp",
",",
"*",
"cpp",
")",
";",
"if",
"(",
"rel_stat",
"(",
"result",
",",
"&",
"st",
")",
"==",
"0",
")",
"{",
"if",
"(",
"S_ISREG",
"(",
"st",
".",
"st_mode",
")",
")",
"{",
"return",
"result",
";",
"}",
"else",
"if",
"(",
"S_ISDIR",
"(",
"st",
".",
"st_mode",
")",
")",
"{",
"strcat",
"(",
"result",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"rel_stat",
"(",
"result",
",",
"&",
"st",
")",
"==",
"0",
"&&",
"S_ISREG",
"(",
"st",
".",
"st_mode",
")",
")",
"{",
"return",
"result",
";",
"}",
"}",
"}",
"}",
"free",
"(",
"result",
")",
";",
"return",
"NULL",
";",
"}"
] | Check if the given file is in place and return full path to it. | [
"Check",
"if",
"the",
"given",
"file",
"is",
"in",
"place",
"and",
"return",
"full",
"path",
"to",
"it",
"."
] | [] | [
{
"param": "path",
"type": "char"
},
{
"param": "name",
"type": "char"
},
{
"param": "namelen",
"type": "int"
},
{
"param": "extlist",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "path",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "namelen",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "extlist",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
24ff89ea61d26ca9ff6a4aa44bc1eae835c17591 | atrens/DragonFlyBSD-src | sys/boot/common/module.c | [
"BSD-3-Clause"
] | C | file_havepath | int | static int
file_havepath(const char *name)
{
const char *cp;
archsw.arch_getdev(NULL, name, &cp);
return (cp != name || strchr(name, '/') != NULL);
} | /*
* Check if file name have any qualifiers
*/ | Check if file name have any qualifiers | [
"Check",
"if",
"file",
"name",
"have",
"any",
"qualifiers"
] | static int
file_havepath(const char *name)
{
const char *cp;
archsw.arch_getdev(NULL, name, &cp);
return (cp != name || strchr(name, '/') != NULL);
} | [
"static",
"int",
"file_havepath",
"(",
"const",
"char",
"*",
"name",
")",
"{",
"const",
"char",
"*",
"cp",
";",
"archsw",
".",
"arch_getdev",
"(",
"NULL",
",",
"name",
",",
"&",
"cp",
")",
";",
"return",
"(",
"cp",
"!=",
"name",
"||",
"strchr",
"(",
"name",
",",
"'",
"'",
")",
"!=",
"NULL",
")",
";",
"}"
] | Check if file name have any qualifiers | [
"Check",
"if",
"file",
"name",
"have",
"any",
"qualifiers"
] | [] | [
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
24ff89ea61d26ca9ff6a4aa44bc1eae835c17591 | atrens/DragonFlyBSD-src | sys/boot/common/module.c | [
"BSD-3-Clause"
] | C | file_search | char | static char *
file_search(const char *name, char **extlist)
{
struct moduledir *mdp;
struct stat sb;
char *result;
int namelen;
/* Don't look for nothing */
if (name == NULL)
return(NULL);
if (*name == 0)
return(strdup(name));
/*
* Qualified name. If it is a directory tag on
* a "/kernel" to it.
*/
if (file_havepath(name)) {
/* Qualified, so just see if it exists */
if (rel_stat(name, &sb) == 0) {
if (S_ISDIR(sb.st_mode)) {
result = malloc(strlen(name) + 7 + 1);
sprintf(result, "%s/kernel", name);
return(result);
} else {
return(strdup(name));
}
}
return(NULL);
}
moduledir_rebuild();
result = NULL;
namelen = strlen(name);
STAILQ_FOREACH(mdp, &moduledir_list, d_link) {
result = file_lookup(mdp->d_path, name, namelen, extlist);
if (result)
break;
}
return(result);
} | /*
* Attempt to find the file (name) on the module searchpath.
* If (name) is qualified in any way, we simply check it and
* return it or NULL. If it is not qualified, then we attempt
* to construct a path using entries in the environment variable
* module_path.
*
* The path we return a pointer to need never be freed, as we manage
* it internally.
*/ | Attempt to find the file (name) on the module searchpath.
If (name) is qualified in any way, we simply check it and
return it or NULL. If it is not qualified, then we attempt
to construct a path using entries in the environment variable
module_path.
The path we return a pointer to need never be freed, as we manage
it internally. | [
"Attempt",
"to",
"find",
"the",
"file",
"(",
"name",
")",
"on",
"the",
"module",
"searchpath",
".",
"If",
"(",
"name",
")",
"is",
"qualified",
"in",
"any",
"way",
"we",
"simply",
"check",
"it",
"and",
"return",
"it",
"or",
"NULL",
".",
"If",
"it",
"is",
"not",
"qualified",
"then",
"we",
"attempt",
"to",
"construct",
"a",
"path",
"using",
"entries",
"in",
"the",
"environment",
"variable",
"module_path",
".",
"The",
"path",
"we",
"return",
"a",
"pointer",
"to",
"need",
"never",
"be",
"freed",
"as",
"we",
"manage",
"it",
"internally",
"."
] | static char *
file_search(const char *name, char **extlist)
{
struct moduledir *mdp;
struct stat sb;
char *result;
int namelen;
if (name == NULL)
return(NULL);
if (*name == 0)
return(strdup(name));
if (file_havepath(name)) {
if (rel_stat(name, &sb) == 0) {
if (S_ISDIR(sb.st_mode)) {
result = malloc(strlen(name) + 7 + 1);
sprintf(result, "%s/kernel", name);
return(result);
} else {
return(strdup(name));
}
}
return(NULL);
}
moduledir_rebuild();
result = NULL;
namelen = strlen(name);
STAILQ_FOREACH(mdp, &moduledir_list, d_link) {
result = file_lookup(mdp->d_path, name, namelen, extlist);
if (result)
break;
}
return(result);
} | [
"static",
"char",
"*",
"file_search",
"(",
"const",
"char",
"*",
"name",
",",
"char",
"*",
"*",
"extlist",
")",
"{",
"struct",
"moduledir",
"*",
"mdp",
";",
"struct",
"stat",
"sb",
";",
"char",
"*",
"result",
";",
"int",
"namelen",
";",
"if",
"(",
"name",
"==",
"NULL",
")",
"return",
"(",
"NULL",
")",
";",
"if",
"(",
"*",
"name",
"==",
"0",
")",
"return",
"(",
"strdup",
"(",
"name",
")",
")",
";",
"if",
"(",
"file_havepath",
"(",
"name",
")",
")",
"{",
"if",
"(",
"rel_stat",
"(",
"name",
",",
"&",
"sb",
")",
"==",
"0",
")",
"{",
"if",
"(",
"S_ISDIR",
"(",
"sb",
".",
"st_mode",
")",
")",
"{",
"result",
"=",
"malloc",
"(",
"strlen",
"(",
"name",
")",
"+",
"7",
"+",
"1",
")",
";",
"sprintf",
"(",
"result",
",",
"\"",
"\"",
",",
"name",
")",
";",
"return",
"(",
"result",
")",
";",
"}",
"else",
"{",
"return",
"(",
"strdup",
"(",
"name",
")",
")",
";",
"}",
"}",
"return",
"(",
"NULL",
")",
";",
"}",
"moduledir_rebuild",
"(",
")",
";",
"result",
"=",
"NULL",
";",
"namelen",
"=",
"strlen",
"(",
"name",
")",
";",
"STAILQ_FOREACH",
"(",
"mdp",
",",
"&",
"moduledir_list",
",",
"d_link",
")",
"",
"{",
"result",
"=",
"file_lookup",
"(",
"mdp",
"->",
"d_path",
",",
"name",
",",
"namelen",
",",
"extlist",
")",
";",
"if",
"(",
"result",
")",
"break",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] | Attempt to find the file (name) on the module searchpath. | [
"Attempt",
"to",
"find",
"the",
"file",
"(",
"name",
")",
"on",
"the",
"module",
"searchpath",
"."
] | [
"/* Don't look for nothing */",
"/*\n * Qualified name. If it is a directory tag on\n * a \"/kernel\" to it.\n */",
"/* Qualified, so just see if it exists */"
] | [
{
"param": "name",
"type": "char"
},
{
"param": "extlist",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "extlist",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
24ff89ea61d26ca9ff6a4aa44bc1eae835c17591 | atrens/DragonFlyBSD-src | sys/boot/common/module.c | [
"BSD-3-Clause"
] | C | mod_searchmodule | char | static char *
mod_searchmodule(char *name, struct mod_depend *verinfo)
{
struct moduledir *mdp;
char *result;
moduledir_rebuild();
/*
* Now we ready to lookup module in the given directories
*/
result = NULL;
STAILQ_FOREACH(mdp, &moduledir_list, d_link) {
result = mod_search_hints(mdp, name, verinfo);
if (result)
break;
}
return(result);
} | /*
* Attempt to locate the file containing the module (name)
*/ | Attempt to locate the file containing the module (name) | [
"Attempt",
"to",
"locate",
"the",
"file",
"containing",
"the",
"module",
"(",
"name",
")"
] | static char *
mod_searchmodule(char *name, struct mod_depend *verinfo)
{
struct moduledir *mdp;
char *result;
moduledir_rebuild();
result = NULL;
STAILQ_FOREACH(mdp, &moduledir_list, d_link) {
result = mod_search_hints(mdp, name, verinfo);
if (result)
break;
}
return(result);
} | [
"static",
"char",
"*",
"mod_searchmodule",
"(",
"char",
"*",
"name",
",",
"struct",
"mod_depend",
"*",
"verinfo",
")",
"{",
"struct",
"moduledir",
"*",
"mdp",
";",
"char",
"*",
"result",
";",
"moduledir_rebuild",
"(",
")",
";",
"result",
"=",
"NULL",
";",
"STAILQ_FOREACH",
"(",
"mdp",
",",
"&",
"moduledir_list",
",",
"d_link",
")",
"",
"{",
"result",
"=",
"mod_search_hints",
"(",
"mdp",
",",
"name",
",",
"verinfo",
")",
";",
"if",
"(",
"result",
")",
"break",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] | Attempt to locate the file containing the module (name) | [
"Attempt",
"to",
"locate",
"the",
"file",
"containing",
"the",
"module",
"(",
"name",
")"
] | [
"/*\n * Now we ready to lookup module in the given directories\n */"
] | [
{
"param": "name",
"type": "char"
},
{
"param": "verinfo",
"type": "struct mod_depend"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "verinfo",
"type": "struct mod_depend",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
24ff89ea61d26ca9ff6a4aa44bc1eae835c17591 | atrens/DragonFlyBSD-src | sys/boot/common/module.c | [
"BSD-3-Clause"
] | C | file_alloc | null | struct preloaded_file *
file_alloc(void)
{
struct preloaded_file *fp;
if ((fp = malloc(sizeof(struct preloaded_file))) != NULL) {
bzero(fp, sizeof(struct preloaded_file));
}
return (fp);
} | /*
* Allocate a new file; must be used instead of malloc()
* to ensure safe initialisation.
*/ | Allocate a new file; must be used instead of malloc()
to ensure safe initialisation. | [
"Allocate",
"a",
"new",
"file",
";",
"must",
"be",
"used",
"instead",
"of",
"malloc",
"()",
"to",
"ensure",
"safe",
"initialisation",
"."
] | struct preloaded_file *
file_alloc(void)
{
struct preloaded_file *fp;
if ((fp = malloc(sizeof(struct preloaded_file))) != NULL) {
bzero(fp, sizeof(struct preloaded_file));
}
return (fp);
} | [
"struct",
"preloaded_file",
"*",
"file_alloc",
"(",
"void",
")",
"{",
"struct",
"preloaded_file",
"*",
"fp",
";",
"if",
"(",
"(",
"fp",
"=",
"malloc",
"(",
"sizeof",
"(",
"struct",
"preloaded_file",
")",
")",
")",
"!=",
"NULL",
")",
"{",
"bzero",
"(",
"fp",
",",
"sizeof",
"(",
"struct",
"preloaded_file",
")",
")",
";",
"}",
"return",
"(",
"fp",
")",
";",
"}"
] | Allocate a new file; must be used instead of malloc()
to ensure safe initialisation. | [
"Allocate",
"a",
"new",
"file",
";",
"must",
"be",
"used",
"instead",
"of",
"malloc",
"()",
"to",
"ensure",
"safe",
"initialisation",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
24ff89ea61d26ca9ff6a4aa44bc1eae835c17591 | atrens/DragonFlyBSD-src | sys/boot/common/module.c | [
"BSD-3-Clause"
] | C | moduledir_readhints | void | static void
moduledir_readhints(struct moduledir *mdp)
{
struct stat st;
char *path;
int fd, size, version;
if (mdp->d_hints != NULL || (mdp->d_flags & MDIR_NOHINTS))
return;
path = moduledir_fullpath(mdp, "linker.hints");
if (rel_stat(path, &st) != 0 ||
st.st_size < (ssize_t)(sizeof(version) + sizeof(int)) ||
st.st_size > 100 * 1024 || (fd = rel_open(path, NULL, O_RDONLY)) < 0) {
free(path);
mdp->d_flags |= MDIR_NOHINTS;
return;
}
free(path);
size = read(fd, &version, sizeof(version));
if (size != sizeof(version) || version != LINKER_HINTS_VERSION)
goto bad;
size = st.st_size - size;
mdp->d_hints = malloc(size);
if (mdp->d_hints == NULL)
goto bad;
if (read(fd, mdp->d_hints, size) != size)
goto bad;
mdp->d_hintsz = size;
close(fd);
return;
bad:
close(fd);
if (mdp->d_hints) {
free(mdp->d_hints);
mdp->d_hints = NULL;
}
mdp->d_flags |= MDIR_NOHINTS;
} | /*
* Read linker.hints file into memory performing some sanity checks.
*/ | Read linker.hints file into memory performing some sanity checks. | [
"Read",
"linker",
".",
"hints",
"file",
"into",
"memory",
"performing",
"some",
"sanity",
"checks",
"."
] | static void
moduledir_readhints(struct moduledir *mdp)
{
struct stat st;
char *path;
int fd, size, version;
if (mdp->d_hints != NULL || (mdp->d_flags & MDIR_NOHINTS))
return;
path = moduledir_fullpath(mdp, "linker.hints");
if (rel_stat(path, &st) != 0 ||
st.st_size < (ssize_t)(sizeof(version) + sizeof(int)) ||
st.st_size > 100 * 1024 || (fd = rel_open(path, NULL, O_RDONLY)) < 0) {
free(path);
mdp->d_flags |= MDIR_NOHINTS;
return;
}
free(path);
size = read(fd, &version, sizeof(version));
if (size != sizeof(version) || version != LINKER_HINTS_VERSION)
goto bad;
size = st.st_size - size;
mdp->d_hints = malloc(size);
if (mdp->d_hints == NULL)
goto bad;
if (read(fd, mdp->d_hints, size) != size)
goto bad;
mdp->d_hintsz = size;
close(fd);
return;
bad:
close(fd);
if (mdp->d_hints) {
free(mdp->d_hints);
mdp->d_hints = NULL;
}
mdp->d_flags |= MDIR_NOHINTS;
} | [
"static",
"void",
"moduledir_readhints",
"(",
"struct",
"moduledir",
"*",
"mdp",
")",
"{",
"struct",
"stat",
"st",
";",
"char",
"*",
"path",
";",
"int",
"fd",
",",
"size",
",",
"version",
";",
"if",
"(",
"mdp",
"->",
"d_hints",
"!=",
"NULL",
"||",
"(",
"mdp",
"->",
"d_flags",
"&",
"MDIR_NOHINTS",
")",
")",
"return",
";",
"path",
"=",
"moduledir_fullpath",
"(",
"mdp",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"rel_stat",
"(",
"path",
",",
"&",
"st",
")",
"!=",
"0",
"||",
"st",
".",
"st_size",
"<",
"(",
"ssize_t",
")",
"(",
"sizeof",
"(",
"version",
")",
"+",
"sizeof",
"(",
"int",
")",
")",
"||",
"st",
".",
"st_size",
">",
"100",
"*",
"1024",
"||",
"(",
"fd",
"=",
"rel_open",
"(",
"path",
",",
"NULL",
",",
"O_RDONLY",
")",
")",
"<",
"0",
")",
"{",
"free",
"(",
"path",
")",
";",
"mdp",
"->",
"d_flags",
"|=",
"MDIR_NOHINTS",
";",
"return",
";",
"}",
"free",
"(",
"path",
")",
";",
"size",
"=",
"read",
"(",
"fd",
",",
"&",
"version",
",",
"sizeof",
"(",
"version",
")",
")",
";",
"if",
"(",
"size",
"!=",
"sizeof",
"(",
"version",
")",
"||",
"version",
"!=",
"LINKER_HINTS_VERSION",
")",
"goto",
"bad",
";",
"size",
"=",
"st",
".",
"st_size",
"-",
"size",
";",
"mdp",
"->",
"d_hints",
"=",
"malloc",
"(",
"size",
")",
";",
"if",
"(",
"mdp",
"->",
"d_hints",
"==",
"NULL",
")",
"goto",
"bad",
";",
"if",
"(",
"read",
"(",
"fd",
",",
"mdp",
"->",
"d_hints",
",",
"size",
")",
"!=",
"size",
")",
"goto",
"bad",
";",
"mdp",
"->",
"d_hintsz",
"=",
"size",
";",
"close",
"(",
"fd",
")",
";",
"return",
";",
"bad",
":",
"close",
"(",
"fd",
")",
";",
"if",
"(",
"mdp",
"->",
"d_hints",
")",
"{",
"free",
"(",
"mdp",
"->",
"d_hints",
")",
";",
"mdp",
"->",
"d_hints",
"=",
"NULL",
";",
"}",
"mdp",
"->",
"d_flags",
"|=",
"MDIR_NOHINTS",
";",
"}"
] | Read linker.hints file into memory performing some sanity checks. | [
"Read",
"linker",
".",
"hints",
"file",
"into",
"memory",
"performing",
"some",
"sanity",
"checks",
"."
] | [] | [
{
"param": "mdp",
"type": "struct moduledir"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "mdp",
"type": "struct moduledir",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad9660a76ba7a174d603466e81b76f6769a3c97 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/libcpp/lex.c | [
"BSD-3-Clause"
] | C | cpp_ideq | int | int
cpp_ideq (const cpp_token *token, const char *string)
{
if (token->type != CPP_NAME)
return 0;
return !ustrcmp (NODE_NAME (token->val.node.node), (const uchar *) string);
} | /* Utility routine:
Compares, the token TOKEN to the NUL-terminated string STRING.
TOKEN must be a CPP_NAME. Returns 1 for equal, 0 for unequal. */ | Utility routine:
Compares, the token TOKEN to the NUL-terminated string STRING.
TOKEN must be a CPP_NAME. Returns 1 for equal, 0 for unequal. | [
"Utility",
"routine",
":",
"Compares",
"the",
"token",
"TOKEN",
"to",
"the",
"NUL",
"-",
"terminated",
"string",
"STRING",
".",
"TOKEN",
"must",
"be",
"a",
"CPP_NAME",
".",
"Returns",
"1",
"for",
"equal",
"0",
"for",
"unequal",
"."
] | int
cpp_ideq (const cpp_token *token, const char *string)
{
if (token->type != CPP_NAME)
return 0;
return !ustrcmp (NODE_NAME (token->val.node.node), (const uchar *) string);
} | [
"int",
"cpp_ideq",
"(",
"const",
"cpp_token",
"*",
"token",
",",
"const",
"char",
"*",
"string",
")",
"{",
"if",
"(",
"token",
"->",
"type",
"!=",
"CPP_NAME",
")",
"return",
"0",
";",
"return",
"!",
"ustrcmp",
"(",
"NODE_NAME",
"(",
"token",
"->",
"val",
".",
"node",
".",
"node",
")",
",",
"(",
"const",
"uchar",
"*",
")",
"string",
")",
";",
"}"
] | Utility routine:
Compares, the token TOKEN to the NUL-terminated string STRING. | [
"Utility",
"routine",
":",
"Compares",
"the",
"token",
"TOKEN",
"to",
"the",
"NUL",
"-",
"terminated",
"string",
"STRING",
"."
] | [] | [
{
"param": "token",
"type": "cpp_token"
},
{
"param": "string",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "token",
"type": "cpp_token",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad9660a76ba7a174d603466e81b76f6769a3c97 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/libcpp/lex.c | [
"BSD-3-Clause"
] | C | acc_char_mask_misalign | word_type | static inline word_type
acc_char_mask_misalign (word_type val, unsigned int n)
{
word_type mask = -1;
if (WORDS_BIGENDIAN)
mask >>= n * 8;
else
mask <<= n * 8;
return val & mask;
} | /* Return X with the first N bytes forced to values that won't match one
of the interesting characters. Note that NUL is not interesting. */ | Return X with the first N bytes forced to values that won't match one
of the interesting characters. Note that NUL is not interesting. | [
"Return",
"X",
"with",
"the",
"first",
"N",
"bytes",
"forced",
"to",
"values",
"that",
"won",
"'",
"t",
"match",
"one",
"of",
"the",
"interesting",
"characters",
".",
"Note",
"that",
"NUL",
"is",
"not",
"interesting",
"."
] | static inline word_type
acc_char_mask_misalign (word_type val, unsigned int n)
{
word_type mask = -1;
if (WORDS_BIGENDIAN)
mask >>= n * 8;
else
mask <<= n * 8;
return val & mask;
} | [
"static",
"inline",
"word_type",
"acc_char_mask_misalign",
"(",
"word_type",
"val",
",",
"unsigned",
"int",
"n",
")",
"{",
"word_type",
"mask",
"=",
"-1",
";",
"if",
"(",
"WORDS_BIGENDIAN",
")",
"mask",
">>=",
"n",
"*",
"8",
";",
"else",
"mask",
"<<=",
"n",
"*",
"8",
";",
"return",
"val",
"&",
"mask",
";",
"}"
] | Return X with the first N bytes forced to values that won't match one
of the interesting characters. | [
"Return",
"X",
"with",
"the",
"first",
"N",
"bytes",
"forced",
"to",
"values",
"that",
"won",
"'",
"t",
"match",
"one",
"of",
"the",
"interesting",
"characters",
"."
] | [] | [
{
"param": "val",
"type": "word_type"
},
{
"param": "n",
"type": "unsigned int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "val",
"type": "word_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "n",
"type": "unsigned int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad9660a76ba7a174d603466e81b76f6769a3c97 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/libcpp/lex.c | [
"BSD-3-Clause"
] | C | acc_char_replicate | word_type | static inline word_type
acc_char_replicate (uchar x)
{
word_type ret;
ret = (x << 24) | (x << 16) | (x << 8) | x;
if (sizeof(word_type) == 8)
ret = (ret << 16 << 16) | ret;
return ret;
} | /* Return X replicated to all byte positions within WORD_TYPE. */ | Return X replicated to all byte positions within WORD_TYPE. | [
"Return",
"X",
"replicated",
"to",
"all",
"byte",
"positions",
"within",
"WORD_TYPE",
"."
] | static inline word_type
acc_char_replicate (uchar x)
{
word_type ret;
ret = (x << 24) | (x << 16) | (x << 8) | x;
if (sizeof(word_type) == 8)
ret = (ret << 16 << 16) | ret;
return ret;
} | [
"static",
"inline",
"word_type",
"acc_char_replicate",
"(",
"uchar",
"x",
")",
"{",
"word_type",
"ret",
";",
"ret",
"=",
"(",
"x",
"<<",
"24",
")",
"|",
"(",
"x",
"<<",
"16",
")",
"|",
"(",
"x",
"<<",
"8",
")",
"|",
"x",
";",
"if",
"(",
"sizeof",
"(",
"word_type",
")",
"==",
"8",
")",
"ret",
"=",
"(",
"ret",
"<<",
"16",
"<<",
"16",
")",
"|",
"ret",
";",
"return",
"ret",
";",
"}"
] | Return X replicated to all byte positions within WORD_TYPE. | [
"Return",
"X",
"replicated",
"to",
"all",
"byte",
"positions",
"within",
"WORD_TYPE",
"."
] | [] | [
{
"param": "x",
"type": "uchar"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": "uchar",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.