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
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_reference_lookup
tree
tree vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind, vn_reference_t *vnresult) { VEC (vn_reference_op_s, heap) *operands; struct vn_reference_s vr1; tree cst; bool valuezied_anything; if (vnresult) *vnresult = NULL; vr1.vuse = vuse ? SSA_VAL (vuse) : NULL_TREE; vr1.operands = operands = valueize_shared_reference_ops_from_ref (op, &valuezied_anything); vr1.type = TREE_TYPE (op); vr1.set = get_alias_set (op); vr1.hashcode = vn_reference_compute_hash (&vr1); if ((cst = fully_constant_vn_reference_p (&vr1))) return cst; if (kind != VN_NOWALK && vr1.vuse) { vn_reference_t wvnresult; ao_ref r; /* Make sure to use a valueized reference if we valueized anything. Otherwise preserve the full reference for advanced TBAA. */ if (!valuezied_anything || !ao_ref_init_from_vn_reference (&r, vr1.set, vr1.type, vr1.operands)) ao_ref_init (&r, op); vn_walk_kind = kind; wvnresult = (vn_reference_t)walk_non_aliased_vuses (&r, vr1.vuse, vn_reference_lookup_2, vn_reference_lookup_3, &vr1); if (vr1.operands != operands) VEC_free (vn_reference_op_s, heap, vr1.operands); if (wvnresult) { if (vnresult) *vnresult = wvnresult; return wvnresult->result; } return NULL_TREE; } return vn_reference_lookup_1 (&vr1, vnresult); }
/* Lookup OP in the current hash table, and return the resulting value number if it exists in the hash table. Return NULL_TREE if it does not exist in the hash table or if the result field of the structure was NULL.. VNRESULT will be filled in with the vn_reference_t stored in the hashtable if one exists. */
Lookup OP in the current hash table, and return the resulting value number if it exists in the hash table. Return NULL_TREE if it does not exist in the hash table or if the result field of the structure was NULL.. VNRESULT will be filled in with the vn_reference_t stored in the hashtable if one exists.
[ "Lookup", "OP", "in", "the", "current", "hash", "table", "and", "return", "the", "resulting", "value", "number", "if", "it", "exists", "in", "the", "hash", "table", ".", "Return", "NULL_TREE", "if", "it", "does", "not", "exist", "in", "the", "hash", "table", "or", "if", "the", "result", "field", "of", "the", "structure", "was", "NULL", "..", "VNRESULT", "will", "be", "filled", "in", "with", "the", "vn_reference_t", "stored", "in", "the", "hashtable", "if", "one", "exists", "." ]
tree vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind, vn_reference_t *vnresult) { VEC (vn_reference_op_s, heap) *operands; struct vn_reference_s vr1; tree cst; bool valuezied_anything; if (vnresult) *vnresult = NULL; vr1.vuse = vuse ? SSA_VAL (vuse) : NULL_TREE; vr1.operands = operands = valueize_shared_reference_ops_from_ref (op, &valuezied_anything); vr1.type = TREE_TYPE (op); vr1.set = get_alias_set (op); vr1.hashcode = vn_reference_compute_hash (&vr1); if ((cst = fully_constant_vn_reference_p (&vr1))) return cst; if (kind != VN_NOWALK && vr1.vuse) { vn_reference_t wvnresult; ao_ref r; if (!valuezied_anything || !ao_ref_init_from_vn_reference (&r, vr1.set, vr1.type, vr1.operands)) ao_ref_init (&r, op); vn_walk_kind = kind; wvnresult = (vn_reference_t)walk_non_aliased_vuses (&r, vr1.vuse, vn_reference_lookup_2, vn_reference_lookup_3, &vr1); if (vr1.operands != operands) VEC_free (vn_reference_op_s, heap, vr1.operands); if (wvnresult) { if (vnresult) *vnresult = wvnresult; return wvnresult->result; } return NULL_TREE; } return vn_reference_lookup_1 (&vr1, vnresult); }
[ "tree", "vn_reference_lookup", "(", "tree", "op", ",", "tree", "vuse", ",", "vn_lookup_kind", "kind", ",", "vn_reference_t", "*", "vnresult", ")", "{", "VEC", "(", "vn_reference_op_s", ",", "heap", ")", "*", "operands", ";", "struct", "vn_reference_s", "vr1", ";", "tree", "cst", ";", "bool", "valuezied_anything", ";", "if", "(", "vnresult", ")", "*", "vnresult", "=", "NULL", ";", "vr1", ".", "vuse", "=", "vuse", "?", "SSA_VAL", "(", "vuse", ")", ":", "NULL_TREE", ";", "vr1", ".", "operands", "=", "operands", "=", "valueize_shared_reference_ops_from_ref", "(", "op", ",", "&", "valuezied_anything", ")", ";", "vr1", ".", "type", "=", "TREE_TYPE", "(", "op", ")", ";", "vr1", ".", "set", "=", "get_alias_set", "(", "op", ")", ";", "vr1", ".", "hashcode", "=", "vn_reference_compute_hash", "(", "&", "vr1", ")", ";", "if", "(", "(", "cst", "=", "fully_constant_vn_reference_p", "(", "&", "vr1", ")", ")", ")", "return", "cst", ";", "if", "(", "kind", "!=", "VN_NOWALK", "&&", "vr1", ".", "vuse", ")", "{", "vn_reference_t", "wvnresult", ";", "ao_ref", "r", ";", "if", "(", "!", "valuezied_anything", "||", "!", "ao_ref_init_from_vn_reference", "(", "&", "r", ",", "vr1", ".", "set", ",", "vr1", ".", "type", ",", "vr1", ".", "operands", ")", ")", "ao_ref_init", "(", "&", "r", ",", "op", ")", ";", "vn_walk_kind", "=", "kind", ";", "wvnresult", "=", "(", "vn_reference_t", ")", "walk_non_aliased_vuses", "(", "&", "r", ",", "vr1", ".", "vuse", ",", "vn_reference_lookup_2", ",", "vn_reference_lookup_3", ",", "&", "vr1", ")", ";", "if", "(", "vr1", ".", "operands", "!=", "operands", ")", "VEC_free", "(", "vn_reference_op_s", ",", "heap", ",", "vr1", ".", "operands", ")", ";", "if", "(", "wvnresult", ")", "{", "if", "(", "vnresult", ")", "*", "vnresult", "=", "wvnresult", ";", "return", "wvnresult", "->", "result", ";", "}", "return", "NULL_TREE", ";", "}", "return", "vn_reference_lookup_1", "(", "&", "vr1", ",", "vnresult", ")", ";", "}" ]
Lookup OP in the current hash table, and return the resulting value number if it exists in the hash table.
[ "Lookup", "OP", "in", "the", "current", "hash", "table", "and", "return", "the", "resulting", "value", "number", "if", "it", "exists", "in", "the", "hash", "table", "." ]
[ "/* Make sure to use a valueized reference if we valueized anything.\n Otherwise preserve the full reference for advanced TBAA. */" ]
[ { "param": "op", "type": "tree" }, { "param": "vuse", "type": "tree" }, { "param": "kind", "type": "vn_lookup_kind" }, { "param": "vnresult", "type": "vn_reference_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "op", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vuse", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kind", "type": "vn_lookup_kind", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vnresult", "type": "vn_reference_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_reference_insert
vn_reference_t
vn_reference_t vn_reference_insert (tree op, tree result, tree vuse) { void **slot; vn_reference_t vr1; vr1 = (vn_reference_t) pool_alloc (current_info->references_pool); if (TREE_CODE (result) == SSA_NAME) vr1->value_id = VN_INFO (result)->value_id; else vr1->value_id = get_or_alloc_constant_value_id (result); vr1->vuse = vuse ? SSA_VAL (vuse) : NULL_TREE; vr1->operands = valueize_refs (create_reference_ops_from_ref (op)); vr1->type = TREE_TYPE (op); vr1->set = get_alias_set (op); vr1->hashcode = vn_reference_compute_hash (vr1); vr1->result = TREE_CODE (result) == SSA_NAME ? SSA_VAL (result) : result; slot = htab_find_slot_with_hash (current_info->references, vr1, vr1->hashcode, INSERT); /* Because we lookup stores using vuses, and value number failures using the vdefs (see visit_reference_op_store for how and why), it's possible that on failure we may try to insert an already inserted store. This is not wrong, there is no ssa name for a store that we could use as a differentiator anyway. Thus, unlike the other lookup functions, you cannot gcc_assert (!*slot) here. */ /* But free the old slot in case of a collision. */ if (*slot) free_reference (*slot); *slot = vr1; return vr1; }
/* Insert OP into the current hash table with a value number of RESULT, and return the resulting reference structure we created. */
Insert OP into the current hash table with a value number of RESULT, and return the resulting reference structure we created.
[ "Insert", "OP", "into", "the", "current", "hash", "table", "with", "a", "value", "number", "of", "RESULT", "and", "return", "the", "resulting", "reference", "structure", "we", "created", "." ]
vn_reference_t vn_reference_insert (tree op, tree result, tree vuse) { void **slot; vn_reference_t vr1; vr1 = (vn_reference_t) pool_alloc (current_info->references_pool); if (TREE_CODE (result) == SSA_NAME) vr1->value_id = VN_INFO (result)->value_id; else vr1->value_id = get_or_alloc_constant_value_id (result); vr1->vuse = vuse ? SSA_VAL (vuse) : NULL_TREE; vr1->operands = valueize_refs (create_reference_ops_from_ref (op)); vr1->type = TREE_TYPE (op); vr1->set = get_alias_set (op); vr1->hashcode = vn_reference_compute_hash (vr1); vr1->result = TREE_CODE (result) == SSA_NAME ? SSA_VAL (result) : result; slot = htab_find_slot_with_hash (current_info->references, vr1, vr1->hashcode, INSERT); if (*slot) free_reference (*slot); *slot = vr1; return vr1; }
[ "vn_reference_t", "vn_reference_insert", "(", "tree", "op", ",", "tree", "result", ",", "tree", "vuse", ")", "{", "void", "*", "*", "slot", ";", "vn_reference_t", "vr1", ";", "vr1", "=", "(", "vn_reference_t", ")", "pool_alloc", "(", "current_info", "->", "references_pool", ")", ";", "if", "(", "TREE_CODE", "(", "result", ")", "==", "SSA_NAME", ")", "vr1", "->", "value_id", "=", "VN_INFO", "(", "result", ")", "->", "value_id", ";", "else", "vr1", "->", "value_id", "=", "get_or_alloc_constant_value_id", "(", "result", ")", ";", "vr1", "->", "vuse", "=", "vuse", "?", "SSA_VAL", "(", "vuse", ")", ":", "NULL_TREE", ";", "vr1", "->", "operands", "=", "valueize_refs", "(", "create_reference_ops_from_ref", "(", "op", ")", ")", ";", "vr1", "->", "type", "=", "TREE_TYPE", "(", "op", ")", ";", "vr1", "->", "set", "=", "get_alias_set", "(", "op", ")", ";", "vr1", "->", "hashcode", "=", "vn_reference_compute_hash", "(", "vr1", ")", ";", "vr1", "->", "result", "=", "TREE_CODE", "(", "result", ")", "==", "SSA_NAME", "?", "SSA_VAL", "(", "result", ")", ":", "result", ";", "slot", "=", "htab_find_slot_with_hash", "(", "current_info", "->", "references", ",", "vr1", ",", "vr1", "->", "hashcode", ",", "INSERT", ")", ";", "if", "(", "*", "slot", ")", "free_reference", "(", "*", "slot", ")", ";", "*", "slot", "=", "vr1", ";", "return", "vr1", ";", "}" ]
Insert OP into the current hash table with a value number of RESULT, and return the resulting reference structure we created.
[ "Insert", "OP", "into", "the", "current", "hash", "table", "with", "a", "value", "number", "of", "RESULT", "and", "return", "the", "resulting", "reference", "structure", "we", "created", "." ]
[ "/* Because we lookup stores using vuses, and value number failures\n using the vdefs (see visit_reference_op_store for how and why),\n it's possible that on failure we may try to insert an already\n inserted store. This is not wrong, there is no ssa name for a\n store that we could use as a differentiator anyway. Thus, unlike\n the other lookup functions, you cannot gcc_assert (!*slot)\n here. */", "/* But free the old slot in case of a collision. */" ]
[ { "param": "op", "type": "tree" }, { "param": "result", "type": "tree" }, { "param": "vuse", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "op", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vuse", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_op_compute_hash
hashval_t
hashval_t vn_nary_op_compute_hash (const vn_nary_op_t vno1) { hashval_t hash; unsigned i; for (i = 0; i < vno1->length; ++i) if (TREE_CODE (vno1->op[i]) == SSA_NAME) vno1->op[i] = SSA_VAL (vno1->op[i]); if (vno1->length == 2 && commutative_tree_code (vno1->opcode) && tree_swap_operands_p (vno1->op[0], vno1->op[1], false)) { tree temp = vno1->op[0]; vno1->op[0] = vno1->op[1]; vno1->op[1] = temp; } hash = iterative_hash_hashval_t (vno1->opcode, 0); for (i = 0; i < vno1->length; ++i) hash = iterative_hash_expr (vno1->op[i], hash); return hash; }
/* Compute and return the hash value for nary operation VBO1. */
Compute and return the hash value for nary operation VBO1.
[ "Compute", "and", "return", "the", "hash", "value", "for", "nary", "operation", "VBO1", "." ]
hashval_t vn_nary_op_compute_hash (const vn_nary_op_t vno1) { hashval_t hash; unsigned i; for (i = 0; i < vno1->length; ++i) if (TREE_CODE (vno1->op[i]) == SSA_NAME) vno1->op[i] = SSA_VAL (vno1->op[i]); if (vno1->length == 2 && commutative_tree_code (vno1->opcode) && tree_swap_operands_p (vno1->op[0], vno1->op[1], false)) { tree temp = vno1->op[0]; vno1->op[0] = vno1->op[1]; vno1->op[1] = temp; } hash = iterative_hash_hashval_t (vno1->opcode, 0); for (i = 0; i < vno1->length; ++i) hash = iterative_hash_expr (vno1->op[i], hash); return hash; }
[ "hashval_t", "vn_nary_op_compute_hash", "(", "const", "vn_nary_op_t", "vno1", ")", "{", "hashval_t", "hash", ";", "unsigned", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "vno1", "->", "length", ";", "++", "i", ")", "if", "(", "TREE_CODE", "(", "vno1", "->", "op", "[", "i", "]", ")", "==", "SSA_NAME", ")", "vno1", "->", "op", "[", "i", "]", "=", "SSA_VAL", "(", "vno1", "->", "op", "[", "i", "]", ")", ";", "if", "(", "vno1", "->", "length", "==", "2", "&&", "commutative_tree_code", "(", "vno1", "->", "opcode", ")", "&&", "tree_swap_operands_p", "(", "vno1", "->", "op", "[", "0", "]", ",", "vno1", "->", "op", "[", "1", "]", ",", "false", ")", ")", "{", "tree", "temp", "=", "vno1", "->", "op", "[", "0", "]", ";", "vno1", "->", "op", "[", "0", "]", "=", "vno1", "->", "op", "[", "1", "]", ";", "vno1", "->", "op", "[", "1", "]", "=", "temp", ";", "}", "hash", "=", "iterative_hash_hashval_t", "(", "vno1", "->", "opcode", ",", "0", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "vno1", "->", "length", ";", "++", "i", ")", "hash", "=", "iterative_hash_expr", "(", "vno1", "->", "op", "[", "i", "]", ",", "hash", ")", ";", "return", "hash", ";", "}" ]
Compute and return the hash value for nary operation VBO1.
[ "Compute", "and", "return", "the", "hash", "value", "for", "nary", "operation", "VBO1", "." ]
[]
[ { "param": "vno1", "type": "vn_nary_op_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vno1", "type": "vn_nary_op_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_op_hash
hashval_t
static hashval_t vn_nary_op_hash (const void *p1) { const_vn_nary_op_t const vno1 = (const_vn_nary_op_t) p1; return vno1->hashcode; }
/* Return the computed hashcode for nary operation P1. */
Return the computed hashcode for nary operation P1.
[ "Return", "the", "computed", "hashcode", "for", "nary", "operation", "P1", "." ]
static hashval_t vn_nary_op_hash (const void *p1) { const_vn_nary_op_t const vno1 = (const_vn_nary_op_t) p1; return vno1->hashcode; }
[ "static", "hashval_t", "vn_nary_op_hash", "(", "const", "void", "*", "p1", ")", "{", "const_vn_nary_op_t", "const", "vno1", "=", "(", "const_vn_nary_op_t", ")", "p1", ";", "return", "vno1", "->", "hashcode", ";", "}" ]
Return the computed hashcode for nary operation P1.
[ "Return", "the", "computed", "hashcode", "for", "nary", "operation", "P1", "." ]
[]
[ { "param": "p1", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p1", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_op_eq
int
int vn_nary_op_eq (const void *p1, const void *p2) { const_vn_nary_op_t const vno1 = (const_vn_nary_op_t) p1; const_vn_nary_op_t const vno2 = (const_vn_nary_op_t) p2; unsigned i; if (vno1->hashcode != vno2->hashcode) return false; if (vno1->length != vno2->length) return false; if (vno1->opcode != vno2->opcode || !types_compatible_p (vno1->type, vno2->type)) return false; for (i = 0; i < vno1->length; ++i) if (!expressions_equal_p (vno1->op[i], vno2->op[i])) return false; return true; }
/* Compare nary operations P1 and P2 and return true if they are equivalent. */
Compare nary operations P1 and P2 and return true if they are equivalent.
[ "Compare", "nary", "operations", "P1", "and", "P2", "and", "return", "true", "if", "they", "are", "equivalent", "." ]
int vn_nary_op_eq (const void *p1, const void *p2) { const_vn_nary_op_t const vno1 = (const_vn_nary_op_t) p1; const_vn_nary_op_t const vno2 = (const_vn_nary_op_t) p2; unsigned i; if (vno1->hashcode != vno2->hashcode) return false; if (vno1->length != vno2->length) return false; if (vno1->opcode != vno2->opcode || !types_compatible_p (vno1->type, vno2->type)) return false; for (i = 0; i < vno1->length; ++i) if (!expressions_equal_p (vno1->op[i], vno2->op[i])) return false; return true; }
[ "int", "vn_nary_op_eq", "(", "const", "void", "*", "p1", ",", "const", "void", "*", "p2", ")", "{", "const_vn_nary_op_t", "const", "vno1", "=", "(", "const_vn_nary_op_t", ")", "p1", ";", "const_vn_nary_op_t", "const", "vno2", "=", "(", "const_vn_nary_op_t", ")", "p2", ";", "unsigned", "i", ";", "if", "(", "vno1", "->", "hashcode", "!=", "vno2", "->", "hashcode", ")", "return", "false", ";", "if", "(", "vno1", "->", "length", "!=", "vno2", "->", "length", ")", "return", "false", ";", "if", "(", "vno1", "->", "opcode", "!=", "vno2", "->", "opcode", "||", "!", "types_compatible_p", "(", "vno1", "->", "type", ",", "vno2", "->", "type", ")", ")", "return", "false", ";", "for", "(", "i", "=", "0", ";", "i", "<", "vno1", "->", "length", ";", "++", "i", ")", "if", "(", "!", "expressions_equal_p", "(", "vno1", "->", "op", "[", "i", "]", ",", "vno2", "->", "op", "[", "i", "]", ")", ")", "return", "false", ";", "return", "true", ";", "}" ]
Compare nary operations P1 and P2 and return true if they are equivalent.
[ "Compare", "nary", "operations", "P1", "and", "P2", "and", "return", "true", "if", "they", "are", "equivalent", "." ]
[]
[ { "param": "p1", "type": "void" }, { "param": "p2", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p1", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "p2", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
init_vn_nary_op_from_pieces
void
static void init_vn_nary_op_from_pieces (vn_nary_op_t vno, unsigned int length, enum tree_code code, tree type, tree *ops) { vno->opcode = code; vno->length = length; vno->type = type; memcpy (&vno->op[0], ops, sizeof (tree) * length); }
/* Initialize VNO from the pieces provided. */
Initialize VNO from the pieces provided.
[ "Initialize", "VNO", "from", "the", "pieces", "provided", "." ]
static void init_vn_nary_op_from_pieces (vn_nary_op_t vno, unsigned int length, enum tree_code code, tree type, tree *ops) { vno->opcode = code; vno->length = length; vno->type = type; memcpy (&vno->op[0], ops, sizeof (tree) * length); }
[ "static", "void", "init_vn_nary_op_from_pieces", "(", "vn_nary_op_t", "vno", ",", "unsigned", "int", "length", ",", "enum", "tree_code", "code", ",", "tree", "type", ",", "tree", "*", "ops", ")", "{", "vno", "->", "opcode", "=", "code", ";", "vno", "->", "length", "=", "length", ";", "vno", "->", "type", "=", "type", ";", "memcpy", "(", "&", "vno", "->", "op", "[", "0", "]", ",", "ops", ",", "sizeof", "(", "tree", ")", "*", "length", ")", ";", "}" ]
Initialize VNO from the pieces provided.
[ "Initialize", "VNO", "from", "the", "pieces", "provided", "." ]
[]
[ { "param": "vno", "type": "vn_nary_op_t" }, { "param": "length", "type": "unsigned int" }, { "param": "code", "type": "enum tree_code" }, { "param": "type", "type": "tree" }, { "param": "ops", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vno", "type": "vn_nary_op_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "length", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "code", "type": "enum tree_code", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ops", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_length_from_stmt
null
static unsigned int vn_nary_length_from_stmt (gimple stmt) { switch (gimple_assign_rhs_code (stmt)) { case REALPART_EXPR: case IMAGPART_EXPR: case VIEW_CONVERT_EXPR: return 1; case CONSTRUCTOR: return CONSTRUCTOR_NELTS (gimple_assign_rhs1 (stmt)); default: return gimple_num_ops (stmt) - 1; } }
/* Return the number of operands for a vn_nary ops structure from STMT. */
Return the number of operands for a vn_nary ops structure from STMT.
[ "Return", "the", "number", "of", "operands", "for", "a", "vn_nary", "ops", "structure", "from", "STMT", "." ]
static unsigned int vn_nary_length_from_stmt (gimple stmt) { switch (gimple_assign_rhs_code (stmt)) { case REALPART_EXPR: case IMAGPART_EXPR: case VIEW_CONVERT_EXPR: return 1; case CONSTRUCTOR: return CONSTRUCTOR_NELTS (gimple_assign_rhs1 (stmt)); default: return gimple_num_ops (stmt) - 1; } }
[ "static", "unsigned", "int", "vn_nary_length_from_stmt", "(", "gimple", "stmt", ")", "{", "switch", "(", "gimple_assign_rhs_code", "(", "stmt", ")", ")", "{", "case", "REALPART_EXPR", ":", "case", "IMAGPART_EXPR", ":", "case", "VIEW_CONVERT_EXPR", ":", "return", "1", ";", "case", "CONSTRUCTOR", ":", "return", "CONSTRUCTOR_NELTS", "(", "gimple_assign_rhs1", "(", "stmt", ")", ")", ";", "default", ":", "return", "gimple_num_ops", "(", "stmt", ")", "-", "1", ";", "}", "}" ]
Return the number of operands for a vn_nary ops structure from STMT.
[ "Return", "the", "number", "of", "operands", "for", "a", "vn_nary", "ops", "structure", "from", "STMT", "." ]
[]
[ { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_op_lookup_1
tree
static tree vn_nary_op_lookup_1 (vn_nary_op_t vno, vn_nary_op_t *vnresult) { void **slot; if (vnresult) *vnresult = NULL; vno->hashcode = vn_nary_op_compute_hash (vno); slot = htab_find_slot_with_hash (current_info->nary, vno, vno->hashcode, NO_INSERT); if (!slot && current_info == optimistic_info) slot = htab_find_slot_with_hash (valid_info->nary, vno, vno->hashcode, NO_INSERT); if (!slot) return NULL_TREE; if (vnresult) *vnresult = (vn_nary_op_t)*slot; return ((vn_nary_op_t)*slot)->result; }
/* Compute the hashcode for VNO and look for it in the hash table; return the resulting value number if it exists in the hash table. Return NULL_TREE if it does not exist in the hash table or if the result field of the operation is NULL. VNRESULT will contain the vn_nary_op_t from the hashtable if it exists. */
Compute the hashcode for VNO and look for it in the hash table; return the resulting value number if it exists in the hash table. Return NULL_TREE if it does not exist in the hash table or if the result field of the operation is NULL. VNRESULT will contain the vn_nary_op_t from the hashtable if it exists.
[ "Compute", "the", "hashcode", "for", "VNO", "and", "look", "for", "it", "in", "the", "hash", "table", ";", "return", "the", "resulting", "value", "number", "if", "it", "exists", "in", "the", "hash", "table", ".", "Return", "NULL_TREE", "if", "it", "does", "not", "exist", "in", "the", "hash", "table", "or", "if", "the", "result", "field", "of", "the", "operation", "is", "NULL", ".", "VNRESULT", "will", "contain", "the", "vn_nary_op_t", "from", "the", "hashtable", "if", "it", "exists", "." ]
static tree vn_nary_op_lookup_1 (vn_nary_op_t vno, vn_nary_op_t *vnresult) { void **slot; if (vnresult) *vnresult = NULL; vno->hashcode = vn_nary_op_compute_hash (vno); slot = htab_find_slot_with_hash (current_info->nary, vno, vno->hashcode, NO_INSERT); if (!slot && current_info == optimistic_info) slot = htab_find_slot_with_hash (valid_info->nary, vno, vno->hashcode, NO_INSERT); if (!slot) return NULL_TREE; if (vnresult) *vnresult = (vn_nary_op_t)*slot; return ((vn_nary_op_t)*slot)->result; }
[ "static", "tree", "vn_nary_op_lookup_1", "(", "vn_nary_op_t", "vno", ",", "vn_nary_op_t", "*", "vnresult", ")", "{", "void", "*", "*", "slot", ";", "if", "(", "vnresult", ")", "*", "vnresult", "=", "NULL", ";", "vno", "->", "hashcode", "=", "vn_nary_op_compute_hash", "(", "vno", ")", ";", "slot", "=", "htab_find_slot_with_hash", "(", "current_info", "->", "nary", ",", "vno", ",", "vno", "->", "hashcode", ",", "NO_INSERT", ")", ";", "if", "(", "!", "slot", "&&", "current_info", "==", "optimistic_info", ")", "slot", "=", "htab_find_slot_with_hash", "(", "valid_info", "->", "nary", ",", "vno", ",", "vno", "->", "hashcode", ",", "NO_INSERT", ")", ";", "if", "(", "!", "slot", ")", "return", "NULL_TREE", ";", "if", "(", "vnresult", ")", "*", "vnresult", "=", "(", "vn_nary_op_t", ")", "*", "slot", ";", "return", "(", "(", "vn_nary_op_t", ")", "*", "slot", ")", "->", "result", ";", "}" ]
Compute the hashcode for VNO and look for it in the hash table; return the resulting value number if it exists in the hash table.
[ "Compute", "the", "hashcode", "for", "VNO", "and", "look", "for", "it", "in", "the", "hash", "table", ";", "return", "the", "resulting", "value", "number", "if", "it", "exists", "in", "the", "hash", "table", "." ]
[]
[ { "param": "vno", "type": "vn_nary_op_t" }, { "param": "vnresult", "type": "vn_nary_op_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vno", "type": "vn_nary_op_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vnresult", "type": "vn_nary_op_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
alloc_vn_nary_op_noinit
vn_nary_op_t
static vn_nary_op_t alloc_vn_nary_op_noinit (unsigned int length, struct obstack *stack) { return (vn_nary_op_t) obstack_alloc (stack, sizeof_vn_nary_op (length)); }
/* Allocate a vn_nary_op_t with LENGTH operands on STACK. */
Allocate a vn_nary_op_t with LENGTH operands on STACK.
[ "Allocate", "a", "vn_nary_op_t", "with", "LENGTH", "operands", "on", "STACK", "." ]
static vn_nary_op_t alloc_vn_nary_op_noinit (unsigned int length, struct obstack *stack) { return (vn_nary_op_t) obstack_alloc (stack, sizeof_vn_nary_op (length)); }
[ "static", "vn_nary_op_t", "alloc_vn_nary_op_noinit", "(", "unsigned", "int", "length", ",", "struct", "obstack", "*", "stack", ")", "{", "return", "(", "vn_nary_op_t", ")", "obstack_alloc", "(", "stack", ",", "sizeof_vn_nary_op", "(", "length", ")", ")", ";", "}" ]
Allocate a vn_nary_op_t with LENGTH operands on STACK.
[ "Allocate", "a", "vn_nary_op_t", "with", "LENGTH", "operands", "on", "STACK", "." ]
[]
[ { "param": "length", "type": "unsigned int" }, { "param": "stack", "type": "struct obstack" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "length", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stack", "type": "struct obstack", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_op_insert_into
vn_nary_op_t
static vn_nary_op_t vn_nary_op_insert_into (vn_nary_op_t vno, htab_t table, bool compute_hash) { void **slot; if (compute_hash) vno->hashcode = vn_nary_op_compute_hash (vno); slot = htab_find_slot_with_hash (table, vno, vno->hashcode, INSERT); gcc_assert (!*slot); *slot = vno; return vno; }
/* Insert VNO into TABLE. If COMPUTE_HASH is true, then compute VNO->HASHCODE first. */
Insert VNO into TABLE. If COMPUTE_HASH is true, then compute VNO->HASHCODE first.
[ "Insert", "VNO", "into", "TABLE", ".", "If", "COMPUTE_HASH", "is", "true", "then", "compute", "VNO", "-", ">", "HASHCODE", "first", "." ]
static vn_nary_op_t vn_nary_op_insert_into (vn_nary_op_t vno, htab_t table, bool compute_hash) { void **slot; if (compute_hash) vno->hashcode = vn_nary_op_compute_hash (vno); slot = htab_find_slot_with_hash (table, vno, vno->hashcode, INSERT); gcc_assert (!*slot); *slot = vno; return vno; }
[ "static", "vn_nary_op_t", "vn_nary_op_insert_into", "(", "vn_nary_op_t", "vno", ",", "htab_t", "table", ",", "bool", "compute_hash", ")", "{", "void", "*", "*", "slot", ";", "if", "(", "compute_hash", ")", "vno", "->", "hashcode", "=", "vn_nary_op_compute_hash", "(", "vno", ")", ";", "slot", "=", "htab_find_slot_with_hash", "(", "table", ",", "vno", ",", "vno", "->", "hashcode", ",", "INSERT", ")", ";", "gcc_assert", "(", "!", "*", "slot", ")", ";", "*", "slot", "=", "vno", ";", "return", "vno", ";", "}" ]
Insert VNO into TABLE.
[ "Insert", "VNO", "into", "TABLE", "." ]
[]
[ { "param": "vno", "type": "vn_nary_op_t" }, { "param": "table", "type": "htab_t" }, { "param": "compute_hash", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vno", "type": "vn_nary_op_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "table", "type": "htab_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "compute_hash", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_op_insert_pieces
vn_nary_op_t
vn_nary_op_t vn_nary_op_insert_pieces (unsigned int length, enum tree_code code, tree type, tree *ops, tree result, unsigned int value_id) { vn_nary_op_t vno1 = alloc_vn_nary_op (length, result, value_id); init_vn_nary_op_from_pieces (vno1, length, code, type, ops); return vn_nary_op_insert_into (vno1, current_info->nary, true); }
/* Insert a n-ary operation into the current hash table using it's pieces. Return the vn_nary_op_t structure we created and put in the hashtable. */
Insert a n-ary operation into the current hash table using it's pieces. Return the vn_nary_op_t structure we created and put in the hashtable.
[ "Insert", "a", "n", "-", "ary", "operation", "into", "the", "current", "hash", "table", "using", "it", "'", "s", "pieces", ".", "Return", "the", "vn_nary_op_t", "structure", "we", "created", "and", "put", "in", "the", "hashtable", "." ]
vn_nary_op_t vn_nary_op_insert_pieces (unsigned int length, enum tree_code code, tree type, tree *ops, tree result, unsigned int value_id) { vn_nary_op_t vno1 = alloc_vn_nary_op (length, result, value_id); init_vn_nary_op_from_pieces (vno1, length, code, type, ops); return vn_nary_op_insert_into (vno1, current_info->nary, true); }
[ "vn_nary_op_t", "vn_nary_op_insert_pieces", "(", "unsigned", "int", "length", ",", "enum", "tree_code", "code", ",", "tree", "type", ",", "tree", "*", "ops", ",", "tree", "result", ",", "unsigned", "int", "value_id", ")", "{", "vn_nary_op_t", "vno1", "=", "alloc_vn_nary_op", "(", "length", ",", "result", ",", "value_id", ")", ";", "init_vn_nary_op_from_pieces", "(", "vno1", ",", "length", ",", "code", ",", "type", ",", "ops", ")", ";", "return", "vn_nary_op_insert_into", "(", "vno1", ",", "current_info", "->", "nary", ",", "true", ")", ";", "}" ]
Insert a n-ary operation into the current hash table using it's pieces.
[ "Insert", "a", "n", "-", "ary", "operation", "into", "the", "current", "hash", "table", "using", "it", "'", "s", "pieces", "." ]
[]
[ { "param": "length", "type": "unsigned int" }, { "param": "code", "type": "enum tree_code" }, { "param": "type", "type": "tree" }, { "param": "ops", "type": "tree" }, { "param": "result", "type": "tree" }, { "param": "value_id", "type": "unsigned int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "length", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "code", "type": "enum tree_code", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ops", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value_id", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_op_insert
vn_nary_op_t
vn_nary_op_t vn_nary_op_insert (tree op, tree result) { unsigned length = TREE_CODE_LENGTH (TREE_CODE (op)); vn_nary_op_t vno1; vno1 = alloc_vn_nary_op (length, result, VN_INFO (result)->value_id); init_vn_nary_op_from_op (vno1, op); return vn_nary_op_insert_into (vno1, current_info->nary, true); }
/* Insert OP into the current hash table with a value number of RESULT. Return the vn_nary_op_t structure we created and put in the hashtable. */
Insert OP into the current hash table with a value number of RESULT. Return the vn_nary_op_t structure we created and put in the hashtable.
[ "Insert", "OP", "into", "the", "current", "hash", "table", "with", "a", "value", "number", "of", "RESULT", ".", "Return", "the", "vn_nary_op_t", "structure", "we", "created", "and", "put", "in", "the", "hashtable", "." ]
vn_nary_op_t vn_nary_op_insert (tree op, tree result) { unsigned length = TREE_CODE_LENGTH (TREE_CODE (op)); vn_nary_op_t vno1; vno1 = alloc_vn_nary_op (length, result, VN_INFO (result)->value_id); init_vn_nary_op_from_op (vno1, op); return vn_nary_op_insert_into (vno1, current_info->nary, true); }
[ "vn_nary_op_t", "vn_nary_op_insert", "(", "tree", "op", ",", "tree", "result", ")", "{", "unsigned", "length", "=", "TREE_CODE_LENGTH", "(", "TREE_CODE", "(", "op", ")", ")", ";", "vn_nary_op_t", "vno1", ";", "vno1", "=", "alloc_vn_nary_op", "(", "length", ",", "result", ",", "VN_INFO", "(", "result", ")", "->", "value_id", ")", ";", "init_vn_nary_op_from_op", "(", "vno1", ",", "op", ")", ";", "return", "vn_nary_op_insert_into", "(", "vno1", ",", "current_info", "->", "nary", ",", "true", ")", ";", "}" ]
Insert OP into the current hash table with a value number of RESULT.
[ "Insert", "OP", "into", "the", "current", "hash", "table", "with", "a", "value", "number", "of", "RESULT", "." ]
[]
[ { "param": "op", "type": "tree" }, { "param": "result", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "op", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_op_insert_stmt
vn_nary_op_t
vn_nary_op_t vn_nary_op_insert_stmt (gimple stmt, tree result) { vn_nary_op_t vno1 = alloc_vn_nary_op (vn_nary_length_from_stmt (stmt), result, VN_INFO (result)->value_id); init_vn_nary_op_from_stmt (vno1, stmt); return vn_nary_op_insert_into (vno1, current_info->nary, true); }
/* Insert the rhs of STMT into the current hash table with a value number of RESULT. */
Insert the rhs of STMT into the current hash table with a value number of RESULT.
[ "Insert", "the", "rhs", "of", "STMT", "into", "the", "current", "hash", "table", "with", "a", "value", "number", "of", "RESULT", "." ]
vn_nary_op_t vn_nary_op_insert_stmt (gimple stmt, tree result) { vn_nary_op_t vno1 = alloc_vn_nary_op (vn_nary_length_from_stmt (stmt), result, VN_INFO (result)->value_id); init_vn_nary_op_from_stmt (vno1, stmt); return vn_nary_op_insert_into (vno1, current_info->nary, true); }
[ "vn_nary_op_t", "vn_nary_op_insert_stmt", "(", "gimple", "stmt", ",", "tree", "result", ")", "{", "vn_nary_op_t", "vno1", "=", "alloc_vn_nary_op", "(", "vn_nary_length_from_stmt", "(", "stmt", ")", ",", "result", ",", "VN_INFO", "(", "result", ")", "->", "value_id", ")", ";", "init_vn_nary_op_from_stmt", "(", "vno1", ",", "stmt", ")", ";", "return", "vn_nary_op_insert_into", "(", "vno1", ",", "current_info", "->", "nary", ",", "true", ")", ";", "}" ]
Insert the rhs of STMT into the current hash table with a value number of RESULT.
[ "Insert", "the", "rhs", "of", "STMT", "into", "the", "current", "hash", "table", "with", "a", "value", "number", "of", "RESULT", "." ]
[]
[ { "param": "stmt", "type": "gimple" }, { "param": "result", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_phi_compute_hash
hashval_t
static inline hashval_t vn_phi_compute_hash (vn_phi_t vp1) { hashval_t result; int i; tree phi1op; tree type; result = vp1->block->index; /* If all PHI arguments are constants we need to distinguish the PHI node via its type. */ type = TREE_TYPE (VEC_index (tree, vp1->phiargs, 0)); result += (INTEGRAL_TYPE_P (type) + (INTEGRAL_TYPE_P (type) ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0)); FOR_EACH_VEC_ELT (tree, vp1->phiargs, i, phi1op) { if (phi1op == VN_TOP) continue; result = iterative_hash_expr (phi1op, result); } return result; }
/* Compute a hashcode for PHI operation VP1 and return it. */
Compute a hashcode for PHI operation VP1 and return it.
[ "Compute", "a", "hashcode", "for", "PHI", "operation", "VP1", "and", "return", "it", "." ]
static inline hashval_t vn_phi_compute_hash (vn_phi_t vp1) { hashval_t result; int i; tree phi1op; tree type; result = vp1->block->index; type = TREE_TYPE (VEC_index (tree, vp1->phiargs, 0)); result += (INTEGRAL_TYPE_P (type) + (INTEGRAL_TYPE_P (type) ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0)); FOR_EACH_VEC_ELT (tree, vp1->phiargs, i, phi1op) { if (phi1op == VN_TOP) continue; result = iterative_hash_expr (phi1op, result); } return result; }
[ "static", "inline", "hashval_t", "vn_phi_compute_hash", "(", "vn_phi_t", "vp1", ")", "{", "hashval_t", "result", ";", "int", "i", ";", "tree", "phi1op", ";", "tree", "type", ";", "result", "=", "vp1", "->", "block", "->", "index", ";", "type", "=", "TREE_TYPE", "(", "VEC_index", "(", "tree", ",", "vp1", "->", "phiargs", ",", "0", ")", ")", ";", "result", "+=", "(", "INTEGRAL_TYPE_P", "(", "type", ")", "+", "(", "INTEGRAL_TYPE_P", "(", "type", ")", "?", "TYPE_PRECISION", "(", "type", ")", "+", "TYPE_UNSIGNED", "(", "type", ")", ":", "0", ")", ")", ";", "FOR_EACH_VEC_ELT", "(", "tree", ",", "vp1", "->", "phiargs", ",", "i", ",", "phi1op", ")", "", "{", "if", "(", "phi1op", "==", "VN_TOP", ")", "continue", ";", "result", "=", "iterative_hash_expr", "(", "phi1op", ",", "result", ")", ";", "}", "return", "result", ";", "}" ]
Compute a hashcode for PHI operation VP1 and return it.
[ "Compute", "a", "hashcode", "for", "PHI", "operation", "VP1", "and", "return", "it", "." ]
[ "/* If all PHI arguments are constants we need to distinguish\n the PHI node via its type. */" ]
[ { "param": "vp1", "type": "vn_phi_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vp1", "type": "vn_phi_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_phi_hash
hashval_t
static hashval_t vn_phi_hash (const void *p1) { const_vn_phi_t const vp1 = (const_vn_phi_t) p1; return vp1->hashcode; }
/* Return the computed hashcode for phi operation P1. */
Return the computed hashcode for phi operation P1.
[ "Return", "the", "computed", "hashcode", "for", "phi", "operation", "P1", "." ]
static hashval_t vn_phi_hash (const void *p1) { const_vn_phi_t const vp1 = (const_vn_phi_t) p1; return vp1->hashcode; }
[ "static", "hashval_t", "vn_phi_hash", "(", "const", "void", "*", "p1", ")", "{", "const_vn_phi_t", "const", "vp1", "=", "(", "const_vn_phi_t", ")", "p1", ";", "return", "vp1", "->", "hashcode", ";", "}" ]
Return the computed hashcode for phi operation P1.
[ "Return", "the", "computed", "hashcode", "for", "phi", "operation", "P1", "." ]
[]
[ { "param": "p1", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p1", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_phi_eq
int
static int vn_phi_eq (const void *p1, const void *p2) { const_vn_phi_t const vp1 = (const_vn_phi_t) p1; const_vn_phi_t const vp2 = (const_vn_phi_t) p2; if (vp1->hashcode != vp2->hashcode) return false; if (vp1->block == vp2->block) { int i; tree phi1op; /* If the PHI nodes do not have compatible types they are not the same. */ if (!types_compatible_p (TREE_TYPE (VEC_index (tree, vp1->phiargs, 0)), TREE_TYPE (VEC_index (tree, vp2->phiargs, 0)))) return false; /* Any phi in the same block will have it's arguments in the same edge order, because of how we store phi nodes. */ FOR_EACH_VEC_ELT (tree, vp1->phiargs, i, phi1op) { tree phi2op = VEC_index (tree, vp2->phiargs, i); if (phi1op == VN_TOP || phi2op == VN_TOP) continue; if (!expressions_equal_p (phi1op, phi2op)) return false; } return true; } return false; }
/* Compare two phi entries for equality, ignoring VN_TOP arguments. */
Compare two phi entries for equality, ignoring VN_TOP arguments.
[ "Compare", "two", "phi", "entries", "for", "equality", "ignoring", "VN_TOP", "arguments", "." ]
static int vn_phi_eq (const void *p1, const void *p2) { const_vn_phi_t const vp1 = (const_vn_phi_t) p1; const_vn_phi_t const vp2 = (const_vn_phi_t) p2; if (vp1->hashcode != vp2->hashcode) return false; if (vp1->block == vp2->block) { int i; tree phi1op; if (!types_compatible_p (TREE_TYPE (VEC_index (tree, vp1->phiargs, 0)), TREE_TYPE (VEC_index (tree, vp2->phiargs, 0)))) return false; FOR_EACH_VEC_ELT (tree, vp1->phiargs, i, phi1op) { tree phi2op = VEC_index (tree, vp2->phiargs, i); if (phi1op == VN_TOP || phi2op == VN_TOP) continue; if (!expressions_equal_p (phi1op, phi2op)) return false; } return true; } return false; }
[ "static", "int", "vn_phi_eq", "(", "const", "void", "*", "p1", ",", "const", "void", "*", "p2", ")", "{", "const_vn_phi_t", "const", "vp1", "=", "(", "const_vn_phi_t", ")", "p1", ";", "const_vn_phi_t", "const", "vp2", "=", "(", "const_vn_phi_t", ")", "p2", ";", "if", "(", "vp1", "->", "hashcode", "!=", "vp2", "->", "hashcode", ")", "return", "false", ";", "if", "(", "vp1", "->", "block", "==", "vp2", "->", "block", ")", "{", "int", "i", ";", "tree", "phi1op", ";", "if", "(", "!", "types_compatible_p", "(", "TREE_TYPE", "(", "VEC_index", "(", "tree", ",", "vp1", "->", "phiargs", ",", "0", ")", ")", ",", "TREE_TYPE", "(", "VEC_index", "(", "tree", ",", "vp2", "->", "phiargs", ",", "0", ")", ")", ")", ")", "return", "false", ";", "FOR_EACH_VEC_ELT", "(", "tree", ",", "vp1", "->", "phiargs", ",", "i", ",", "phi1op", ")", "", "{", "tree", "phi2op", "=", "VEC_index", "(", "tree", ",", "vp2", "->", "phiargs", ",", "i", ")", ";", "if", "(", "phi1op", "==", "VN_TOP", "||", "phi2op", "==", "VN_TOP", ")", "continue", ";", "if", "(", "!", "expressions_equal_p", "(", "phi1op", ",", "phi2op", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "return", "false", ";", "}" ]
Compare two phi entries for equality, ignoring VN_TOP arguments.
[ "Compare", "two", "phi", "entries", "for", "equality", "ignoring", "VN_TOP", "arguments", "." ]
[ "/* If the PHI nodes do not have compatible types\n\t they are not the same. */", "/* Any phi in the same block will have it's arguments in the\n\t same edge order, because of how we store phi nodes. */" ]
[ { "param": "p1", "type": "void" }, { "param": "p2", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p1", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "p2", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_phi_lookup
tree
static tree vn_phi_lookup (gimple phi) { void **slot; struct vn_phi_s vp1; unsigned i; VEC_truncate (tree, shared_lookup_phiargs, 0); /* Canonicalize the SSA_NAME's to their value number. */ for (i = 0; i < gimple_phi_num_args (phi); i++) { tree def = PHI_ARG_DEF (phi, i); def = TREE_CODE (def) == SSA_NAME ? SSA_VAL (def) : def; VEC_safe_push (tree, heap, shared_lookup_phiargs, def); } vp1.phiargs = shared_lookup_phiargs; vp1.block = gimple_bb (phi); vp1.hashcode = vn_phi_compute_hash (&vp1); slot = htab_find_slot_with_hash (current_info->phis, &vp1, vp1.hashcode, NO_INSERT); if (!slot && current_info == optimistic_info) slot = htab_find_slot_with_hash (valid_info->phis, &vp1, vp1.hashcode, NO_INSERT); if (!slot) return NULL_TREE; return ((vn_phi_t)*slot)->result; }
/* Lookup PHI in the current hash table, and return the resulting value number if it exists in the hash table. Return NULL_TREE if it does not exist in the hash table. */
Lookup PHI in the current hash table, and return the resulting value number if it exists in the hash table. Return NULL_TREE if it does not exist in the hash table.
[ "Lookup", "PHI", "in", "the", "current", "hash", "table", "and", "return", "the", "resulting", "value", "number", "if", "it", "exists", "in", "the", "hash", "table", ".", "Return", "NULL_TREE", "if", "it", "does", "not", "exist", "in", "the", "hash", "table", "." ]
static tree vn_phi_lookup (gimple phi) { void **slot; struct vn_phi_s vp1; unsigned i; VEC_truncate (tree, shared_lookup_phiargs, 0); for (i = 0; i < gimple_phi_num_args (phi); i++) { tree def = PHI_ARG_DEF (phi, i); def = TREE_CODE (def) == SSA_NAME ? SSA_VAL (def) : def; VEC_safe_push (tree, heap, shared_lookup_phiargs, def); } vp1.phiargs = shared_lookup_phiargs; vp1.block = gimple_bb (phi); vp1.hashcode = vn_phi_compute_hash (&vp1); slot = htab_find_slot_with_hash (current_info->phis, &vp1, vp1.hashcode, NO_INSERT); if (!slot && current_info == optimistic_info) slot = htab_find_slot_with_hash (valid_info->phis, &vp1, vp1.hashcode, NO_INSERT); if (!slot) return NULL_TREE; return ((vn_phi_t)*slot)->result; }
[ "static", "tree", "vn_phi_lookup", "(", "gimple", "phi", ")", "{", "void", "*", "*", "slot", ";", "struct", "vn_phi_s", "vp1", ";", "unsigned", "i", ";", "VEC_truncate", "(", "tree", ",", "shared_lookup_phiargs", ",", "0", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "gimple_phi_num_args", "(", "phi", ")", ";", "i", "++", ")", "{", "tree", "def", "=", "PHI_ARG_DEF", "(", "phi", ",", "i", ")", ";", "def", "=", "TREE_CODE", "(", "def", ")", "==", "SSA_NAME", "?", "SSA_VAL", "(", "def", ")", ":", "def", ";", "VEC_safe_push", "(", "tree", ",", "heap", ",", "shared_lookup_phiargs", ",", "def", ")", ";", "}", "vp1", ".", "phiargs", "=", "shared_lookup_phiargs", ";", "vp1", ".", "block", "=", "gimple_bb", "(", "phi", ")", ";", "vp1", ".", "hashcode", "=", "vn_phi_compute_hash", "(", "&", "vp1", ")", ";", "slot", "=", "htab_find_slot_with_hash", "(", "current_info", "->", "phis", ",", "&", "vp1", ",", "vp1", ".", "hashcode", ",", "NO_INSERT", ")", ";", "if", "(", "!", "slot", "&&", "current_info", "==", "optimistic_info", ")", "slot", "=", "htab_find_slot_with_hash", "(", "valid_info", "->", "phis", ",", "&", "vp1", ",", "vp1", ".", "hashcode", ",", "NO_INSERT", ")", ";", "if", "(", "!", "slot", ")", "return", "NULL_TREE", ";", "return", "(", "(", "vn_phi_t", ")", "*", "slot", ")", "->", "result", ";", "}" ]
Lookup PHI in the current hash table, and return the resulting value number if it exists in the hash table.
[ "Lookup", "PHI", "in", "the", "current", "hash", "table", "and", "return", "the", "resulting", "value", "number", "if", "it", "exists", "in", "the", "hash", "table", "." ]
[ "/* Canonicalize the SSA_NAME's to their value number. */" ]
[ { "param": "phi", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "phi", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_phi_insert
vn_phi_t
static vn_phi_t vn_phi_insert (gimple phi, tree result) { void **slot; vn_phi_t vp1 = (vn_phi_t) pool_alloc (current_info->phis_pool); unsigned i; VEC (tree, heap) *args = NULL; /* Canonicalize the SSA_NAME's to their value number. */ for (i = 0; i < gimple_phi_num_args (phi); i++) { tree def = PHI_ARG_DEF (phi, i); def = TREE_CODE (def) == SSA_NAME ? SSA_VAL (def) : def; VEC_safe_push (tree, heap, args, def); } vp1->value_id = VN_INFO (result)->value_id; vp1->phiargs = args; vp1->block = gimple_bb (phi); vp1->result = result; vp1->hashcode = vn_phi_compute_hash (vp1); slot = htab_find_slot_with_hash (current_info->phis, vp1, vp1->hashcode, INSERT); /* Because we iterate over phi operations more than once, it's possible the slot might already exist here, hence no assert.*/ *slot = vp1; return vp1; }
/* Insert PHI into the current hash table with a value number of RESULT. */
Insert PHI into the current hash table with a value number of RESULT.
[ "Insert", "PHI", "into", "the", "current", "hash", "table", "with", "a", "value", "number", "of", "RESULT", "." ]
static vn_phi_t vn_phi_insert (gimple phi, tree result) { void **slot; vn_phi_t vp1 = (vn_phi_t) pool_alloc (current_info->phis_pool); unsigned i; VEC (tree, heap) *args = NULL; for (i = 0; i < gimple_phi_num_args (phi); i++) { tree def = PHI_ARG_DEF (phi, i); def = TREE_CODE (def) == SSA_NAME ? SSA_VAL (def) : def; VEC_safe_push (tree, heap, args, def); } vp1->value_id = VN_INFO (result)->value_id; vp1->phiargs = args; vp1->block = gimple_bb (phi); vp1->result = result; vp1->hashcode = vn_phi_compute_hash (vp1); slot = htab_find_slot_with_hash (current_info->phis, vp1, vp1->hashcode, INSERT); *slot = vp1; return vp1; }
[ "static", "vn_phi_t", "vn_phi_insert", "(", "gimple", "phi", ",", "tree", "result", ")", "{", "void", "*", "*", "slot", ";", "vn_phi_t", "vp1", "=", "(", "vn_phi_t", ")", "pool_alloc", "(", "current_info", "->", "phis_pool", ")", ";", "unsigned", "i", ";", "VEC", "(", "tree", ",", "heap", ")", "*", "args", "=", "NULL", ";", "for", "(", "i", "=", "0", ";", "i", "<", "gimple_phi_num_args", "(", "phi", ")", ";", "i", "++", ")", "{", "tree", "def", "=", "PHI_ARG_DEF", "(", "phi", ",", "i", ")", ";", "def", "=", "TREE_CODE", "(", "def", ")", "==", "SSA_NAME", "?", "SSA_VAL", "(", "def", ")", ":", "def", ";", "VEC_safe_push", "(", "tree", ",", "heap", ",", "args", ",", "def", ")", ";", "}", "vp1", "->", "value_id", "=", "VN_INFO", "(", "result", ")", "->", "value_id", ";", "vp1", "->", "phiargs", "=", "args", ";", "vp1", "->", "block", "=", "gimple_bb", "(", "phi", ")", ";", "vp1", "->", "result", "=", "result", ";", "vp1", "->", "hashcode", "=", "vn_phi_compute_hash", "(", "vp1", ")", ";", "slot", "=", "htab_find_slot_with_hash", "(", "current_info", "->", "phis", ",", "vp1", ",", "vp1", "->", "hashcode", ",", "INSERT", ")", ";", "*", "slot", "=", "vp1", ";", "return", "vp1", ";", "}" ]
Insert PHI into the current hash table with a value number of RESULT.
[ "Insert", "PHI", "into", "the", "current", "hash", "table", "with", "a", "value", "number", "of", "RESULT", "." ]
[ "/* Canonicalize the SSA_NAME's to their value number. */", "/* Because we iterate over phi operations more than once, it's\n possible the slot might already exist here, hence no assert.*/" ]
[ { "param": "phi", "type": "gimple" }, { "param": "result", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "phi", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
defs_to_varying
bool
static bool defs_to_varying (gimple stmt) { bool changed = false; ssa_op_iter iter; def_operand_p defp; FOR_EACH_SSA_DEF_OPERAND (defp, stmt, iter, SSA_OP_ALL_DEFS) { tree def = DEF_FROM_PTR (defp); VN_INFO (def)->use_processed = true; changed |= set_ssa_val_to (def, def); } return changed; }
/* Set all definitions in STMT to value number to themselves. Return true if a value number changed. */
Set all definitions in STMT to value number to themselves. Return true if a value number changed.
[ "Set", "all", "definitions", "in", "STMT", "to", "value", "number", "to", "themselves", ".", "Return", "true", "if", "a", "value", "number", "changed", "." ]
static bool defs_to_varying (gimple stmt) { bool changed = false; ssa_op_iter iter; def_operand_p defp; FOR_EACH_SSA_DEF_OPERAND (defp, stmt, iter, SSA_OP_ALL_DEFS) { tree def = DEF_FROM_PTR (defp); VN_INFO (def)->use_processed = true; changed |= set_ssa_val_to (def, def); } return changed; }
[ "static", "bool", "defs_to_varying", "(", "gimple", "stmt", ")", "{", "bool", "changed", "=", "false", ";", "ssa_op_iter", "iter", ";", "def_operand_p", "defp", ";", "FOR_EACH_SSA_DEF_OPERAND", "(", "defp", ",", "stmt", ",", "iter", ",", "SSA_OP_ALL_DEFS", ")", "", "{", "tree", "def", "=", "DEF_FROM_PTR", "(", "defp", ")", ";", "VN_INFO", "(", "def", ")", "->", "use_processed", "=", "true", ";", "changed", "|=", "set_ssa_val_to", "(", "def", ",", "def", ")", ";", "}", "return", "changed", ";", "}" ]
Set all definitions in STMT to value number to themselves.
[ "Set", "all", "definitions", "in", "STMT", "to", "value", "number", "to", "themselves", "." ]
[]
[ { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
visit_copy
bool
static bool visit_copy (tree lhs, tree rhs) { /* Follow chains of copies to their destination. */ while (TREE_CODE (rhs) == SSA_NAME && SSA_VAL (rhs) != rhs) rhs = SSA_VAL (rhs); /* The copy may have a more interesting constant filled expression (we don't, since we know our RHS is just an SSA name). */ if (TREE_CODE (rhs) == SSA_NAME) { VN_INFO (lhs)->has_constants = VN_INFO (rhs)->has_constants; VN_INFO (lhs)->expr = VN_INFO (rhs)->expr; } return set_ssa_val_to (lhs, rhs); }
/* Visit a copy between LHS and RHS, return true if the value number changed. */
Visit a copy between LHS and RHS, return true if the value number changed.
[ "Visit", "a", "copy", "between", "LHS", "and", "RHS", "return", "true", "if", "the", "value", "number", "changed", "." ]
static bool visit_copy (tree lhs, tree rhs) { while (TREE_CODE (rhs) == SSA_NAME && SSA_VAL (rhs) != rhs) rhs = SSA_VAL (rhs); if (TREE_CODE (rhs) == SSA_NAME) { VN_INFO (lhs)->has_constants = VN_INFO (rhs)->has_constants; VN_INFO (lhs)->expr = VN_INFO (rhs)->expr; } return set_ssa_val_to (lhs, rhs); }
[ "static", "bool", "visit_copy", "(", "tree", "lhs", ",", "tree", "rhs", ")", "{", "while", "(", "TREE_CODE", "(", "rhs", ")", "==", "SSA_NAME", "&&", "SSA_VAL", "(", "rhs", ")", "!=", "rhs", ")", "rhs", "=", "SSA_VAL", "(", "rhs", ")", ";", "if", "(", "TREE_CODE", "(", "rhs", ")", "==", "SSA_NAME", ")", "{", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "VN_INFO", "(", "rhs", ")", "->", "has_constants", ";", "VN_INFO", "(", "lhs", ")", "->", "expr", "=", "VN_INFO", "(", "rhs", ")", "->", "expr", ";", "}", "return", "set_ssa_val_to", "(", "lhs", ",", "rhs", ")", ";", "}" ]
Visit a copy between LHS and RHS, return true if the value number changed.
[ "Visit", "a", "copy", "between", "LHS", "and", "RHS", "return", "true", "if", "the", "value", "number", "changed", "." ]
[ "/* Follow chains of copies to their destination. */", "/* The copy may have a more interesting constant filled expression\n (we don't, since we know our RHS is just an SSA name). */" ]
[ { "param": "lhs", "type": "tree" }, { "param": "rhs", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lhs", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhs", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
visit_nary_op
bool
static bool visit_nary_op (tree lhs, gimple stmt) { bool changed = false; tree result = vn_nary_op_lookup_stmt (stmt, NULL); if (result) changed = set_ssa_val_to (lhs, result); else { changed = set_ssa_val_to (lhs, lhs); vn_nary_op_insert_stmt (stmt, lhs); } return changed; }
/* Visit a nary operator RHS, value number it, and return true if the value number of LHS has changed as a result. */
Visit a nary operator RHS, value number it, and return true if the value number of LHS has changed as a result.
[ "Visit", "a", "nary", "operator", "RHS", "value", "number", "it", "and", "return", "true", "if", "the", "value", "number", "of", "LHS", "has", "changed", "as", "a", "result", "." ]
static bool visit_nary_op (tree lhs, gimple stmt) { bool changed = false; tree result = vn_nary_op_lookup_stmt (stmt, NULL); if (result) changed = set_ssa_val_to (lhs, result); else { changed = set_ssa_val_to (lhs, lhs); vn_nary_op_insert_stmt (stmt, lhs); } return changed; }
[ "static", "bool", "visit_nary_op", "(", "tree", "lhs", ",", "gimple", "stmt", ")", "{", "bool", "changed", "=", "false", ";", "tree", "result", "=", "vn_nary_op_lookup_stmt", "(", "stmt", ",", "NULL", ")", ";", "if", "(", "result", ")", "changed", "=", "set_ssa_val_to", "(", "lhs", ",", "result", ")", ";", "else", "{", "changed", "=", "set_ssa_val_to", "(", "lhs", ",", "lhs", ")", ";", "vn_nary_op_insert_stmt", "(", "stmt", ",", "lhs", ")", ";", "}", "return", "changed", ";", "}" ]
Visit a nary operator RHS, value number it, and return true if the value number of LHS has changed as a result.
[ "Visit", "a", "nary", "operator", "RHS", "value", "number", "it", "and", "return", "true", "if", "the", "value", "number", "of", "LHS", "has", "changed", "as", "a", "result", "." ]
[]
[ { "param": "lhs", "type": "tree" }, { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lhs", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
visit_reference_op_call
bool
static bool visit_reference_op_call (tree lhs, gimple stmt) { bool changed = false; struct vn_reference_s vr1; tree result; tree vuse = gimple_vuse (stmt); vr1.vuse = vuse ? SSA_VAL (vuse) : NULL_TREE; vr1.operands = valueize_shared_reference_ops_from_call (stmt); vr1.type = gimple_expr_type (stmt); vr1.set = 0; vr1.hashcode = vn_reference_compute_hash (&vr1); result = vn_reference_lookup_1 (&vr1, NULL); if (result) { changed = set_ssa_val_to (lhs, result); if (TREE_CODE (result) == SSA_NAME && VN_INFO (result)->has_constants) VN_INFO (lhs)->has_constants = true; } else { void **slot; vn_reference_t vr2; changed = set_ssa_val_to (lhs, lhs); vr2 = (vn_reference_t) pool_alloc (current_info->references_pool); vr2->vuse = vr1.vuse; vr2->operands = valueize_refs (create_reference_ops_from_call (stmt)); vr2->type = vr1.type; vr2->set = vr1.set; vr2->hashcode = vr1.hashcode; vr2->result = lhs; slot = htab_find_slot_with_hash (current_info->references, vr2, vr2->hashcode, INSERT); if (*slot) free_reference (*slot); *slot = vr2; } return changed; }
/* Visit a call STMT storing into LHS. Return true if the value number of the LHS has changed as a result. */
Visit a call STMT storing into LHS. Return true if the value number of the LHS has changed as a result.
[ "Visit", "a", "call", "STMT", "storing", "into", "LHS", ".", "Return", "true", "if", "the", "value", "number", "of", "the", "LHS", "has", "changed", "as", "a", "result", "." ]
static bool visit_reference_op_call (tree lhs, gimple stmt) { bool changed = false; struct vn_reference_s vr1; tree result; tree vuse = gimple_vuse (stmt); vr1.vuse = vuse ? SSA_VAL (vuse) : NULL_TREE; vr1.operands = valueize_shared_reference_ops_from_call (stmt); vr1.type = gimple_expr_type (stmt); vr1.set = 0; vr1.hashcode = vn_reference_compute_hash (&vr1); result = vn_reference_lookup_1 (&vr1, NULL); if (result) { changed = set_ssa_val_to (lhs, result); if (TREE_CODE (result) == SSA_NAME && VN_INFO (result)->has_constants) VN_INFO (lhs)->has_constants = true; } else { void **slot; vn_reference_t vr2; changed = set_ssa_val_to (lhs, lhs); vr2 = (vn_reference_t) pool_alloc (current_info->references_pool); vr2->vuse = vr1.vuse; vr2->operands = valueize_refs (create_reference_ops_from_call (stmt)); vr2->type = vr1.type; vr2->set = vr1.set; vr2->hashcode = vr1.hashcode; vr2->result = lhs; slot = htab_find_slot_with_hash (current_info->references, vr2, vr2->hashcode, INSERT); if (*slot) free_reference (*slot); *slot = vr2; } return changed; }
[ "static", "bool", "visit_reference_op_call", "(", "tree", "lhs", ",", "gimple", "stmt", ")", "{", "bool", "changed", "=", "false", ";", "struct", "vn_reference_s", "vr1", ";", "tree", "result", ";", "tree", "vuse", "=", "gimple_vuse", "(", "stmt", ")", ";", "vr1", ".", "vuse", "=", "vuse", "?", "SSA_VAL", "(", "vuse", ")", ":", "NULL_TREE", ";", "vr1", ".", "operands", "=", "valueize_shared_reference_ops_from_call", "(", "stmt", ")", ";", "vr1", ".", "type", "=", "gimple_expr_type", "(", "stmt", ")", ";", "vr1", ".", "set", "=", "0", ";", "vr1", ".", "hashcode", "=", "vn_reference_compute_hash", "(", "&", "vr1", ")", ";", "result", "=", "vn_reference_lookup_1", "(", "&", "vr1", ",", "NULL", ")", ";", "if", "(", "result", ")", "{", "changed", "=", "set_ssa_val_to", "(", "lhs", ",", "result", ")", ";", "if", "(", "TREE_CODE", "(", "result", ")", "==", "SSA_NAME", "&&", "VN_INFO", "(", "result", ")", "->", "has_constants", ")", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "true", ";", "}", "else", "{", "void", "*", "*", "slot", ";", "vn_reference_t", "vr2", ";", "changed", "=", "set_ssa_val_to", "(", "lhs", ",", "lhs", ")", ";", "vr2", "=", "(", "vn_reference_t", ")", "pool_alloc", "(", "current_info", "->", "references_pool", ")", ";", "vr2", "->", "vuse", "=", "vr1", ".", "vuse", ";", "vr2", "->", "operands", "=", "valueize_refs", "(", "create_reference_ops_from_call", "(", "stmt", ")", ")", ";", "vr2", "->", "type", "=", "vr1", ".", "type", ";", "vr2", "->", "set", "=", "vr1", ".", "set", ";", "vr2", "->", "hashcode", "=", "vr1", ".", "hashcode", ";", "vr2", "->", "result", "=", "lhs", ";", "slot", "=", "htab_find_slot_with_hash", "(", "current_info", "->", "references", ",", "vr2", ",", "vr2", "->", "hashcode", ",", "INSERT", ")", ";", "if", "(", "*", "slot", ")", "free_reference", "(", "*", "slot", ")", ";", "*", "slot", "=", "vr2", ";", "}", "return", "changed", ";", "}" ]
Visit a call STMT storing into LHS.
[ "Visit", "a", "call", "STMT", "storing", "into", "LHS", "." ]
[]
[ { "param": "lhs", "type": "tree" }, { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lhs", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
visit_reference_op_load
bool
static bool visit_reference_op_load (tree lhs, tree op, gimple stmt) { bool changed = false; tree last_vuse; tree result; last_vuse = gimple_vuse (stmt); last_vuse_ptr = &last_vuse; result = vn_reference_lookup (op, gimple_vuse (stmt), default_vn_walk_kind, NULL); last_vuse_ptr = NULL; /* If we have a VCE, try looking up its operand as it might be stored in a different type. */ if (!result && TREE_CODE (op) == VIEW_CONVERT_EXPR) result = vn_reference_lookup (TREE_OPERAND (op, 0), gimple_vuse (stmt), default_vn_walk_kind, NULL); /* We handle type-punning through unions by value-numbering based on offset and size of the access. Be prepared to handle a type-mismatch here via creating a VIEW_CONVERT_EXPR. */ if (result && !useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (op))) { /* We will be setting the value number of lhs to the value number of VIEW_CONVERT_EXPR <TREE_TYPE (result)> (result). So first simplify and lookup this expression to see if it is already available. */ tree val = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (op), result); if ((CONVERT_EXPR_P (val) || TREE_CODE (val) == VIEW_CONVERT_EXPR) && TREE_CODE (TREE_OPERAND (val, 0)) == SSA_NAME) { tree tem = valueize_expr (vn_get_expr_for (TREE_OPERAND (val, 0))); if ((CONVERT_EXPR_P (tem) || TREE_CODE (tem) == VIEW_CONVERT_EXPR) && (tem = fold_unary_ignore_overflow (TREE_CODE (val), TREE_TYPE (val), tem))) val = tem; } result = val; if (!is_gimple_min_invariant (val) && TREE_CODE (val) != SSA_NAME) result = vn_nary_op_lookup (val, NULL); /* If the expression is not yet available, value-number lhs to a new SSA_NAME we create. */ if (!result) { result = make_ssa_name (SSA_NAME_VAR (lhs), gimple_build_nop ()); /* Initialize value-number information properly. */ VN_INFO_GET (result)->valnum = result; VN_INFO (result)->value_id = get_next_value_id (); VN_INFO (result)->expr = val; VN_INFO (result)->has_constants = expr_has_constants (val); VN_INFO (result)->needs_insertion = true; /* As all "inserted" statements are singleton SCCs, insert to the valid table. This is strictly needed to avoid re-generating new value SSA_NAMEs for the same expression during SCC iteration over and over (the optimistic table gets cleared after each iteration). We do not need to insert into the optimistic table, as lookups there will fall back to the valid table. */ if (current_info == optimistic_info) { current_info = valid_info; vn_nary_op_insert (val, result); current_info = optimistic_info; } else vn_nary_op_insert (val, result); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Inserting name "); print_generic_expr (dump_file, result, 0); fprintf (dump_file, " for expression "); print_generic_expr (dump_file, val, 0); fprintf (dump_file, "\n"); } } } if (result) { changed = set_ssa_val_to (lhs, result); if (TREE_CODE (result) == SSA_NAME && VN_INFO (result)->has_constants) { VN_INFO (lhs)->expr = VN_INFO (result)->expr; VN_INFO (lhs)->has_constants = true; } } else { changed = set_ssa_val_to (lhs, lhs); vn_reference_insert (op, lhs, last_vuse); } return changed; }
/* Visit a load from a reference operator RHS, part of STMT, value number it, and return true if the value number of the LHS has changed as a result. */
Visit a load from a reference operator RHS, part of STMT, value number it, and return true if the value number of the LHS has changed as a result.
[ "Visit", "a", "load", "from", "a", "reference", "operator", "RHS", "part", "of", "STMT", "value", "number", "it", "and", "return", "true", "if", "the", "value", "number", "of", "the", "LHS", "has", "changed", "as", "a", "result", "." ]
static bool visit_reference_op_load (tree lhs, tree op, gimple stmt) { bool changed = false; tree last_vuse; tree result; last_vuse = gimple_vuse (stmt); last_vuse_ptr = &last_vuse; result = vn_reference_lookup (op, gimple_vuse (stmt), default_vn_walk_kind, NULL); last_vuse_ptr = NULL; if (!result && TREE_CODE (op) == VIEW_CONVERT_EXPR) result = vn_reference_lookup (TREE_OPERAND (op, 0), gimple_vuse (stmt), default_vn_walk_kind, NULL); if (result && !useless_type_conversion_p (TREE_TYPE (result), TREE_TYPE (op))) { tree val = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (op), result); if ((CONVERT_EXPR_P (val) || TREE_CODE (val) == VIEW_CONVERT_EXPR) && TREE_CODE (TREE_OPERAND (val, 0)) == SSA_NAME) { tree tem = valueize_expr (vn_get_expr_for (TREE_OPERAND (val, 0))); if ((CONVERT_EXPR_P (tem) || TREE_CODE (tem) == VIEW_CONVERT_EXPR) && (tem = fold_unary_ignore_overflow (TREE_CODE (val), TREE_TYPE (val), tem))) val = tem; } result = val; if (!is_gimple_min_invariant (val) && TREE_CODE (val) != SSA_NAME) result = vn_nary_op_lookup (val, NULL); if (!result) { result = make_ssa_name (SSA_NAME_VAR (lhs), gimple_build_nop ()); VN_INFO_GET (result)->valnum = result; VN_INFO (result)->value_id = get_next_value_id (); VN_INFO (result)->expr = val; VN_INFO (result)->has_constants = expr_has_constants (val); VN_INFO (result)->needs_insertion = true; if (current_info == optimistic_info) { current_info = valid_info; vn_nary_op_insert (val, result); current_info = optimistic_info; } else vn_nary_op_insert (val, result); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Inserting name "); print_generic_expr (dump_file, result, 0); fprintf (dump_file, " for expression "); print_generic_expr (dump_file, val, 0); fprintf (dump_file, "\n"); } } } if (result) { changed = set_ssa_val_to (lhs, result); if (TREE_CODE (result) == SSA_NAME && VN_INFO (result)->has_constants) { VN_INFO (lhs)->expr = VN_INFO (result)->expr; VN_INFO (lhs)->has_constants = true; } } else { changed = set_ssa_val_to (lhs, lhs); vn_reference_insert (op, lhs, last_vuse); } return changed; }
[ "static", "bool", "visit_reference_op_load", "(", "tree", "lhs", ",", "tree", "op", ",", "gimple", "stmt", ")", "{", "bool", "changed", "=", "false", ";", "tree", "last_vuse", ";", "tree", "result", ";", "last_vuse", "=", "gimple_vuse", "(", "stmt", ")", ";", "last_vuse_ptr", "=", "&", "last_vuse", ";", "result", "=", "vn_reference_lookup", "(", "op", ",", "gimple_vuse", "(", "stmt", ")", ",", "default_vn_walk_kind", ",", "NULL", ")", ";", "last_vuse_ptr", "=", "NULL", ";", "if", "(", "!", "result", "&&", "TREE_CODE", "(", "op", ")", "==", "VIEW_CONVERT_EXPR", ")", "result", "=", "vn_reference_lookup", "(", "TREE_OPERAND", "(", "op", ",", "0", ")", ",", "gimple_vuse", "(", "stmt", ")", ",", "default_vn_walk_kind", ",", "NULL", ")", ";", "if", "(", "result", "&&", "!", "useless_type_conversion_p", "(", "TREE_TYPE", "(", "result", ")", ",", "TREE_TYPE", "(", "op", ")", ")", ")", "{", "tree", "val", "=", "fold_build1", "(", "VIEW_CONVERT_EXPR", ",", "TREE_TYPE", "(", "op", ")", ",", "result", ")", ";", "if", "(", "(", "CONVERT_EXPR_P", "(", "val", ")", "||", "TREE_CODE", "(", "val", ")", "==", "VIEW_CONVERT_EXPR", ")", "&&", "TREE_CODE", "(", "TREE_OPERAND", "(", "val", ",", "0", ")", ")", "==", "SSA_NAME", ")", "{", "tree", "tem", "=", "valueize_expr", "(", "vn_get_expr_for", "(", "TREE_OPERAND", "(", "val", ",", "0", ")", ")", ")", ";", "if", "(", "(", "CONVERT_EXPR_P", "(", "tem", ")", "||", "TREE_CODE", "(", "tem", ")", "==", "VIEW_CONVERT_EXPR", ")", "&&", "(", "tem", "=", "fold_unary_ignore_overflow", "(", "TREE_CODE", "(", "val", ")", ",", "TREE_TYPE", "(", "val", ")", ",", "tem", ")", ")", ")", "val", "=", "tem", ";", "}", "result", "=", "val", ";", "if", "(", "!", "is_gimple_min_invariant", "(", "val", ")", "&&", "TREE_CODE", "(", "val", ")", "!=", "SSA_NAME", ")", "result", "=", "vn_nary_op_lookup", "(", "val", ",", "NULL", ")", ";", "if", "(", "!", "result", ")", "{", "result", "=", "make_ssa_name", "(", "SSA_NAME_VAR", "(", "lhs", ")", ",", "gimple_build_nop", "(", ")", ")", ";", "VN_INFO_GET", "(", "result", ")", "->", "valnum", "=", "result", ";", "VN_INFO", "(", "result", ")", "->", "value_id", "=", "get_next_value_id", "(", ")", ";", "VN_INFO", "(", "result", ")", "->", "expr", "=", "val", ";", "VN_INFO", "(", "result", ")", "->", "has_constants", "=", "expr_has_constants", "(", "val", ")", ";", "VN_INFO", "(", "result", ")", "->", "needs_insertion", "=", "true", ";", "if", "(", "current_info", "==", "optimistic_info", ")", "{", "current_info", "=", "valid_info", ";", "vn_nary_op_insert", "(", "val", ",", "result", ")", ";", "current_info", "=", "optimistic_info", ";", "}", "else", "vn_nary_op_insert", "(", "val", ",", "result", ")", ";", "if", "(", "dump_file", "&&", "(", "dump_flags", "&", "TDF_DETAILS", ")", ")", "{", "fprintf", "(", "dump_file", ",", "\"", "\"", ")", ";", "print_generic_expr", "(", "dump_file", ",", "result", ",", "0", ")", ";", "fprintf", "(", "dump_file", ",", "\"", "\"", ")", ";", "print_generic_expr", "(", "dump_file", ",", "val", ",", "0", ")", ";", "fprintf", "(", "dump_file", ",", "\"", "\\n", "\"", ")", ";", "}", "}", "}", "if", "(", "result", ")", "{", "changed", "=", "set_ssa_val_to", "(", "lhs", ",", "result", ")", ";", "if", "(", "TREE_CODE", "(", "result", ")", "==", "SSA_NAME", "&&", "VN_INFO", "(", "result", ")", "->", "has_constants", ")", "{", "VN_INFO", "(", "lhs", ")", "->", "expr", "=", "VN_INFO", "(", "result", ")", "->", "expr", ";", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "true", ";", "}", "}", "else", "{", "changed", "=", "set_ssa_val_to", "(", "lhs", ",", "lhs", ")", ";", "vn_reference_insert", "(", "op", ",", "lhs", ",", "last_vuse", ")", ";", "}", "return", "changed", ";", "}" ]
Visit a load from a reference operator RHS, part of STMT, value number it, and return true if the value number of the LHS has changed as a result.
[ "Visit", "a", "load", "from", "a", "reference", "operator", "RHS", "part", "of", "STMT", "value", "number", "it", "and", "return", "true", "if", "the", "value", "number", "of", "the", "LHS", "has", "changed", "as", "a", "result", "." ]
[ "/* If we have a VCE, try looking up its operand as it might be stored in\n a different type. */", "/* We handle type-punning through unions by value-numbering based\n on offset and size of the access. Be prepared to handle a\n type-mismatch here via creating a VIEW_CONVERT_EXPR. */", "/* We will be setting the value number of lhs to the value number\n\t of VIEW_CONVERT_EXPR <TREE_TYPE (result)> (result).\n\t So first simplify and lookup this expression to see if it\n\t is already available. */", "/* If the expression is not yet available, value-number lhs to\n\t a new SSA_NAME we create. */", "/* Initialize value-number information properly. */", "/* As all \"inserted\" statements are singleton SCCs, insert\n\t to the valid table. This is strictly needed to\n\t avoid re-generating new value SSA_NAMEs for the same\n\t expression during SCC iteration over and over (the\n\t optimistic table gets cleared after each iteration).\n\t We do not need to insert into the optimistic table, as\n\t lookups there will fall back to the valid table. */" ]
[ { "param": "lhs", "type": "tree" }, { "param": "op", "type": "tree" }, { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lhs", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "op", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
visit_reference_op_store
bool
static bool visit_reference_op_store (tree lhs, tree op, gimple stmt) { bool changed = false; tree result; bool resultsame = false; /* First we want to lookup using the *vuses* from the store and see if there the last store to this location with the same address had the same value. The vuses represent the memory state before the store. If the memory state, address, and value of the store is the same as the last store to this location, then this store will produce the same memory state as that store. In this case the vdef versions for this store are value numbered to those vuse versions, since they represent the same memory state after this store. Otherwise, the vdefs for the store are used when inserting into the table, since the store generates a new memory state. */ result = vn_reference_lookup (lhs, gimple_vuse (stmt), VN_NOWALK, NULL); if (result) { if (TREE_CODE (result) == SSA_NAME) result = SSA_VAL (result); if (TREE_CODE (op) == SSA_NAME) op = SSA_VAL (op); resultsame = expressions_equal_p (result, op); } if (!result || !resultsame) { tree vdef; if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "No store match\n"); fprintf (dump_file, "Value numbering store "); print_generic_expr (dump_file, lhs, 0); fprintf (dump_file, " to "); print_generic_expr (dump_file, op, 0); fprintf (dump_file, "\n"); } /* Have to set value numbers before insert, since insert is going to valueize the references in-place. */ if ((vdef = gimple_vdef (stmt))) { VN_INFO (vdef)->use_processed = true; changed |= set_ssa_val_to (vdef, vdef); } /* Do not insert structure copies into the tables. */ if (is_gimple_min_invariant (op) || is_gimple_reg (op)) vn_reference_insert (lhs, op, vdef); } else { /* We had a match, so value number the vdef to have the value number of the vuse it came from. */ tree def, use; if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Store matched earlier value," "value numbering store vdefs to matching vuses.\n"); def = gimple_vdef (stmt); use = gimple_vuse (stmt); VN_INFO (def)->use_processed = true; changed |= set_ssa_val_to (def, SSA_VAL (use)); } return changed; }
/* Visit a store to a reference operator LHS, part of STMT, value number it, and return true if the value number of the LHS has changed as a result. */
Visit a store to a reference operator LHS, part of STMT, value number it, and return true if the value number of the LHS has changed as a result.
[ "Visit", "a", "store", "to", "a", "reference", "operator", "LHS", "part", "of", "STMT", "value", "number", "it", "and", "return", "true", "if", "the", "value", "number", "of", "the", "LHS", "has", "changed", "as", "a", "result", "." ]
static bool visit_reference_op_store (tree lhs, tree op, gimple stmt) { bool changed = false; tree result; bool resultsame = false; result = vn_reference_lookup (lhs, gimple_vuse (stmt), VN_NOWALK, NULL); if (result) { if (TREE_CODE (result) == SSA_NAME) result = SSA_VAL (result); if (TREE_CODE (op) == SSA_NAME) op = SSA_VAL (op); resultsame = expressions_equal_p (result, op); } if (!result || !resultsame) { tree vdef; if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "No store match\n"); fprintf (dump_file, "Value numbering store "); print_generic_expr (dump_file, lhs, 0); fprintf (dump_file, " to "); print_generic_expr (dump_file, op, 0); fprintf (dump_file, "\n"); } if ((vdef = gimple_vdef (stmt))) { VN_INFO (vdef)->use_processed = true; changed |= set_ssa_val_to (vdef, vdef); } if (is_gimple_min_invariant (op) || is_gimple_reg (op)) vn_reference_insert (lhs, op, vdef); } else { tree def, use; if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Store matched earlier value," "value numbering store vdefs to matching vuses.\n"); def = gimple_vdef (stmt); use = gimple_vuse (stmt); VN_INFO (def)->use_processed = true; changed |= set_ssa_val_to (def, SSA_VAL (use)); } return changed; }
[ "static", "bool", "visit_reference_op_store", "(", "tree", "lhs", ",", "tree", "op", ",", "gimple", "stmt", ")", "{", "bool", "changed", "=", "false", ";", "tree", "result", ";", "bool", "resultsame", "=", "false", ";", "result", "=", "vn_reference_lookup", "(", "lhs", ",", "gimple_vuse", "(", "stmt", ")", ",", "VN_NOWALK", ",", "NULL", ")", ";", "if", "(", "result", ")", "{", "if", "(", "TREE_CODE", "(", "result", ")", "==", "SSA_NAME", ")", "result", "=", "SSA_VAL", "(", "result", ")", ";", "if", "(", "TREE_CODE", "(", "op", ")", "==", "SSA_NAME", ")", "op", "=", "SSA_VAL", "(", "op", ")", ";", "resultsame", "=", "expressions_equal_p", "(", "result", ",", "op", ")", ";", "}", "if", "(", "!", "result", "||", "!", "resultsame", ")", "{", "tree", "vdef", ";", "if", "(", "dump_file", "&&", "(", "dump_flags", "&", "TDF_DETAILS", ")", ")", "{", "fprintf", "(", "dump_file", ",", "\"", "\\n", "\"", ")", ";", "fprintf", "(", "dump_file", ",", "\"", "\"", ")", ";", "print_generic_expr", "(", "dump_file", ",", "lhs", ",", "0", ")", ";", "fprintf", "(", "dump_file", ",", "\"", "\"", ")", ";", "print_generic_expr", "(", "dump_file", ",", "op", ",", "0", ")", ";", "fprintf", "(", "dump_file", ",", "\"", "\\n", "\"", ")", ";", "}", "if", "(", "(", "vdef", "=", "gimple_vdef", "(", "stmt", ")", ")", ")", "{", "VN_INFO", "(", "vdef", ")", "->", "use_processed", "=", "true", ";", "changed", "|=", "set_ssa_val_to", "(", "vdef", ",", "vdef", ")", ";", "}", "if", "(", "is_gimple_min_invariant", "(", "op", ")", "||", "is_gimple_reg", "(", "op", ")", ")", "vn_reference_insert", "(", "lhs", ",", "op", ",", "vdef", ")", ";", "}", "else", "{", "tree", "def", ",", "use", ";", "if", "(", "dump_file", "&&", "(", "dump_flags", "&", "TDF_DETAILS", ")", ")", "fprintf", "(", "dump_file", ",", "\"", "\"", "\"", "\\n", "\"", ")", ";", "def", "=", "gimple_vdef", "(", "stmt", ")", ";", "use", "=", "gimple_vuse", "(", "stmt", ")", ";", "VN_INFO", "(", "def", ")", "->", "use_processed", "=", "true", ";", "changed", "|=", "set_ssa_val_to", "(", "def", ",", "SSA_VAL", "(", "use", ")", ")", ";", "}", "return", "changed", ";", "}" ]
Visit a store to a reference operator LHS, part of STMT, value number it, and return true if the value number of the LHS has changed as a result.
[ "Visit", "a", "store", "to", "a", "reference", "operator", "LHS", "part", "of", "STMT", "value", "number", "it", "and", "return", "true", "if", "the", "value", "number", "of", "the", "LHS", "has", "changed", "as", "a", "result", "." ]
[ "/* First we want to lookup using the *vuses* from the store and see\n if there the last store to this location with the same address\n had the same value.\n\n The vuses represent the memory state before the store. If the\n memory state, address, and value of the store is the same as the\n last store to this location, then this store will produce the\n same memory state as that store.\n\n In this case the vdef versions for this store are value numbered to those\n vuse versions, since they represent the same memory state after\n this store.\n\n Otherwise, the vdefs for the store are used when inserting into\n the table, since the store generates a new memory state. */", "/* Have to set value numbers before insert, since insert is\n\t going to valueize the references in-place. */", "/* Do not insert structure copies into the tables. */", "/* We had a match, so value number the vdef to have the value\n\t number of the vuse it came from. */" ]
[ { "param": "lhs", "type": "tree" }, { "param": "op", "type": "tree" }, { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lhs", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "op", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
visit_phi
bool
static bool visit_phi (gimple phi) { bool changed = false; tree result; tree sameval = VN_TOP; bool allsame = true; unsigned i; /* TODO: We could check for this in init_sccvn, and replace this with a gcc_assert. */ if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi))) return set_ssa_val_to (PHI_RESULT (phi), PHI_RESULT (phi)); /* See if all non-TOP arguments have the same value. TOP is equivalent to everything, so we can ignore it. */ for (i = 0; i < gimple_phi_num_args (phi); i++) { tree def = PHI_ARG_DEF (phi, i); if (TREE_CODE (def) == SSA_NAME) def = SSA_VAL (def); if (def == VN_TOP) continue; if (sameval == VN_TOP) { sameval = def; } else { if (!expressions_equal_p (def, sameval)) { allsame = false; break; } } } /* If all value numbered to the same value, the phi node has that value. */ if (allsame) { if (is_gimple_min_invariant (sameval)) { VN_INFO (PHI_RESULT (phi))->has_constants = true; VN_INFO (PHI_RESULT (phi))->expr = sameval; } else { VN_INFO (PHI_RESULT (phi))->has_constants = false; VN_INFO (PHI_RESULT (phi))->expr = sameval; } if (TREE_CODE (sameval) == SSA_NAME) return visit_copy (PHI_RESULT (phi), sameval); return set_ssa_val_to (PHI_RESULT (phi), sameval); } /* Otherwise, see if it is equivalent to a phi node in this block. */ result = vn_phi_lookup (phi); if (result) { if (TREE_CODE (result) == SSA_NAME) changed = visit_copy (PHI_RESULT (phi), result); else changed = set_ssa_val_to (PHI_RESULT (phi), result); } else { vn_phi_insert (phi, PHI_RESULT (phi)); VN_INFO (PHI_RESULT (phi))->has_constants = false; VN_INFO (PHI_RESULT (phi))->expr = PHI_RESULT (phi); changed = set_ssa_val_to (PHI_RESULT (phi), PHI_RESULT (phi)); } return changed; }
/* Visit and value number PHI, return true if the value number changed. */
Visit and value number PHI, return true if the value number changed.
[ "Visit", "and", "value", "number", "PHI", "return", "true", "if", "the", "value", "number", "changed", "." ]
static bool visit_phi (gimple phi) { bool changed = false; tree result; tree sameval = VN_TOP; bool allsame = true; unsigned i; if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (PHI_RESULT (phi))) return set_ssa_val_to (PHI_RESULT (phi), PHI_RESULT (phi)); for (i = 0; i < gimple_phi_num_args (phi); i++) { tree def = PHI_ARG_DEF (phi, i); if (TREE_CODE (def) == SSA_NAME) def = SSA_VAL (def); if (def == VN_TOP) continue; if (sameval == VN_TOP) { sameval = def; } else { if (!expressions_equal_p (def, sameval)) { allsame = false; break; } } } if (allsame) { if (is_gimple_min_invariant (sameval)) { VN_INFO (PHI_RESULT (phi))->has_constants = true; VN_INFO (PHI_RESULT (phi))->expr = sameval; } else { VN_INFO (PHI_RESULT (phi))->has_constants = false; VN_INFO (PHI_RESULT (phi))->expr = sameval; } if (TREE_CODE (sameval) == SSA_NAME) return visit_copy (PHI_RESULT (phi), sameval); return set_ssa_val_to (PHI_RESULT (phi), sameval); } result = vn_phi_lookup (phi); if (result) { if (TREE_CODE (result) == SSA_NAME) changed = visit_copy (PHI_RESULT (phi), result); else changed = set_ssa_val_to (PHI_RESULT (phi), result); } else { vn_phi_insert (phi, PHI_RESULT (phi)); VN_INFO (PHI_RESULT (phi))->has_constants = false; VN_INFO (PHI_RESULT (phi))->expr = PHI_RESULT (phi); changed = set_ssa_val_to (PHI_RESULT (phi), PHI_RESULT (phi)); } return changed; }
[ "static", "bool", "visit_phi", "(", "gimple", "phi", ")", "{", "bool", "changed", "=", "false", ";", "tree", "result", ";", "tree", "sameval", "=", "VN_TOP", ";", "bool", "allsame", "=", "true", ";", "unsigned", "i", ";", "if", "(", "SSA_NAME_OCCURS_IN_ABNORMAL_PHI", "(", "PHI_RESULT", "(", "phi", ")", ")", ")", "return", "set_ssa_val_to", "(", "PHI_RESULT", "(", "phi", ")", ",", "PHI_RESULT", "(", "phi", ")", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "gimple_phi_num_args", "(", "phi", ")", ";", "i", "++", ")", "{", "tree", "def", "=", "PHI_ARG_DEF", "(", "phi", ",", "i", ")", ";", "if", "(", "TREE_CODE", "(", "def", ")", "==", "SSA_NAME", ")", "def", "=", "SSA_VAL", "(", "def", ")", ";", "if", "(", "def", "==", "VN_TOP", ")", "continue", ";", "if", "(", "sameval", "==", "VN_TOP", ")", "{", "sameval", "=", "def", ";", "}", "else", "{", "if", "(", "!", "expressions_equal_p", "(", "def", ",", "sameval", ")", ")", "{", "allsame", "=", "false", ";", "break", ";", "}", "}", "}", "if", "(", "allsame", ")", "{", "if", "(", "is_gimple_min_invariant", "(", "sameval", ")", ")", "{", "VN_INFO", "(", "PHI_RESULT", "(", "phi", ")", ")", "->", "has_constants", "=", "true", ";", "VN_INFO", "(", "PHI_RESULT", "(", "phi", ")", ")", "->", "expr", "=", "sameval", ";", "}", "else", "{", "VN_INFO", "(", "PHI_RESULT", "(", "phi", ")", ")", "->", "has_constants", "=", "false", ";", "VN_INFO", "(", "PHI_RESULT", "(", "phi", ")", ")", "->", "expr", "=", "sameval", ";", "}", "if", "(", "TREE_CODE", "(", "sameval", ")", "==", "SSA_NAME", ")", "return", "visit_copy", "(", "PHI_RESULT", "(", "phi", ")", ",", "sameval", ")", ";", "return", "set_ssa_val_to", "(", "PHI_RESULT", "(", "phi", ")", ",", "sameval", ")", ";", "}", "result", "=", "vn_phi_lookup", "(", "phi", ")", ";", "if", "(", "result", ")", "{", "if", "(", "TREE_CODE", "(", "result", ")", "==", "SSA_NAME", ")", "changed", "=", "visit_copy", "(", "PHI_RESULT", "(", "phi", ")", ",", "result", ")", ";", "else", "changed", "=", "set_ssa_val_to", "(", "PHI_RESULT", "(", "phi", ")", ",", "result", ")", ";", "}", "else", "{", "vn_phi_insert", "(", "phi", ",", "PHI_RESULT", "(", "phi", ")", ")", ";", "VN_INFO", "(", "PHI_RESULT", "(", "phi", ")", ")", "->", "has_constants", "=", "false", ";", "VN_INFO", "(", "PHI_RESULT", "(", "phi", ")", ")", "->", "expr", "=", "PHI_RESULT", "(", "phi", ")", ";", "changed", "=", "set_ssa_val_to", "(", "PHI_RESULT", "(", "phi", ")", ",", "PHI_RESULT", "(", "phi", ")", ")", ";", "}", "return", "changed", ";", "}" ]
Visit and value number PHI, return true if the value number changed.
[ "Visit", "and", "value", "number", "PHI", "return", "true", "if", "the", "value", "number", "changed", "." ]
[ "/* TODO: We could check for this in init_sccvn, and replace this\n with a gcc_assert. */", "/* See if all non-TOP arguments have the same value. TOP is\n equivalent to everything, so we can ignore it. */", "/* If all value numbered to the same value, the phi node has that\n value. */", "/* Otherwise, see if it is equivalent to a phi node in this block. */" ]
[ { "param": "phi", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "phi", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
expr_has_constants
bool
static bool expr_has_constants (tree expr) { switch (TREE_CODE_CLASS (TREE_CODE (expr))) { case tcc_unary: return is_gimple_min_invariant (TREE_OPERAND (expr, 0)); case tcc_binary: return is_gimple_min_invariant (TREE_OPERAND (expr, 0)) || is_gimple_min_invariant (TREE_OPERAND (expr, 1)); /* Constants inside reference ops are rarely interesting, but it can take a lot of looking to find them. */ case tcc_reference: case tcc_declaration: return false; default: return is_gimple_min_invariant (expr); } return false; }
/* Return true if EXPR contains constants. */
Return true if EXPR contains constants.
[ "Return", "true", "if", "EXPR", "contains", "constants", "." ]
static bool expr_has_constants (tree expr) { switch (TREE_CODE_CLASS (TREE_CODE (expr))) { case tcc_unary: return is_gimple_min_invariant (TREE_OPERAND (expr, 0)); case tcc_binary: return is_gimple_min_invariant (TREE_OPERAND (expr, 0)) || is_gimple_min_invariant (TREE_OPERAND (expr, 1)); case tcc_reference: case tcc_declaration: return false; default: return is_gimple_min_invariant (expr); } return false; }
[ "static", "bool", "expr_has_constants", "(", "tree", "expr", ")", "{", "switch", "(", "TREE_CODE_CLASS", "(", "TREE_CODE", "(", "expr", ")", ")", ")", "{", "case", "tcc_unary", ":", "return", "is_gimple_min_invariant", "(", "TREE_OPERAND", "(", "expr", ",", "0", ")", ")", ";", "case", "tcc_binary", ":", "return", "is_gimple_min_invariant", "(", "TREE_OPERAND", "(", "expr", ",", "0", ")", ")", "||", "is_gimple_min_invariant", "(", "TREE_OPERAND", "(", "expr", ",", "1", ")", ")", ";", "case", "tcc_reference", ":", "case", "tcc_declaration", ":", "return", "false", ";", "default", ":", "return", "is_gimple_min_invariant", "(", "expr", ")", ";", "}", "return", "false", ";", "}" ]
Return true if EXPR contains constants.
[ "Return", "true", "if", "EXPR", "contains", "constants", "." ]
[ "/* Constants inside reference ops are rarely interesting, but\n\t it can take a lot of looking to find them. */" ]
[ { "param": "expr", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "expr", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
stmt_has_constants
bool
static bool stmt_has_constants (gimple stmt) { if (gimple_code (stmt) != GIMPLE_ASSIGN) return false; switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))) { case GIMPLE_UNARY_RHS: return is_gimple_min_invariant (gimple_assign_rhs1 (stmt)); case GIMPLE_BINARY_RHS: return (is_gimple_min_invariant (gimple_assign_rhs1 (stmt)) || is_gimple_min_invariant (gimple_assign_rhs2 (stmt))); case GIMPLE_TERNARY_RHS: return (is_gimple_min_invariant (gimple_assign_rhs1 (stmt)) || is_gimple_min_invariant (gimple_assign_rhs2 (stmt)) || is_gimple_min_invariant (gimple_assign_rhs3 (stmt))); case GIMPLE_SINGLE_RHS: /* Constants inside reference ops are rarely interesting, but it can take a lot of looking to find them. */ return is_gimple_min_invariant (gimple_assign_rhs1 (stmt)); default: gcc_unreachable (); } return false; }
/* Return true if STMT contains constants. */
Return true if STMT contains constants.
[ "Return", "true", "if", "STMT", "contains", "constants", "." ]
static bool stmt_has_constants (gimple stmt) { if (gimple_code (stmt) != GIMPLE_ASSIGN) return false; switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))) { case GIMPLE_UNARY_RHS: return is_gimple_min_invariant (gimple_assign_rhs1 (stmt)); case GIMPLE_BINARY_RHS: return (is_gimple_min_invariant (gimple_assign_rhs1 (stmt)) || is_gimple_min_invariant (gimple_assign_rhs2 (stmt))); case GIMPLE_TERNARY_RHS: return (is_gimple_min_invariant (gimple_assign_rhs1 (stmt)) || is_gimple_min_invariant (gimple_assign_rhs2 (stmt)) || is_gimple_min_invariant (gimple_assign_rhs3 (stmt))); case GIMPLE_SINGLE_RHS: return is_gimple_min_invariant (gimple_assign_rhs1 (stmt)); default: gcc_unreachable (); } return false; }
[ "static", "bool", "stmt_has_constants", "(", "gimple", "stmt", ")", "{", "if", "(", "gimple_code", "(", "stmt", ")", "!=", "GIMPLE_ASSIGN", ")", "return", "false", ";", "switch", "(", "get_gimple_rhs_class", "(", "gimple_assign_rhs_code", "(", "stmt", ")", ")", ")", "{", "case", "GIMPLE_UNARY_RHS", ":", "return", "is_gimple_min_invariant", "(", "gimple_assign_rhs1", "(", "stmt", ")", ")", ";", "case", "GIMPLE_BINARY_RHS", ":", "return", "(", "is_gimple_min_invariant", "(", "gimple_assign_rhs1", "(", "stmt", ")", ")", "||", "is_gimple_min_invariant", "(", "gimple_assign_rhs2", "(", "stmt", ")", ")", ")", ";", "case", "GIMPLE_TERNARY_RHS", ":", "return", "(", "is_gimple_min_invariant", "(", "gimple_assign_rhs1", "(", "stmt", ")", ")", "||", "is_gimple_min_invariant", "(", "gimple_assign_rhs2", "(", "stmt", ")", ")", "||", "is_gimple_min_invariant", "(", "gimple_assign_rhs3", "(", "stmt", ")", ")", ")", ";", "case", "GIMPLE_SINGLE_RHS", ":", "return", "is_gimple_min_invariant", "(", "gimple_assign_rhs1", "(", "stmt", ")", ")", ";", "default", ":", "gcc_unreachable", "(", ")", ";", "}", "return", "false", ";", "}" ]
Return true if STMT contains constants.
[ "Return", "true", "if", "STMT", "contains", "constants", "." ]
[ "/* Constants inside reference ops are rarely interesting, but\n\t it can take a lot of looking to find them. */" ]
[ { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
valueize_expr
tree
static tree valueize_expr (tree expr) { switch (TREE_CODE_CLASS (TREE_CODE (expr))) { case tcc_binary: TREE_OPERAND (expr, 1) = vn_valueize (TREE_OPERAND (expr, 1)); /* Fallthru. */ case tcc_unary: TREE_OPERAND (expr, 0) = vn_valueize (TREE_OPERAND (expr, 0)); break; default:; } return expr; }
/* Replace SSA_NAMES in expr with their value numbers, and return the result. This is performed in place. */
Replace SSA_NAMES in expr with their value numbers, and return the result. This is performed in place.
[ "Replace", "SSA_NAMES", "in", "expr", "with", "their", "value", "numbers", "and", "return", "the", "result", ".", "This", "is", "performed", "in", "place", "." ]
static tree valueize_expr (tree expr) { switch (TREE_CODE_CLASS (TREE_CODE (expr))) { case tcc_binary: TREE_OPERAND (expr, 1) = vn_valueize (TREE_OPERAND (expr, 1)); case tcc_unary: TREE_OPERAND (expr, 0) = vn_valueize (TREE_OPERAND (expr, 0)); break; default:; } return expr; }
[ "static", "tree", "valueize_expr", "(", "tree", "expr", ")", "{", "switch", "(", "TREE_CODE_CLASS", "(", "TREE_CODE", "(", "expr", ")", ")", ")", "{", "case", "tcc_binary", ":", "TREE_OPERAND", "(", "expr", ",", "1", ")", "=", "vn_valueize", "(", "TREE_OPERAND", "(", "expr", ",", "1", ")", ")", ";", "case", "tcc_unary", ":", "TREE_OPERAND", "(", "expr", ",", "0", ")", "=", "vn_valueize", "(", "TREE_OPERAND", "(", "expr", ",", "0", ")", ")", ";", "break", ";", "default", ":", ";", "}", "return", "expr", ";", "}" ]
Replace SSA_NAMES in expr with their value numbers, and return the result.
[ "Replace", "SSA_NAMES", "in", "expr", "with", "their", "value", "numbers", "and", "return", "the", "result", "." ]
[ "/* Fallthru. */" ]
[ { "param": "expr", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "expr", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
simplify_binary_expression
tree
static tree simplify_binary_expression (gimple stmt) { tree result = NULL_TREE; tree op0 = gimple_assign_rhs1 (stmt); tree op1 = gimple_assign_rhs2 (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); /* This will not catch every single case we could combine, but will catch those with constants. The goal here is to simultaneously combine constants between expressions, but avoid infinite expansion of expressions during simplification. */ if (TREE_CODE (op0) == SSA_NAME) { if (VN_INFO (op0)->has_constants || TREE_CODE_CLASS (code) == tcc_comparison || code == COMPLEX_EXPR) op0 = valueize_expr (vn_get_expr_for (op0)); else op0 = vn_valueize (op0); } if (TREE_CODE (op1) == SSA_NAME) { if (VN_INFO (op1)->has_constants || code == COMPLEX_EXPR) op1 = valueize_expr (vn_get_expr_for (op1)); else op1 = vn_valueize (op1); } /* Pointer plus constant can be represented as invariant address. Do so to allow further propatation, see also tree forwprop. */ if (code == POINTER_PLUS_EXPR && host_integerp (op1, 1) && TREE_CODE (op0) == ADDR_EXPR && is_gimple_min_invariant (op0)) return build_invariant_address (TREE_TYPE (op0), TREE_OPERAND (op0, 0), TREE_INT_CST_LOW (op1)); /* Avoid folding if nothing changed. */ if (op0 == gimple_assign_rhs1 (stmt) && op1 == gimple_assign_rhs2 (stmt)) return NULL_TREE; fold_defer_overflow_warnings (); result = fold_binary (code, gimple_expr_type (stmt), op0, op1); if (result) STRIP_USELESS_TYPE_CONVERSION (result); fold_undefer_overflow_warnings (result && valid_gimple_rhs_p (result), stmt, 0); /* Make sure result is not a complex expression consisting of operators of operators (IE (a + b) + (a + c)) Otherwise, we will end up with unbounded expressions if fold does anything at all. */ if (result && valid_gimple_rhs_p (result)) return result; return NULL_TREE; }
/* Simplify the binary expression RHS, and return the result if simplified. */
Simplify the binary expression RHS, and return the result if simplified.
[ "Simplify", "the", "binary", "expression", "RHS", "and", "return", "the", "result", "if", "simplified", "." ]
static tree simplify_binary_expression (gimple stmt) { tree result = NULL_TREE; tree op0 = gimple_assign_rhs1 (stmt); tree op1 = gimple_assign_rhs2 (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); if (TREE_CODE (op0) == SSA_NAME) { if (VN_INFO (op0)->has_constants || TREE_CODE_CLASS (code) == tcc_comparison || code == COMPLEX_EXPR) op0 = valueize_expr (vn_get_expr_for (op0)); else op0 = vn_valueize (op0); } if (TREE_CODE (op1) == SSA_NAME) { if (VN_INFO (op1)->has_constants || code == COMPLEX_EXPR) op1 = valueize_expr (vn_get_expr_for (op1)); else op1 = vn_valueize (op1); } if (code == POINTER_PLUS_EXPR && host_integerp (op1, 1) && TREE_CODE (op0) == ADDR_EXPR && is_gimple_min_invariant (op0)) return build_invariant_address (TREE_TYPE (op0), TREE_OPERAND (op0, 0), TREE_INT_CST_LOW (op1)); if (op0 == gimple_assign_rhs1 (stmt) && op1 == gimple_assign_rhs2 (stmt)) return NULL_TREE; fold_defer_overflow_warnings (); result = fold_binary (code, gimple_expr_type (stmt), op0, op1); if (result) STRIP_USELESS_TYPE_CONVERSION (result); fold_undefer_overflow_warnings (result && valid_gimple_rhs_p (result), stmt, 0); if (result && valid_gimple_rhs_p (result)) return result; return NULL_TREE; }
[ "static", "tree", "simplify_binary_expression", "(", "gimple", "stmt", ")", "{", "tree", "result", "=", "NULL_TREE", ";", "tree", "op0", "=", "gimple_assign_rhs1", "(", "stmt", ")", ";", "tree", "op1", "=", "gimple_assign_rhs2", "(", "stmt", ")", ";", "enum", "tree_code", "code", "=", "gimple_assign_rhs_code", "(", "stmt", ")", ";", "if", "(", "TREE_CODE", "(", "op0", ")", "==", "SSA_NAME", ")", "{", "if", "(", "VN_INFO", "(", "op0", ")", "->", "has_constants", "||", "TREE_CODE_CLASS", "(", "code", ")", "==", "tcc_comparison", "||", "code", "==", "COMPLEX_EXPR", ")", "op0", "=", "valueize_expr", "(", "vn_get_expr_for", "(", "op0", ")", ")", ";", "else", "op0", "=", "vn_valueize", "(", "op0", ")", ";", "}", "if", "(", "TREE_CODE", "(", "op1", ")", "==", "SSA_NAME", ")", "{", "if", "(", "VN_INFO", "(", "op1", ")", "->", "has_constants", "||", "code", "==", "COMPLEX_EXPR", ")", "op1", "=", "valueize_expr", "(", "vn_get_expr_for", "(", "op1", ")", ")", ";", "else", "op1", "=", "vn_valueize", "(", "op1", ")", ";", "}", "if", "(", "code", "==", "POINTER_PLUS_EXPR", "&&", "host_integerp", "(", "op1", ",", "1", ")", "&&", "TREE_CODE", "(", "op0", ")", "==", "ADDR_EXPR", "&&", "is_gimple_min_invariant", "(", "op0", ")", ")", "return", "build_invariant_address", "(", "TREE_TYPE", "(", "op0", ")", ",", "TREE_OPERAND", "(", "op0", ",", "0", ")", ",", "TREE_INT_CST_LOW", "(", "op1", ")", ")", ";", "if", "(", "op0", "==", "gimple_assign_rhs1", "(", "stmt", ")", "&&", "op1", "==", "gimple_assign_rhs2", "(", "stmt", ")", ")", "return", "NULL_TREE", ";", "fold_defer_overflow_warnings", "(", ")", ";", "result", "=", "fold_binary", "(", "code", ",", "gimple_expr_type", "(", "stmt", ")", ",", "op0", ",", "op1", ")", ";", "if", "(", "result", ")", "STRIP_USELESS_TYPE_CONVERSION", "(", "result", ")", ";", "fold_undefer_overflow_warnings", "(", "result", "&&", "valid_gimple_rhs_p", "(", "result", ")", ",", "stmt", ",", "0", ")", ";", "if", "(", "result", "&&", "valid_gimple_rhs_p", "(", "result", ")", ")", "return", "result", ";", "return", "NULL_TREE", ";", "}" ]
Simplify the binary expression RHS, and return the result if simplified.
[ "Simplify", "the", "binary", "expression", "RHS", "and", "return", "the", "result", "if", "simplified", "." ]
[ "/* This will not catch every single case we could combine, but will\n catch those with constants. The goal here is to simultaneously\n combine constants between expressions, but avoid infinite\n expansion of expressions during simplification. */", "/* Pointer plus constant can be represented as invariant address.\n Do so to allow further propatation, see also tree forwprop. */", "/* Avoid folding if nothing changed. */", "/* Make sure result is not a complex expression consisting\n of operators of operators (IE (a + b) + (a + c))\n Otherwise, we will end up with unbounded expressions if\n fold does anything at all. */" ]
[ { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
simplify_unary_expression
tree
static tree simplify_unary_expression (gimple stmt) { tree result = NULL_TREE; tree orig_op0, op0 = gimple_assign_rhs1 (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); /* We handle some tcc_reference codes here that are all GIMPLE_ASSIGN_SINGLE codes. */ if (code == REALPART_EXPR || code == IMAGPART_EXPR || code == VIEW_CONVERT_EXPR || code == BIT_FIELD_REF) op0 = TREE_OPERAND (op0, 0); if (TREE_CODE (op0) != SSA_NAME) return NULL_TREE; orig_op0 = op0; if (VN_INFO (op0)->has_constants) op0 = valueize_expr (vn_get_expr_for (op0)); else if (CONVERT_EXPR_CODE_P (code) || code == REALPART_EXPR || code == IMAGPART_EXPR || code == VIEW_CONVERT_EXPR || code == BIT_FIELD_REF) { /* We want to do tree-combining on conversion-like expressions. Make sure we feed only SSA_NAMEs or constants to fold though. */ tree tem = valueize_expr (vn_get_expr_for (op0)); if (UNARY_CLASS_P (tem) || BINARY_CLASS_P (tem) || TREE_CODE (tem) == VIEW_CONVERT_EXPR || TREE_CODE (tem) == SSA_NAME || TREE_CODE (tem) == CONSTRUCTOR || is_gimple_min_invariant (tem)) op0 = tem; } /* Avoid folding if nothing changed, but remember the expression. */ if (op0 == orig_op0) return NULL_TREE; if (code == BIT_FIELD_REF) { tree rhs = gimple_assign_rhs1 (stmt); result = fold_ternary (BIT_FIELD_REF, TREE_TYPE (rhs), op0, TREE_OPERAND (rhs, 1), TREE_OPERAND (rhs, 2)); } else result = fold_unary_ignore_overflow (code, gimple_expr_type (stmt), op0); if (result) { STRIP_USELESS_TYPE_CONVERSION (result); if (valid_gimple_rhs_p (result)) return result; } return NULL_TREE; }
/* Simplify the unary expression RHS, and return the result if simplified. */
Simplify the unary expression RHS, and return the result if simplified.
[ "Simplify", "the", "unary", "expression", "RHS", "and", "return", "the", "result", "if", "simplified", "." ]
static tree simplify_unary_expression (gimple stmt) { tree result = NULL_TREE; tree orig_op0, op0 = gimple_assign_rhs1 (stmt); enum tree_code code = gimple_assign_rhs_code (stmt); if (code == REALPART_EXPR || code == IMAGPART_EXPR || code == VIEW_CONVERT_EXPR || code == BIT_FIELD_REF) op0 = TREE_OPERAND (op0, 0); if (TREE_CODE (op0) != SSA_NAME) return NULL_TREE; orig_op0 = op0; if (VN_INFO (op0)->has_constants) op0 = valueize_expr (vn_get_expr_for (op0)); else if (CONVERT_EXPR_CODE_P (code) || code == REALPART_EXPR || code == IMAGPART_EXPR || code == VIEW_CONVERT_EXPR || code == BIT_FIELD_REF) { tree tem = valueize_expr (vn_get_expr_for (op0)); if (UNARY_CLASS_P (tem) || BINARY_CLASS_P (tem) || TREE_CODE (tem) == VIEW_CONVERT_EXPR || TREE_CODE (tem) == SSA_NAME || TREE_CODE (tem) == CONSTRUCTOR || is_gimple_min_invariant (tem)) op0 = tem; } if (op0 == orig_op0) return NULL_TREE; if (code == BIT_FIELD_REF) { tree rhs = gimple_assign_rhs1 (stmt); result = fold_ternary (BIT_FIELD_REF, TREE_TYPE (rhs), op0, TREE_OPERAND (rhs, 1), TREE_OPERAND (rhs, 2)); } else result = fold_unary_ignore_overflow (code, gimple_expr_type (stmt), op0); if (result) { STRIP_USELESS_TYPE_CONVERSION (result); if (valid_gimple_rhs_p (result)) return result; } return NULL_TREE; }
[ "static", "tree", "simplify_unary_expression", "(", "gimple", "stmt", ")", "{", "tree", "result", "=", "NULL_TREE", ";", "tree", "orig_op0", ",", "op0", "=", "gimple_assign_rhs1", "(", "stmt", ")", ";", "enum", "tree_code", "code", "=", "gimple_assign_rhs_code", "(", "stmt", ")", ";", "if", "(", "code", "==", "REALPART_EXPR", "||", "code", "==", "IMAGPART_EXPR", "||", "code", "==", "VIEW_CONVERT_EXPR", "||", "code", "==", "BIT_FIELD_REF", ")", "op0", "=", "TREE_OPERAND", "(", "op0", ",", "0", ")", ";", "if", "(", "TREE_CODE", "(", "op0", ")", "!=", "SSA_NAME", ")", "return", "NULL_TREE", ";", "orig_op0", "=", "op0", ";", "if", "(", "VN_INFO", "(", "op0", ")", "->", "has_constants", ")", "op0", "=", "valueize_expr", "(", "vn_get_expr_for", "(", "op0", ")", ")", ";", "else", "if", "(", "CONVERT_EXPR_CODE_P", "(", "code", ")", "||", "code", "==", "REALPART_EXPR", "||", "code", "==", "IMAGPART_EXPR", "||", "code", "==", "VIEW_CONVERT_EXPR", "||", "code", "==", "BIT_FIELD_REF", ")", "{", "tree", "tem", "=", "valueize_expr", "(", "vn_get_expr_for", "(", "op0", ")", ")", ";", "if", "(", "UNARY_CLASS_P", "(", "tem", ")", "||", "BINARY_CLASS_P", "(", "tem", ")", "||", "TREE_CODE", "(", "tem", ")", "==", "VIEW_CONVERT_EXPR", "||", "TREE_CODE", "(", "tem", ")", "==", "SSA_NAME", "||", "TREE_CODE", "(", "tem", ")", "==", "CONSTRUCTOR", "||", "is_gimple_min_invariant", "(", "tem", ")", ")", "op0", "=", "tem", ";", "}", "if", "(", "op0", "==", "orig_op0", ")", "return", "NULL_TREE", ";", "if", "(", "code", "==", "BIT_FIELD_REF", ")", "{", "tree", "rhs", "=", "gimple_assign_rhs1", "(", "stmt", ")", ";", "result", "=", "fold_ternary", "(", "BIT_FIELD_REF", ",", "TREE_TYPE", "(", "rhs", ")", ",", "op0", ",", "TREE_OPERAND", "(", "rhs", ",", "1", ")", ",", "TREE_OPERAND", "(", "rhs", ",", "2", ")", ")", ";", "}", "else", "result", "=", "fold_unary_ignore_overflow", "(", "code", ",", "gimple_expr_type", "(", "stmt", ")", ",", "op0", ")", ";", "if", "(", "result", ")", "{", "STRIP_USELESS_TYPE_CONVERSION", "(", "result", ")", ";", "if", "(", "valid_gimple_rhs_p", "(", "result", ")", ")", "return", "result", ";", "}", "return", "NULL_TREE", ";", "}" ]
Simplify the unary expression RHS, and return the result if simplified.
[ "Simplify", "the", "unary", "expression", "RHS", "and", "return", "the", "result", "if", "simplified", "." ]
[ "/* We handle some tcc_reference codes here that are all\n GIMPLE_ASSIGN_SINGLE codes. */", "/* We want to do tree-combining on conversion-like expressions.\n Make sure we feed only SSA_NAMEs or constants to fold though. */", "/* Avoid folding if nothing changed, but remember the expression. */" ]
[ { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
try_to_simplify
tree
static tree try_to_simplify (gimple stmt) { enum tree_code code = gimple_assign_rhs_code (stmt); tree tem; /* For stores we can end up simplifying a SSA_NAME rhs. Just return in this case, there is no point in doing extra work. */ if (code == SSA_NAME) return NULL_TREE; /* First try constant folding based on our current lattice. */ tem = gimple_fold_stmt_to_constant_1 (stmt, vn_valueize); if (tem && (TREE_CODE (tem) == SSA_NAME || is_gimple_min_invariant (tem))) return tem; /* If that didn't work try combining multiple statements. */ switch (TREE_CODE_CLASS (code)) { case tcc_reference: /* Fallthrough for some unary codes that can operate on registers. */ if (!(code == REALPART_EXPR || code == IMAGPART_EXPR || code == VIEW_CONVERT_EXPR || code == BIT_FIELD_REF)) break; /* We could do a little more with unary ops, if they expand into binary ops, but it's debatable whether it is worth it. */ case tcc_unary: return simplify_unary_expression (stmt); case tcc_comparison: case tcc_binary: return simplify_binary_expression (stmt); default: break; } return NULL_TREE; }
/* Try to simplify RHS using equivalences and constant folding. */
Try to simplify RHS using equivalences and constant folding.
[ "Try", "to", "simplify", "RHS", "using", "equivalences", "and", "constant", "folding", "." ]
static tree try_to_simplify (gimple stmt) { enum tree_code code = gimple_assign_rhs_code (stmt); tree tem; if (code == SSA_NAME) return NULL_TREE; tem = gimple_fold_stmt_to_constant_1 (stmt, vn_valueize); if (tem && (TREE_CODE (tem) == SSA_NAME || is_gimple_min_invariant (tem))) return tem; switch (TREE_CODE_CLASS (code)) { case tcc_reference: if (!(code == REALPART_EXPR || code == IMAGPART_EXPR || code == VIEW_CONVERT_EXPR || code == BIT_FIELD_REF)) break; case tcc_unary: return simplify_unary_expression (stmt); case tcc_comparison: case tcc_binary: return simplify_binary_expression (stmt); default: break; } return NULL_TREE; }
[ "static", "tree", "try_to_simplify", "(", "gimple", "stmt", ")", "{", "enum", "tree_code", "code", "=", "gimple_assign_rhs_code", "(", "stmt", ")", ";", "tree", "tem", ";", "if", "(", "code", "==", "SSA_NAME", ")", "return", "NULL_TREE", ";", "tem", "=", "gimple_fold_stmt_to_constant_1", "(", "stmt", ",", "vn_valueize", ")", ";", "if", "(", "tem", "&&", "(", "TREE_CODE", "(", "tem", ")", "==", "SSA_NAME", "||", "is_gimple_min_invariant", "(", "tem", ")", ")", ")", "return", "tem", ";", "switch", "(", "TREE_CODE_CLASS", "(", "code", ")", ")", "{", "case", "tcc_reference", ":", "if", "(", "!", "(", "code", "==", "REALPART_EXPR", "||", "code", "==", "IMAGPART_EXPR", "||", "code", "==", "VIEW_CONVERT_EXPR", "||", "code", "==", "BIT_FIELD_REF", ")", ")", "break", ";", "case", "tcc_unary", ":", "return", "simplify_unary_expression", "(", "stmt", ")", ";", "case", "tcc_comparison", ":", "case", "tcc_binary", ":", "return", "simplify_binary_expression", "(", "stmt", ")", ";", "default", ":", "break", ";", "}", "return", "NULL_TREE", ";", "}" ]
Try to simplify RHS using equivalences and constant folding.
[ "Try", "to", "simplify", "RHS", "using", "equivalences", "and", "constant", "folding", "." ]
[ "/* For stores we can end up simplifying a SSA_NAME rhs. Just return\n in this case, there is no point in doing extra work. */", "/* First try constant folding based on our current lattice. */", "/* If that didn't work try combining multiple statements. */", "/* Fallthrough for some unary codes that can operate on registers. */", "/* We could do a little more with unary ops, if they expand\n\t into binary ops, but it's debatable whether it is worth it. */" ]
[ { "param": "stmt", "type": "gimple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "stmt", "type": "gimple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
visit_use
bool
static bool visit_use (tree use) { bool changed = false; gimple stmt = SSA_NAME_DEF_STMT (use); VN_INFO (use)->use_processed = true; gcc_assert (!SSA_NAME_IN_FREE_LIST (use)); if (dump_file && (dump_flags & TDF_DETAILS) && !SSA_NAME_IS_DEFAULT_DEF (use)) { fprintf (dump_file, "Value numbering "); print_generic_expr (dump_file, use, 0); fprintf (dump_file, " stmt = "); print_gimple_stmt (dump_file, stmt, 0, 0); } /* Handle uninitialized uses. */ if (SSA_NAME_IS_DEFAULT_DEF (use)) changed = set_ssa_val_to (use, use); else { if (gimple_code (stmt) == GIMPLE_PHI) changed = visit_phi (stmt); else if (!gimple_has_lhs (stmt) || gimple_has_volatile_ops (stmt)) changed = defs_to_varying (stmt); else if (is_gimple_assign (stmt)) { enum tree_code code = gimple_assign_rhs_code (stmt); tree lhs = gimple_assign_lhs (stmt); tree rhs1 = gimple_assign_rhs1 (stmt); tree simplified; /* Shortcut for copies. Simplifying copies is pointless, since we copy the expression and value they represent. */ if (code == SSA_NAME && TREE_CODE (lhs) == SSA_NAME) { changed = visit_copy (lhs, rhs1); goto done; } simplified = try_to_simplify (stmt); if (simplified) { if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "RHS "); print_gimple_expr (dump_file, stmt, 0, 0); fprintf (dump_file, " simplified to "); print_generic_expr (dump_file, simplified, 0); if (TREE_CODE (lhs) == SSA_NAME) fprintf (dump_file, " has constants %d\n", expr_has_constants (simplified)); else fprintf (dump_file, "\n"); } } /* Setting value numbers to constants will occasionally screw up phi congruence because constants are not uniquely associated with a single ssa name that can be looked up. */ if (simplified && is_gimple_min_invariant (simplified) && TREE_CODE (lhs) == SSA_NAME) { VN_INFO (lhs)->expr = simplified; VN_INFO (lhs)->has_constants = true; changed = set_ssa_val_to (lhs, simplified); goto done; } else if (simplified && TREE_CODE (simplified) == SSA_NAME && TREE_CODE (lhs) == SSA_NAME) { changed = visit_copy (lhs, simplified); goto done; } else if (simplified) { if (TREE_CODE (lhs) == SSA_NAME) { VN_INFO (lhs)->has_constants = expr_has_constants (simplified); /* We have to unshare the expression or else valuizing may change the IL stream. */ VN_INFO (lhs)->expr = unshare_expr (simplified); } } else if (stmt_has_constants (stmt) && TREE_CODE (lhs) == SSA_NAME) VN_INFO (lhs)->has_constants = true; else if (TREE_CODE (lhs) == SSA_NAME) { /* We reset expr and constantness here because we may have been value numbering optimistically, and iterating. They may become non-constant in this case, even if they were optimistically constant. */ VN_INFO (lhs)->has_constants = false; VN_INFO (lhs)->expr = NULL_TREE; } if ((TREE_CODE (lhs) == SSA_NAME /* We can substitute SSA_NAMEs that are live over abnormal edges with their constant value. */ && !(gimple_assign_copy_p (stmt) && is_gimple_min_invariant (rhs1)) && !(simplified && is_gimple_min_invariant (simplified)) && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) /* Stores or copies from SSA_NAMEs that are live over abnormal edges are a problem. */ || (code == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1))) changed = defs_to_varying (stmt); else if (REFERENCE_CLASS_P (lhs) || DECL_P (lhs)) changed = visit_reference_op_store (lhs, rhs1, stmt); else if (TREE_CODE (lhs) == SSA_NAME) { if ((gimple_assign_copy_p (stmt) && is_gimple_min_invariant (rhs1)) || (simplified && is_gimple_min_invariant (simplified))) { VN_INFO (lhs)->has_constants = true; if (simplified) changed = set_ssa_val_to (lhs, simplified); else changed = set_ssa_val_to (lhs, rhs1); } else { switch (get_gimple_rhs_class (code)) { case GIMPLE_UNARY_RHS: case GIMPLE_BINARY_RHS: case GIMPLE_TERNARY_RHS: changed = visit_nary_op (lhs, stmt); break; case GIMPLE_SINGLE_RHS: switch (TREE_CODE_CLASS (code)) { case tcc_reference: /* VOP-less references can go through unary case. */ if ((code == REALPART_EXPR || code == IMAGPART_EXPR || code == VIEW_CONVERT_EXPR || code == BIT_FIELD_REF) && TREE_CODE (TREE_OPERAND (rhs1, 0)) == SSA_NAME) { changed = visit_nary_op (lhs, stmt); break; } /* Fallthrough. */ case tcc_declaration: changed = visit_reference_op_load (lhs, rhs1, stmt); break; default: if (code == ADDR_EXPR) { changed = visit_nary_op (lhs, stmt); break; } else if (code == CONSTRUCTOR) { changed = visit_nary_op (lhs, stmt); break; } changed = defs_to_varying (stmt); } break; default: changed = defs_to_varying (stmt); break; } } } else changed = defs_to_varying (stmt); } else if (is_gimple_call (stmt)) { tree lhs = gimple_call_lhs (stmt); /* ??? We could try to simplify calls. */ if (stmt_has_constants (stmt) && TREE_CODE (lhs) == SSA_NAME) VN_INFO (lhs)->has_constants = true; else if (TREE_CODE (lhs) == SSA_NAME) { /* We reset expr and constantness here because we may have been value numbering optimistically, and iterating. They may become non-constant in this case, even if they were optimistically constant. */ VN_INFO (lhs)->has_constants = false; VN_INFO (lhs)->expr = NULL_TREE; } if (TREE_CODE (lhs) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) changed = defs_to_varying (stmt); /* ??? We should handle stores from calls. */ else if (TREE_CODE (lhs) == SSA_NAME) { if (!gimple_call_internal_p (stmt) && gimple_call_flags (stmt) & (ECF_PURE | ECF_CONST)) changed = visit_reference_op_call (lhs, stmt); else changed = defs_to_varying (stmt); } else changed = defs_to_varying (stmt); } } done: return changed; }
/* Visit and value number USE, return true if the value number changed. */
Visit and value number USE, return true if the value number changed.
[ "Visit", "and", "value", "number", "USE", "return", "true", "if", "the", "value", "number", "changed", "." ]
static bool visit_use (tree use) { bool changed = false; gimple stmt = SSA_NAME_DEF_STMT (use); VN_INFO (use)->use_processed = true; gcc_assert (!SSA_NAME_IN_FREE_LIST (use)); if (dump_file && (dump_flags & TDF_DETAILS) && !SSA_NAME_IS_DEFAULT_DEF (use)) { fprintf (dump_file, "Value numbering "); print_generic_expr (dump_file, use, 0); fprintf (dump_file, " stmt = "); print_gimple_stmt (dump_file, stmt, 0, 0); } if (SSA_NAME_IS_DEFAULT_DEF (use)) changed = set_ssa_val_to (use, use); else { if (gimple_code (stmt) == GIMPLE_PHI) changed = visit_phi (stmt); else if (!gimple_has_lhs (stmt) || gimple_has_volatile_ops (stmt)) changed = defs_to_varying (stmt); else if (is_gimple_assign (stmt)) { enum tree_code code = gimple_assign_rhs_code (stmt); tree lhs = gimple_assign_lhs (stmt); tree rhs1 = gimple_assign_rhs1 (stmt); tree simplified; if (code == SSA_NAME && TREE_CODE (lhs) == SSA_NAME) { changed = visit_copy (lhs, rhs1); goto done; } simplified = try_to_simplify (stmt); if (simplified) { if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "RHS "); print_gimple_expr (dump_file, stmt, 0, 0); fprintf (dump_file, " simplified to "); print_generic_expr (dump_file, simplified, 0); if (TREE_CODE (lhs) == SSA_NAME) fprintf (dump_file, " has constants %d\n", expr_has_constants (simplified)); else fprintf (dump_file, "\n"); } } if (simplified && is_gimple_min_invariant (simplified) && TREE_CODE (lhs) == SSA_NAME) { VN_INFO (lhs)->expr = simplified; VN_INFO (lhs)->has_constants = true; changed = set_ssa_val_to (lhs, simplified); goto done; } else if (simplified && TREE_CODE (simplified) == SSA_NAME && TREE_CODE (lhs) == SSA_NAME) { changed = visit_copy (lhs, simplified); goto done; } else if (simplified) { if (TREE_CODE (lhs) == SSA_NAME) { VN_INFO (lhs)->has_constants = expr_has_constants (simplified); VN_INFO (lhs)->expr = unshare_expr (simplified); } } else if (stmt_has_constants (stmt) && TREE_CODE (lhs) == SSA_NAME) VN_INFO (lhs)->has_constants = true; else if (TREE_CODE (lhs) == SSA_NAME) { VN_INFO (lhs)->has_constants = false; VN_INFO (lhs)->expr = NULL_TREE; } if ((TREE_CODE (lhs) == SSA_NAME && !(gimple_assign_copy_p (stmt) && is_gimple_min_invariant (rhs1)) && !(simplified && is_gimple_min_invariant (simplified)) && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) || (code == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs1))) changed = defs_to_varying (stmt); else if (REFERENCE_CLASS_P (lhs) || DECL_P (lhs)) changed = visit_reference_op_store (lhs, rhs1, stmt); else if (TREE_CODE (lhs) == SSA_NAME) { if ((gimple_assign_copy_p (stmt) && is_gimple_min_invariant (rhs1)) || (simplified && is_gimple_min_invariant (simplified))) { VN_INFO (lhs)->has_constants = true; if (simplified) changed = set_ssa_val_to (lhs, simplified); else changed = set_ssa_val_to (lhs, rhs1); } else { switch (get_gimple_rhs_class (code)) { case GIMPLE_UNARY_RHS: case GIMPLE_BINARY_RHS: case GIMPLE_TERNARY_RHS: changed = visit_nary_op (lhs, stmt); break; case GIMPLE_SINGLE_RHS: switch (TREE_CODE_CLASS (code)) { case tcc_reference: if ((code == REALPART_EXPR || code == IMAGPART_EXPR || code == VIEW_CONVERT_EXPR || code == BIT_FIELD_REF) && TREE_CODE (TREE_OPERAND (rhs1, 0)) == SSA_NAME) { changed = visit_nary_op (lhs, stmt); break; } case tcc_declaration: changed = visit_reference_op_load (lhs, rhs1, stmt); break; default: if (code == ADDR_EXPR) { changed = visit_nary_op (lhs, stmt); break; } else if (code == CONSTRUCTOR) { changed = visit_nary_op (lhs, stmt); break; } changed = defs_to_varying (stmt); } break; default: changed = defs_to_varying (stmt); break; } } } else changed = defs_to_varying (stmt); } else if (is_gimple_call (stmt)) { tree lhs = gimple_call_lhs (stmt); if (stmt_has_constants (stmt) && TREE_CODE (lhs) == SSA_NAME) VN_INFO (lhs)->has_constants = true; else if (TREE_CODE (lhs) == SSA_NAME) { VN_INFO (lhs)->has_constants = false; VN_INFO (lhs)->expr = NULL_TREE; } if (TREE_CODE (lhs) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) changed = defs_to_varying (stmt); else if (TREE_CODE (lhs) == SSA_NAME) { if (!gimple_call_internal_p (stmt) && gimple_call_flags (stmt) & (ECF_PURE | ECF_CONST)) changed = visit_reference_op_call (lhs, stmt); else changed = defs_to_varying (stmt); } else changed = defs_to_varying (stmt); } } done: return changed; }
[ "static", "bool", "visit_use", "(", "tree", "use", ")", "{", "bool", "changed", "=", "false", ";", "gimple", "stmt", "=", "SSA_NAME_DEF_STMT", "(", "use", ")", ";", "VN_INFO", "(", "use", ")", "->", "use_processed", "=", "true", ";", "gcc_assert", "(", "!", "SSA_NAME_IN_FREE_LIST", "(", "use", ")", ")", ";", "if", "(", "dump_file", "&&", "(", "dump_flags", "&", "TDF_DETAILS", ")", "&&", "!", "SSA_NAME_IS_DEFAULT_DEF", "(", "use", ")", ")", "{", "fprintf", "(", "dump_file", ",", "\"", "\"", ")", ";", "print_generic_expr", "(", "dump_file", ",", "use", ",", "0", ")", ";", "fprintf", "(", "dump_file", ",", "\"", "\"", ")", ";", "print_gimple_stmt", "(", "dump_file", ",", "stmt", ",", "0", ",", "0", ")", ";", "}", "if", "(", "SSA_NAME_IS_DEFAULT_DEF", "(", "use", ")", ")", "changed", "=", "set_ssa_val_to", "(", "use", ",", "use", ")", ";", "else", "{", "if", "(", "gimple_code", "(", "stmt", ")", "==", "GIMPLE_PHI", ")", "changed", "=", "visit_phi", "(", "stmt", ")", ";", "else", "if", "(", "!", "gimple_has_lhs", "(", "stmt", ")", "||", "gimple_has_volatile_ops", "(", "stmt", ")", ")", "changed", "=", "defs_to_varying", "(", "stmt", ")", ";", "else", "if", "(", "is_gimple_assign", "(", "stmt", ")", ")", "{", "enum", "tree_code", "code", "=", "gimple_assign_rhs_code", "(", "stmt", ")", ";", "tree", "lhs", "=", "gimple_assign_lhs", "(", "stmt", ")", ";", "tree", "rhs1", "=", "gimple_assign_rhs1", "(", "stmt", ")", ";", "tree", "simplified", ";", "if", "(", "code", "==", "SSA_NAME", "&&", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "{", "changed", "=", "visit_copy", "(", "lhs", ",", "rhs1", ")", ";", "goto", "done", ";", "}", "simplified", "=", "try_to_simplify", "(", "stmt", ")", ";", "if", "(", "simplified", ")", "{", "if", "(", "dump_file", "&&", "(", "dump_flags", "&", "TDF_DETAILS", ")", ")", "{", "fprintf", "(", "dump_file", ",", "\"", "\"", ")", ";", "print_gimple_expr", "(", "dump_file", ",", "stmt", ",", "0", ",", "0", ")", ";", "fprintf", "(", "dump_file", ",", "\"", "\"", ")", ";", "print_generic_expr", "(", "dump_file", ",", "simplified", ",", "0", ")", ";", "if", "(", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "fprintf", "(", "dump_file", ",", "\"", "\\n", "\"", ",", "expr_has_constants", "(", "simplified", ")", ")", ";", "else", "fprintf", "(", "dump_file", ",", "\"", "\\n", "\"", ")", ";", "}", "}", "if", "(", "simplified", "&&", "is_gimple_min_invariant", "(", "simplified", ")", "&&", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "{", "VN_INFO", "(", "lhs", ")", "->", "expr", "=", "simplified", ";", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "true", ";", "changed", "=", "set_ssa_val_to", "(", "lhs", ",", "simplified", ")", ";", "goto", "done", ";", "}", "else", "if", "(", "simplified", "&&", "TREE_CODE", "(", "simplified", ")", "==", "SSA_NAME", "&&", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "{", "changed", "=", "visit_copy", "(", "lhs", ",", "simplified", ")", ";", "goto", "done", ";", "}", "else", "if", "(", "simplified", ")", "{", "if", "(", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "{", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "expr_has_constants", "(", "simplified", ")", ";", "VN_INFO", "(", "lhs", ")", "->", "expr", "=", "unshare_expr", "(", "simplified", ")", ";", "}", "}", "else", "if", "(", "stmt_has_constants", "(", "stmt", ")", "&&", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "true", ";", "else", "if", "(", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "{", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "false", ";", "VN_INFO", "(", "lhs", ")", "->", "expr", "=", "NULL_TREE", ";", "}", "if", "(", "(", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", "&&", "!", "(", "gimple_assign_copy_p", "(", "stmt", ")", "&&", "is_gimple_min_invariant", "(", "rhs1", ")", ")", "&&", "!", "(", "simplified", "&&", "is_gimple_min_invariant", "(", "simplified", ")", ")", "&&", "SSA_NAME_OCCURS_IN_ABNORMAL_PHI", "(", "lhs", ")", ")", "||", "(", "code", "==", "SSA_NAME", "&&", "SSA_NAME_OCCURS_IN_ABNORMAL_PHI", "(", "rhs1", ")", ")", ")", "changed", "=", "defs_to_varying", "(", "stmt", ")", ";", "else", "if", "(", "REFERENCE_CLASS_P", "(", "lhs", ")", "||", "DECL_P", "(", "lhs", ")", ")", "changed", "=", "visit_reference_op_store", "(", "lhs", ",", "rhs1", ",", "stmt", ")", ";", "else", "if", "(", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "{", "if", "(", "(", "gimple_assign_copy_p", "(", "stmt", ")", "&&", "is_gimple_min_invariant", "(", "rhs1", ")", ")", "||", "(", "simplified", "&&", "is_gimple_min_invariant", "(", "simplified", ")", ")", ")", "{", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "true", ";", "if", "(", "simplified", ")", "changed", "=", "set_ssa_val_to", "(", "lhs", ",", "simplified", ")", ";", "else", "changed", "=", "set_ssa_val_to", "(", "lhs", ",", "rhs1", ")", ";", "}", "else", "{", "switch", "(", "get_gimple_rhs_class", "(", "code", ")", ")", "{", "case", "GIMPLE_UNARY_RHS", ":", "case", "GIMPLE_BINARY_RHS", ":", "case", "GIMPLE_TERNARY_RHS", ":", "changed", "=", "visit_nary_op", "(", "lhs", ",", "stmt", ")", ";", "break", ";", "case", "GIMPLE_SINGLE_RHS", ":", "switch", "(", "TREE_CODE_CLASS", "(", "code", ")", ")", "{", "case", "tcc_reference", ":", "if", "(", "(", "code", "==", "REALPART_EXPR", "||", "code", "==", "IMAGPART_EXPR", "||", "code", "==", "VIEW_CONVERT_EXPR", "||", "code", "==", "BIT_FIELD_REF", ")", "&&", "TREE_CODE", "(", "TREE_OPERAND", "(", "rhs1", ",", "0", ")", ")", "==", "SSA_NAME", ")", "{", "changed", "=", "visit_nary_op", "(", "lhs", ",", "stmt", ")", ";", "break", ";", "}", "case", "tcc_declaration", ":", "changed", "=", "visit_reference_op_load", "(", "lhs", ",", "rhs1", ",", "stmt", ")", ";", "break", ";", "default", ":", "if", "(", "code", "==", "ADDR_EXPR", ")", "{", "changed", "=", "visit_nary_op", "(", "lhs", ",", "stmt", ")", ";", "break", ";", "}", "else", "if", "(", "code", "==", "CONSTRUCTOR", ")", "{", "changed", "=", "visit_nary_op", "(", "lhs", ",", "stmt", ")", ";", "break", ";", "}", "changed", "=", "defs_to_varying", "(", "stmt", ")", ";", "}", "break", ";", "default", ":", "changed", "=", "defs_to_varying", "(", "stmt", ")", ";", "break", ";", "}", "}", "}", "else", "changed", "=", "defs_to_varying", "(", "stmt", ")", ";", "}", "else", "if", "(", "is_gimple_call", "(", "stmt", ")", ")", "{", "tree", "lhs", "=", "gimple_call_lhs", "(", "stmt", ")", ";", "if", "(", "stmt_has_constants", "(", "stmt", ")", "&&", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "true", ";", "else", "if", "(", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "{", "VN_INFO", "(", "lhs", ")", "->", "has_constants", "=", "false", ";", "VN_INFO", "(", "lhs", ")", "->", "expr", "=", "NULL_TREE", ";", "}", "if", "(", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", "&&", "SSA_NAME_OCCURS_IN_ABNORMAL_PHI", "(", "lhs", ")", ")", "changed", "=", "defs_to_varying", "(", "stmt", ")", ";", "else", "if", "(", "TREE_CODE", "(", "lhs", ")", "==", "SSA_NAME", ")", "{", "if", "(", "!", "gimple_call_internal_p", "(", "stmt", ")", "&&", "gimple_call_flags", "(", "stmt", ")", "&", "(", "ECF_PURE", "|", "ECF_CONST", ")", ")", "changed", "=", "visit_reference_op_call", "(", "lhs", ",", "stmt", ")", ";", "else", "changed", "=", "defs_to_varying", "(", "stmt", ")", ";", "}", "else", "changed", "=", "defs_to_varying", "(", "stmt", ")", ";", "}", "}", "done", ":", "return", "changed", ";", "}" ]
Visit and value number USE, return true if the value number changed.
[ "Visit", "and", "value", "number", "USE", "return", "true", "if", "the", "value", "number", "changed", "." ]
[ "/* Handle uninitialized uses. */", "/* Shortcut for copies. Simplifying copies is pointless,\n\t since we copy the expression and value they represent. */", "/* Setting value numbers to constants will occasionally\n\t screw up phi congruence because constants are not\n\t uniquely associated with a single ssa name that can be\n\t looked up. */", "/* We have to unshare the expression or else\n\t\t valuizing may change the IL stream. */", "/* We reset expr and constantness here because we may\n\t\t have been value numbering optimistically, and\n\t\t iterating. They may become non-constant in this case,\n\t\t even if they were optimistically constant. */", "/* We can substitute SSA_NAMEs that are live over\n\t\t abnormal edges with their constant value. */", "/* Stores or copies from SSA_NAMEs that are live over\n\t\t abnormal edges are a problem. */", "/* VOP-less references can go through unary case. */", "/* Fallthrough. */", "/* ??? We could try to simplify calls. */", "/* We reset expr and constantness here because we may\n\t\t have been value numbering optimistically, and\n\t\t iterating. They may become non-constant in this case,\n\t\t even if they were optimistically constant. */", "/* ??? We should handle stores from calls. */" ]
[ { "param": "use", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "use", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
compare_ops
int
static int compare_ops (const void *pa, const void *pb) { const tree opa = *((const tree *)pa); const tree opb = *((const tree *)pb); gimple opstmta = SSA_NAME_DEF_STMT (opa); gimple opstmtb = SSA_NAME_DEF_STMT (opb); basic_block bba; basic_block bbb; if (gimple_nop_p (opstmta) && gimple_nop_p (opstmtb)) return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); else if (gimple_nop_p (opstmta)) return -1; else if (gimple_nop_p (opstmtb)) return 1; bba = gimple_bb (opstmta); bbb = gimple_bb (opstmtb); if (!bba && !bbb) return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); else if (!bba) return -1; else if (!bbb) return 1; if (bba == bbb) { if (gimple_code (opstmta) == GIMPLE_PHI && gimple_code (opstmtb) == GIMPLE_PHI) return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); else if (gimple_code (opstmta) == GIMPLE_PHI) return -1; else if (gimple_code (opstmtb) == GIMPLE_PHI) return 1; else if (gimple_uid (opstmta) != gimple_uid (opstmtb)) return gimple_uid (opstmta) - gimple_uid (opstmtb); else return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); } return rpo_numbers[bba->index] - rpo_numbers[bbb->index]; }
/* Compare two operands by reverse postorder index */
Compare two operands by reverse postorder index
[ "Compare", "two", "operands", "by", "reverse", "postorder", "index" ]
static int compare_ops (const void *pa, const void *pb) { const tree opa = *((const tree *)pa); const tree opb = *((const tree *)pb); gimple opstmta = SSA_NAME_DEF_STMT (opa); gimple opstmtb = SSA_NAME_DEF_STMT (opb); basic_block bba; basic_block bbb; if (gimple_nop_p (opstmta) && gimple_nop_p (opstmtb)) return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); else if (gimple_nop_p (opstmta)) return -1; else if (gimple_nop_p (opstmtb)) return 1; bba = gimple_bb (opstmta); bbb = gimple_bb (opstmtb); if (!bba && !bbb) return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); else if (!bba) return -1; else if (!bbb) return 1; if (bba == bbb) { if (gimple_code (opstmta) == GIMPLE_PHI && gimple_code (opstmtb) == GIMPLE_PHI) return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); else if (gimple_code (opstmta) == GIMPLE_PHI) return -1; else if (gimple_code (opstmtb) == GIMPLE_PHI) return 1; else if (gimple_uid (opstmta) != gimple_uid (opstmtb)) return gimple_uid (opstmta) - gimple_uid (opstmtb); else return SSA_NAME_VERSION (opa) - SSA_NAME_VERSION (opb); } return rpo_numbers[bba->index] - rpo_numbers[bbb->index]; }
[ "static", "int", "compare_ops", "(", "const", "void", "*", "pa", ",", "const", "void", "*", "pb", ")", "{", "const", "tree", "opa", "=", "*", "(", "(", "const", "tree", "*", ")", "pa", ")", ";", "const", "tree", "opb", "=", "*", "(", "(", "const", "tree", "*", ")", "pb", ")", ";", "gimple", "opstmta", "=", "SSA_NAME_DEF_STMT", "(", "opa", ")", ";", "gimple", "opstmtb", "=", "SSA_NAME_DEF_STMT", "(", "opb", ")", ";", "basic_block", "bba", ";", "basic_block", "bbb", ";", "if", "(", "gimple_nop_p", "(", "opstmta", ")", "&&", "gimple_nop_p", "(", "opstmtb", ")", ")", "return", "SSA_NAME_VERSION", "(", "opa", ")", "-", "SSA_NAME_VERSION", "(", "opb", ")", ";", "else", "if", "(", "gimple_nop_p", "(", "opstmta", ")", ")", "return", "-1", ";", "else", "if", "(", "gimple_nop_p", "(", "opstmtb", ")", ")", "return", "1", ";", "bba", "=", "gimple_bb", "(", "opstmta", ")", ";", "bbb", "=", "gimple_bb", "(", "opstmtb", ")", ";", "if", "(", "!", "bba", "&&", "!", "bbb", ")", "return", "SSA_NAME_VERSION", "(", "opa", ")", "-", "SSA_NAME_VERSION", "(", "opb", ")", ";", "else", "if", "(", "!", "bba", ")", "return", "-1", ";", "else", "if", "(", "!", "bbb", ")", "return", "1", ";", "if", "(", "bba", "==", "bbb", ")", "{", "if", "(", "gimple_code", "(", "opstmta", ")", "==", "GIMPLE_PHI", "&&", "gimple_code", "(", "opstmtb", ")", "==", "GIMPLE_PHI", ")", "return", "SSA_NAME_VERSION", "(", "opa", ")", "-", "SSA_NAME_VERSION", "(", "opb", ")", ";", "else", "if", "(", "gimple_code", "(", "opstmta", ")", "==", "GIMPLE_PHI", ")", "return", "-1", ";", "else", "if", "(", "gimple_code", "(", "opstmtb", ")", "==", "GIMPLE_PHI", ")", "return", "1", ";", "else", "if", "(", "gimple_uid", "(", "opstmta", ")", "!=", "gimple_uid", "(", "opstmtb", ")", ")", "return", "gimple_uid", "(", "opstmta", ")", "-", "gimple_uid", "(", "opstmtb", ")", ";", "else", "return", "SSA_NAME_VERSION", "(", "opa", ")", "-", "SSA_NAME_VERSION", "(", "opb", ")", ";", "}", "return", "rpo_numbers", "[", "bba", "->", "index", "]", "-", "rpo_numbers", "[", "bbb", "->", "index", "]", ";", "}" ]
Compare two operands by reverse postorder index
[ "Compare", "two", "operands", "by", "reverse", "postorder", "index" ]
[]
[ { "param": "pa", "type": "void" }, { "param": "pb", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pa", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pb", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
copy_nary
void
static void copy_nary (vn_nary_op_t onary, vn_tables_t info) { size_t size = sizeof_vn_nary_op (onary->length); vn_nary_op_t nary = alloc_vn_nary_op_noinit (onary->length, &info->nary_obstack); memcpy (nary, onary, size); vn_nary_op_insert_into (nary, info->nary, false); }
/* Insert the no longer used nary ONARY to the hash INFO. */
Insert the no longer used nary ONARY to the hash INFO.
[ "Insert", "the", "no", "longer", "used", "nary", "ONARY", "to", "the", "hash", "INFO", "." ]
static void copy_nary (vn_nary_op_t onary, vn_tables_t info) { size_t size = sizeof_vn_nary_op (onary->length); vn_nary_op_t nary = alloc_vn_nary_op_noinit (onary->length, &info->nary_obstack); memcpy (nary, onary, size); vn_nary_op_insert_into (nary, info->nary, false); }
[ "static", "void", "copy_nary", "(", "vn_nary_op_t", "onary", ",", "vn_tables_t", "info", ")", "{", "size_t", "size", "=", "sizeof_vn_nary_op", "(", "onary", "->", "length", ")", ";", "vn_nary_op_t", "nary", "=", "alloc_vn_nary_op_noinit", "(", "onary", "->", "length", ",", "&", "info", "->", "nary_obstack", ")", ";", "memcpy", "(", "nary", ",", "onary", ",", "size", ")", ";", "vn_nary_op_insert_into", "(", "nary", ",", "info", "->", "nary", ",", "false", ")", ";", "}" ]
Insert the no longer used nary ONARY to the hash INFO.
[ "Insert", "the", "no", "longer", "used", "nary", "ONARY", "to", "the", "hash", "INFO", "." ]
[]
[ { "param": "onary", "type": "vn_nary_op_t" }, { "param": "info", "type": "vn_tables_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "onary", "type": "vn_nary_op_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "info", "type": "vn_tables_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
copy_phi
void
static void copy_phi (vn_phi_t ophi, vn_tables_t info) { vn_phi_t phi = (vn_phi_t) pool_alloc (info->phis_pool); void **slot; memcpy (phi, ophi, sizeof (*phi)); ophi->phiargs = NULL; slot = htab_find_slot_with_hash (info->phis, phi, phi->hashcode, INSERT); gcc_assert (!*slot); *slot = phi; }
/* Insert the no longer used phi OPHI to the hash INFO. */
Insert the no longer used phi OPHI to the hash INFO.
[ "Insert", "the", "no", "longer", "used", "phi", "OPHI", "to", "the", "hash", "INFO", "." ]
static void copy_phi (vn_phi_t ophi, vn_tables_t info) { vn_phi_t phi = (vn_phi_t) pool_alloc (info->phis_pool); void **slot; memcpy (phi, ophi, sizeof (*phi)); ophi->phiargs = NULL; slot = htab_find_slot_with_hash (info->phis, phi, phi->hashcode, INSERT); gcc_assert (!*slot); *slot = phi; }
[ "static", "void", "copy_phi", "(", "vn_phi_t", "ophi", ",", "vn_tables_t", "info", ")", "{", "vn_phi_t", "phi", "=", "(", "vn_phi_t", ")", "pool_alloc", "(", "info", "->", "phis_pool", ")", ";", "void", "*", "*", "slot", ";", "memcpy", "(", "phi", ",", "ophi", ",", "sizeof", "(", "*", "phi", ")", ")", ";", "ophi", "->", "phiargs", "=", "NULL", ";", "slot", "=", "htab_find_slot_with_hash", "(", "info", "->", "phis", ",", "phi", ",", "phi", "->", "hashcode", ",", "INSERT", ")", ";", "gcc_assert", "(", "!", "*", "slot", ")", ";", "*", "slot", "=", "phi", ";", "}" ]
Insert the no longer used phi OPHI to the hash INFO.
[ "Insert", "the", "no", "longer", "used", "phi", "OPHI", "to", "the", "hash", "INFO", "." ]
[]
[ { "param": "ophi", "type": "vn_phi_t" }, { "param": "info", "type": "vn_tables_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ophi", "type": "vn_phi_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "info", "type": "vn_tables_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
copy_reference
void
static void copy_reference (vn_reference_t oref, vn_tables_t info) { vn_reference_t ref; void **slot; ref = (vn_reference_t) pool_alloc (info->references_pool); memcpy (ref, oref, sizeof (*ref)); oref->operands = NULL; slot = htab_find_slot_with_hash (info->references, ref, ref->hashcode, INSERT); if (*slot) free_reference (*slot); *slot = ref; }
/* Insert the no longer used reference OREF to the hash INFO. */
Insert the no longer used reference OREF to the hash INFO.
[ "Insert", "the", "no", "longer", "used", "reference", "OREF", "to", "the", "hash", "INFO", "." ]
static void copy_reference (vn_reference_t oref, vn_tables_t info) { vn_reference_t ref; void **slot; ref = (vn_reference_t) pool_alloc (info->references_pool); memcpy (ref, oref, sizeof (*ref)); oref->operands = NULL; slot = htab_find_slot_with_hash (info->references, ref, ref->hashcode, INSERT); if (*slot) free_reference (*slot); *slot = ref; }
[ "static", "void", "copy_reference", "(", "vn_reference_t", "oref", ",", "vn_tables_t", "info", ")", "{", "vn_reference_t", "ref", ";", "void", "*", "*", "slot", ";", "ref", "=", "(", "vn_reference_t", ")", "pool_alloc", "(", "info", "->", "references_pool", ")", ";", "memcpy", "(", "ref", ",", "oref", ",", "sizeof", "(", "*", "ref", ")", ")", ";", "oref", "->", "operands", "=", "NULL", ";", "slot", "=", "htab_find_slot_with_hash", "(", "info", "->", "references", ",", "ref", ",", "ref", "->", "hashcode", ",", "INSERT", ")", ";", "if", "(", "*", "slot", ")", "free_reference", "(", "*", "slot", ")", ";", "*", "slot", "=", "ref", ";", "}" ]
Insert the no longer used reference OREF to the hash INFO.
[ "Insert", "the", "no", "longer", "used", "reference", "OREF", "to", "the", "hash", "INFO", "." ]
[]
[ { "param": "oref", "type": "vn_reference_t" }, { "param": "info", "type": "vn_tables_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "oref", "type": "vn_reference_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "info", "type": "vn_tables_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
extract_and_process_scc_for_name
bool
static bool extract_and_process_scc_for_name (tree name) { VEC (tree, heap) *scc = NULL; tree x; /* Found an SCC, pop the components off the SCC stack and process them. */ do { x = VEC_pop (tree, sccstack); VN_INFO (x)->on_sccstack = false; VEC_safe_push (tree, heap, scc, x); } while (x != name); /* Bail out of SCCVN in case a SCC turns out to be incredibly large. */ if (VEC_length (tree, scc) > (unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE)) { if (dump_file) fprintf (dump_file, "WARNING: Giving up with SCCVN due to " "SCC size %u exceeding %u\n", VEC_length (tree, scc), (unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE)); VEC_free (tree, heap, scc); return false; } if (VEC_length (tree, scc) > 1) sort_scc (scc); if (dump_file && (dump_flags & TDF_DETAILS)) print_scc (dump_file, scc); process_scc (scc); VEC_free (tree, heap, scc); return true; }
/* Pop the components of the found SCC for NAME off the SCC stack and process them. Returns true if all went well, false if we run into resource limits. */
Pop the components of the found SCC for NAME off the SCC stack and process them. Returns true if all went well, false if we run into resource limits.
[ "Pop", "the", "components", "of", "the", "found", "SCC", "for", "NAME", "off", "the", "SCC", "stack", "and", "process", "them", ".", "Returns", "true", "if", "all", "went", "well", "false", "if", "we", "run", "into", "resource", "limits", "." ]
static bool extract_and_process_scc_for_name (tree name) { VEC (tree, heap) *scc = NULL; tree x; do { x = VEC_pop (tree, sccstack); VN_INFO (x)->on_sccstack = false; VEC_safe_push (tree, heap, scc, x); } while (x != name); if (VEC_length (tree, scc) > (unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE)) { if (dump_file) fprintf (dump_file, "WARNING: Giving up with SCCVN due to " "SCC size %u exceeding %u\n", VEC_length (tree, scc), (unsigned)PARAM_VALUE (PARAM_SCCVN_MAX_SCC_SIZE)); VEC_free (tree, heap, scc); return false; } if (VEC_length (tree, scc) > 1) sort_scc (scc); if (dump_file && (dump_flags & TDF_DETAILS)) print_scc (dump_file, scc); process_scc (scc); VEC_free (tree, heap, scc); return true; }
[ "static", "bool", "extract_and_process_scc_for_name", "(", "tree", "name", ")", "{", "VEC", "(", "tree", ",", "heap", ")", "*", "scc", "=", "NULL", ";", "tree", "x", ";", "do", "{", "x", "=", "VEC_pop", "(", "tree", ",", "sccstack", ")", ";", "VN_INFO", "(", "x", ")", "->", "on_sccstack", "=", "false", ";", "VEC_safe_push", "(", "tree", ",", "heap", ",", "scc", ",", "x", ")", ";", "}", "while", "(", "x", "!=", "name", ")", ";", "if", "(", "VEC_length", "(", "tree", ",", "scc", ")", ">", "(", "unsigned", ")", "PARAM_VALUE", "(", "PARAM_SCCVN_MAX_SCC_SIZE", ")", ")", "{", "if", "(", "dump_file", ")", "fprintf", "(", "dump_file", ",", "\"", "\"", "\"", "\\n", "\"", ",", "VEC_length", "(", "tree", ",", "scc", ")", ",", "(", "unsigned", ")", "PARAM_VALUE", "(", "PARAM_SCCVN_MAX_SCC_SIZE", ")", ")", ";", "VEC_free", "(", "tree", ",", "heap", ",", "scc", ")", ";", "return", "false", ";", "}", "if", "(", "VEC_length", "(", "tree", ",", "scc", ")", ">", "1", ")", "sort_scc", "(", "scc", ")", ";", "if", "(", "dump_file", "&&", "(", "dump_flags", "&", "TDF_DETAILS", ")", ")", "print_scc", "(", "dump_file", ",", "scc", ")", ";", "process_scc", "(", "scc", ")", ";", "VEC_free", "(", "tree", ",", "heap", ",", "scc", ")", ";", "return", "true", ";", "}" ]
Pop the components of the found SCC for NAME off the SCC stack and process them.
[ "Pop", "the", "components", "of", "the", "found", "SCC", "for", "NAME", "off", "the", "SCC", "stack", "and", "process", "them", "." ]
[ "/* Found an SCC, pop the components off the SCC stack and\n process them. */", "/* Bail out of SCCVN in case a SCC turns out to be incredibly large. */" ]
[ { "param": "name", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
DFS
bool
static bool DFS (tree name) { VEC(ssa_op_iter, heap) *itervec = NULL; VEC(tree, heap) *namevec = NULL; use_operand_p usep = NULL; gimple defstmt; tree use; ssa_op_iter iter; start_over: /* SCC info */ VN_INFO (name)->dfsnum = next_dfs_num++; VN_INFO (name)->visited = true; VN_INFO (name)->low = VN_INFO (name)->dfsnum; VEC_safe_push (tree, heap, sccstack, name); VN_INFO (name)->on_sccstack = true; defstmt = SSA_NAME_DEF_STMT (name); /* Recursively DFS on our operands, looking for SCC's. */ if (!gimple_nop_p (defstmt)) { /* Push a new iterator. */ if (gimple_code (defstmt) == GIMPLE_PHI) usep = op_iter_init_phiuse (&iter, defstmt, SSA_OP_ALL_USES); else usep = op_iter_init_use (&iter, defstmt, SSA_OP_ALL_USES); } else clear_and_done_ssa_iter (&iter); while (1) { /* If we are done processing uses of a name, go up the stack of iterators and process SCCs as we found them. */ if (op_iter_done (&iter)) { /* See if we found an SCC. */ if (VN_INFO (name)->low == VN_INFO (name)->dfsnum) if (!extract_and_process_scc_for_name (name)) { VEC_free (tree, heap, namevec); VEC_free (ssa_op_iter, heap, itervec); return false; } /* Check if we are done. */ if (VEC_empty (tree, namevec)) { VEC_free (tree, heap, namevec); VEC_free (ssa_op_iter, heap, itervec); return true; } /* Restore the last use walker and continue walking there. */ use = name; name = VEC_pop (tree, namevec); memcpy (&iter, VEC_last (ssa_op_iter, itervec), sizeof (ssa_op_iter)); VEC_pop (ssa_op_iter, itervec); goto continue_walking; } use = USE_FROM_PTR (usep); /* Since we handle phi nodes, we will sometimes get invariants in the use expression. */ if (TREE_CODE (use) == SSA_NAME) { if (! (VN_INFO (use)->visited)) { /* Recurse by pushing the current use walking state on the stack and starting over. */ VEC_safe_push(ssa_op_iter, heap, itervec, &iter); VEC_safe_push(tree, heap, namevec, name); name = use; goto start_over; continue_walking: VN_INFO (name)->low = MIN (VN_INFO (name)->low, VN_INFO (use)->low); } if (VN_INFO (use)->dfsnum < VN_INFO (name)->dfsnum && VN_INFO (use)->on_sccstack) { VN_INFO (name)->low = MIN (VN_INFO (use)->dfsnum, VN_INFO (name)->low); } } usep = op_iter_next_use (&iter); } }
/* Depth first search on NAME to discover and process SCC's in the SSA graph. Execution of this algorithm relies on the fact that the SCC's are popped off the stack in topological order. Returns true if successful, false if we stopped processing SCC's due to resource constraints. */
Depth first search on NAME to discover and process SCC's in the SSA graph. Execution of this algorithm relies on the fact that the SCC's are popped off the stack in topological order. Returns true if successful, false if we stopped processing SCC's due to resource constraints.
[ "Depth", "first", "search", "on", "NAME", "to", "discover", "and", "process", "SCC", "'", "s", "in", "the", "SSA", "graph", ".", "Execution", "of", "this", "algorithm", "relies", "on", "the", "fact", "that", "the", "SCC", "'", "s", "are", "popped", "off", "the", "stack", "in", "topological", "order", ".", "Returns", "true", "if", "successful", "false", "if", "we", "stopped", "processing", "SCC", "'", "s", "due", "to", "resource", "constraints", "." ]
static bool DFS (tree name) { VEC(ssa_op_iter, heap) *itervec = NULL; VEC(tree, heap) *namevec = NULL; use_operand_p usep = NULL; gimple defstmt; tree use; ssa_op_iter iter; start_over: VN_INFO (name)->dfsnum = next_dfs_num++; VN_INFO (name)->visited = true; VN_INFO (name)->low = VN_INFO (name)->dfsnum; VEC_safe_push (tree, heap, sccstack, name); VN_INFO (name)->on_sccstack = true; defstmt = SSA_NAME_DEF_STMT (name); if (!gimple_nop_p (defstmt)) { if (gimple_code (defstmt) == GIMPLE_PHI) usep = op_iter_init_phiuse (&iter, defstmt, SSA_OP_ALL_USES); else usep = op_iter_init_use (&iter, defstmt, SSA_OP_ALL_USES); } else clear_and_done_ssa_iter (&iter); while (1) { if (op_iter_done (&iter)) { if (VN_INFO (name)->low == VN_INFO (name)->dfsnum) if (!extract_and_process_scc_for_name (name)) { VEC_free (tree, heap, namevec); VEC_free (ssa_op_iter, heap, itervec); return false; } if (VEC_empty (tree, namevec)) { VEC_free (tree, heap, namevec); VEC_free (ssa_op_iter, heap, itervec); return true; } use = name; name = VEC_pop (tree, namevec); memcpy (&iter, VEC_last (ssa_op_iter, itervec), sizeof (ssa_op_iter)); VEC_pop (ssa_op_iter, itervec); goto continue_walking; } use = USE_FROM_PTR (usep); if (TREE_CODE (use) == SSA_NAME) { if (! (VN_INFO (use)->visited)) { VEC_safe_push(ssa_op_iter, heap, itervec, &iter); VEC_safe_push(tree, heap, namevec, name); name = use; goto start_over; continue_walking: VN_INFO (name)->low = MIN (VN_INFO (name)->low, VN_INFO (use)->low); } if (VN_INFO (use)->dfsnum < VN_INFO (name)->dfsnum && VN_INFO (use)->on_sccstack) { VN_INFO (name)->low = MIN (VN_INFO (use)->dfsnum, VN_INFO (name)->low); } } usep = op_iter_next_use (&iter); } }
[ "static", "bool", "DFS", "(", "tree", "name", ")", "{", "VEC", "(", "ssa_op_iter", ",", "heap", ")", "*", "itervec", "=", "NULL", ";", "VEC", "(", "tree", ",", "heap", ")", "*", "namevec", "=", "NULL", ";", "use_operand_p", "usep", "=", "NULL", ";", "gimple", "defstmt", ";", "tree", "use", ";", "ssa_op_iter", "iter", ";", "start_over", ":", "VN_INFO", "(", "name", ")", "->", "dfsnum", "=", "next_dfs_num", "++", ";", "VN_INFO", "(", "name", ")", "->", "visited", "=", "true", ";", "VN_INFO", "(", "name", ")", "->", "low", "=", "VN_INFO", "(", "name", ")", "->", "dfsnum", ";", "VEC_safe_push", "(", "tree", ",", "heap", ",", "sccstack", ",", "name", ")", ";", "VN_INFO", "(", "name", ")", "->", "on_sccstack", "=", "true", ";", "defstmt", "=", "SSA_NAME_DEF_STMT", "(", "name", ")", ";", "if", "(", "!", "gimple_nop_p", "(", "defstmt", ")", ")", "{", "if", "(", "gimple_code", "(", "defstmt", ")", "==", "GIMPLE_PHI", ")", "usep", "=", "op_iter_init_phiuse", "(", "&", "iter", ",", "defstmt", ",", "SSA_OP_ALL_USES", ")", ";", "else", "usep", "=", "op_iter_init_use", "(", "&", "iter", ",", "defstmt", ",", "SSA_OP_ALL_USES", ")", ";", "}", "else", "clear_and_done_ssa_iter", "(", "&", "iter", ")", ";", "while", "(", "1", ")", "{", "if", "(", "op_iter_done", "(", "&", "iter", ")", ")", "{", "if", "(", "VN_INFO", "(", "name", ")", "->", "low", "==", "VN_INFO", "(", "name", ")", "->", "dfsnum", ")", "if", "(", "!", "extract_and_process_scc_for_name", "(", "name", ")", ")", "{", "VEC_free", "(", "tree", ",", "heap", ",", "namevec", ")", ";", "VEC_free", "(", "ssa_op_iter", ",", "heap", ",", "itervec", ")", ";", "return", "false", ";", "}", "if", "(", "VEC_empty", "(", "tree", ",", "namevec", ")", ")", "{", "VEC_free", "(", "tree", ",", "heap", ",", "namevec", ")", ";", "VEC_free", "(", "ssa_op_iter", ",", "heap", ",", "itervec", ")", ";", "return", "true", ";", "}", "use", "=", "name", ";", "name", "=", "VEC_pop", "(", "tree", ",", "namevec", ")", ";", "memcpy", "(", "&", "iter", ",", "VEC_last", "(", "ssa_op_iter", ",", "itervec", ")", ",", "sizeof", "(", "ssa_op_iter", ")", ")", ";", "VEC_pop", "(", "ssa_op_iter", ",", "itervec", ")", ";", "goto", "continue_walking", ";", "}", "use", "=", "USE_FROM_PTR", "(", "usep", ")", ";", "if", "(", "TREE_CODE", "(", "use", ")", "==", "SSA_NAME", ")", "{", "if", "(", "!", "(", "VN_INFO", "(", "use", ")", "->", "visited", ")", ")", "{", "VEC_safe_push", "(", "ssa_op_iter", ",", "heap", ",", "itervec", ",", "&", "iter", ")", ";", "VEC_safe_push", "(", "tree", ",", "heap", ",", "namevec", ",", "name", ")", ";", "name", "=", "use", ";", "goto", "start_over", ";", "continue_walking", ":", "VN_INFO", "(", "name", ")", "->", "low", "=", "MIN", "(", "VN_INFO", "(", "name", ")", "->", "low", ",", "VN_INFO", "(", "use", ")", "->", "low", ")", ";", "}", "if", "(", "VN_INFO", "(", "use", ")", "->", "dfsnum", "<", "VN_INFO", "(", "name", ")", "->", "dfsnum", "&&", "VN_INFO", "(", "use", ")", "->", "on_sccstack", ")", "{", "VN_INFO", "(", "name", ")", "->", "low", "=", "MIN", "(", "VN_INFO", "(", "use", ")", "->", "dfsnum", ",", "VN_INFO", "(", "name", ")", "->", "low", ")", ";", "}", "}", "usep", "=", "op_iter_next_use", "(", "&", "iter", ")", ";", "}", "}" ]
Depth first search on NAME to discover and process SCC's in the SSA graph.
[ "Depth", "first", "search", "on", "NAME", "to", "discover", "and", "process", "SCC", "'", "s", "in", "the", "SSA", "graph", "." ]
[ "/* SCC info */", "/* Recursively DFS on our operands, looking for SCC's. */", "/* Push a new iterator. */", "/* If we are done processing uses of a name, go up the stack\n\t of iterators and process SCCs as we found them. */", "/* See if we found an SCC. */", "/* Check if we are done. */", "/* Restore the last use walker and continue walking there. */", "/* Since we handle phi nodes, we will sometimes get\n\t invariants in the use expression. */", "/* Recurse by pushing the current use walking state on\n\t\t the stack and starting over. */" ]
[ { "param": "name", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
allocate_vn_table
void
static void allocate_vn_table (vn_tables_t table) { table->phis = htab_create (23, vn_phi_hash, vn_phi_eq, free_phi); table->nary = htab_create (23, vn_nary_op_hash, vn_nary_op_eq, NULL); table->references = htab_create (23, vn_reference_hash, vn_reference_eq, free_reference); gcc_obstack_init (&table->nary_obstack); table->phis_pool = create_alloc_pool ("VN phis", sizeof (struct vn_phi_s), 30); table->references_pool = create_alloc_pool ("VN references", sizeof (struct vn_reference_s), 30); }
/* Allocate a value number table. */
Allocate a value number table.
[ "Allocate", "a", "value", "number", "table", "." ]
static void allocate_vn_table (vn_tables_t table) { table->phis = htab_create (23, vn_phi_hash, vn_phi_eq, free_phi); table->nary = htab_create (23, vn_nary_op_hash, vn_nary_op_eq, NULL); table->references = htab_create (23, vn_reference_hash, vn_reference_eq, free_reference); gcc_obstack_init (&table->nary_obstack); table->phis_pool = create_alloc_pool ("VN phis", sizeof (struct vn_phi_s), 30); table->references_pool = create_alloc_pool ("VN references", sizeof (struct vn_reference_s), 30); }
[ "static", "void", "allocate_vn_table", "(", "vn_tables_t", "table", ")", "{", "table", "->", "phis", "=", "htab_create", "(", "23", ",", "vn_phi_hash", ",", "vn_phi_eq", ",", "free_phi", ")", ";", "table", "->", "nary", "=", "htab_create", "(", "23", ",", "vn_nary_op_hash", ",", "vn_nary_op_eq", ",", "NULL", ")", ";", "table", "->", "references", "=", "htab_create", "(", "23", ",", "vn_reference_hash", ",", "vn_reference_eq", ",", "free_reference", ")", ";", "gcc_obstack_init", "(", "&", "table", "->", "nary_obstack", ")", ";", "table", "->", "phis_pool", "=", "create_alloc_pool", "(", "\"", "\"", ",", "sizeof", "(", "struct", "vn_phi_s", ")", ",", "30", ")", ";", "table", "->", "references_pool", "=", "create_alloc_pool", "(", "\"", "\"", ",", "sizeof", "(", "struct", "vn_reference_s", ")", ",", "30", ")", ";", "}" ]
Allocate a value number table.
[ "Allocate", "a", "value", "number", "table", "." ]
[]
[ { "param": "table", "type": "vn_tables_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "table", "type": "vn_tables_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
free_vn_table
void
static void free_vn_table (vn_tables_t table) { htab_delete (table->phis); htab_delete (table->nary); htab_delete (table->references); obstack_free (&table->nary_obstack, NULL); free_alloc_pool (table->phis_pool); free_alloc_pool (table->references_pool); }
/* Free a value number table. */
Free a value number table.
[ "Free", "a", "value", "number", "table", "." ]
static void free_vn_table (vn_tables_t table) { htab_delete (table->phis); htab_delete (table->nary); htab_delete (table->references); obstack_free (&table->nary_obstack, NULL); free_alloc_pool (table->phis_pool); free_alloc_pool (table->references_pool); }
[ "static", "void", "free_vn_table", "(", "vn_tables_t", "table", ")", "{", "htab_delete", "(", "table", "->", "phis", ")", ";", "htab_delete", "(", "table", "->", "nary", ")", ";", "htab_delete", "(", "table", "->", "references", ")", ";", "obstack_free", "(", "&", "table", "->", "nary_obstack", ",", "NULL", ")", ";", "free_alloc_pool", "(", "table", "->", "phis_pool", ")", ";", "free_alloc_pool", "(", "table", "->", "references_pool", ")", ";", "}" ]
Free a value number table.
[ "Free", "a", "value", "number", "table", "." ]
[]
[ { "param": "table", "type": "vn_tables_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "table", "type": "vn_tables_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
run_scc_vn
bool
bool run_scc_vn (vn_lookup_kind default_vn_walk_kind_) { size_t i; tree param; bool changed = true; default_vn_walk_kind = default_vn_walk_kind_; init_scc_vn (); current_info = valid_info; for (param = DECL_ARGUMENTS (current_function_decl); param; param = DECL_CHAIN (param)) { if (gimple_default_def (cfun, param) != NULL) { tree def = gimple_default_def (cfun, param); VN_INFO (def)->valnum = def; } } for (i = 1; i < num_ssa_names; ++i) { tree name = ssa_name (i); if (name && VN_INFO (name)->visited == false && !has_zero_uses (name)) if (!DFS (name)) { free_scc_vn (); return false; } } /* Initialize the value ids. */ for (i = 1; i < num_ssa_names; ++i) { tree name = ssa_name (i); vn_ssa_aux_t info; if (!name) continue; info = VN_INFO (name); if (info->valnum == name || info->valnum == VN_TOP) info->value_id = get_next_value_id (); else if (is_gimple_min_invariant (info->valnum)) info->value_id = get_or_alloc_constant_value_id (info->valnum); } /* Propagate until they stop changing. */ while (changed) { changed = false; for (i = 1; i < num_ssa_names; ++i) { tree name = ssa_name (i); vn_ssa_aux_t info; if (!name) continue; info = VN_INFO (name); if (TREE_CODE (info->valnum) == SSA_NAME && info->valnum != name && info->value_id != VN_INFO (info->valnum)->value_id) { changed = true; info->value_id = VN_INFO (info->valnum)->value_id; } } } set_hashtable_value_ids (); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Value numbers:\n"); for (i = 0; i < num_ssa_names; i++) { tree name = ssa_name (i); if (name && VN_INFO (name)->visited && SSA_VAL (name) != name) { print_generic_expr (dump_file, name, 0); fprintf (dump_file, " = "); print_generic_expr (dump_file, SSA_VAL (name), 0); fprintf (dump_file, "\n"); } } } return true; }
/* Do SCCVN. Returns true if it finished, false if we bailed out due to resource constraints. DEFAULT_VN_WALK_KIND_ specifies how we use the alias oracle walking during the VN process. */
Do SCCVN. Returns true if it finished, false if we bailed out due to resource constraints. DEFAULT_VN_WALK_KIND_ specifies how we use the alias oracle walking during the VN process.
[ "Do", "SCCVN", ".", "Returns", "true", "if", "it", "finished", "false", "if", "we", "bailed", "out", "due", "to", "resource", "constraints", ".", "DEFAULT_VN_WALK_KIND_", "specifies", "how", "we", "use", "the", "alias", "oracle", "walking", "during", "the", "VN", "process", "." ]
bool run_scc_vn (vn_lookup_kind default_vn_walk_kind_) { size_t i; tree param; bool changed = true; default_vn_walk_kind = default_vn_walk_kind_; init_scc_vn (); current_info = valid_info; for (param = DECL_ARGUMENTS (current_function_decl); param; param = DECL_CHAIN (param)) { if (gimple_default_def (cfun, param) != NULL) { tree def = gimple_default_def (cfun, param); VN_INFO (def)->valnum = def; } } for (i = 1; i < num_ssa_names; ++i) { tree name = ssa_name (i); if (name && VN_INFO (name)->visited == false && !has_zero_uses (name)) if (!DFS (name)) { free_scc_vn (); return false; } } for (i = 1; i < num_ssa_names; ++i) { tree name = ssa_name (i); vn_ssa_aux_t info; if (!name) continue; info = VN_INFO (name); if (info->valnum == name || info->valnum == VN_TOP) info->value_id = get_next_value_id (); else if (is_gimple_min_invariant (info->valnum)) info->value_id = get_or_alloc_constant_value_id (info->valnum); } while (changed) { changed = false; for (i = 1; i < num_ssa_names; ++i) { tree name = ssa_name (i); vn_ssa_aux_t info; if (!name) continue; info = VN_INFO (name); if (TREE_CODE (info->valnum) == SSA_NAME && info->valnum != name && info->value_id != VN_INFO (info->valnum)->value_id) { changed = true; info->value_id = VN_INFO (info->valnum)->value_id; } } } set_hashtable_value_ids (); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Value numbers:\n"); for (i = 0; i < num_ssa_names; i++) { tree name = ssa_name (i); if (name && VN_INFO (name)->visited && SSA_VAL (name) != name) { print_generic_expr (dump_file, name, 0); fprintf (dump_file, " = "); print_generic_expr (dump_file, SSA_VAL (name), 0); fprintf (dump_file, "\n"); } } } return true; }
[ "bool", "run_scc_vn", "(", "vn_lookup_kind", "default_vn_walk_kind_", ")", "{", "size_t", "i", ";", "tree", "param", ";", "bool", "changed", "=", "true", ";", "default_vn_walk_kind", "=", "default_vn_walk_kind_", ";", "init_scc_vn", "(", ")", ";", "current_info", "=", "valid_info", ";", "for", "(", "param", "=", "DECL_ARGUMENTS", "(", "current_function_decl", ")", ";", "param", ";", "param", "=", "DECL_CHAIN", "(", "param", ")", ")", "{", "if", "(", "gimple_default_def", "(", "cfun", ",", "param", ")", "!=", "NULL", ")", "{", "tree", "def", "=", "gimple_default_def", "(", "cfun", ",", "param", ")", ";", "VN_INFO", "(", "def", ")", "->", "valnum", "=", "def", ";", "}", "}", "for", "(", "i", "=", "1", ";", "i", "<", "num_ssa_names", ";", "++", "i", ")", "{", "tree", "name", "=", "ssa_name", "(", "i", ")", ";", "if", "(", "name", "&&", "VN_INFO", "(", "name", ")", "->", "visited", "==", "false", "&&", "!", "has_zero_uses", "(", "name", ")", ")", "if", "(", "!", "DFS", "(", "name", ")", ")", "{", "free_scc_vn", "(", ")", ";", "return", "false", ";", "}", "}", "for", "(", "i", "=", "1", ";", "i", "<", "num_ssa_names", ";", "++", "i", ")", "{", "tree", "name", "=", "ssa_name", "(", "i", ")", ";", "vn_ssa_aux_t", "info", ";", "if", "(", "!", "name", ")", "continue", ";", "info", "=", "VN_INFO", "(", "name", ")", ";", "if", "(", "info", "->", "valnum", "==", "name", "||", "info", "->", "valnum", "==", "VN_TOP", ")", "info", "->", "value_id", "=", "get_next_value_id", "(", ")", ";", "else", "if", "(", "is_gimple_min_invariant", "(", "info", "->", "valnum", ")", ")", "info", "->", "value_id", "=", "get_or_alloc_constant_value_id", "(", "info", "->", "valnum", ")", ";", "}", "while", "(", "changed", ")", "{", "changed", "=", "false", ";", "for", "(", "i", "=", "1", ";", "i", "<", "num_ssa_names", ";", "++", "i", ")", "{", "tree", "name", "=", "ssa_name", "(", "i", ")", ";", "vn_ssa_aux_t", "info", ";", "if", "(", "!", "name", ")", "continue", ";", "info", "=", "VN_INFO", "(", "name", ")", ";", "if", "(", "TREE_CODE", "(", "info", "->", "valnum", ")", "==", "SSA_NAME", "&&", "info", "->", "valnum", "!=", "name", "&&", "info", "->", "value_id", "!=", "VN_INFO", "(", "info", "->", "valnum", ")", "->", "value_id", ")", "{", "changed", "=", "true", ";", "info", "->", "value_id", "=", "VN_INFO", "(", "info", "->", "valnum", ")", "->", "value_id", ";", "}", "}", "}", "set_hashtable_value_ids", "(", ")", ";", "if", "(", "dump_file", "&&", "(", "dump_flags", "&", "TDF_DETAILS", ")", ")", "{", "fprintf", "(", "dump_file", ",", "\"", "\\n", "\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "num_ssa_names", ";", "i", "++", ")", "{", "tree", "name", "=", "ssa_name", "(", "i", ")", ";", "if", "(", "name", "&&", "VN_INFO", "(", "name", ")", "->", "visited", "&&", "SSA_VAL", "(", "name", ")", "!=", "name", ")", "{", "print_generic_expr", "(", "dump_file", ",", "name", ",", "0", ")", ";", "fprintf", "(", "dump_file", ",", "\"", "\"", ")", ";", "print_generic_expr", "(", "dump_file", ",", "SSA_VAL", "(", "name", ")", ",", "0", ")", ";", "fprintf", "(", "dump_file", ",", "\"", "\\n", "\"", ")", ";", "}", "}", "}", "return", "true", ";", "}" ]
Do SCCVN.
[ "Do", "SCCVN", "." ]
[ "/* Initialize the value ids. */", "/* Propagate until they stop changing. */" ]
[ { "param": "default_vn_walk_kind_", "type": "vn_lookup_kind" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "default_vn_walk_kind_", "type": "vn_lookup_kind", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
expressions_equal_p
bool
bool expressions_equal_p (tree e1, tree e2) { /* The obvious case. */ if (e1 == e2) return true; /* If only one of them is null, they cannot be equal. */ if (!e1 || !e2) return false; /* Now perform the actual comparison. */ if (TREE_CODE (e1) == TREE_CODE (e2) && operand_equal_p (e1, e2, OEP_PURE_SAME)) return true; return false; }
/* Compare two expressions E1 and E2 and return true if they are equal. */
Compare two expressions E1 and E2 and return true if they are equal.
[ "Compare", "two", "expressions", "E1", "and", "E2", "and", "return", "true", "if", "they", "are", "equal", "." ]
bool expressions_equal_p (tree e1, tree e2) { if (e1 == e2) return true; if (!e1 || !e2) return false; if (TREE_CODE (e1) == TREE_CODE (e2) && operand_equal_p (e1, e2, OEP_PURE_SAME)) return true; return false; }
[ "bool", "expressions_equal_p", "(", "tree", "e1", ",", "tree", "e2", ")", "{", "if", "(", "e1", "==", "e2", ")", "return", "true", ";", "if", "(", "!", "e1", "||", "!", "e2", ")", "return", "false", ";", "if", "(", "TREE_CODE", "(", "e1", ")", "==", "TREE_CODE", "(", "e2", ")", "&&", "operand_equal_p", "(", "e1", ",", "e2", ",", "OEP_PURE_SAME", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Compare two expressions E1 and E2 and return true if they are equal.
[ "Compare", "two", "expressions", "E1", "and", "E2", "and", "return", "true", "if", "they", "are", "equal", "." ]
[ "/* The obvious case. */", "/* If only one of them is null, they cannot be equal. */", "/* Now perform the actual comparison. */" ]
[ { "param": "e1", "type": "tree" }, { "param": "e2", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "e1", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "e2", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e4dc14434d6cf8445323db81d832877f4f0f30b
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-sccvn.c
[ "BSD-3-Clause" ]
C
vn_nary_may_trap
bool
bool vn_nary_may_trap (vn_nary_op_t nary) { tree type; tree rhs2 = NULL_TREE; bool honor_nans = false; bool honor_snans = false; bool fp_operation = false; bool honor_trapv = false; bool handled, ret; unsigned i; if (TREE_CODE_CLASS (nary->opcode) == tcc_comparison || TREE_CODE_CLASS (nary->opcode) == tcc_unary || TREE_CODE_CLASS (nary->opcode) == tcc_binary) { type = nary->type; fp_operation = FLOAT_TYPE_P (type); if (fp_operation) { honor_nans = flag_trapping_math && !flag_finite_math_only; honor_snans = flag_signaling_nans != 0; } else if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_TRAPS (type)) honor_trapv = true; } if (nary->length >= 2) rhs2 = nary->op[1]; ret = operation_could_trap_helper_p (nary->opcode, fp_operation, honor_trapv, honor_nans, honor_snans, rhs2, &handled); if (handled && ret) return true; for (i = 0; i < nary->length; ++i) if (tree_could_trap_p (nary->op[i])) return true; return false; }
/* Return true if the nary operation NARY may trap. This is a copy of stmt_could_throw_1_p adjusted to the SCCVN IL. */
Return true if the nary operation NARY may trap. This is a copy of stmt_could_throw_1_p adjusted to the SCCVN IL.
[ "Return", "true", "if", "the", "nary", "operation", "NARY", "may", "trap", ".", "This", "is", "a", "copy", "of", "stmt_could_throw_1_p", "adjusted", "to", "the", "SCCVN", "IL", "." ]
bool vn_nary_may_trap (vn_nary_op_t nary) { tree type; tree rhs2 = NULL_TREE; bool honor_nans = false; bool honor_snans = false; bool fp_operation = false; bool honor_trapv = false; bool handled, ret; unsigned i; if (TREE_CODE_CLASS (nary->opcode) == tcc_comparison || TREE_CODE_CLASS (nary->opcode) == tcc_unary || TREE_CODE_CLASS (nary->opcode) == tcc_binary) { type = nary->type; fp_operation = FLOAT_TYPE_P (type); if (fp_operation) { honor_nans = flag_trapping_math && !flag_finite_math_only; honor_snans = flag_signaling_nans != 0; } else if (INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_TRAPS (type)) honor_trapv = true; } if (nary->length >= 2) rhs2 = nary->op[1]; ret = operation_could_trap_helper_p (nary->opcode, fp_operation, honor_trapv, honor_nans, honor_snans, rhs2, &handled); if (handled && ret) return true; for (i = 0; i < nary->length; ++i) if (tree_could_trap_p (nary->op[i])) return true; return false; }
[ "bool", "vn_nary_may_trap", "(", "vn_nary_op_t", "nary", ")", "{", "tree", "type", ";", "tree", "rhs2", "=", "NULL_TREE", ";", "bool", "honor_nans", "=", "false", ";", "bool", "honor_snans", "=", "false", ";", "bool", "fp_operation", "=", "false", ";", "bool", "honor_trapv", "=", "false", ";", "bool", "handled", ",", "ret", ";", "unsigned", "i", ";", "if", "(", "TREE_CODE_CLASS", "(", "nary", "->", "opcode", ")", "==", "tcc_comparison", "||", "TREE_CODE_CLASS", "(", "nary", "->", "opcode", ")", "==", "tcc_unary", "||", "TREE_CODE_CLASS", "(", "nary", "->", "opcode", ")", "==", "tcc_binary", ")", "{", "type", "=", "nary", "->", "type", ";", "fp_operation", "=", "FLOAT_TYPE_P", "(", "type", ")", ";", "if", "(", "fp_operation", ")", "{", "honor_nans", "=", "flag_trapping_math", "&&", "!", "flag_finite_math_only", ";", "honor_snans", "=", "flag_signaling_nans", "!=", "0", ";", "}", "else", "if", "(", "INTEGRAL_TYPE_P", "(", "type", ")", "&&", "TYPE_OVERFLOW_TRAPS", "(", "type", ")", ")", "honor_trapv", "=", "true", ";", "}", "if", "(", "nary", "->", "length", ">=", "2", ")", "rhs2", "=", "nary", "->", "op", "[", "1", "]", ";", "ret", "=", "operation_could_trap_helper_p", "(", "nary", "->", "opcode", ",", "fp_operation", ",", "honor_trapv", ",", "honor_nans", ",", "honor_snans", ",", "rhs2", ",", "&", "handled", ")", ";", "if", "(", "handled", "&&", "ret", ")", "return", "true", ";", "for", "(", "i", "=", "0", ";", "i", "<", "nary", "->", "length", ";", "++", "i", ")", "if", "(", "tree_could_trap_p", "(", "nary", "->", "op", "[", "i", "]", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Return true if the nary operation NARY may trap.
[ "Return", "true", "if", "the", "nary", "operation", "NARY", "may", "trap", "." ]
[]
[ { "param": "nary", "type": "vn_nary_op_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "nary", "type": "vn_nary_op_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e9b901e227f7396e85773880cbf847ce3d0880f
atrens/DragonFlyBSD-src
games/larn/display.c
[ "BSD-3-Clause" ]
C
bottomline
void
void bottomline(void) { recalc(); bot1f = 1; }
/* bottomline() now for the bottom line of the display */
bottomline() now for the bottom line of the display
[ "bottomline", "()", "now", "for", "the", "bottom", "line", "of", "the", "display" ]
void bottomline(void) { recalc(); bot1f = 1; }
[ "void", "bottomline", "(", "void", ")", "{", "recalc", "(", ")", ";", "bot1f", "=", "1", ";", "}" ]
bottomline() now for the bottom line of the display
[ "bottomline", "()", "now", "for", "the", "bottom", "line", "of", "the", "display" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1e9b901e227f7396e85773880cbf847ce3d0880f
atrens/DragonFlyBSD-src
games/larn/display.c
[ "BSD-3-Clause" ]
C
bottomgold
void
void bottomgold(void) { botsub(makecode(GOLD, 69, 19), "%-6d"); }
/* special subroutine to update only the gold number on the bottomlines called from ogold() */
special subroutine to update only the gold number on the bottomlines called from ogold()
[ "special", "subroutine", "to", "update", "only", "the", "gold", "number", "on", "the", "bottomlines", "called", "from", "ogold", "()" ]
void bottomgold(void) { botsub(makecode(GOLD, 69, 19), "%-6d"); }
[ "void", "bottomgold", "(", "void", ")", "{", "botsub", "(", "makecode", "(", "GOLD", ",", "69", ",", "19", ")", ",", "\"", "\"", ")", ";", "}" ]
special subroutine to update only the gold number on the bottomlines called from ogold()
[ "special", "subroutine", "to", "update", "only", "the", "gold", "number", "on", "the", "bottomlines", "called", "from", "ogold", "()" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1e9b901e227f7396e85773880cbf847ce3d0880f
atrens/DragonFlyBSD-src
games/larn/display.c
[ "BSD-3-Clause" ]
C
bot_hpx
void
static void bot_hpx(void) { if (c[EXPERIENCE] != cbak[EXPERIENCE]) { recalc(); bot_linex(); } else botsub(makecode(HP, 5, 19), "%3d"); }
/* special routine to update hp and level fields on bottom lines called in monster.c hitplayer() and spattack() */
special routine to update hp and level fields on bottom lines called in monster.c hitplayer() and spattack()
[ "special", "routine", "to", "update", "hp", "and", "level", "fields", "on", "bottom", "lines", "called", "in", "monster", ".", "c", "hitplayer", "()", "and", "spattack", "()" ]
static void bot_hpx(void) { if (c[EXPERIENCE] != cbak[EXPERIENCE]) { recalc(); bot_linex(); } else botsub(makecode(HP, 5, 19), "%3d"); }
[ "static", "void", "bot_hpx", "(", "void", ")", "{", "if", "(", "c", "[", "EXPERIENCE", "]", "!=", "cbak", "[", "EXPERIENCE", "]", ")", "{", "recalc", "(", ")", ";", "bot_linex", "(", ")", ";", "}", "else", "botsub", "(", "makecode", "(", "HP", ",", "5", ",", "19", ")", ",", "\"", "\"", ")", ";", "}" ]
special routine to update hp and level fields on bottom lines called in monster.c hitplayer() and spattack()
[ "special", "routine", "to", "update", "hp", "and", "level", "fields", "on", "bottom", "lines", "called", "in", "monster", ".", "c", "hitplayer", "()", "and", "spattack", "()" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1e9b901e227f7396e85773880cbf847ce3d0880f
atrens/DragonFlyBSD-src
games/larn/display.c
[ "BSD-3-Clause" ]
C
bot_spellx
void
static void bot_spellx(void) { botsub(makecode(SPELLS, 9, 18), "%2d"); }
/* special routine to update number of spells called from regen() */
special routine to update number of spells called from regen()
[ "special", "routine", "to", "update", "number", "of", "spells", "called", "from", "regen", "()" ]
static void bot_spellx(void) { botsub(makecode(SPELLS, 9, 18), "%2d"); }
[ "static", "void", "bot_spellx", "(", "void", ")", "{", "botsub", "(", "makecode", "(", "SPELLS", ",", "9", ",", "18", ")", ",", "\"", "\"", ")", ";", "}" ]
special routine to update number of spells called from regen()
[ "special", "routine", "to", "update", "number", "of", "spells", "called", "from", "regen", "()" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1e9b901e227f7396e85773880cbf847ce3d0880f
atrens/DragonFlyBSD-src
games/larn/display.c
[ "BSD-3-Clause" ]
C
showcell
void
void showcell(int x, int y) { int i, j, l, n; if (c[BLINDCOUNT]) /* see nothing if blind */ return; if (c[AWARENESS]) { minx = x - 3; maxx = x + 3; miny = y - 3; maxy = y + 3; } else { minx = x - 1; maxx = x + 1; miny = y - 1; maxy = y + 1; } if (minx < 0) minx = 0; if (maxx > MAXX - 1) maxx = MAXX - 1; if (miny < 0) miny = 0; if (maxy > MAXY - 1) maxy = MAXY - 1; for (j = miny; j <= maxy; j++) for (n = minx; n <= maxx; n++) if (know[n][j] == 0) { cursor(n + 1, j + 1); x = maxx; while (know[x][j]) --x; for (i = n; i <= x; i++) { if ((l = mitem[i][j]) != 0) lprc(monstnamelist[l]); else switch (l = item[i][j]) { case OWALL: case 0: case OIVTELETRAP: case OTRAPARROWIV: case OIVDARTRAP: case OIVTRAPDOOR: lprc(objnamelist[l]); break; default: setbold(); lprc(objnamelist[l]); resetbold(); } know[i][j] = 1; } n = maxx; } }
/* showcell(x,y) subroutine to display a cell location on the screen */
showcell(x,y) subroutine to display a cell location on the screen
[ "showcell", "(", "x", "y", ")", "subroutine", "to", "display", "a", "cell", "location", "on", "the", "screen" ]
void showcell(int x, int y) { int i, j, l, n; if (c[BLINDCOUNT]) return; if (c[AWARENESS]) { minx = x - 3; maxx = x + 3; miny = y - 3; maxy = y + 3; } else { minx = x - 1; maxx = x + 1; miny = y - 1; maxy = y + 1; } if (minx < 0) minx = 0; if (maxx > MAXX - 1) maxx = MAXX - 1; if (miny < 0) miny = 0; if (maxy > MAXY - 1) maxy = MAXY - 1; for (j = miny; j <= maxy; j++) for (n = minx; n <= maxx; n++) if (know[n][j] == 0) { cursor(n + 1, j + 1); x = maxx; while (know[x][j]) --x; for (i = n; i <= x; i++) { if ((l = mitem[i][j]) != 0) lprc(monstnamelist[l]); else switch (l = item[i][j]) { case OWALL: case 0: case OIVTELETRAP: case OTRAPARROWIV: case OIVDARTRAP: case OIVTRAPDOOR: lprc(objnamelist[l]); break; default: setbold(); lprc(objnamelist[l]); resetbold(); } know[i][j] = 1; } n = maxx; } }
[ "void", "showcell", "(", "int", "x", ",", "int", "y", ")", "{", "int", "i", ",", "j", ",", "l", ",", "n", ";", "if", "(", "c", "[", "BLINDCOUNT", "]", ")", "return", ";", "if", "(", "c", "[", "AWARENESS", "]", ")", "{", "minx", "=", "x", "-", "3", ";", "maxx", "=", "x", "+", "3", ";", "miny", "=", "y", "-", "3", ";", "maxy", "=", "y", "+", "3", ";", "}", "else", "{", "minx", "=", "x", "-", "1", ";", "maxx", "=", "x", "+", "1", ";", "miny", "=", "y", "-", "1", ";", "maxy", "=", "y", "+", "1", ";", "}", "if", "(", "minx", "<", "0", ")", "minx", "=", "0", ";", "if", "(", "maxx", ">", "MAXX", "-", "1", ")", "maxx", "=", "MAXX", "-", "1", ";", "if", "(", "miny", "<", "0", ")", "miny", "=", "0", ";", "if", "(", "maxy", ">", "MAXY", "-", "1", ")", "maxy", "=", "MAXY", "-", "1", ";", "for", "(", "j", "=", "miny", ";", "j", "<=", "maxy", ";", "j", "++", ")", "for", "(", "n", "=", "minx", ";", "n", "<=", "maxx", ";", "n", "++", ")", "if", "(", "know", "[", "n", "]", "[", "j", "]", "==", "0", ")", "{", "cursor", "(", "n", "+", "1", ",", "j", "+", "1", ")", ";", "x", "=", "maxx", ";", "while", "(", "know", "[", "x", "]", "[", "j", "]", ")", "--", "x", ";", "for", "(", "i", "=", "n", ";", "i", "<=", "x", ";", "i", "++", ")", "{", "if", "(", "(", "l", "=", "mitem", "[", "i", "]", "[", "j", "]", ")", "!=", "0", ")", "lprc", "(", "monstnamelist", "[", "l", "]", ")", ";", "else", "switch", "(", "l", "=", "item", "[", "i", "]", "[", "j", "]", ")", "{", "case", "OWALL", ":", "case", "0", ":", "case", "OIVTELETRAP", ":", "case", "OTRAPARROWIV", ":", "case", "OIVDARTRAP", ":", "case", "OIVTRAPDOOR", ":", "lprc", "(", "objnamelist", "[", "l", "]", ")", ";", "break", ";", "default", ":", "setbold", "(", ")", ";", "lprc", "(", "objnamelist", "[", "l", "]", ")", ";", "resetbold", "(", ")", ";", "}", "know", "[", "i", "]", "[", "j", "]", "=", "1", ";", "}", "n", "=", "maxx", ";", "}", "}" ]
showcell(x,y) subroutine to display a cell location on the screen
[ "showcell", "(", "x", "y", ")", "subroutine", "to", "display", "a", "cell", "location", "on", "the", "screen" ]
[ "/* see nothing if blind */" ]
[ { "param": "x", "type": "int" }, { "param": "y", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e9b901e227f7396e85773880cbf847ce3d0880f
atrens/DragonFlyBSD-src
games/larn/display.c
[ "BSD-3-Clause" ]
C
show1cell
void
void show1cell(int x, int y) { if (c[BLINDCOUNT]) /* see nothing if blind */ return; cursor(x + 1, y + 1); if ((k = mitem[x][y]) != 0) lprc(monstnamelist[k]); else switch (k = item[x][y]) { case OWALL: case 0: case OIVTELETRAP: case OTRAPARROWIV: case OIVDARTRAP: case OIVTRAPDOOR: lprc(objnamelist[k]); break; default: setbold(); lprc(objnamelist[k]); resetbold(); } know[x][y] |= 1; /* we end up knowing about it */ }
/* this routine shows only the spot that is given it. the spaces around these coordinated are not shown used in godirect() in monster.c for missile weapons display */
this routine shows only the spot that is given it. the spaces around these coordinated are not shown used in godirect() in monster.c for missile weapons display
[ "this", "routine", "shows", "only", "the", "spot", "that", "is", "given", "it", ".", "the", "spaces", "around", "these", "coordinated", "are", "not", "shown", "used", "in", "godirect", "()", "in", "monster", ".", "c", "for", "missile", "weapons", "display" ]
void show1cell(int x, int y) { if (c[BLINDCOUNT]) return; cursor(x + 1, y + 1); if ((k = mitem[x][y]) != 0) lprc(monstnamelist[k]); else switch (k = item[x][y]) { case OWALL: case 0: case OIVTELETRAP: case OTRAPARROWIV: case OIVDARTRAP: case OIVTRAPDOOR: lprc(objnamelist[k]); break; default: setbold(); lprc(objnamelist[k]); resetbold(); } know[x][y] |= 1; }
[ "void", "show1cell", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "c", "[", "BLINDCOUNT", "]", ")", "return", ";", "cursor", "(", "x", "+", "1", ",", "y", "+", "1", ")", ";", "if", "(", "(", "k", "=", "mitem", "[", "x", "]", "[", "y", "]", ")", "!=", "0", ")", "lprc", "(", "monstnamelist", "[", "k", "]", ")", ";", "else", "switch", "(", "k", "=", "item", "[", "x", "]", "[", "y", "]", ")", "{", "case", "OWALL", ":", "case", "0", ":", "case", "OIVTELETRAP", ":", "case", "OTRAPARROWIV", ":", "case", "OIVDARTRAP", ":", "case", "OIVTRAPDOOR", ":", "lprc", "(", "objnamelist", "[", "k", "]", ")", ";", "break", ";", "default", ":", "setbold", "(", ")", ";", "lprc", "(", "objnamelist", "[", "k", "]", ")", ";", "resetbold", "(", ")", ";", "}", "know", "[", "x", "]", "[", "y", "]", "|=", "1", ";", "}" ]
this routine shows only the spot that is given it.
[ "this", "routine", "shows", "only", "the", "spot", "that", "is", "given", "it", "." ]
[ "/* see nothing if blind */", "/* we end up knowing about it */" ]
[ { "param": "x", "type": "int" }, { "param": "y", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e9b901e227f7396e85773880cbf847ce3d0880f
atrens/DragonFlyBSD-src
games/larn/display.c
[ "BSD-3-Clause" ]
C
showplayer
void
void showplayer(void) { cursor(playerx + 1, playery + 1); oldx = playerx; oldy = playery; }
/* showplayer() subroutine to show where the player is on the screen cursor values start from 1 up */
showplayer() subroutine to show where the player is on the screen cursor values start from 1 up
[ "showplayer", "()", "subroutine", "to", "show", "where", "the", "player", "is", "on", "the", "screen", "cursor", "values", "start", "from", "1", "up" ]
void showplayer(void) { cursor(playerx + 1, playery + 1); oldx = playerx; oldy = playery; }
[ "void", "showplayer", "(", "void", ")", "{", "cursor", "(", "playerx", "+", "1", ",", "playery", "+", "1", ")", ";", "oldx", "=", "playerx", ";", "oldy", "=", "playery", ";", "}" ]
showplayer() subroutine to show where the player is on the screen cursor values start from 1 up
[ "showplayer", "()", "subroutine", "to", "show", "where", "the", "player", "is", "on", "the", "screen", "cursor", "values", "start", "from", "1", "up" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1e9b901e227f7396e85773880cbf847ce3d0880f
atrens/DragonFlyBSD-src
games/larn/display.c
[ "BSD-3-Clause" ]
C
seepage
void
static void seepage(void) { if (++count == 3) { lincount++; count = 0; lprc('\n'); if (lincount > 17) { lincount = 0; more(); clear(); } } }
/* * subroutine to paginate the seemagic function */
subroutine to paginate the seemagic function
[ "subroutine", "to", "paginate", "the", "seemagic", "function" ]
static void seepage(void) { if (++count == 3) { lincount++; count = 0; lprc('\n'); if (lincount > 17) { lincount = 0; more(); clear(); } } }
[ "static", "void", "seepage", "(", "void", ")", "{", "if", "(", "++", "count", "==", "3", ")", "{", "lincount", "++", ";", "count", "=", "0", ";", "lprc", "(", "'", "\\n", "'", ")", ";", "if", "(", "lincount", ">", "17", ")", "{", "lincount", "=", "0", ";", "more", "(", ")", ";", "clear", "(", ")", ";", "}", "}", "}" ]
subroutine to paginate the seemagic function
[ "subroutine", "to", "paginate", "the", "seemagic", "function" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
244b2e3d1a6a5360bc6da01a5a3d562fbfd2a667
atrens/DragonFlyBSD-src
sys/bus/u4b/wlan/if_urtwn.c
[ "BSD-3-Clause" ]
C
urtwn_ra_init
int
static int urtwn_ra_init(struct urtwn_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct ieee80211_node *ni; struct ieee80211_rateset *rs, *rs_ht; struct r92c_fw_cmd_macid_cfg cmd; uint32_t rates, basicrates; uint8_t mode, ridx; int maxrate, maxbasicrate, error, i; ni = ieee80211_ref_node(vap->iv_bss); rs = &ni->ni_rates; rs_ht = (struct ieee80211_rateset *) &ni->ni_htrates; /* Get normal and basic rates mask. */ rates = basicrates = 0; maxrate = maxbasicrate = 0; /* This is for 11bg */ for (i = 0; i < rs->rs_nrates; i++) { /* Convert 802.11 rate to HW rate index. */ ridx = rate2ridx(IEEE80211_RV(rs->rs_rates[i])); if (ridx == URTWN_RIDX_UNKNOWN) /* Unknown rate, skip. */ continue; rates |= 1 << ridx; if (ridx > maxrate) maxrate = ridx; if (rs->rs_rates[i] & IEEE80211_RATE_BASIC) { basicrates |= 1 << ridx; if (ridx > maxbasicrate) maxbasicrate = ridx; } } /* If we're doing 11n, enable 11n rates */ if (ni->ni_flags & IEEE80211_NODE_HT) { for (i = 0; i < rs_ht->rs_nrates; i++) { if ((rs_ht->rs_rates[i] & 0x7f) > 0xf) continue; /* 11n rates start at index 12 */ ridx = ((rs_ht->rs_rates[i]) & 0xf) + 12; rates |= (1 << ridx); /* Guard against the rate table being oddly ordered */ if (ridx > maxrate) maxrate = ridx; } } #if 0 if (ic->ic_curmode == IEEE80211_MODE_11NG) raid = R92C_RAID_11GN; #endif /* NB: group addressed frames are done at 11bg rates for now */ if (ic->ic_curmode == IEEE80211_MODE_11B) mode = R92C_RAID_11B; else mode = R92C_RAID_11BG; /* XXX misleading 'mode' value here for unicast frames */ URTWN_DPRINTF(sc, URTWN_DEBUG_RA, "%s: mode 0x%x, rates 0x%08x, basicrates 0x%08x\n", __func__, mode, rates, basicrates); /* Set rates mask for group addressed frames. */ cmd.macid = URTWN_MACID_BC | URTWN_MACID_VALID; cmd.mask = htole32(mode << 28 | basicrates); error = urtwn_fw_cmd(sc, R92C_CMD_MACID_CONFIG, &cmd, sizeof(cmd)); if (error != 0) { ieee80211_free_node(ni); device_printf(sc->sc_dev, "could not add broadcast station\n"); return (error); } /* Set initial MRR rate. */ URTWN_DPRINTF(sc, URTWN_DEBUG_RA, "%s: maxbasicrate %d\n", __func__, maxbasicrate); urtwn_write_1(sc, R92C_INIDATA_RATE_SEL(URTWN_MACID_BC), maxbasicrate); /* Set rates mask for unicast frames. */ if (ni->ni_flags & IEEE80211_NODE_HT) mode = R92C_RAID_11GN; else if (ic->ic_curmode == IEEE80211_MODE_11B) mode = R92C_RAID_11B; else mode = R92C_RAID_11BG; cmd.macid = URTWN_MACID_BSS | URTWN_MACID_VALID; cmd.mask = htole32(mode << 28 | rates); error = urtwn_fw_cmd(sc, R92C_CMD_MACID_CONFIG, &cmd, sizeof(cmd)); if (error != 0) { ieee80211_free_node(ni); device_printf(sc->sc_dev, "could not add BSS station\n"); return (error); } /* Set initial MRR rate. */ URTWN_DPRINTF(sc, URTWN_DEBUG_RA, "%s: maxrate %d\n", __func__, maxrate); urtwn_write_1(sc, R92C_INIDATA_RATE_SEL(URTWN_MACID_BSS), maxrate); /* Indicate highest supported rate. */ if (ni->ni_flags & IEEE80211_NODE_HT) ni->ni_txrate = rs_ht->rs_rates[rs_ht->rs_nrates - 1] | IEEE80211_RATE_MCS; else ni->ni_txrate = rs->rs_rates[rs->rs_nrates - 1]; ieee80211_free_node(ni); return (0); }
/* * Initialize rate adaptation in firmware. */
Initialize rate adaptation in firmware.
[ "Initialize", "rate", "adaptation", "in", "firmware", "." ]
static int urtwn_ra_init(struct urtwn_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); struct ieee80211_node *ni; struct ieee80211_rateset *rs, *rs_ht; struct r92c_fw_cmd_macid_cfg cmd; uint32_t rates, basicrates; uint8_t mode, ridx; int maxrate, maxbasicrate, error, i; ni = ieee80211_ref_node(vap->iv_bss); rs = &ni->ni_rates; rs_ht = (struct ieee80211_rateset *) &ni->ni_htrates; rates = basicrates = 0; maxrate = maxbasicrate = 0; for (i = 0; i < rs->rs_nrates; i++) { ridx = rate2ridx(IEEE80211_RV(rs->rs_rates[i])); if (ridx == URTWN_RIDX_UNKNOWN) continue; rates |= 1 << ridx; if (ridx > maxrate) maxrate = ridx; if (rs->rs_rates[i] & IEEE80211_RATE_BASIC) { basicrates |= 1 << ridx; if (ridx > maxbasicrate) maxbasicrate = ridx; } } if (ni->ni_flags & IEEE80211_NODE_HT) { for (i = 0; i < rs_ht->rs_nrates; i++) { if ((rs_ht->rs_rates[i] & 0x7f) > 0xf) continue; ridx = ((rs_ht->rs_rates[i]) & 0xf) + 12; rates |= (1 << ridx); if (ridx > maxrate) maxrate = ridx; } } #if 0 if (ic->ic_curmode == IEEE80211_MODE_11NG) raid = R92C_RAID_11GN; #endif if (ic->ic_curmode == IEEE80211_MODE_11B) mode = R92C_RAID_11B; else mode = R92C_RAID_11BG; URTWN_DPRINTF(sc, URTWN_DEBUG_RA, "%s: mode 0x%x, rates 0x%08x, basicrates 0x%08x\n", __func__, mode, rates, basicrates); cmd.macid = URTWN_MACID_BC | URTWN_MACID_VALID; cmd.mask = htole32(mode << 28 | basicrates); error = urtwn_fw_cmd(sc, R92C_CMD_MACID_CONFIG, &cmd, sizeof(cmd)); if (error != 0) { ieee80211_free_node(ni); device_printf(sc->sc_dev, "could not add broadcast station\n"); return (error); } URTWN_DPRINTF(sc, URTWN_DEBUG_RA, "%s: maxbasicrate %d\n", __func__, maxbasicrate); urtwn_write_1(sc, R92C_INIDATA_RATE_SEL(URTWN_MACID_BC), maxbasicrate); if (ni->ni_flags & IEEE80211_NODE_HT) mode = R92C_RAID_11GN; else if (ic->ic_curmode == IEEE80211_MODE_11B) mode = R92C_RAID_11B; else mode = R92C_RAID_11BG; cmd.macid = URTWN_MACID_BSS | URTWN_MACID_VALID; cmd.mask = htole32(mode << 28 | rates); error = urtwn_fw_cmd(sc, R92C_CMD_MACID_CONFIG, &cmd, sizeof(cmd)); if (error != 0) { ieee80211_free_node(ni); device_printf(sc->sc_dev, "could not add BSS station\n"); return (error); } URTWN_DPRINTF(sc, URTWN_DEBUG_RA, "%s: maxrate %d\n", __func__, maxrate); urtwn_write_1(sc, R92C_INIDATA_RATE_SEL(URTWN_MACID_BSS), maxrate); if (ni->ni_flags & IEEE80211_NODE_HT) ni->ni_txrate = rs_ht->rs_rates[rs_ht->rs_nrates - 1] | IEEE80211_RATE_MCS; else ni->ni_txrate = rs->rs_rates[rs->rs_nrates - 1]; ieee80211_free_node(ni); return (0); }
[ "static", "int", "urtwn_ra_init", "(", "struct", "urtwn_softc", "*", "sc", ")", "{", "struct", "ieee80211com", "*", "ic", "=", "&", "sc", "->", "sc_ic", ";", "struct", "ieee80211vap", "*", "vap", "=", "TAILQ_FIRST", "(", "&", "ic", "->", "ic_vaps", ")", ";", "struct", "ieee80211_node", "*", "ni", ";", "struct", "ieee80211_rateset", "*", "rs", ",", "*", "rs_ht", ";", "struct", "r92c_fw_cmd_macid_cfg", "cmd", ";", "uint32_t", "rates", ",", "basicrates", ";", "uint8_t", "mode", ",", "ridx", ";", "int", "maxrate", ",", "maxbasicrate", ",", "error", ",", "i", ";", "ni", "=", "ieee80211_ref_node", "(", "vap", "->", "iv_bss", ")", ";", "rs", "=", "&", "ni", "->", "ni_rates", ";", "rs_ht", "=", "(", "struct", "ieee80211_rateset", "*", ")", "&", "ni", "->", "ni_htrates", ";", "rates", "=", "basicrates", "=", "0", ";", "maxrate", "=", "maxbasicrate", "=", "0", ";", "for", "(", "i", "=", "0", ";", "i", "<", "rs", "->", "rs_nrates", ";", "i", "++", ")", "{", "ridx", "=", "rate2ridx", "(", "IEEE80211_RV", "(", "rs", "->", "rs_rates", "[", "i", "]", ")", ")", ";", "if", "(", "ridx", "==", "URTWN_RIDX_UNKNOWN", ")", "continue", ";", "rates", "|=", "1", "<<", "ridx", ";", "if", "(", "ridx", ">", "maxrate", ")", "maxrate", "=", "ridx", ";", "if", "(", "rs", "->", "rs_rates", "[", "i", "]", "&", "IEEE80211_RATE_BASIC", ")", "{", "basicrates", "|=", "1", "<<", "ridx", ";", "if", "(", "ridx", ">", "maxbasicrate", ")", "maxbasicrate", "=", "ridx", ";", "}", "}", "if", "(", "ni", "->", "ni_flags", "&", "IEEE80211_NODE_HT", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "rs_ht", "->", "rs_nrates", ";", "i", "++", ")", "{", "if", "(", "(", "rs_ht", "->", "rs_rates", "[", "i", "]", "&", "0x7f", ")", ">", "0xf", ")", "continue", ";", "ridx", "=", "(", "(", "rs_ht", "->", "rs_rates", "[", "i", "]", ")", "&", "0xf", ")", "+", "12", ";", "rates", "|=", "(", "1", "<<", "ridx", ")", ";", "if", "(", "ridx", ">", "maxrate", ")", "maxrate", "=", "ridx", ";", "}", "}", "#if", "0", "\n", "if", "(", "ic", "->", "ic_curmode", "==", "IEEE80211_MODE_11NG", ")", "raid", "=", "R92C_RAID_11GN", ";", "#endif", "if", "(", "ic", "->", "ic_curmode", "==", "IEEE80211_MODE_11B", ")", "mode", "=", "R92C_RAID_11B", ";", "else", "mode", "=", "R92C_RAID_11BG", ";", "URTWN_DPRINTF", "(", "sc", ",", "URTWN_DEBUG_RA", ",", "\"", "\\n", "\"", ",", "__func__", ",", "mode", ",", "rates", ",", "basicrates", ")", ";", "cmd", ".", "macid", "=", "URTWN_MACID_BC", "|", "URTWN_MACID_VALID", ";", "cmd", ".", "mask", "=", "htole32", "(", "mode", "<<", "28", "|", "basicrates", ")", ";", "error", "=", "urtwn_fw_cmd", "(", "sc", ",", "R92C_CMD_MACID_CONFIG", ",", "&", "cmd", ",", "sizeof", "(", "cmd", ")", ")", ";", "if", "(", "error", "!=", "0", ")", "{", "ieee80211_free_node", "(", "ni", ")", ";", "device_printf", "(", "sc", "->", "sc_dev", ",", "\"", "\\n", "\"", ")", ";", "return", "(", "error", ")", ";", "}", "URTWN_DPRINTF", "(", "sc", ",", "URTWN_DEBUG_RA", ",", "\"", "\\n", "\"", ",", "__func__", ",", "maxbasicrate", ")", ";", "urtwn_write_1", "(", "sc", ",", "R92C_INIDATA_RATE_SEL", "(", "URTWN_MACID_BC", ")", ",", "maxbasicrate", ")", ";", "if", "(", "ni", "->", "ni_flags", "&", "IEEE80211_NODE_HT", ")", "mode", "=", "R92C_RAID_11GN", ";", "else", "if", "(", "ic", "->", "ic_curmode", "==", "IEEE80211_MODE_11B", ")", "mode", "=", "R92C_RAID_11B", ";", "else", "mode", "=", "R92C_RAID_11BG", ";", "cmd", ".", "macid", "=", "URTWN_MACID_BSS", "|", "URTWN_MACID_VALID", ";", "cmd", ".", "mask", "=", "htole32", "(", "mode", "<<", "28", "|", "rates", ")", ";", "error", "=", "urtwn_fw_cmd", "(", "sc", ",", "R92C_CMD_MACID_CONFIG", ",", "&", "cmd", ",", "sizeof", "(", "cmd", ")", ")", ";", "if", "(", "error", "!=", "0", ")", "{", "ieee80211_free_node", "(", "ni", ")", ";", "device_printf", "(", "sc", "->", "sc_dev", ",", "\"", "\\n", "\"", ")", ";", "return", "(", "error", ")", ";", "}", "URTWN_DPRINTF", "(", "sc", ",", "URTWN_DEBUG_RA", ",", "\"", "\\n", "\"", ",", "__func__", ",", "maxrate", ")", ";", "urtwn_write_1", "(", "sc", ",", "R92C_INIDATA_RATE_SEL", "(", "URTWN_MACID_BSS", ")", ",", "maxrate", ")", ";", "if", "(", "ni", "->", "ni_flags", "&", "IEEE80211_NODE_HT", ")", "ni", "->", "ni_txrate", "=", "rs_ht", "->", "rs_rates", "[", "rs_ht", "->", "rs_nrates", "-", "1", "]", "|", "IEEE80211_RATE_MCS", ";", "else", "ni", "->", "ni_txrate", "=", "rs", "->", "rs_rates", "[", "rs", "->", "rs_nrates", "-", "1", "]", ";", "ieee80211_free_node", "(", "ni", ")", ";", "return", "(", "0", ")", ";", "}" ]
Initialize rate adaptation in firmware.
[ "Initialize", "rate", "adaptation", "in", "firmware", "." ]
[ "/* Get normal and basic rates mask. */", "/* This is for 11bg */", "/* Convert 802.11 rate to HW rate index. */", "/* Unknown rate, skip. */", "/* If we're doing 11n, enable 11n rates */", "/* 11n rates start at index 12 */", "/* Guard against the rate table being oddly ordered */", "/* NB: group addressed frames are done at 11bg rates for now */", "/* XXX misleading 'mode' value here for unicast frames */", "/* Set rates mask for group addressed frames. */", "/* Set initial MRR rate. */", "/* Set rates mask for unicast frames. */", "/* Set initial MRR rate. */", "/* Indicate highest supported rate. */" ]
[ { "param": "sc", "type": "struct urtwn_softc" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sc", "type": "struct urtwn_softc", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
244b2e3d1a6a5360bc6da01a5a3d562fbfd2a667
atrens/DragonFlyBSD-src
sys/bus/u4b/wlan/if_urtwn.c
[ "BSD-3-Clause" ]
C
urtwn_tx_beacon
int
static int urtwn_tx_beacon(struct urtwn_softc *sc, struct urtwn_vap *uvp) { struct r92c_tx_desc *desc = &uvp->bcn_desc; struct urtwn_data *bf; URTWN_ASSERT_LOCKED(sc); bf = urtwn_getbuf(sc); if (bf == NULL) return (ENOMEM); memcpy(bf->buf, desc, sizeof(*desc)); urtwn_tx_start(sc, uvp->bcn_mbuf, IEEE80211_FC0_TYPE_MGT, bf); sc->sc_txtimer = 5; callout_reset(&sc->sc_watchdog_ch, hz, urtwn_watchdog, sc); return (0); }
/* * Push a beacon frame into the chip. Beacon will * be repeated by the chip every R92C_BCN_INTERVAL. */
Push a beacon frame into the chip. Beacon will be repeated by the chip every R92C_BCN_INTERVAL.
[ "Push", "a", "beacon", "frame", "into", "the", "chip", ".", "Beacon", "will", "be", "repeated", "by", "the", "chip", "every", "R92C_BCN_INTERVAL", "." ]
static int urtwn_tx_beacon(struct urtwn_softc *sc, struct urtwn_vap *uvp) { struct r92c_tx_desc *desc = &uvp->bcn_desc; struct urtwn_data *bf; URTWN_ASSERT_LOCKED(sc); bf = urtwn_getbuf(sc); if (bf == NULL) return (ENOMEM); memcpy(bf->buf, desc, sizeof(*desc)); urtwn_tx_start(sc, uvp->bcn_mbuf, IEEE80211_FC0_TYPE_MGT, bf); sc->sc_txtimer = 5; callout_reset(&sc->sc_watchdog_ch, hz, urtwn_watchdog, sc); return (0); }
[ "static", "int", "urtwn_tx_beacon", "(", "struct", "urtwn_softc", "*", "sc", ",", "struct", "urtwn_vap", "*", "uvp", ")", "{", "struct", "r92c_tx_desc", "*", "desc", "=", "&", "uvp", "->", "bcn_desc", ";", "struct", "urtwn_data", "*", "bf", ";", "URTWN_ASSERT_LOCKED", "(", "sc", ")", ";", "bf", "=", "urtwn_getbuf", "(", "sc", ")", ";", "if", "(", "bf", "==", "NULL", ")", "return", "(", "ENOMEM", ")", ";", "memcpy", "(", "bf", "->", "buf", ",", "desc", ",", "sizeof", "(", "*", "desc", ")", ")", ";", "urtwn_tx_start", "(", "sc", ",", "uvp", "->", "bcn_mbuf", ",", "IEEE80211_FC0_TYPE_MGT", ",", "bf", ")", ";", "sc", "->", "sc_txtimer", "=", "5", ";", "callout_reset", "(", "&", "sc", "->", "sc_watchdog_ch", ",", "hz", ",", "urtwn_watchdog", ",", "sc", ")", ";", "return", "(", "0", ")", ";", "}" ]
Push a beacon frame into the chip.
[ "Push", "a", "beacon", "frame", "into", "the", "chip", "." ]
[]
[ { "param": "sc", "type": "struct urtwn_softc" }, { "param": "uvp", "type": "struct urtwn_vap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "sc", "type": "struct urtwn_softc", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "uvp", "type": "struct urtwn_vap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
330d68d8d357439489833d6ff18f8f4831e223bc
atrens/DragonFlyBSD-src
lib/libypclnt/ypclnt_passwd.c
[ "BSD-3-Clause" ]
C
ypclnt_havepasswdd
int
int ypclnt_havepasswdd(ypclnt_t *ypclnt) { struct netconfig *nc = NULL; void *localhandle = NULL; CLIENT *clnt = NULL; int ret; /* check if rpc.yppasswdd is running */ if (getrpcport(ypclnt->server, YPPASSWDPROG, YPPASSWDPROC_UPDATE, IPPROTO_UDP) == 0) { ypclnt_error(ypclnt, __func__, "no rpc.yppasswdd on server"); return (-1); } /* if we're not root, use remote method */ if (getuid() != 0) return (0); /* try to connect to rpc.yppasswdd */ localhandle = setnetconfig(); while ((nc = getnetconfig(localhandle)) != NULL) { if (nc->nc_protofmly != NULL && strcmp(nc->nc_protofmly, NC_LOOPBACK) == 0) break; } if (nc == NULL) { ypclnt_error(ypclnt, __func__, "getnetconfig: %s", nc_sperror()); ret = 0; goto done; } if ((clnt = clnt_tp_create(NULL, MASTER_YPPASSWDPROG, MASTER_YPPASSWDVERS, nc)) == NULL) { ypclnt_error(ypclnt, __func__, "failed to connect to rpc.yppasswdd: %s", clnt_spcreateerror(ypclnt->server)); ret = 0; goto done; } else ret = 1; done: if (clnt != NULL) { clnt_destroy(clnt); } endnetconfig(localhandle); return (ret); }
/* * Determines the availability of rpc.yppasswdd. Returns -1 for not * available (or unable to determine), 0 for available, 1 for available in * master mode. */
Determines the availability of rpc.yppasswdd. Returns -1 for not available (or unable to determine), 0 for available, 1 for available in master mode.
[ "Determines", "the", "availability", "of", "rpc", ".", "yppasswdd", ".", "Returns", "-", "1", "for", "not", "available", "(", "or", "unable", "to", "determine", ")", "0", "for", "available", "1", "for", "available", "in", "master", "mode", "." ]
int ypclnt_havepasswdd(ypclnt_t *ypclnt) { struct netconfig *nc = NULL; void *localhandle = NULL; CLIENT *clnt = NULL; int ret; if (getrpcport(ypclnt->server, YPPASSWDPROG, YPPASSWDPROC_UPDATE, IPPROTO_UDP) == 0) { ypclnt_error(ypclnt, __func__, "no rpc.yppasswdd on server"); return (-1); } if (getuid() != 0) return (0); localhandle = setnetconfig(); while ((nc = getnetconfig(localhandle)) != NULL) { if (nc->nc_protofmly != NULL && strcmp(nc->nc_protofmly, NC_LOOPBACK) == 0) break; } if (nc == NULL) { ypclnt_error(ypclnt, __func__, "getnetconfig: %s", nc_sperror()); ret = 0; goto done; } if ((clnt = clnt_tp_create(NULL, MASTER_YPPASSWDPROG, MASTER_YPPASSWDVERS, nc)) == NULL) { ypclnt_error(ypclnt, __func__, "failed to connect to rpc.yppasswdd: %s", clnt_spcreateerror(ypclnt->server)); ret = 0; goto done; } else ret = 1; done: if (clnt != NULL) { clnt_destroy(clnt); } endnetconfig(localhandle); return (ret); }
[ "int", "ypclnt_havepasswdd", "(", "ypclnt_t", "*", "ypclnt", ")", "{", "struct", "netconfig", "*", "nc", "=", "NULL", ";", "void", "*", "localhandle", "=", "NULL", ";", "CLIENT", "*", "clnt", "=", "NULL", ";", "int", "ret", ";", "if", "(", "getrpcport", "(", "ypclnt", "->", "server", ",", "YPPASSWDPROG", ",", "YPPASSWDPROC_UPDATE", ",", "IPPROTO_UDP", ")", "==", "0", ")", "{", "ypclnt_error", "(", "ypclnt", ",", "__func__", ",", "\"", "\"", ")", ";", "return", "(", "-1", ")", ";", "}", "if", "(", "getuid", "(", ")", "!=", "0", ")", "return", "(", "0", ")", ";", "localhandle", "=", "setnetconfig", "(", ")", ";", "while", "(", "(", "nc", "=", "getnetconfig", "(", "localhandle", ")", ")", "!=", "NULL", ")", "{", "if", "(", "nc", "->", "nc_protofmly", "!=", "NULL", "&&", "strcmp", "(", "nc", "->", "nc_protofmly", ",", "NC_LOOPBACK", ")", "==", "0", ")", "break", ";", "}", "if", "(", "nc", "==", "NULL", ")", "{", "ypclnt_error", "(", "ypclnt", ",", "__func__", ",", "\"", "\"", ",", "nc_sperror", "(", ")", ")", ";", "ret", "=", "0", ";", "goto", "done", ";", "}", "if", "(", "(", "clnt", "=", "clnt_tp_create", "(", "NULL", ",", "MASTER_YPPASSWDPROG", ",", "MASTER_YPPASSWDVERS", ",", "nc", ")", ")", "==", "NULL", ")", "{", "ypclnt_error", "(", "ypclnt", ",", "__func__", ",", "\"", "\"", ",", "clnt_spcreateerror", "(", "ypclnt", "->", "server", ")", ")", ";", "ret", "=", "0", ";", "goto", "done", ";", "}", "else", "ret", "=", "1", ";", "done", ":", "if", "(", "clnt", "!=", "NULL", ")", "{", "clnt_destroy", "(", "clnt", ")", ";", "}", "endnetconfig", "(", "localhandle", ")", ";", "return", "(", "ret", ")", ";", "}" ]
Determines the availability of rpc.yppasswdd.
[ "Determines", "the", "availability", "of", "rpc", ".", "yppasswdd", "." ]
[ "/* check if rpc.yppasswdd is running */", "/* if we're not root, use remote method */", "/* try to connect to rpc.yppasswdd */" ]
[ { "param": "ypclnt", "type": "ypclnt_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ypclnt", "type": "ypclnt_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
330d68d8d357439489833d6ff18f8f4831e223bc
atrens/DragonFlyBSD-src
lib/libypclnt/ypclnt_passwd.c
[ "BSD-3-Clause" ]
C
yppasswd_local
int
static int yppasswd_local(ypclnt_t *ypclnt, const struct passwd *pwd) { struct master_yppasswd yppwd; struct rpc_err rpcerr; struct netconfig *nc = NULL; void *localhandle = NULL; CLIENT *clnt = NULL; int ret, *result; /* fill the master_yppasswd structure */ memset(&yppwd, 0, sizeof yppwd); yppwd.newpw.pw_uid = pwd->pw_uid; yppwd.newpw.pw_gid = pwd->pw_gid; yppwd.newpw.pw_change = pwd->pw_change; yppwd.newpw.pw_expire = pwd->pw_expire; yppwd.newpw.pw_fields = pwd->pw_fields; yppwd.oldpass = strdup(""); yppwd.domain = strdup(ypclnt->domain); if ((yppwd.newpw.pw_name = strdup(pwd->pw_name)) == NULL || (yppwd.newpw.pw_passwd = strdup(pwd->pw_passwd)) == NULL || (yppwd.newpw.pw_class = strdup(pwd->pw_class)) == NULL || (yppwd.newpw.pw_gecos = strdup(pwd->pw_gecos)) == NULL || (yppwd.newpw.pw_dir = strdup(pwd->pw_dir)) == NULL || (yppwd.newpw.pw_shell = strdup(pwd->pw_shell)) == NULL) { ypclnt_error(ypclnt, __func__, "%s", strerror(errno)); ret = -1; goto done; } /* connect to rpc.yppasswdd */ localhandle = setnetconfig(); while ((nc = getnetconfig(localhandle)) != NULL) { if (nc->nc_protofmly != NULL && strcmp(nc->nc_protofmly, NC_LOOPBACK) == 0) break; } if (nc == NULL) { ypclnt_error(ypclnt, __func__, "getnetconfig: %s", nc_sperror()); ret = -1; goto done; } if ((clnt = clnt_tp_create(NULL, MASTER_YPPASSWDPROG, MASTER_YPPASSWDVERS, nc)) == NULL) { ypclnt_error(ypclnt, __func__, "failed to connect to rpc.yppasswdd: %s", clnt_spcreateerror(ypclnt->server)); ret = -1; goto done; } clnt->cl_auth = authunix_create_default(); /* request the update */ result = yppasswdproc_update_master_1(&yppwd, clnt); /* check for RPC errors */ clnt_geterr(clnt, &rpcerr); if (rpcerr.re_status != RPC_SUCCESS) { ypclnt_error(ypclnt, __func__, "NIS password update failed: %s", clnt_sperror(clnt, ypclnt->server)); ret = -1; goto done; } /* check the result of the update */ if (result == NULL || *result != 0) { ypclnt_error(ypclnt, __func__, "NIS password update failed"); /* XXX how do we get more details? */ ret = -1; goto done; } ypclnt_error(ypclnt, NULL, NULL); ret = 0; done: if (clnt != NULL) { auth_destroy(clnt->cl_auth); clnt_destroy(clnt); } endnetconfig(localhandle); free(yppwd.newpw.pw_name); if (yppwd.newpw.pw_passwd != NULL) { memset(yppwd.newpw.pw_passwd, 0, strlen(yppwd.newpw.pw_passwd)); free(yppwd.newpw.pw_passwd); } free(yppwd.newpw.pw_class); free(yppwd.newpw.pw_gecos); free(yppwd.newpw.pw_dir); free(yppwd.newpw.pw_shell); if (yppwd.oldpass != NULL) { memset(yppwd.oldpass, 0, strlen(yppwd.oldpass)); free(yppwd.oldpass); } return (ret); }
/* * yppasswd_remote and yppasswd_local are quite similar but still * sufficiently different that merging them into one makes the code * significantly less readable, IMHO, so we keep them separate. */
yppasswd_remote and yppasswd_local are quite similar but still sufficiently different that merging them into one makes the code significantly less readable, IMHO, so we keep them separate.
[ "yppasswd_remote", "and", "yppasswd_local", "are", "quite", "similar", "but", "still", "sufficiently", "different", "that", "merging", "them", "into", "one", "makes", "the", "code", "significantly", "less", "readable", "IMHO", "so", "we", "keep", "them", "separate", "." ]
static int yppasswd_local(ypclnt_t *ypclnt, const struct passwd *pwd) { struct master_yppasswd yppwd; struct rpc_err rpcerr; struct netconfig *nc = NULL; void *localhandle = NULL; CLIENT *clnt = NULL; int ret, *result; memset(&yppwd, 0, sizeof yppwd); yppwd.newpw.pw_uid = pwd->pw_uid; yppwd.newpw.pw_gid = pwd->pw_gid; yppwd.newpw.pw_change = pwd->pw_change; yppwd.newpw.pw_expire = pwd->pw_expire; yppwd.newpw.pw_fields = pwd->pw_fields; yppwd.oldpass = strdup(""); yppwd.domain = strdup(ypclnt->domain); if ((yppwd.newpw.pw_name = strdup(pwd->pw_name)) == NULL || (yppwd.newpw.pw_passwd = strdup(pwd->pw_passwd)) == NULL || (yppwd.newpw.pw_class = strdup(pwd->pw_class)) == NULL || (yppwd.newpw.pw_gecos = strdup(pwd->pw_gecos)) == NULL || (yppwd.newpw.pw_dir = strdup(pwd->pw_dir)) == NULL || (yppwd.newpw.pw_shell = strdup(pwd->pw_shell)) == NULL) { ypclnt_error(ypclnt, __func__, "%s", strerror(errno)); ret = -1; goto done; } localhandle = setnetconfig(); while ((nc = getnetconfig(localhandle)) != NULL) { if (nc->nc_protofmly != NULL && strcmp(nc->nc_protofmly, NC_LOOPBACK) == 0) break; } if (nc == NULL) { ypclnt_error(ypclnt, __func__, "getnetconfig: %s", nc_sperror()); ret = -1; goto done; } if ((clnt = clnt_tp_create(NULL, MASTER_YPPASSWDPROG, MASTER_YPPASSWDVERS, nc)) == NULL) { ypclnt_error(ypclnt, __func__, "failed to connect to rpc.yppasswdd: %s", clnt_spcreateerror(ypclnt->server)); ret = -1; goto done; } clnt->cl_auth = authunix_create_default(); result = yppasswdproc_update_master_1(&yppwd, clnt); clnt_geterr(clnt, &rpcerr); if (rpcerr.re_status != RPC_SUCCESS) { ypclnt_error(ypclnt, __func__, "NIS password update failed: %s", clnt_sperror(clnt, ypclnt->server)); ret = -1; goto done; } if (result == NULL || *result != 0) { ypclnt_error(ypclnt, __func__, "NIS password update failed"); ret = -1; goto done; } ypclnt_error(ypclnt, NULL, NULL); ret = 0; done: if (clnt != NULL) { auth_destroy(clnt->cl_auth); clnt_destroy(clnt); } endnetconfig(localhandle); free(yppwd.newpw.pw_name); if (yppwd.newpw.pw_passwd != NULL) { memset(yppwd.newpw.pw_passwd, 0, strlen(yppwd.newpw.pw_passwd)); free(yppwd.newpw.pw_passwd); } free(yppwd.newpw.pw_class); free(yppwd.newpw.pw_gecos); free(yppwd.newpw.pw_dir); free(yppwd.newpw.pw_shell); if (yppwd.oldpass != NULL) { memset(yppwd.oldpass, 0, strlen(yppwd.oldpass)); free(yppwd.oldpass); } return (ret); }
[ "static", "int", "yppasswd_local", "(", "ypclnt_t", "*", "ypclnt", ",", "const", "struct", "passwd", "*", "pwd", ")", "{", "struct", "master_yppasswd", "yppwd", ";", "struct", "rpc_err", "rpcerr", ";", "struct", "netconfig", "*", "nc", "=", "NULL", ";", "void", "*", "localhandle", "=", "NULL", ";", "CLIENT", "*", "clnt", "=", "NULL", ";", "int", "ret", ",", "*", "result", ";", "memset", "(", "&", "yppwd", ",", "0", ",", "sizeof", "yppwd", ")", ";", "yppwd", ".", "newpw", ".", "pw_uid", "=", "pwd", "->", "pw_uid", ";", "yppwd", ".", "newpw", ".", "pw_gid", "=", "pwd", "->", "pw_gid", ";", "yppwd", ".", "newpw", ".", "pw_change", "=", "pwd", "->", "pw_change", ";", "yppwd", ".", "newpw", ".", "pw_expire", "=", "pwd", "->", "pw_expire", ";", "yppwd", ".", "newpw", ".", "pw_fields", "=", "pwd", "->", "pw_fields", ";", "yppwd", ".", "oldpass", "=", "strdup", "(", "\"", "\"", ")", ";", "yppwd", ".", "domain", "=", "strdup", "(", "ypclnt", "->", "domain", ")", ";", "if", "(", "(", "yppwd", ".", "newpw", ".", "pw_name", "=", "strdup", "(", "pwd", "->", "pw_name", ")", ")", "==", "NULL", "||", "(", "yppwd", ".", "newpw", ".", "pw_passwd", "=", "strdup", "(", "pwd", "->", "pw_passwd", ")", ")", "==", "NULL", "||", "(", "yppwd", ".", "newpw", ".", "pw_class", "=", "strdup", "(", "pwd", "->", "pw_class", ")", ")", "==", "NULL", "||", "(", "yppwd", ".", "newpw", ".", "pw_gecos", "=", "strdup", "(", "pwd", "->", "pw_gecos", ")", ")", "==", "NULL", "||", "(", "yppwd", ".", "newpw", ".", "pw_dir", "=", "strdup", "(", "pwd", "->", "pw_dir", ")", ")", "==", "NULL", "||", "(", "yppwd", ".", "newpw", ".", "pw_shell", "=", "strdup", "(", "pwd", "->", "pw_shell", ")", ")", "==", "NULL", ")", "{", "ypclnt_error", "(", "ypclnt", ",", "__func__", ",", "\"", "\"", ",", "strerror", "(", "errno", ")", ")", ";", "ret", "=", "-1", ";", "goto", "done", ";", "}", "localhandle", "=", "setnetconfig", "(", ")", ";", "while", "(", "(", "nc", "=", "getnetconfig", "(", "localhandle", ")", ")", "!=", "NULL", ")", "{", "if", "(", "nc", "->", "nc_protofmly", "!=", "NULL", "&&", "strcmp", "(", "nc", "->", "nc_protofmly", ",", "NC_LOOPBACK", ")", "==", "0", ")", "break", ";", "}", "if", "(", "nc", "==", "NULL", ")", "{", "ypclnt_error", "(", "ypclnt", ",", "__func__", ",", "\"", "\"", ",", "nc_sperror", "(", ")", ")", ";", "ret", "=", "-1", ";", "goto", "done", ";", "}", "if", "(", "(", "clnt", "=", "clnt_tp_create", "(", "NULL", ",", "MASTER_YPPASSWDPROG", ",", "MASTER_YPPASSWDVERS", ",", "nc", ")", ")", "==", "NULL", ")", "{", "ypclnt_error", "(", "ypclnt", ",", "__func__", ",", "\"", "\"", ",", "clnt_spcreateerror", "(", "ypclnt", "->", "server", ")", ")", ";", "ret", "=", "-1", ";", "goto", "done", ";", "}", "clnt", "->", "cl_auth", "=", "authunix_create_default", "(", ")", ";", "result", "=", "yppasswdproc_update_master_1", "(", "&", "yppwd", ",", "clnt", ")", ";", "clnt_geterr", "(", "clnt", ",", "&", "rpcerr", ")", ";", "if", "(", "rpcerr", ".", "re_status", "!=", "RPC_SUCCESS", ")", "{", "ypclnt_error", "(", "ypclnt", ",", "__func__", ",", "\"", "\"", ",", "clnt_sperror", "(", "clnt", ",", "ypclnt", "->", "server", ")", ")", ";", "ret", "=", "-1", ";", "goto", "done", ";", "}", "if", "(", "result", "==", "NULL", "||", "*", "result", "!=", "0", ")", "{", "ypclnt_error", "(", "ypclnt", ",", "__func__", ",", "\"", "\"", ")", ";", "ret", "=", "-1", ";", "goto", "done", ";", "}", "ypclnt_error", "(", "ypclnt", ",", "NULL", ",", "NULL", ")", ";", "ret", "=", "0", ";", "done", ":", "if", "(", "clnt", "!=", "NULL", ")", "{", "auth_destroy", "(", "clnt", "->", "cl_auth", ")", ";", "clnt_destroy", "(", "clnt", ")", ";", "}", "endnetconfig", "(", "localhandle", ")", ";", "free", "(", "yppwd", ".", "newpw", ".", "pw_name", ")", ";", "if", "(", "yppwd", ".", "newpw", ".", "pw_passwd", "!=", "NULL", ")", "{", "memset", "(", "yppwd", ".", "newpw", ".", "pw_passwd", ",", "0", ",", "strlen", "(", "yppwd", ".", "newpw", ".", "pw_passwd", ")", ")", ";", "free", "(", "yppwd", ".", "newpw", ".", "pw_passwd", ")", ";", "}", "free", "(", "yppwd", ".", "newpw", ".", "pw_class", ")", ";", "free", "(", "yppwd", ".", "newpw", ".", "pw_gecos", ")", ";", "free", "(", "yppwd", ".", "newpw", ".", "pw_dir", ")", ";", "free", "(", "yppwd", ".", "newpw", ".", "pw_shell", ")", ";", "if", "(", "yppwd", ".", "oldpass", "!=", "NULL", ")", "{", "memset", "(", "yppwd", ".", "oldpass", ",", "0", ",", "strlen", "(", "yppwd", ".", "oldpass", ")", ")", ";", "free", "(", "yppwd", ".", "oldpass", ")", ";", "}", "return", "(", "ret", ")", ";", "}" ]
yppasswd_remote and yppasswd_local are quite similar but still sufficiently different that merging them into one makes the code significantly less readable, IMHO, so we keep them separate.
[ "yppasswd_remote", "and", "yppasswd_local", "are", "quite", "similar", "but", "still", "sufficiently", "different", "that", "merging", "them", "into", "one", "makes", "the", "code", "significantly", "less", "readable", "IMHO", "so", "we", "keep", "them", "separate", "." ]
[ "/* fill the master_yppasswd structure */", "/* connect to rpc.yppasswdd */", "/* request the update */", "/* check for RPC errors */", "/* check the result of the update */", "/* XXX how do we get more details? */" ]
[ { "param": "ypclnt", "type": "ypclnt_t" }, { "param": "pwd", "type": "struct passwd" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ypclnt", "type": "ypclnt_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pwd", "type": "struct passwd", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
24c04038ad11c17259941fa9e9e56d659b1320b2
atrens/DragonFlyBSD-src
contrib/binutils-2.34/libctf/ctf-open-bfd.c
[ "BSD-3-Clause" ]
C
ctf_new_archive_internal
null
static struct ctf_archive_internal * ctf_new_archive_internal (int is_archive, struct ctf_archive *arc, ctf_file_t *fp, const ctf_sect_t *symsect, const ctf_sect_t *strsect, int *errp) { struct ctf_archive_internal *arci; if ((arci = calloc (1, sizeof (struct ctf_archive_internal))) == NULL) { if (is_archive) ctf_arc_close_internal (arc); else ctf_file_close (fp); return (ctf_set_open_errno (errp, errno)); } arci->ctfi_is_archive = is_archive; if (is_archive) arci->ctfi_archive = arc; else arci->ctfi_file = fp; if (symsect) memcpy (&arci->ctfi_symsect, symsect, sizeof (struct ctf_sect)); if (strsect) memcpy (&arci->ctfi_strsect, strsect, sizeof (struct ctf_sect)); return arci; }
/* Make a new struct ctf_archive_internal wrapper for a ctf_archive or a ctf_file. Closes ARC and/or FP on error. Arrange to free the SYMSECT or STRSECT, as needed, on close (though the STRSECT interior is bound to the bfd * and is not actually freed by this machinery). */
Make a new struct ctf_archive_internal wrapper for a ctf_archive or a ctf_file. Closes ARC and/or FP on error. Arrange to free the SYMSECT or STRSECT, as needed, on close (though the STRSECT interior is bound to the bfd and is not actually freed by this machinery).
[ "Make", "a", "new", "struct", "ctf_archive_internal", "wrapper", "for", "a", "ctf_archive", "or", "a", "ctf_file", ".", "Closes", "ARC", "and", "/", "or", "FP", "on", "error", ".", "Arrange", "to", "free", "the", "SYMSECT", "or", "STRSECT", "as", "needed", "on", "close", "(", "though", "the", "STRSECT", "interior", "is", "bound", "to", "the", "bfd", "and", "is", "not", "actually", "freed", "by", "this", "machinery", ")", "." ]
static struct ctf_archive_internal * ctf_new_archive_internal (int is_archive, struct ctf_archive *arc, ctf_file_t *fp, const ctf_sect_t *symsect, const ctf_sect_t *strsect, int *errp) { struct ctf_archive_internal *arci; if ((arci = calloc (1, sizeof (struct ctf_archive_internal))) == NULL) { if (is_archive) ctf_arc_close_internal (arc); else ctf_file_close (fp); return (ctf_set_open_errno (errp, errno)); } arci->ctfi_is_archive = is_archive; if (is_archive) arci->ctfi_archive = arc; else arci->ctfi_file = fp; if (symsect) memcpy (&arci->ctfi_symsect, symsect, sizeof (struct ctf_sect)); if (strsect) memcpy (&arci->ctfi_strsect, strsect, sizeof (struct ctf_sect)); return arci; }
[ "static", "struct", "ctf_archive_internal", "*", "ctf_new_archive_internal", "(", "int", "is_archive", ",", "struct", "ctf_archive", "*", "arc", ",", "ctf_file_t", "*", "fp", ",", "const", "ctf_sect_t", "*", "symsect", ",", "const", "ctf_sect_t", "*", "strsect", ",", "int", "*", "errp", ")", "{", "struct", "ctf_archive_internal", "*", "arci", ";", "if", "(", "(", "arci", "=", "calloc", "(", "1", ",", "sizeof", "(", "struct", "ctf_archive_internal", ")", ")", ")", "==", "NULL", ")", "{", "if", "(", "is_archive", ")", "ctf_arc_close_internal", "(", "arc", ")", ";", "else", "ctf_file_close", "(", "fp", ")", ";", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "errno", ")", ")", ";", "}", "arci", "->", "ctfi_is_archive", "=", "is_archive", ";", "if", "(", "is_archive", ")", "arci", "->", "ctfi_archive", "=", "arc", ";", "else", "arci", "->", "ctfi_file", "=", "fp", ";", "if", "(", "symsect", ")", "memcpy", "(", "&", "arci", "->", "ctfi_symsect", ",", "symsect", ",", "sizeof", "(", "struct", "ctf_sect", ")", ")", ";", "if", "(", "strsect", ")", "memcpy", "(", "&", "arci", "->", "ctfi_strsect", ",", "strsect", ",", "sizeof", "(", "struct", "ctf_sect", ")", ")", ";", "return", "arci", ";", "}" ]
Make a new struct ctf_archive_internal wrapper for a ctf_archive or a ctf_file.
[ "Make", "a", "new", "struct", "ctf_archive_internal", "wrapper", "for", "a", "ctf_archive", "or", "a", "ctf_file", "." ]
[]
[ { "param": "is_archive", "type": "int" }, { "param": "arc", "type": "struct ctf_archive" }, { "param": "fp", "type": "ctf_file_t" }, { "param": "symsect", "type": "ctf_sect_t" }, { "param": "strsect", "type": "ctf_sect_t" }, { "param": "errp", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "is_archive", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arc", "type": "struct ctf_archive", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fp", "type": "ctf_file_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "symsect", "type": "ctf_sect_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "strsect", "type": "ctf_sect_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "errp", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
24c04038ad11c17259941fa9e9e56d659b1320b2
atrens/DragonFlyBSD-src
contrib/binutils-2.34/libctf/ctf-open-bfd.c
[ "BSD-3-Clause" ]
C
ctf_bfdopen
ctf_archive_t
ctf_archive_t * ctf_bfdopen (struct bfd *abfd, int *errp) { ctf_archive_t *arc; asection *ctf_asect; bfd_byte *contents; ctf_sect_t ctfsect; libctf_init_debug(); if ((ctf_asect = bfd_get_section_by_name (abfd, _CTF_SECTION)) == NULL) { return (ctf_set_open_errno (errp, ECTF_NOCTFDATA)); } if (!bfd_malloc_and_get_section (abfd, ctf_asect, &contents)) { ctf_dprintf ("ctf_bfdopen(): cannot malloc CTF section: %s\n", bfd_errmsg (bfd_get_error())); return (ctf_set_open_errno (errp, ECTF_FMT)); } ctfsect.cts_name = _CTF_SECTION; ctfsect.cts_entsize = 1; ctfsect.cts_size = bfd_section_size (ctf_asect); ctfsect.cts_data = contents; if ((arc = ctf_bfdopen_ctfsect (abfd, &ctfsect, errp)) != NULL) { arc->ctfi_data = (void *) ctfsect.cts_data; return arc; } free (contents); return NULL; /* errno is set for us. */ }
/* Open a CTF file given the specified BFD. */
Open a CTF file given the specified BFD.
[ "Open", "a", "CTF", "file", "given", "the", "specified", "BFD", "." ]
ctf_archive_t * ctf_bfdopen (struct bfd *abfd, int *errp) { ctf_archive_t *arc; asection *ctf_asect; bfd_byte *contents; ctf_sect_t ctfsect; libctf_init_debug(); if ((ctf_asect = bfd_get_section_by_name (abfd, _CTF_SECTION)) == NULL) { return (ctf_set_open_errno (errp, ECTF_NOCTFDATA)); } if (!bfd_malloc_and_get_section (abfd, ctf_asect, &contents)) { ctf_dprintf ("ctf_bfdopen(): cannot malloc CTF section: %s\n", bfd_errmsg (bfd_get_error())); return (ctf_set_open_errno (errp, ECTF_FMT)); } ctfsect.cts_name = _CTF_SECTION; ctfsect.cts_entsize = 1; ctfsect.cts_size = bfd_section_size (ctf_asect); ctfsect.cts_data = contents; if ((arc = ctf_bfdopen_ctfsect (abfd, &ctfsect, errp)) != NULL) { arc->ctfi_data = (void *) ctfsect.cts_data; return arc; } free (contents); return NULL; }
[ "ctf_archive_t", "*", "ctf_bfdopen", "(", "struct", "bfd", "*", "abfd", ",", "int", "*", "errp", ")", "{", "ctf_archive_t", "*", "arc", ";", "asection", "*", "ctf_asect", ";", "bfd_byte", "*", "contents", ";", "ctf_sect_t", "ctfsect", ";", "libctf_init_debug", "(", ")", ";", "if", "(", "(", "ctf_asect", "=", "bfd_get_section_by_name", "(", "abfd", ",", "_CTF_SECTION", ")", ")", "==", "NULL", ")", "{", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "ECTF_NOCTFDATA", ")", ")", ";", "}", "if", "(", "!", "bfd_malloc_and_get_section", "(", "abfd", ",", "ctf_asect", ",", "&", "contents", ")", ")", "{", "ctf_dprintf", "(", "\"", "\\n", "\"", ",", "bfd_errmsg", "(", "bfd_get_error", "(", ")", ")", ")", ";", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "ECTF_FMT", ")", ")", ";", "}", "ctfsect", ".", "cts_name", "=", "_CTF_SECTION", ";", "ctfsect", ".", "cts_entsize", "=", "1", ";", "ctfsect", ".", "cts_size", "=", "bfd_section_size", "(", "ctf_asect", ")", ";", "ctfsect", ".", "cts_data", "=", "contents", ";", "if", "(", "(", "arc", "=", "ctf_bfdopen_ctfsect", "(", "abfd", ",", "&", "ctfsect", ",", "errp", ")", ")", "!=", "NULL", ")", "{", "arc", "->", "ctfi_data", "=", "(", "void", "*", ")", "ctfsect", ".", "cts_data", ";", "return", "arc", ";", "}", "free", "(", "contents", ")", ";", "return", "NULL", ";", "}" ]
Open a CTF file given the specified BFD.
[ "Open", "a", "CTF", "file", "given", "the", "specified", "BFD", "." ]
[ "/* errno is set for us. */" ]
[ { "param": "abfd", "type": "struct bfd" }, { "param": "errp", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "abfd", "type": "struct bfd", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "errp", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
24c04038ad11c17259941fa9e9e56d659b1320b2
atrens/DragonFlyBSD-src
contrib/binutils-2.34/libctf/ctf-open-bfd.c
[ "BSD-3-Clause" ]
C
ctf_fdopen
ctf_archive_t
ctf_archive_t * ctf_fdopen (int fd, const char *filename, const char *target, int *errp) { ctf_archive_t *arci; bfd *abfd; int nfd; struct stat st; ssize_t nbytes; ctf_preamble_t ctfhdr; uint64_t arc_magic; memset (&ctfhdr, 0, sizeof (ctfhdr)); libctf_init_debug(); if (fstat (fd, &st) == -1) return (ctf_set_open_errno (errp, errno)); if ((nbytes = ctf_pread (fd, &ctfhdr, sizeof (ctfhdr), 0)) <= 0) return (ctf_set_open_errno (errp, nbytes < 0 ? errno : ECTF_FMT)); /* If we have read enough bytes to form a CTF header and the magic string matches, in either endianness, attempt to interpret the file as raw CTF. */ if ((size_t) nbytes >= sizeof (ctf_preamble_t) && (ctfhdr.ctp_magic == CTF_MAGIC || ctfhdr.ctp_magic == bswap_16 (CTF_MAGIC))) { ctf_file_t *fp = NULL; void *data; if ((data = ctf_mmap (st.st_size, 0, fd)) == NULL) return (ctf_set_open_errno (errp, errno)); if ((fp = ctf_simple_open (data, (size_t) st.st_size, NULL, 0, 0, NULL, 0, errp)) == NULL) { ctf_munmap (data, (size_t) st.st_size); return NULL; /* errno is set for us. */ } fp->ctf_data_mmapped = data; fp->ctf_data_mmapped_len = (size_t) st.st_size; return ctf_new_archive_internal (0, NULL, fp, NULL, NULL, errp); } if ((nbytes = ctf_pread (fd, &arc_magic, sizeof (arc_magic), 0)) <= 0) return (ctf_set_open_errno (errp, nbytes < 0 ? errno : ECTF_FMT)); if ((size_t) nbytes >= sizeof (uint64_t) && le64toh (arc_magic) == CTFA_MAGIC) { struct ctf_archive *arc; if ((arc = ctf_arc_open_internal (filename, errp)) == NULL) return NULL; /* errno is set for us. */ return ctf_new_archive_internal (1, arc, NULL, NULL, NULL, errp); } /* Attempt to open the file with BFD. We must dup the fd first, since bfd takes ownership of the passed fd. */ if ((nfd = dup (fd)) < 0) return (ctf_set_open_errno (errp, errno)); if ((abfd = bfd_fdopenr (filename, target, nfd)) == NULL) { ctf_dprintf ("Cannot open BFD from %s: %s\n", filename ? filename : "(unknown file)", bfd_errmsg (bfd_get_error())); return (ctf_set_open_errno (errp, ECTF_FMT)); } bfd_set_cacheable (abfd, 1); if (!bfd_check_format (abfd, bfd_object)) { ctf_dprintf ("BFD format problem in %s: %s\n", filename ? filename : "(unknown file)", bfd_errmsg (bfd_get_error())); if (bfd_get_error() == bfd_error_file_ambiguously_recognized) return (ctf_set_open_errno (errp, ECTF_BFD_AMBIGUOUS)); else return (ctf_set_open_errno (errp, ECTF_FMT)); } if ((arci = ctf_bfdopen (abfd, errp)) == NULL) { if (!bfd_close_all_done (abfd)) ctf_dprintf ("Cannot close BFD: %s\n", bfd_errmsg (bfd_get_error())); return NULL; /* errno is set for us. */ } arci->ctfi_bfd_close = ctf_bfdclose; arci->ctfi_abfd = abfd; return arci; }
/* Open the specified file descriptor and return a pointer to a CTF archive that contains one or more CTF containers. The file can be an ELF file, a raw CTF file, or a CTF archive. The caller is responsible for closing the file descriptor when it is no longer needed. If this is an ELF file, TARGET, if non-NULL, should be the name of a suitable BFD target. */
Open the specified file descriptor and return a pointer to a CTF archive that contains one or more CTF containers. The file can be an ELF file, a raw CTF file, or a CTF archive. The caller is responsible for closing the file descriptor when it is no longer needed. If this is an ELF file, TARGET, if non-NULL, should be the name of a suitable BFD target.
[ "Open", "the", "specified", "file", "descriptor", "and", "return", "a", "pointer", "to", "a", "CTF", "archive", "that", "contains", "one", "or", "more", "CTF", "containers", ".", "The", "file", "can", "be", "an", "ELF", "file", "a", "raw", "CTF", "file", "or", "a", "CTF", "archive", ".", "The", "caller", "is", "responsible", "for", "closing", "the", "file", "descriptor", "when", "it", "is", "no", "longer", "needed", ".", "If", "this", "is", "an", "ELF", "file", "TARGET", "if", "non", "-", "NULL", "should", "be", "the", "name", "of", "a", "suitable", "BFD", "target", "." ]
ctf_archive_t * ctf_fdopen (int fd, const char *filename, const char *target, int *errp) { ctf_archive_t *arci; bfd *abfd; int nfd; struct stat st; ssize_t nbytes; ctf_preamble_t ctfhdr; uint64_t arc_magic; memset (&ctfhdr, 0, sizeof (ctfhdr)); libctf_init_debug(); if (fstat (fd, &st) == -1) return (ctf_set_open_errno (errp, errno)); if ((nbytes = ctf_pread (fd, &ctfhdr, sizeof (ctfhdr), 0)) <= 0) return (ctf_set_open_errno (errp, nbytes < 0 ? errno : ECTF_FMT)); if ((size_t) nbytes >= sizeof (ctf_preamble_t) && (ctfhdr.ctp_magic == CTF_MAGIC || ctfhdr.ctp_magic == bswap_16 (CTF_MAGIC))) { ctf_file_t *fp = NULL; void *data; if ((data = ctf_mmap (st.st_size, 0, fd)) == NULL) return (ctf_set_open_errno (errp, errno)); if ((fp = ctf_simple_open (data, (size_t) st.st_size, NULL, 0, 0, NULL, 0, errp)) == NULL) { ctf_munmap (data, (size_t) st.st_size); return NULL; } fp->ctf_data_mmapped = data; fp->ctf_data_mmapped_len = (size_t) st.st_size; return ctf_new_archive_internal (0, NULL, fp, NULL, NULL, errp); } if ((nbytes = ctf_pread (fd, &arc_magic, sizeof (arc_magic), 0)) <= 0) return (ctf_set_open_errno (errp, nbytes < 0 ? errno : ECTF_FMT)); if ((size_t) nbytes >= sizeof (uint64_t) && le64toh (arc_magic) == CTFA_MAGIC) { struct ctf_archive *arc; if ((arc = ctf_arc_open_internal (filename, errp)) == NULL) return NULL; return ctf_new_archive_internal (1, arc, NULL, NULL, NULL, errp); } if ((nfd = dup (fd)) < 0) return (ctf_set_open_errno (errp, errno)); if ((abfd = bfd_fdopenr (filename, target, nfd)) == NULL) { ctf_dprintf ("Cannot open BFD from %s: %s\n", filename ? filename : "(unknown file)", bfd_errmsg (bfd_get_error())); return (ctf_set_open_errno (errp, ECTF_FMT)); } bfd_set_cacheable (abfd, 1); if (!bfd_check_format (abfd, bfd_object)) { ctf_dprintf ("BFD format problem in %s: %s\n", filename ? filename : "(unknown file)", bfd_errmsg (bfd_get_error())); if (bfd_get_error() == bfd_error_file_ambiguously_recognized) return (ctf_set_open_errno (errp, ECTF_BFD_AMBIGUOUS)); else return (ctf_set_open_errno (errp, ECTF_FMT)); } if ((arci = ctf_bfdopen (abfd, errp)) == NULL) { if (!bfd_close_all_done (abfd)) ctf_dprintf ("Cannot close BFD: %s\n", bfd_errmsg (bfd_get_error())); return NULL; } arci->ctfi_bfd_close = ctf_bfdclose; arci->ctfi_abfd = abfd; return arci; }
[ "ctf_archive_t", "*", "ctf_fdopen", "(", "int", "fd", ",", "const", "char", "*", "filename", ",", "const", "char", "*", "target", ",", "int", "*", "errp", ")", "{", "ctf_archive_t", "*", "arci", ";", "bfd", "*", "abfd", ";", "int", "nfd", ";", "struct", "stat", "st", ";", "ssize_t", "nbytes", ";", "ctf_preamble_t", "ctfhdr", ";", "uint64_t", "arc_magic", ";", "memset", "(", "&", "ctfhdr", ",", "0", ",", "sizeof", "(", "ctfhdr", ")", ")", ";", "libctf_init_debug", "(", ")", ";", "if", "(", "fstat", "(", "fd", ",", "&", "st", ")", "==", "-1", ")", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "errno", ")", ")", ";", "if", "(", "(", "nbytes", "=", "ctf_pread", "(", "fd", ",", "&", "ctfhdr", ",", "sizeof", "(", "ctfhdr", ")", ",", "0", ")", ")", "<=", "0", ")", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "nbytes", "<", "0", "?", "errno", ":", "ECTF_FMT", ")", ")", ";", "if", "(", "(", "size_t", ")", "nbytes", ">=", "sizeof", "(", "ctf_preamble_t", ")", "&&", "(", "ctfhdr", ".", "ctp_magic", "==", "CTF_MAGIC", "||", "ctfhdr", ".", "ctp_magic", "==", "bswap_16", "(", "CTF_MAGIC", ")", ")", ")", "{", "ctf_file_t", "*", "fp", "=", "NULL", ";", "void", "*", "data", ";", "if", "(", "(", "data", "=", "ctf_mmap", "(", "st", ".", "st_size", ",", "0", ",", "fd", ")", ")", "==", "NULL", ")", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "errno", ")", ")", ";", "if", "(", "(", "fp", "=", "ctf_simple_open", "(", "data", ",", "(", "size_t", ")", "st", ".", "st_size", ",", "NULL", ",", "0", ",", "0", ",", "NULL", ",", "0", ",", "errp", ")", ")", "==", "NULL", ")", "{", "ctf_munmap", "(", "data", ",", "(", "size_t", ")", "st", ".", "st_size", ")", ";", "return", "NULL", ";", "}", "fp", "->", "ctf_data_mmapped", "=", "data", ";", "fp", "->", "ctf_data_mmapped_len", "=", "(", "size_t", ")", "st", ".", "st_size", ";", "return", "ctf_new_archive_internal", "(", "0", ",", "NULL", ",", "fp", ",", "NULL", ",", "NULL", ",", "errp", ")", ";", "}", "if", "(", "(", "nbytes", "=", "ctf_pread", "(", "fd", ",", "&", "arc_magic", ",", "sizeof", "(", "arc_magic", ")", ",", "0", ")", ")", "<=", "0", ")", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "nbytes", "<", "0", "?", "errno", ":", "ECTF_FMT", ")", ")", ";", "if", "(", "(", "size_t", ")", "nbytes", ">=", "sizeof", "(", "uint64_t", ")", "&&", "le64toh", "(", "arc_magic", ")", "==", "CTFA_MAGIC", ")", "{", "struct", "ctf_archive", "*", "arc", ";", "if", "(", "(", "arc", "=", "ctf_arc_open_internal", "(", "filename", ",", "errp", ")", ")", "==", "NULL", ")", "return", "NULL", ";", "return", "ctf_new_archive_internal", "(", "1", ",", "arc", ",", "NULL", ",", "NULL", ",", "NULL", ",", "errp", ")", ";", "}", "if", "(", "(", "nfd", "=", "dup", "(", "fd", ")", ")", "<", "0", ")", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "errno", ")", ")", ";", "if", "(", "(", "abfd", "=", "bfd_fdopenr", "(", "filename", ",", "target", ",", "nfd", ")", ")", "==", "NULL", ")", "{", "ctf_dprintf", "(", "\"", "\\n", "\"", ",", "filename", "?", "filename", ":", "\"", "\"", ",", "bfd_errmsg", "(", "bfd_get_error", "(", ")", ")", ")", ";", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "ECTF_FMT", ")", ")", ";", "}", "bfd_set_cacheable", "(", "abfd", ",", "1", ")", ";", "if", "(", "!", "bfd_check_format", "(", "abfd", ",", "bfd_object", ")", ")", "{", "ctf_dprintf", "(", "\"", "\\n", "\"", ",", "filename", "?", "filename", ":", "\"", "\"", ",", "bfd_errmsg", "(", "bfd_get_error", "(", ")", ")", ")", ";", "if", "(", "bfd_get_error", "(", ")", "==", "bfd_error_file_ambiguously_recognized", ")", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "ECTF_BFD_AMBIGUOUS", ")", ")", ";", "else", "return", "(", "ctf_set_open_errno", "(", "errp", ",", "ECTF_FMT", ")", ")", ";", "}", "if", "(", "(", "arci", "=", "ctf_bfdopen", "(", "abfd", ",", "errp", ")", ")", "==", "NULL", ")", "{", "if", "(", "!", "bfd_close_all_done", "(", "abfd", ")", ")", "ctf_dprintf", "(", "\"", "\\n", "\"", ",", "bfd_errmsg", "(", "bfd_get_error", "(", ")", ")", ")", ";", "return", "NULL", ";", "}", "arci", "->", "ctfi_bfd_close", "=", "ctf_bfdclose", ";", "arci", "->", "ctfi_abfd", "=", "abfd", ";", "return", "arci", ";", "}" ]
Open the specified file descriptor and return a pointer to a CTF archive that contains one or more CTF containers.
[ "Open", "the", "specified", "file", "descriptor", "and", "return", "a", "pointer", "to", "a", "CTF", "archive", "that", "contains", "one", "or", "more", "CTF", "containers", "." ]
[ "/* If we have read enough bytes to form a CTF header and the magic string\n matches, in either endianness, attempt to interpret the file as raw\n CTF. */", "/* errno is set for us. */", "/* errno is set for us. */", "/* Attempt to open the file with BFD. We must dup the fd first, since bfd\n takes ownership of the passed fd. */", "/* errno is set for us. */" ]
[ { "param": "fd", "type": "int" }, { "param": "filename", "type": "char" }, { "param": "target", "type": "char" }, { "param": "errp", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fd", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filename", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "errp", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
24c04038ad11c17259941fa9e9e56d659b1320b2
atrens/DragonFlyBSD-src
contrib/binutils-2.34/libctf/ctf-open-bfd.c
[ "BSD-3-Clause" ]
C
ctf_open
ctf_archive_t
ctf_archive_t * ctf_open (const char *filename, const char *target, int *errp) { ctf_archive_t *arc; int fd; if ((fd = open (filename, O_RDONLY)) == -1) { if (errp != NULL) *errp = errno; return NULL; } arc = ctf_fdopen (fd, filename, target, errp); (void) close (fd); return arc; }
/* Open the specified file and return a pointer to a CTF container. The file can be either an ELF file or raw CTF file. This is just a convenient wrapper around ctf_fdopen() for callers. */
Open the specified file and return a pointer to a CTF container. The file can be either an ELF file or raw CTF file. This is just a convenient wrapper around ctf_fdopen() for callers.
[ "Open", "the", "specified", "file", "and", "return", "a", "pointer", "to", "a", "CTF", "container", ".", "The", "file", "can", "be", "either", "an", "ELF", "file", "or", "raw", "CTF", "file", ".", "This", "is", "just", "a", "convenient", "wrapper", "around", "ctf_fdopen", "()", "for", "callers", "." ]
ctf_archive_t * ctf_open (const char *filename, const char *target, int *errp) { ctf_archive_t *arc; int fd; if ((fd = open (filename, O_RDONLY)) == -1) { if (errp != NULL) *errp = errno; return NULL; } arc = ctf_fdopen (fd, filename, target, errp); (void) close (fd); return arc; }
[ "ctf_archive_t", "*", "ctf_open", "(", "const", "char", "*", "filename", ",", "const", "char", "*", "target", ",", "int", "*", "errp", ")", "{", "ctf_archive_t", "*", "arc", ";", "int", "fd", ";", "if", "(", "(", "fd", "=", "open", "(", "filename", ",", "O_RDONLY", ")", ")", "==", "-1", ")", "{", "if", "(", "errp", "!=", "NULL", ")", "*", "errp", "=", "errno", ";", "return", "NULL", ";", "}", "arc", "=", "ctf_fdopen", "(", "fd", ",", "filename", ",", "target", ",", "errp", ")", ";", "(", "void", ")", "close", "(", "fd", ")", ";", "return", "arc", ";", "}" ]
Open the specified file and return a pointer to a CTF container.
[ "Open", "the", "specified", "file", "and", "return", "a", "pointer", "to", "a", "CTF", "container", "." ]
[]
[ { "param": "filename", "type": "char" }, { "param": "target", "type": "char" }, { "param": "errp", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "errp", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
24c04038ad11c17259941fa9e9e56d659b1320b2
atrens/DragonFlyBSD-src
contrib/binutils-2.34/libctf/ctf-open-bfd.c
[ "BSD-3-Clause" ]
C
ctf_arc_open
ctf_archive_t
ctf_archive_t * ctf_arc_open (const char *filename, int *errp) { return ctf_open (filename, NULL, errp); }
/* Public entry point: open a CTF archive, or CTF file. Returns the archive, or NULL and an error in *err. Despite the fact that this uses CTF archives, it must be in this file to avoid dragging in BFD into non-BFD-using programs. */
Public entry point: open a CTF archive, or CTF file. Returns the archive, or NULL and an error in *err. Despite the fact that this uses CTF archives, it must be in this file to avoid dragging in BFD into non-BFD-using programs.
[ "Public", "entry", "point", ":", "open", "a", "CTF", "archive", "or", "CTF", "file", ".", "Returns", "the", "archive", "or", "NULL", "and", "an", "error", "in", "*", "err", ".", "Despite", "the", "fact", "that", "this", "uses", "CTF", "archives", "it", "must", "be", "in", "this", "file", "to", "avoid", "dragging", "in", "BFD", "into", "non", "-", "BFD", "-", "using", "programs", "." ]
ctf_archive_t * ctf_arc_open (const char *filename, int *errp) { return ctf_open (filename, NULL, errp); }
[ "ctf_archive_t", "*", "ctf_arc_open", "(", "const", "char", "*", "filename", ",", "int", "*", "errp", ")", "{", "return", "ctf_open", "(", "filename", ",", "NULL", ",", "errp", ")", ";", "}" ]
Public entry point: open a CTF archive, or CTF file.
[ "Public", "entry", "point", ":", "open", "a", "CTF", "archive", "or", "CTF", "file", "." ]
[]
[ { "param": "filename", "type": "char" }, { "param": "errp", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "filename", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "errp", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
248f3116c6774022aee2d6f0c300e8d27e1eb925
atrens/DragonFlyBSD-src
contrib/cvs-1.12/src/diff.c
[ "BSD-3-Clause" ]
C
add_diff_args
void
static void add_diff_args (char opt, const char *longopt, const char *argument) { char *tmp; /* Add opt or longopt to diff_arv. */ assert (opt || (longopt && *longopt)); assert (!(opt && (longopt && *longopt))); if (opt) tmp = Xasprintf ("-%c", opt); else tmp = Xasprintf ("--%s", longopt); run_add_arg_p (&diff_argc, &diff_arg_allocated, &diff_argv, tmp); free (tmp); /* When present, add ARGUMENT to DIFF_ARGV. */ if (argument) run_add_arg_p (&diff_argc, &diff_arg_allocated, &diff_argv, argument); }
/* Add one of OPT or LONGOPT, and ARGUMENT, when present, to global DIFF_ARGV. * * INPUTS * opt A character option representation. * longopt A long option name. * argument Optional option argument. * * GLOBALS * diff_argc The number of arguments in DIFF_ARGV. * diff_argv Array of argument strings. * diff_arg_allocated Allocated length of DIFF_ARGV. * * NOTES * Behavior when both OPT & LONGOPT are provided is undefined. * * RETURNS * Nothing. */
Add one of OPT or LONGOPT, and ARGUMENT, when present, to global DIFF_ARGV. INPUTS opt A character option representation. longopt A long option name. argument Optional option argument. GLOBALS diff_argc The number of arguments in DIFF_ARGV. diff_argv Array of argument strings. NOTES Behavior when both OPT & LONGOPT are provided is undefined. RETURNS Nothing.
[ "Add", "one", "of", "OPT", "or", "LONGOPT", "and", "ARGUMENT", "when", "present", "to", "global", "DIFF_ARGV", ".", "INPUTS", "opt", "A", "character", "option", "representation", ".", "longopt", "A", "long", "option", "name", ".", "argument", "Optional", "option", "argument", ".", "GLOBALS", "diff_argc", "The", "number", "of", "arguments", "in", "DIFF_ARGV", ".", "diff_argv", "Array", "of", "argument", "strings", ".", "NOTES", "Behavior", "when", "both", "OPT", "&", "LONGOPT", "are", "provided", "is", "undefined", ".", "RETURNS", "Nothing", "." ]
static void add_diff_args (char opt, const char *longopt, const char *argument) { char *tmp; assert (opt || (longopt && *longopt)); assert (!(opt && (longopt && *longopt))); if (opt) tmp = Xasprintf ("-%c", opt); else tmp = Xasprintf ("--%s", longopt); run_add_arg_p (&diff_argc, &diff_arg_allocated, &diff_argv, tmp); free (tmp); if (argument) run_add_arg_p (&diff_argc, &diff_arg_allocated, &diff_argv, argument); }
[ "static", "void", "add_diff_args", "(", "char", "opt", ",", "const", "char", "*", "longopt", ",", "const", "char", "*", "argument", ")", "{", "char", "*", "tmp", ";", "assert", "(", "opt", "||", "(", "longopt", "&&", "*", "longopt", ")", ")", ";", "assert", "(", "!", "(", "opt", "&&", "(", "longopt", "&&", "*", "longopt", ")", ")", ")", ";", "if", "(", "opt", ")", "tmp", "=", "Xasprintf", "(", "\"", "\"", ",", "opt", ")", ";", "else", "tmp", "=", "Xasprintf", "(", "\"", "\"", ",", "longopt", ")", ";", "run_add_arg_p", "(", "&", "diff_argc", ",", "&", "diff_arg_allocated", ",", "&", "diff_argv", ",", "tmp", ")", ";", "free", "(", "tmp", ")", ";", "if", "(", "argument", ")", "run_add_arg_p", "(", "&", "diff_argc", ",", "&", "diff_arg_allocated", ",", "&", "diff_argv", ",", "argument", ")", ";", "}" ]
Add one of OPT or LONGOPT, and ARGUMENT, when present, to global DIFF_ARGV.
[ "Add", "one", "of", "OPT", "or", "LONGOPT", "and", "ARGUMENT", "when", "present", "to", "global", "DIFF_ARGV", "." ]
[ "/* Add opt or longopt to diff_arv. */", "/* When present, add ARGUMENT to DIFF_ARGV. */" ]
[ { "param": "opt", "type": "char" }, { "param": "longopt", "type": "char" }, { "param": "argument", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "opt", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "longopt", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "argument", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
248f3116c6774022aee2d6f0c300e8d27e1eb925
atrens/DragonFlyBSD-src
contrib/cvs-1.12/src/diff.c
[ "BSD-3-Clause" ]
C
diff_file_nodiff
null
static enum diff_file diff_file_nodiff (struct file_info *finfo, Vers_TS *vers, enum diff_file empty_file, char **rev1_cache) { Vers_TS *xvers; int retcode; TRACE (TRACE_FUNCTION, "diff_file_nodiff (%s, %d)", finfo->fullname ? finfo->fullname : "(null)", empty_file); /* free up any old use_rev* variables and reset 'em */ if (use_rev1) free (use_rev1); if (use_rev2) free (use_rev2); use_rev1 = use_rev2 = NULL; if (diff_rev1 || diff_date1) { /* special handling for TAG_HEAD */ if (diff_rev1 && strcmp (diff_rev1, TAG_HEAD) == 0) { if (vers->vn_rcs != NULL && vers->srcfile != NULL) use_rev1 = RCS_branch_head (vers->srcfile, vers->vn_rcs); } else { xvers = Version_TS (finfo, NULL, diff_rev1, diff_date1, 1, 0); if (xvers->vn_rcs != NULL) use_rev1 = xstrdup (xvers->vn_rcs); freevers_ts (&xvers); } } if (diff_rev2 || diff_date2) { /* special handling for TAG_HEAD */ if (diff_rev2 && strcmp (diff_rev2, TAG_HEAD) == 0) { if (vers->vn_rcs && vers->srcfile) use_rev2 = RCS_branch_head (vers->srcfile, vers->vn_rcs); } else { xvers = Version_TS (finfo, NULL, diff_rev2, diff_date2, 1, 0); if (xvers->vn_rcs != NULL) use_rev2 = xstrdup (xvers->vn_rcs); freevers_ts (&xvers); } if (use_rev1 == NULL || RCS_isdead (vers->srcfile, use_rev1)) { /* The first revision does not exist. If EMPTY_FILES is true, treat this as an added file. Otherwise, warn about the missing tag. */ if (use_rev2 == NULL || RCS_isdead (vers->srcfile, use_rev2)) /* At least in the case where DIFF_REV1 and DIFF_REV2 * are both numeric (and non-existant (NULL), as opposed to * dead?), we should be returning some kind of error (see * basicb-8a0 in testsuite). The symbolic case may be more * complicated. */ return DIFF_SAME; if (empty_files) return DIFF_ADDED; if (use_rev1 != NULL) { if (diff_rev1) { error (0, 0, "Tag %s refers to a dead (removed) revision in file `%s'.", diff_rev1, finfo->fullname); } else { error (0, 0, "Date %s refers to a dead (removed) revision in file `%s'.", diff_date1, finfo->fullname); } error (0, 0, "No comparison available. Pass `-N' to `%s diff'?", program_name); } else if (diff_rev1) error (0, 0, "tag %s is not in file %s", diff_rev1, finfo->fullname); else error (0, 0, "no revision for date %s in file %s", diff_date1, finfo->fullname); return DIFF_ERROR; } assert( use_rev1 != NULL ); if( use_rev2 == NULL || RCS_isdead( vers->srcfile, use_rev2 ) ) { /* The second revision does not exist. If EMPTY_FILES is true, treat this as a removed file. Otherwise warn about the missing tag. */ if (empty_files) return DIFF_REMOVED; if( use_rev2 != NULL ) { if (diff_rev2) { error( 0, 0, "Tag %s refers to a dead (removed) revision in file `%s'.", diff_rev2, finfo->fullname ); } else { error( 0, 0, "Date %s refers to a dead (removed) revision in file `%s'.", diff_date2, finfo->fullname ); } error( 0, 0, "No comparison available. Pass `-N' to `%s diff'?", program_name ); } else if (diff_rev2) error (0, 0, "tag %s is not in file %s", diff_rev2, finfo->fullname); else error (0, 0, "no revision for date %s in file %s", diff_date2, finfo->fullname); return DIFF_ERROR; } /* Now, see if we really need to do the diff. We can't assume that the * files are different when the revs are. */ assert( use_rev2 != NULL ); if( strcmp (use_rev1, use_rev2) == 0 ) return DIFF_SAME; /* else fall through and do the diff */ } /* If we had a r1/d1 & r2/d2, then at this point we must have a C3P0... * err... ok, then both rev1 & rev2 must have resolved to an existing, * live version due to if statement we just closed. */ assert (!(diff_rev2 || diff_date2) || (use_rev1 && use_rev2)); if ((diff_rev1 || diff_date1) && (use_rev1 == NULL || RCS_isdead (vers->srcfile, use_rev1))) { /* The first revision does not exist, and no second revision was given. */ if (empty_files) { if (empty_file == DIFF_REMOVED) return DIFF_SAME; if( user_file_rev && use_rev2 == NULL ) use_rev2 = xstrdup( user_file_rev ); return DIFF_ADDED; } if( use_rev1 != NULL ) { if (diff_rev1) { error( 0, 0, "Tag %s refers to a dead (removed) revision in file `%s'.", diff_rev1, finfo->fullname ); } else { error( 0, 0, "Date %s refers to a dead (removed) revision in file `%s'.", diff_date1, finfo->fullname ); } error( 0, 0, "No comparison available. Pass `-N' to `%s diff'?", program_name ); } else if ( diff_rev1 ) error( 0, 0, "tag %s is not in file %s", diff_rev1, finfo->fullname ); else error( 0, 0, "no revision for date %s in file %s", diff_date1, finfo->fullname ); return DIFF_ERROR; } assert( !diff_rev1 || use_rev1 ); if (user_file_rev) { /* drop user_file_rev into first unused use_rev */ if (!use_rev1) use_rev1 = xstrdup (user_file_rev); else if (!use_rev2) use_rev2 = xstrdup (user_file_rev); /* and if not, it wasn't needed anyhow */ user_file_rev = NULL; } /* Now, see if we really need to do the diff. We can't assume that the * files are different when the revs are. */ if( use_rev1 && use_rev2) { if (strcmp (use_rev1, use_rev2) == 0) return DIFF_SAME; /* Fall through and do the diff. */ } /* Don't want to do the timestamp check with both use_rev1 & use_rev2 set. * The timestamp check is just for the default case of diffing the * workspace file against its base revision. */ else if( use_rev1 == NULL || ( vers->vn_user != NULL && strcmp( use_rev1, vers->vn_user ) == 0 ) ) { if (empty_file == DIFF_DIFFERENT && vers->ts_user != NULL && strcmp (vers->ts_rcs, vers->ts_user) == 0 && (!(*options) || strcmp (options, vers->options) == 0)) { return DIFF_SAME; } if (use_rev1 == NULL && (vers->vn_user[0] != '0' || vers->vn_user[1] != '\0')) { if (vers->vn_user[0] == '-') use_rev1 = xstrdup (vers->vn_user + 1); else use_rev1 = xstrdup (vers->vn_user); } } /* If we already know that the file is being added or removed, then we don't want to do an actual file comparison here. */ if (empty_file != DIFF_DIFFERENT) return empty_file; /* * Run a quick cmp to see if we should bother with a full diff. */ retcode = RCS_cmp_file( vers->srcfile, use_rev1, rev1_cache, use_rev2, *options ? options : vers->options, finfo->file ); return retcode == 0 ? DIFF_SAME : DIFF_DIFFERENT; }
/* * verify that a file is different * * INPUTS * finfo * vers * empty_file * * OUTPUTS * rev1_cache Cache the contents of rev1 if we look it up. */
verify that a file is different INPUTS finfo vers empty_file OUTPUTS rev1_cache Cache the contents of rev1 if we look it up.
[ "verify", "that", "a", "file", "is", "different", "INPUTS", "finfo", "vers", "empty_file", "OUTPUTS", "rev1_cache", "Cache", "the", "contents", "of", "rev1", "if", "we", "look", "it", "up", "." ]
static enum diff_file diff_file_nodiff (struct file_info *finfo, Vers_TS *vers, enum diff_file empty_file, char **rev1_cache) { Vers_TS *xvers; int retcode; TRACE (TRACE_FUNCTION, "diff_file_nodiff (%s, %d)", finfo->fullname ? finfo->fullname : "(null)", empty_file); if (use_rev1) free (use_rev1); if (use_rev2) free (use_rev2); use_rev1 = use_rev2 = NULL; if (diff_rev1 || diff_date1) { if (diff_rev1 && strcmp (diff_rev1, TAG_HEAD) == 0) { if (vers->vn_rcs != NULL && vers->srcfile != NULL) use_rev1 = RCS_branch_head (vers->srcfile, vers->vn_rcs); } else { xvers = Version_TS (finfo, NULL, diff_rev1, diff_date1, 1, 0); if (xvers->vn_rcs != NULL) use_rev1 = xstrdup (xvers->vn_rcs); freevers_ts (&xvers); } } if (diff_rev2 || diff_date2) { if (diff_rev2 && strcmp (diff_rev2, TAG_HEAD) == 0) { if (vers->vn_rcs && vers->srcfile) use_rev2 = RCS_branch_head (vers->srcfile, vers->vn_rcs); } else { xvers = Version_TS (finfo, NULL, diff_rev2, diff_date2, 1, 0); if (xvers->vn_rcs != NULL) use_rev2 = xstrdup (xvers->vn_rcs); freevers_ts (&xvers); } if (use_rev1 == NULL || RCS_isdead (vers->srcfile, use_rev1)) { if (use_rev2 == NULL || RCS_isdead (vers->srcfile, use_rev2)) return DIFF_SAME; if (empty_files) return DIFF_ADDED; if (use_rev1 != NULL) { if (diff_rev1) { error (0, 0, "Tag %s refers to a dead (removed) revision in file `%s'.", diff_rev1, finfo->fullname); } else { error (0, 0, "Date %s refers to a dead (removed) revision in file `%s'.", diff_date1, finfo->fullname); } error (0, 0, "No comparison available. Pass `-N' to `%s diff'?", program_name); } else if (diff_rev1) error (0, 0, "tag %s is not in file %s", diff_rev1, finfo->fullname); else error (0, 0, "no revision for date %s in file %s", diff_date1, finfo->fullname); return DIFF_ERROR; } assert( use_rev1 != NULL ); if( use_rev2 == NULL || RCS_isdead( vers->srcfile, use_rev2 ) ) { if (empty_files) return DIFF_REMOVED; if( use_rev2 != NULL ) { if (diff_rev2) { error( 0, 0, "Tag %s refers to a dead (removed) revision in file `%s'.", diff_rev2, finfo->fullname ); } else { error( 0, 0, "Date %s refers to a dead (removed) revision in file `%s'.", diff_date2, finfo->fullname ); } error( 0, 0, "No comparison available. Pass `-N' to `%s diff'?", program_name ); } else if (diff_rev2) error (0, 0, "tag %s is not in file %s", diff_rev2, finfo->fullname); else error (0, 0, "no revision for date %s in file %s", diff_date2, finfo->fullname); return DIFF_ERROR; } assert( use_rev2 != NULL ); if( strcmp (use_rev1, use_rev2) == 0 ) return DIFF_SAME; } assert (!(diff_rev2 || diff_date2) || (use_rev1 && use_rev2)); if ((diff_rev1 || diff_date1) && (use_rev1 == NULL || RCS_isdead (vers->srcfile, use_rev1))) { if (empty_files) { if (empty_file == DIFF_REMOVED) return DIFF_SAME; if( user_file_rev && use_rev2 == NULL ) use_rev2 = xstrdup( user_file_rev ); return DIFF_ADDED; } if( use_rev1 != NULL ) { if (diff_rev1) { error( 0, 0, "Tag %s refers to a dead (removed) revision in file `%s'.", diff_rev1, finfo->fullname ); } else { error( 0, 0, "Date %s refers to a dead (removed) revision in file `%s'.", diff_date1, finfo->fullname ); } error( 0, 0, "No comparison available. Pass `-N' to `%s diff'?", program_name ); } else if ( diff_rev1 ) error( 0, 0, "tag %s is not in file %s", diff_rev1, finfo->fullname ); else error( 0, 0, "no revision for date %s in file %s", diff_date1, finfo->fullname ); return DIFF_ERROR; } assert( !diff_rev1 || use_rev1 ); if (user_file_rev) { if (!use_rev1) use_rev1 = xstrdup (user_file_rev); else if (!use_rev2) use_rev2 = xstrdup (user_file_rev); user_file_rev = NULL; } if( use_rev1 && use_rev2) { if (strcmp (use_rev1, use_rev2) == 0) return DIFF_SAME; } else if( use_rev1 == NULL || ( vers->vn_user != NULL && strcmp( use_rev1, vers->vn_user ) == 0 ) ) { if (empty_file == DIFF_DIFFERENT && vers->ts_user != NULL && strcmp (vers->ts_rcs, vers->ts_user) == 0 && (!(*options) || strcmp (options, vers->options) == 0)) { return DIFF_SAME; } if (use_rev1 == NULL && (vers->vn_user[0] != '0' || vers->vn_user[1] != '\0')) { if (vers->vn_user[0] == '-') use_rev1 = xstrdup (vers->vn_user + 1); else use_rev1 = xstrdup (vers->vn_user); } } if (empty_file != DIFF_DIFFERENT) return empty_file; retcode = RCS_cmp_file( vers->srcfile, use_rev1, rev1_cache, use_rev2, *options ? options : vers->options, finfo->file ); return retcode == 0 ? DIFF_SAME : DIFF_DIFFERENT; }
[ "static", "enum", "diff_file", "diff_file_nodiff", "(", "struct", "file_info", "*", "finfo", ",", "Vers_TS", "*", "vers", ",", "enum", "diff_file", "empty_file", ",", "char", "*", "*", "rev1_cache", ")", "{", "Vers_TS", "*", "xvers", ";", "int", "retcode", ";", "TRACE", "(", "TRACE_FUNCTION", ",", "\"", "\"", ",", "finfo", "->", "fullname", "?", "finfo", "->", "fullname", ":", "\"", "\"", ",", "empty_file", ")", ";", "if", "(", "use_rev1", ")", "free", "(", "use_rev1", ")", ";", "if", "(", "use_rev2", ")", "free", "(", "use_rev2", ")", ";", "use_rev1", "=", "use_rev2", "=", "NULL", ";", "if", "(", "diff_rev1", "||", "diff_date1", ")", "{", "if", "(", "diff_rev1", "&&", "strcmp", "(", "diff_rev1", ",", "TAG_HEAD", ")", "==", "0", ")", "{", "if", "(", "vers", "->", "vn_rcs", "!=", "NULL", "&&", "vers", "->", "srcfile", "!=", "NULL", ")", "use_rev1", "=", "RCS_branch_head", "(", "vers", "->", "srcfile", ",", "vers", "->", "vn_rcs", ")", ";", "}", "else", "{", "xvers", "=", "Version_TS", "(", "finfo", ",", "NULL", ",", "diff_rev1", ",", "diff_date1", ",", "1", ",", "0", ")", ";", "if", "(", "xvers", "->", "vn_rcs", "!=", "NULL", ")", "use_rev1", "=", "xstrdup", "(", "xvers", "->", "vn_rcs", ")", ";", "freevers_ts", "(", "&", "xvers", ")", ";", "}", "}", "if", "(", "diff_rev2", "||", "diff_date2", ")", "{", "if", "(", "diff_rev2", "&&", "strcmp", "(", "diff_rev2", ",", "TAG_HEAD", ")", "==", "0", ")", "{", "if", "(", "vers", "->", "vn_rcs", "&&", "vers", "->", "srcfile", ")", "use_rev2", "=", "RCS_branch_head", "(", "vers", "->", "srcfile", ",", "vers", "->", "vn_rcs", ")", ";", "}", "else", "{", "xvers", "=", "Version_TS", "(", "finfo", ",", "NULL", ",", "diff_rev2", ",", "diff_date2", ",", "1", ",", "0", ")", ";", "if", "(", "xvers", "->", "vn_rcs", "!=", "NULL", ")", "use_rev2", "=", "xstrdup", "(", "xvers", "->", "vn_rcs", ")", ";", "freevers_ts", "(", "&", "xvers", ")", ";", "}", "if", "(", "use_rev1", "==", "NULL", "||", "RCS_isdead", "(", "vers", "->", "srcfile", ",", "use_rev1", ")", ")", "{", "if", "(", "use_rev2", "==", "NULL", "||", "RCS_isdead", "(", "vers", "->", "srcfile", ",", "use_rev2", ")", ")", "return", "DIFF_SAME", ";", "if", "(", "empty_files", ")", "return", "DIFF_ADDED", ";", "if", "(", "use_rev1", "!=", "NULL", ")", "{", "if", "(", "diff_rev1", ")", "{", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_rev1", ",", "finfo", "->", "fullname", ")", ";", "}", "else", "{", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_date1", ",", "finfo", "->", "fullname", ")", ";", "}", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "program_name", ")", ";", "}", "else", "if", "(", "diff_rev1", ")", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_rev1", ",", "finfo", "->", "fullname", ")", ";", "else", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_date1", ",", "finfo", "->", "fullname", ")", ";", "return", "DIFF_ERROR", ";", "}", "assert", "(", "use_rev1", "!=", "NULL", ")", ";", "if", "(", "use_rev2", "==", "NULL", "||", "RCS_isdead", "(", "vers", "->", "srcfile", ",", "use_rev2", ")", ")", "{", "if", "(", "empty_files", ")", "return", "DIFF_REMOVED", ";", "if", "(", "use_rev2", "!=", "NULL", ")", "{", "if", "(", "diff_rev2", ")", "{", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_rev2", ",", "finfo", "->", "fullname", ")", ";", "}", "else", "{", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_date2", ",", "finfo", "->", "fullname", ")", ";", "}", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "program_name", ")", ";", "}", "else", "if", "(", "diff_rev2", ")", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_rev2", ",", "finfo", "->", "fullname", ")", ";", "else", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_date2", ",", "finfo", "->", "fullname", ")", ";", "return", "DIFF_ERROR", ";", "}", "assert", "(", "use_rev2", "!=", "NULL", ")", ";", "if", "(", "strcmp", "(", "use_rev1", ",", "use_rev2", ")", "==", "0", ")", "return", "DIFF_SAME", ";", "}", "assert", "(", "!", "(", "diff_rev2", "||", "diff_date2", ")", "||", "(", "use_rev1", "&&", "use_rev2", ")", ")", ";", "if", "(", "(", "diff_rev1", "||", "diff_date1", ")", "&&", "(", "use_rev1", "==", "NULL", "||", "RCS_isdead", "(", "vers", "->", "srcfile", ",", "use_rev1", ")", ")", ")", "{", "if", "(", "empty_files", ")", "{", "if", "(", "empty_file", "==", "DIFF_REMOVED", ")", "return", "DIFF_SAME", ";", "if", "(", "user_file_rev", "&&", "use_rev2", "==", "NULL", ")", "use_rev2", "=", "xstrdup", "(", "user_file_rev", ")", ";", "return", "DIFF_ADDED", ";", "}", "if", "(", "use_rev1", "!=", "NULL", ")", "{", "if", "(", "diff_rev1", ")", "{", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_rev1", ",", "finfo", "->", "fullname", ")", ";", "}", "else", "{", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_date1", ",", "finfo", "->", "fullname", ")", ";", "}", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "program_name", ")", ";", "}", "else", "if", "(", "diff_rev1", ")", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_rev1", ",", "finfo", "->", "fullname", ")", ";", "else", "error", "(", "0", ",", "0", ",", "\"", "\"", ",", "diff_date1", ",", "finfo", "->", "fullname", ")", ";", "return", "DIFF_ERROR", ";", "}", "assert", "(", "!", "diff_rev1", "||", "use_rev1", ")", ";", "if", "(", "user_file_rev", ")", "{", "if", "(", "!", "use_rev1", ")", "use_rev1", "=", "xstrdup", "(", "user_file_rev", ")", ";", "else", "if", "(", "!", "use_rev2", ")", "use_rev2", "=", "xstrdup", "(", "user_file_rev", ")", ";", "user_file_rev", "=", "NULL", ";", "}", "if", "(", "use_rev1", "&&", "use_rev2", ")", "{", "if", "(", "strcmp", "(", "use_rev1", ",", "use_rev2", ")", "==", "0", ")", "return", "DIFF_SAME", ";", "}", "else", "if", "(", "use_rev1", "==", "NULL", "||", "(", "vers", "->", "vn_user", "!=", "NULL", "&&", "strcmp", "(", "use_rev1", ",", "vers", "->", "vn_user", ")", "==", "0", ")", ")", "{", "if", "(", "empty_file", "==", "DIFF_DIFFERENT", "&&", "vers", "->", "ts_user", "!=", "NULL", "&&", "strcmp", "(", "vers", "->", "ts_rcs", ",", "vers", "->", "ts_user", ")", "==", "0", "&&", "(", "!", "(", "*", "options", ")", "||", "strcmp", "(", "options", ",", "vers", "->", "options", ")", "==", "0", ")", ")", "{", "return", "DIFF_SAME", ";", "}", "if", "(", "use_rev1", "==", "NULL", "&&", "(", "vers", "->", "vn_user", "[", "0", "]", "!=", "'", "'", "||", "vers", "->", "vn_user", "[", "1", "]", "!=", "'", "\\0", "'", ")", ")", "{", "if", "(", "vers", "->", "vn_user", "[", "0", "]", "==", "'", "'", ")", "use_rev1", "=", "xstrdup", "(", "vers", "->", "vn_user", "+", "1", ")", ";", "else", "use_rev1", "=", "xstrdup", "(", "vers", "->", "vn_user", ")", ";", "}", "}", "if", "(", "empty_file", "!=", "DIFF_DIFFERENT", ")", "return", "empty_file", ";", "retcode", "=", "RCS_cmp_file", "(", "vers", "->", "srcfile", ",", "use_rev1", ",", "rev1_cache", ",", "use_rev2", ",", "*", "options", "?", "options", ":", "vers", "->", "options", ",", "finfo", "->", "file", ")", ";", "return", "retcode", "==", "0", "?", "DIFF_SAME", ":", "DIFF_DIFFERENT", ";", "}" ]
verify that a file is different INPUTS finfo vers empty_file
[ "verify", "that", "a", "file", "is", "different", "INPUTS", "finfo", "vers", "empty_file" ]
[ "/* free up any old use_rev* variables and reset 'em */", "/* special handling for TAG_HEAD */", "/* special handling for TAG_HEAD */", "/* The first revision does not exist. If EMPTY_FILES is\n true, treat this as an added file. Otherwise, warn\n about the missing tag. */", "/* At least in the case where DIFF_REV1 and DIFF_REV2\n\t\t * are both numeric (and non-existant (NULL), as opposed to\n\t\t * dead?), we should be returning some kind of error (see\n\t\t * basicb-8a0 in testsuite). The symbolic case may be more\n\t\t * complicated.\n\t\t */", "/* The second revision does not exist. If EMPTY_FILES is\n true, treat this as a removed file. Otherwise warn\n about the missing tag. */", "/* Now, see if we really need to do the diff. We can't assume that the\n\t * files are different when the revs are.\n\t */", "/* else fall through and do the diff */", "/* If we had a r1/d1 & r2/d2, then at this point we must have a C3P0...\n * err... ok, then both rev1 & rev2 must have resolved to an existing,\n * live version due to if statement we just closed.\n */", "/* The first revision does not exist, and no second revision\n was given. */", "/* drop user_file_rev into first unused use_rev */", "/* and if not, it wasn't needed anyhow */", "/* Now, see if we really need to do the diff. We can't assume that the\n * files are different when the revs are.\n */", "/* Fall through and do the diff. */", "/* Don't want to do the timestamp check with both use_rev1 & use_rev2 set.\n * The timestamp check is just for the default case of diffing the\n * workspace file against its base revision.\n */", "/* If we already know that the file is being added or removed,\n then we don't want to do an actual file comparison here. */", "/*\n * Run a quick cmp to see if we should bother with a full diff.\n */" ]
[ { "param": "finfo", "type": "struct file_info" }, { "param": "vers", "type": "Vers_TS" }, { "param": "empty_file", "type": "enum diff_file" }, { "param": "rev1_cache", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "finfo", "type": "struct file_info", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "vers", "type": "Vers_TS", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "empty_file", "type": "enum diff_file", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rev1_cache", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
14dc1de76c40f76c758c4dee5771ea59bc828ae5
atrens/DragonFlyBSD-src
contrib/gdb-7/gdb/tui/tui-out.c
[ "BSD-3-Clause" ]
C
tui_field_string
void
static void tui_field_string (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *string) { tui_out_data *data = ui_out_data (uiout); if (data->base.suppress_output) return; if (fldname && data->line > 0 && strcmp (fldname, "fullname") == 0) { data->start_of_line ++; if (data->line > 0) { tui_show_source (string, data->line); } return; } data->start_of_line++; (*cli_ui_out_impl.field_string) (uiout, fldno, width, align, fldname, string); }
/* Other cli_field_* end up here so alignment and field separators are both handled by tui_field_string. */
Other cli_field_* end up here so alignment and field separators are both handled by tui_field_string.
[ "Other", "cli_field_", "*", "end", "up", "here", "so", "alignment", "and", "field", "separators", "are", "both", "handled", "by", "tui_field_string", "." ]
static void tui_field_string (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *string) { tui_out_data *data = ui_out_data (uiout); if (data->base.suppress_output) return; if (fldname && data->line > 0 && strcmp (fldname, "fullname") == 0) { data->start_of_line ++; if (data->line > 0) { tui_show_source (string, data->line); } return; } data->start_of_line++; (*cli_ui_out_impl.field_string) (uiout, fldno, width, align, fldname, string); }
[ "static", "void", "tui_field_string", "(", "struct", "ui_out", "*", "uiout", ",", "int", "fldno", ",", "int", "width", ",", "enum", "ui_align", "align", ",", "const", "char", "*", "fldname", ",", "const", "char", "*", "string", ")", "{", "tui_out_data", "*", "data", "=", "ui_out_data", "(", "uiout", ")", ";", "if", "(", "data", "->", "base", ".", "suppress_output", ")", "return", ";", "if", "(", "fldname", "&&", "data", "->", "line", ">", "0", "&&", "strcmp", "(", "fldname", ",", "\"", "\"", ")", "==", "0", ")", "{", "data", "->", "start_of_line", "++", ";", "if", "(", "data", "->", "line", ">", "0", ")", "{", "tui_show_source", "(", "string", ",", "data", "->", "line", ")", ";", "}", "return", ";", "}", "data", "->", "start_of_line", "++", ";", "(", "*", "cli_ui_out_impl", ".", "field_string", ")", "(", "uiout", ",", "fldno", ",", "width", ",", "align", ",", "fldname", ",", "string", ")", ";", "}" ]
Other cli_field_* end up here so alignment and field separators are both handled by tui_field_string.
[ "Other", "cli_field_", "*", "end", "up", "here", "so", "alignment", "and", "field", "separators", "are", "both", "handled", "by", "tui_field_string", "." ]
[]
[ { "param": "uiout", "type": "struct ui_out" }, { "param": "fldno", "type": "int" }, { "param": "width", "type": "int" }, { "param": "align", "type": "enum ui_align" }, { "param": "fldname", "type": "char" }, { "param": "string", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "uiout", "type": "struct ui_out", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fldno", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "width", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "align", "type": "enum ui_align", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fldname", "type": "char", "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": [] }
14dc1de76c40f76c758c4dee5771ea59bc828ae5
atrens/DragonFlyBSD-src
contrib/gdb-7/gdb/tui/tui-out.c
[ "BSD-3-Clause" ]
C
tui_field_fmt
void
static void tui_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *format, va_list args) { tui_out_data *data = ui_out_data (uiout); if (data->base.suppress_output) return; data->start_of_line++; (*cli_ui_out_impl.field_fmt) (uiout, fldno, width, align, fldname, format, args); }
/* This is the only field function that does not align. */
This is the only field function that does not align.
[ "This", "is", "the", "only", "field", "function", "that", "does", "not", "align", "." ]
static void tui_field_fmt (struct ui_out *uiout, int fldno, int width, enum ui_align align, const char *fldname, const char *format, va_list args) { tui_out_data *data = ui_out_data (uiout); if (data->base.suppress_output) return; data->start_of_line++; (*cli_ui_out_impl.field_fmt) (uiout, fldno, width, align, fldname, format, args); }
[ "static", "void", "tui_field_fmt", "(", "struct", "ui_out", "*", "uiout", ",", "int", "fldno", ",", "int", "width", ",", "enum", "ui_align", "align", ",", "const", "char", "*", "fldname", ",", "const", "char", "*", "format", ",", "va_list", "args", ")", "{", "tui_out_data", "*", "data", "=", "ui_out_data", "(", "uiout", ")", ";", "if", "(", "data", "->", "base", ".", "suppress_output", ")", "return", ";", "data", "->", "start_of_line", "++", ";", "(", "*", "cli_ui_out_impl", ".", "field_fmt", ")", "(", "uiout", ",", "fldno", ",", "width", ",", "align", ",", "fldname", ",", "format", ",", "args", ")", ";", "}" ]
This is the only field function that does not align.
[ "This", "is", "the", "only", "field", "function", "that", "does", "not", "align", "." ]
[]
[ { "param": "uiout", "type": "struct ui_out" }, { "param": "fldno", "type": "int" }, { "param": "width", "type": "int" }, { "param": "align", "type": "enum ui_align" }, { "param": "fldname", "type": "char" }, { "param": "format", "type": "char" }, { "param": "args", "type": "va_list" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "uiout", "type": "struct ui_out", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fldno", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "width", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "align", "type": "enum ui_align", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fldname", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "format", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": "va_list", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
called_as_built_in
bool
bool called_as_built_in (tree node) { /* Note that we must use DECL_NAME, not DECL_ASSEMBLER_NAME_SET_P since we want the name used to call the function, not the name it will have. */ const char *name = IDENTIFIER_POINTER (DECL_NAME (node)); return is_builtin_name (name); }
/* Return true if NODE should be considered for inline expansion regardless of the optimization level. This means whenever a function is invoked with its "internal" name, which normally contains the prefix "__builtin". */
Return true if NODE should be considered for inline expansion regardless of the optimization level. This means whenever a function is invoked with its "internal" name, which normally contains the prefix "__builtin".
[ "Return", "true", "if", "NODE", "should", "be", "considered", "for", "inline", "expansion", "regardless", "of", "the", "optimization", "level", ".", "This", "means", "whenever", "a", "function", "is", "invoked", "with", "its", "\"", "internal", "\"", "name", "which", "normally", "contains", "the", "prefix", "\"", "__builtin", "\"", "." ]
bool called_as_built_in (tree node) { const char *name = IDENTIFIER_POINTER (DECL_NAME (node)); return is_builtin_name (name); }
[ "bool", "called_as_built_in", "(", "tree", "node", ")", "{", "const", "char", "*", "name", "=", "IDENTIFIER_POINTER", "(", "DECL_NAME", "(", "node", ")", ")", ";", "return", "is_builtin_name", "(", "name", ")", ";", "}" ]
Return true if NODE should be considered for inline expansion regardless of the optimization level.
[ "Return", "true", "if", "NODE", "should", "be", "considered", "for", "inline", "expansion", "regardless", "of", "the", "optimization", "level", "." ]
[ "/* Note that we must use DECL_NAME, not DECL_ASSEMBLER_NAME_SET_P since\n we want the name used to call the function, not the name it\n will have. */" ]
[ { "param": "node", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "node", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
string_length
null
static unsigned string_length (const void *ptr, unsigned eltsize, unsigned maxelts) { gcc_checking_assert (eltsize == 1 || eltsize == 2 || eltsize == 4); unsigned n; if (eltsize == 1) { /* Optimize the common case of plain char. */ for (n = 0; n < maxelts; n++) { const char *elt = (const char*) ptr + n; if (!*elt) break; } } else { for (n = 0; n < maxelts; n++) { const char *elt = (const char*) ptr + n * eltsize; if (!memcmp (elt, "\0\0\0\0", eltsize)) break; } } return n; }
/* Return the number of non-zero elements in the sequence [ PTR, PTR + MAXELTS ) where each element's size is ELTSIZE bytes. ELTSIZE must be a power of 2 less than 8. Used by c_strlen. */
Return the number of non-zero elements in the sequence [ PTR, PTR + MAXELTS ) where each element's size is ELTSIZE bytes. ELTSIZE must be a power of 2 less than 8.
[ "Return", "the", "number", "of", "non", "-", "zero", "elements", "in", "the", "sequence", "[", "PTR", "PTR", "+", "MAXELTS", ")", "where", "each", "element", "'", "s", "size", "is", "ELTSIZE", "bytes", ".", "ELTSIZE", "must", "be", "a", "power", "of", "2", "less", "than", "8", "." ]
static unsigned string_length (const void *ptr, unsigned eltsize, unsigned maxelts) { gcc_checking_assert (eltsize == 1 || eltsize == 2 || eltsize == 4); unsigned n; if (eltsize == 1) { for (n = 0; n < maxelts; n++) { const char *elt = (const char*) ptr + n; if (!*elt) break; } } else { for (n = 0; n < maxelts; n++) { const char *elt = (const char*) ptr + n * eltsize; if (!memcmp (elt, "\0\0\0\0", eltsize)) break; } } return n; }
[ "static", "unsigned", "string_length", "(", "const", "void", "*", "ptr", ",", "unsigned", "eltsize", ",", "unsigned", "maxelts", ")", "{", "gcc_checking_assert", "(", "eltsize", "==", "1", "||", "eltsize", "==", "2", "||", "eltsize", "==", "4", ")", ";", "unsigned", "n", ";", "if", "(", "eltsize", "==", "1", ")", "{", "for", "(", "n", "=", "0", ";", "n", "<", "maxelts", ";", "n", "++", ")", "{", "const", "char", "*", "elt", "=", "(", "const", "char", "*", ")", "ptr", "+", "n", ";", "if", "(", "!", "*", "elt", ")", "break", ";", "}", "}", "else", "{", "for", "(", "n", "=", "0", ";", "n", "<", "maxelts", ";", "n", "++", ")", "{", "const", "char", "*", "elt", "=", "(", "const", "char", "*", ")", "ptr", "+", "n", "*", "eltsize", ";", "if", "(", "!", "memcmp", "(", "elt", ",", "\"", "\\0", "\\0", "\\0", "\\0", "\"", ",", "eltsize", ")", ")", "break", ";", "}", "}", "return", "n", ";", "}" ]
Return the number of non-zero elements in the sequence [ PTR, PTR + MAXELTS ) where each element's size is ELTSIZE bytes.
[ "Return", "the", "number", "of", "non", "-", "zero", "elements", "in", "the", "sequence", "[", "PTR", "PTR", "+", "MAXELTS", ")", "where", "each", "element", "'", "s", "size", "is", "ELTSIZE", "bytes", "." ]
[ "/* Optimize the common case of plain char. */" ]
[ { "param": "ptr", "type": "void" }, { "param": "eltsize", "type": "unsigned" }, { "param": "maxelts", "type": "unsigned" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ptr", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "eltsize", "type": "unsigned", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "maxelts", "type": "unsigned", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
c_strlen
tree
tree c_strlen (tree src, int only_value) { STRIP_NOPS (src); if (TREE_CODE (src) == COND_EXPR && (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0)))) { tree len1, len2; len1 = c_strlen (TREE_OPERAND (src, 1), only_value); len2 = c_strlen (TREE_OPERAND (src, 2), only_value); if (tree_int_cst_equal (len1, len2)) return len1; } if (TREE_CODE (src) == COMPOUND_EXPR && (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0)))) return c_strlen (TREE_OPERAND (src, 1), only_value); location_t loc = EXPR_LOC_OR_LOC (src, input_location); /* Offset from the beginning of the string in bytes. */ tree byteoff; src = string_constant (src, &byteoff); if (src == 0) return NULL_TREE; /* Determine the size of the string element. */ unsigned eltsize = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (src)))); /* Set MAXELTS to sizeof (SRC) / sizeof (*SRC) - 1, the maximum possible length of SRC. */ unsigned maxelts = TREE_STRING_LENGTH (src) / eltsize - 1; /* PTR can point to the byte representation of any string type, including char* and wchar_t*. */ const char *ptr = TREE_STRING_POINTER (src); if (byteoff && TREE_CODE (byteoff) != INTEGER_CST) { /* If the string has an internal zero byte (e.g., "foo\0bar"), we can't compute the offset to the following null if we don't know where to start searching for it. */ if (string_length (ptr, eltsize, maxelts) < maxelts) { /* Return when an embedded null character is found. */ return NULL_TREE; } if (!maxelts) return ssize_int (0); /* We don't know the starting offset, but we do know that the string has no internal zero bytes. We can assume that the offset falls within the bounds of the string; otherwise, the programmer deserves what he gets. Subtract the offset from the length of the string, and return that. This would perhaps not be valid if we were dealing with named arrays in addition to literal string constants. */ return size_diffop_loc (loc, size_int (maxelts * eltsize), byteoff); } /* Offset from the beginning of the string in elements. */ HOST_WIDE_INT eltoff; /* We have a known offset into the string. Start searching there for a null character if we can represent it as a single HOST_WIDE_INT. */ if (byteoff == 0) eltoff = 0; else if (! tree_fits_shwi_p (byteoff)) eltoff = -1; else eltoff = tree_to_shwi (byteoff) / eltsize; /* If the offset is known to be out of bounds, warn, and call strlen at runtime. */ if (eltoff < 0 || eltoff > maxelts) { /* Suppress multiple warnings for propagated constant strings. */ if (only_value != 2 && !TREE_NO_WARNING (src)) { warning_at (loc, OPT_Warray_bounds, "offset %qwi outside bounds of constant string", eltoff); TREE_NO_WARNING (src) = 1; } return NULL_TREE; } /* Use strlen to search for the first zero byte. Since any strings constructed with build_string will have nulls appended, we win even if we get handed something like (char[4])"abcd". Since ELTOFF is our starting index into the string, no further calculation is needed. */ unsigned len = string_length (ptr + eltoff * eltsize, eltsize, maxelts - eltoff); return ssize_int (len); }
/* Compute the length of a null-terminated character string or wide character string handling character sizes of 1, 2, and 4 bytes. TREE_STRING_LENGTH is not the right way because it evaluates to the size of the character array in bytes (as opposed to characters) and because it can contain a zero byte in the middle. ONLY_VALUE should be nonzero if the result is not going to be emitted into the instruction stream and zero if it is going to be expanded. E.g. with i++ ? "foo" : "bar", if ONLY_VALUE is nonzero, constant 3 is returned, otherwise NULL, since len = c_strlen (src, 1); if (len) expand_expr (len, ...); would not evaluate the side-effects. If ONLY_VALUE is two then we do not emit warnings about out-of-bound accesses. Note that this implies the result is not going to be emitted into the instruction stream. The value returned is of type `ssizetype'. Unfortunately, string_constant can't access the values of const char arrays with initializers, so neither can we do so here. */
Compute the length of a null-terminated character string or wide character string handling character sizes of 1, 2, and 4 bytes. TREE_STRING_LENGTH is not the right way because it evaluates to the size of the character array in bytes (as opposed to characters) and because it can contain a zero byte in the middle. ONLY_VALUE should be nonzero if the result is not going to be emitted into the instruction stream and zero if it is going to be expanded. If ONLY_VALUE is two then we do not emit warnings about out-of-bound accesses. Note that this implies the result is not going to be emitted into the instruction stream. The value returned is of type `ssizetype'. Unfortunately, string_constant can't access the values of const char arrays with initializers, so neither can we do so here.
[ "Compute", "the", "length", "of", "a", "null", "-", "terminated", "character", "string", "or", "wide", "character", "string", "handling", "character", "sizes", "of", "1", "2", "and", "4", "bytes", ".", "TREE_STRING_LENGTH", "is", "not", "the", "right", "way", "because", "it", "evaluates", "to", "the", "size", "of", "the", "character", "array", "in", "bytes", "(", "as", "opposed", "to", "characters", ")", "and", "because", "it", "can", "contain", "a", "zero", "byte", "in", "the", "middle", ".", "ONLY_VALUE", "should", "be", "nonzero", "if", "the", "result", "is", "not", "going", "to", "be", "emitted", "into", "the", "instruction", "stream", "and", "zero", "if", "it", "is", "going", "to", "be", "expanded", ".", "If", "ONLY_VALUE", "is", "two", "then", "we", "do", "not", "emit", "warnings", "about", "out", "-", "of", "-", "bound", "accesses", ".", "Note", "that", "this", "implies", "the", "result", "is", "not", "going", "to", "be", "emitted", "into", "the", "instruction", "stream", ".", "The", "value", "returned", "is", "of", "type", "`", "ssizetype", "'", ".", "Unfortunately", "string_constant", "can", "'", "t", "access", "the", "values", "of", "const", "char", "arrays", "with", "initializers", "so", "neither", "can", "we", "do", "so", "here", "." ]
tree c_strlen (tree src, int only_value) { STRIP_NOPS (src); if (TREE_CODE (src) == COND_EXPR && (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0)))) { tree len1, len2; len1 = c_strlen (TREE_OPERAND (src, 1), only_value); len2 = c_strlen (TREE_OPERAND (src, 2), only_value); if (tree_int_cst_equal (len1, len2)) return len1; } if (TREE_CODE (src) == COMPOUND_EXPR && (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0)))) return c_strlen (TREE_OPERAND (src, 1), only_value); location_t loc = EXPR_LOC_OR_LOC (src, input_location); tree byteoff; src = string_constant (src, &byteoff); if (src == 0) return NULL_TREE; unsigned eltsize = tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (src)))); unsigned maxelts = TREE_STRING_LENGTH (src) / eltsize - 1; const char *ptr = TREE_STRING_POINTER (src); if (byteoff && TREE_CODE (byteoff) != INTEGER_CST) { if (string_length (ptr, eltsize, maxelts) < maxelts) { return NULL_TREE; } if (!maxelts) return ssize_int (0); return size_diffop_loc (loc, size_int (maxelts * eltsize), byteoff); } HOST_WIDE_INT eltoff; if (byteoff == 0) eltoff = 0; else if (! tree_fits_shwi_p (byteoff)) eltoff = -1; else eltoff = tree_to_shwi (byteoff) / eltsize; if (eltoff < 0 || eltoff > maxelts) { if (only_value != 2 && !TREE_NO_WARNING (src)) { warning_at (loc, OPT_Warray_bounds, "offset %qwi outside bounds of constant string", eltoff); TREE_NO_WARNING (src) = 1; } return NULL_TREE; } unsigned len = string_length (ptr + eltoff * eltsize, eltsize, maxelts - eltoff); return ssize_int (len); }
[ "tree", "c_strlen", "(", "tree", "src", ",", "int", "only_value", ")", "{", "STRIP_NOPS", "(", "src", ")", ";", "if", "(", "TREE_CODE", "(", "src", ")", "==", "COND_EXPR", "&&", "(", "only_value", "||", "!", "TREE_SIDE_EFFECTS", "(", "TREE_OPERAND", "(", "src", ",", "0", ")", ")", ")", ")", "{", "tree", "len1", ",", "len2", ";", "len1", "=", "c_strlen", "(", "TREE_OPERAND", "(", "src", ",", "1", ")", ",", "only_value", ")", ";", "len2", "=", "c_strlen", "(", "TREE_OPERAND", "(", "src", ",", "2", ")", ",", "only_value", ")", ";", "if", "(", "tree_int_cst_equal", "(", "len1", ",", "len2", ")", ")", "return", "len1", ";", "}", "if", "(", "TREE_CODE", "(", "src", ")", "==", "COMPOUND_EXPR", "&&", "(", "only_value", "||", "!", "TREE_SIDE_EFFECTS", "(", "TREE_OPERAND", "(", "src", ",", "0", ")", ")", ")", ")", "return", "c_strlen", "(", "TREE_OPERAND", "(", "src", ",", "1", ")", ",", "only_value", ")", ";", "location_t", "loc", "=", "EXPR_LOC_OR_LOC", "(", "src", ",", "input_location", ")", ";", "tree", "byteoff", ";", "src", "=", "string_constant", "(", "src", ",", "&", "byteoff", ")", ";", "if", "(", "src", "==", "0", ")", "return", "NULL_TREE", ";", "unsigned", "eltsize", "=", "tree_to_uhwi", "(", "TYPE_SIZE_UNIT", "(", "TREE_TYPE", "(", "TREE_TYPE", "(", "src", ")", ")", ")", ")", ";", "unsigned", "maxelts", "=", "TREE_STRING_LENGTH", "(", "src", ")", "/", "eltsize", "-", "1", ";", "const", "char", "*", "ptr", "=", "TREE_STRING_POINTER", "(", "src", ")", ";", "if", "(", "byteoff", "&&", "TREE_CODE", "(", "byteoff", ")", "!=", "INTEGER_CST", ")", "{", "if", "(", "string_length", "(", "ptr", ",", "eltsize", ",", "maxelts", ")", "<", "maxelts", ")", "{", "return", "NULL_TREE", ";", "}", "if", "(", "!", "maxelts", ")", "return", "ssize_int", "(", "0", ")", ";", "return", "size_diffop_loc", "(", "loc", ",", "size_int", "(", "maxelts", "*", "eltsize", ")", ",", "byteoff", ")", ";", "}", "HOST_WIDE_INT", "eltoff", ";", "if", "(", "byteoff", "==", "0", ")", "eltoff", "=", "0", ";", "else", "if", "(", "!", "tree_fits_shwi_p", "(", "byteoff", ")", ")", "eltoff", "=", "-1", ";", "else", "eltoff", "=", "tree_to_shwi", "(", "byteoff", ")", "/", "eltsize", ";", "if", "(", "eltoff", "<", "0", "||", "eltoff", ">", "maxelts", ")", "{", "if", "(", "only_value", "!=", "2", "&&", "!", "TREE_NO_WARNING", "(", "src", ")", ")", "{", "warning_at", "(", "loc", ",", "OPT_Warray_bounds", ",", "\"", "\"", ",", "eltoff", ")", ";", "TREE_NO_WARNING", "(", "src", ")", "=", "1", ";", "}", "return", "NULL_TREE", ";", "}", "unsigned", "len", "=", "string_length", "(", "ptr", "+", "eltoff", "*", "eltsize", ",", "eltsize", ",", "maxelts", "-", "eltoff", ")", ";", "return", "ssize_int", "(", "len", ")", ";", "}" ]
Compute the length of a null-terminated character string or wide character string handling character sizes of 1, 2, and 4 bytes.
[ "Compute", "the", "length", "of", "a", "null", "-", "terminated", "character", "string", "or", "wide", "character", "string", "handling", "character", "sizes", "of", "1", "2", "and", "4", "bytes", "." ]
[ "/* Offset from the beginning of the string in bytes. */", "/* Determine the size of the string element. */", "/* Set MAXELTS to sizeof (SRC) / sizeof (*SRC) - 1, the maximum possible\n length of SRC. */", "/* PTR can point to the byte representation of any string type, including\n char* and wchar_t*. */", "/* If the string has an internal zero byte (e.g., \"foo\\0bar\"), we can't\n\t compute the offset to the following null if we don't know where to\n\t start searching for it. */", "/* Return when an embedded null character is found. */", "/* We don't know the starting offset, but we do know that the string\n\t has no internal zero bytes. We can assume that the offset falls\n\t within the bounds of the string; otherwise, the programmer deserves\n\t what he gets. Subtract the offset from the length of the string,\n\t and return that. This would perhaps not be valid if we were dealing\n\t with named arrays in addition to literal string constants. */", "/* Offset from the beginning of the string in elements. */", "/* We have a known offset into the string. Start searching there for\n a null character if we can represent it as a single HOST_WIDE_INT. */", "/* If the offset is known to be out of bounds, warn, and call strlen at\n runtime. */", "/* Suppress multiple warnings for propagated constant strings. */", "/* Use strlen to search for the first zero byte. Since any strings\n constructed with build_string will have nulls appended, we win even\n if we get handed something like (char[4])\"abcd\".\n\n Since ELTOFF is our starting index into the string, no further\n calculation is needed. */" ]
[ { "param": "src", "type": "tree" }, { "param": "only_value", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "src", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "only_value", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
target_char_cast
int
static int target_char_cast (tree cst, char *p) { unsigned HOST_WIDE_INT val, hostval; if (TREE_CODE (cst) != INTEGER_CST || CHAR_TYPE_SIZE > HOST_BITS_PER_WIDE_INT) return 1; /* Do not care if it fits or not right here. */ val = TREE_INT_CST_LOW (cst); if (CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT) val &= (HOST_WIDE_INT_1U << CHAR_TYPE_SIZE) - 1; hostval = val; if (HOST_BITS_PER_CHAR < HOST_BITS_PER_WIDE_INT) hostval &= (HOST_WIDE_INT_1U << HOST_BITS_PER_CHAR) - 1; if (val != hostval) return 1; *p = hostval; return 0; }
/* Cast a target constant CST to target CHAR and if that value fits into host char type, return zero and put that value into variable pointed to by P. */
Cast a target constant CST to target CHAR and if that value fits into host char type, return zero and put that value into variable pointed to by P.
[ "Cast", "a", "target", "constant", "CST", "to", "target", "CHAR", "and", "if", "that", "value", "fits", "into", "host", "char", "type", "return", "zero", "and", "put", "that", "value", "into", "variable", "pointed", "to", "by", "P", "." ]
static int target_char_cast (tree cst, char *p) { unsigned HOST_WIDE_INT val, hostval; if (TREE_CODE (cst) != INTEGER_CST || CHAR_TYPE_SIZE > HOST_BITS_PER_WIDE_INT) return 1; val = TREE_INT_CST_LOW (cst); if (CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT) val &= (HOST_WIDE_INT_1U << CHAR_TYPE_SIZE) - 1; hostval = val; if (HOST_BITS_PER_CHAR < HOST_BITS_PER_WIDE_INT) hostval &= (HOST_WIDE_INT_1U << HOST_BITS_PER_CHAR) - 1; if (val != hostval) return 1; *p = hostval; return 0; }
[ "static", "int", "target_char_cast", "(", "tree", "cst", ",", "char", "*", "p", ")", "{", "unsigned", "HOST_WIDE_INT", "val", ",", "hostval", ";", "if", "(", "TREE_CODE", "(", "cst", ")", "!=", "INTEGER_CST", "||", "CHAR_TYPE_SIZE", ">", "HOST_BITS_PER_WIDE_INT", ")", "return", "1", ";", "val", "=", "TREE_INT_CST_LOW", "(", "cst", ")", ";", "if", "(", "CHAR_TYPE_SIZE", "<", "HOST_BITS_PER_WIDE_INT", ")", "val", "&=", "(", "HOST_WIDE_INT_1U", "<<", "CHAR_TYPE_SIZE", ")", "-", "1", ";", "hostval", "=", "val", ";", "if", "(", "HOST_BITS_PER_CHAR", "<", "HOST_BITS_PER_WIDE_INT", ")", "hostval", "&=", "(", "HOST_WIDE_INT_1U", "<<", "HOST_BITS_PER_CHAR", ")", "-", "1", ";", "if", "(", "val", "!=", "hostval", ")", "return", "1", ";", "*", "p", "=", "hostval", ";", "return", "0", ";", "}" ]
Cast a target constant CST to target CHAR and if that value fits into host char type, return zero and put that value into variable pointed to by P.
[ "Cast", "a", "target", "constant", "CST", "to", "target", "CHAR", "and", "if", "that", "value", "fits", "into", "host", "char", "type", "return", "zero", "and", "put", "that", "value", "into", "variable", "pointed", "to", "by", "P", "." ]
[ "/* Do not care if it fits or not right here. */" ]
[ { "param": "cst", "type": "tree" }, { "param": "p", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cst", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "p", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
builtin_save_expr
tree
static tree builtin_save_expr (tree exp) { if (TREE_CODE (exp) == SSA_NAME || (TREE_ADDRESSABLE (exp) == 0 && (TREE_CODE (exp) == PARM_DECL || (VAR_P (exp) && !TREE_STATIC (exp))))) return exp; return save_expr (exp); }
/* Similar to save_expr, but assumes that arbitrary code is not executed in between the multiple evaluations. In particular, we assume that a non-addressable local variable will not be modified. */
Similar to save_expr, but assumes that arbitrary code is not executed in between the multiple evaluations. In particular, we assume that a non-addressable local variable will not be modified.
[ "Similar", "to", "save_expr", "but", "assumes", "that", "arbitrary", "code", "is", "not", "executed", "in", "between", "the", "multiple", "evaluations", ".", "In", "particular", "we", "assume", "that", "a", "non", "-", "addressable", "local", "variable", "will", "not", "be", "modified", "." ]
static tree builtin_save_expr (tree exp) { if (TREE_CODE (exp) == SSA_NAME || (TREE_ADDRESSABLE (exp) == 0 && (TREE_CODE (exp) == PARM_DECL || (VAR_P (exp) && !TREE_STATIC (exp))))) return exp; return save_expr (exp); }
[ "static", "tree", "builtin_save_expr", "(", "tree", "exp", ")", "{", "if", "(", "TREE_CODE", "(", "exp", ")", "==", "SSA_NAME", "||", "(", "TREE_ADDRESSABLE", "(", "exp", ")", "==", "0", "&&", "(", "TREE_CODE", "(", "exp", ")", "==", "PARM_DECL", "||", "(", "VAR_P", "(", "exp", ")", "&&", "!", "TREE_STATIC", "(", "exp", ")", ")", ")", ")", ")", "return", "exp", ";", "return", "save_expr", "(", "exp", ")", ";", "}" ]
Similar to save_expr, but assumes that arbitrary code is not executed in between the multiple evaluations.
[ "Similar", "to", "save_expr", "but", "assumes", "that", "arbitrary", "code", "is", "not", "executed", "in", "between", "the", "multiple", "evaluations", "." ]
[]
[ { "param": "exp", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_return_addr
rtx
static rtx expand_builtin_return_addr (enum built_in_function fndecl_code, int count) { int i; rtx tem = INITIAL_FRAME_ADDRESS_RTX; if (tem == NULL_RTX) { /* For a zero count with __builtin_return_address, we don't care what frame address we return, because target-specific definitions will override us. Therefore frame pointer elimination is OK, and using the soft frame pointer is OK. For a nonzero count, or a zero count with __builtin_frame_address, we require a stable offset from the current frame pointer to the previous one, so we must use the hard frame pointer, and we must disable frame pointer elimination. */ if (count == 0 && fndecl_code == BUILT_IN_RETURN_ADDRESS) tem = frame_pointer_rtx; else { tem = hard_frame_pointer_rtx; /* Tell reload not to eliminate the frame pointer. */ crtl->accesses_prior_frames = 1; } } if (count > 0) SETUP_FRAME_ADDRESSES (); /* On the SPARC, the return address is not in the frame, it is in a register. There is no way to access it off of the current frame pointer, but it can be accessed off the previous frame pointer by reading the value from the register window save area. */ if (RETURN_ADDR_IN_PREVIOUS_FRAME && fndecl_code == BUILT_IN_RETURN_ADDRESS) count--; /* Scan back COUNT frames to the specified frame. */ for (i = 0; i < count; i++) { /* Assume the dynamic chain pointer is in the word that the frame address points to, unless otherwise specified. */ tem = DYNAMIC_CHAIN_ADDRESS (tem); tem = memory_address (Pmode, tem); tem = gen_frame_mem (Pmode, tem); tem = copy_to_reg (tem); } /* For __builtin_frame_address, return what we've got. But, on the SPARC for example, we may have to add a bias. */ if (fndecl_code == BUILT_IN_FRAME_ADDRESS) return FRAME_ADDR_RTX (tem); /* For __builtin_return_address, get the return address from that frame. */ #ifdef RETURN_ADDR_RTX tem = RETURN_ADDR_RTX (count, tem); #else tem = memory_address (Pmode, plus_constant (Pmode, tem, GET_MODE_SIZE (Pmode))); tem = gen_frame_mem (Pmode, tem); #endif return tem; }
/* Given TEM, a pointer to a stack frame, follow the dynamic chain COUNT times to get the address of either a higher stack frame, or a return address located within it (depending on FNDECL_CODE). */
Given TEM, a pointer to a stack frame, follow the dynamic chain COUNT times to get the address of either a higher stack frame, or a return address located within it (depending on FNDECL_CODE).
[ "Given", "TEM", "a", "pointer", "to", "a", "stack", "frame", "follow", "the", "dynamic", "chain", "COUNT", "times", "to", "get", "the", "address", "of", "either", "a", "higher", "stack", "frame", "or", "a", "return", "address", "located", "within", "it", "(", "depending", "on", "FNDECL_CODE", ")", "." ]
static rtx expand_builtin_return_addr (enum built_in_function fndecl_code, int count) { int i; rtx tem = INITIAL_FRAME_ADDRESS_RTX; if (tem == NULL_RTX) { if (count == 0 && fndecl_code == BUILT_IN_RETURN_ADDRESS) tem = frame_pointer_rtx; else { tem = hard_frame_pointer_rtx; crtl->accesses_prior_frames = 1; } } if (count > 0) SETUP_FRAME_ADDRESSES (); if (RETURN_ADDR_IN_PREVIOUS_FRAME && fndecl_code == BUILT_IN_RETURN_ADDRESS) count--; for (i = 0; i < count; i++) { tem = DYNAMIC_CHAIN_ADDRESS (tem); tem = memory_address (Pmode, tem); tem = gen_frame_mem (Pmode, tem); tem = copy_to_reg (tem); } if (fndecl_code == BUILT_IN_FRAME_ADDRESS) return FRAME_ADDR_RTX (tem); #ifdef RETURN_ADDR_RTX tem = RETURN_ADDR_RTX (count, tem); #else tem = memory_address (Pmode, plus_constant (Pmode, tem, GET_MODE_SIZE (Pmode))); tem = gen_frame_mem (Pmode, tem); #endif return tem; }
[ "static", "rtx", "expand_builtin_return_addr", "(", "enum", "built_in_function", "fndecl_code", ",", "int", "count", ")", "{", "int", "i", ";", "rtx", "tem", "=", "INITIAL_FRAME_ADDRESS_RTX", ";", "if", "(", "tem", "==", "NULL_RTX", ")", "{", "if", "(", "count", "==", "0", "&&", "fndecl_code", "==", "BUILT_IN_RETURN_ADDRESS", ")", "tem", "=", "frame_pointer_rtx", ";", "else", "{", "tem", "=", "hard_frame_pointer_rtx", ";", "crtl", "->", "accesses_prior_frames", "=", "1", ";", "}", "}", "if", "(", "count", ">", "0", ")", "SETUP_FRAME_ADDRESSES", "(", ")", ";", "if", "(", "RETURN_ADDR_IN_PREVIOUS_FRAME", "&&", "fndecl_code", "==", "BUILT_IN_RETURN_ADDRESS", ")", "count", "--", ";", "for", "(", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "tem", "=", "DYNAMIC_CHAIN_ADDRESS", "(", "tem", ")", ";", "tem", "=", "memory_address", "(", "Pmode", ",", "tem", ")", ";", "tem", "=", "gen_frame_mem", "(", "Pmode", ",", "tem", ")", ";", "tem", "=", "copy_to_reg", "(", "tem", ")", ";", "}", "if", "(", "fndecl_code", "==", "BUILT_IN_FRAME_ADDRESS", ")", "return", "FRAME_ADDR_RTX", "(", "tem", ")", ";", "#ifdef", "RETURN_ADDR_RTX", "tem", "=", "RETURN_ADDR_RTX", "(", "count", ",", "tem", ")", ";", "#else", "tem", "=", "memory_address", "(", "Pmode", ",", "plus_constant", "(", "Pmode", ",", "tem", ",", "GET_MODE_SIZE", "(", "Pmode", ")", ")", ")", ";", "tem", "=", "gen_frame_mem", "(", "Pmode", ",", "tem", ")", ";", "#endif", "return", "tem", ";", "}" ]
Given TEM, a pointer to a stack frame, follow the dynamic chain COUNT times to get the address of either a higher stack frame, or a return address located within it (depending on FNDECL_CODE).
[ "Given", "TEM", "a", "pointer", "to", "a", "stack", "frame", "follow", "the", "dynamic", "chain", "COUNT", "times", "to", "get", "the", "address", "of", "either", "a", "higher", "stack", "frame", "or", "a", "return", "address", "located", "within", "it", "(", "depending", "on", "FNDECL_CODE", ")", "." ]
[ "/* For a zero count with __builtin_return_address, we don't care what\n\t frame address we return, because target-specific definitions will\n\t override us. Therefore frame pointer elimination is OK, and using\n\t the soft frame pointer is OK.\n\n\t For a nonzero count, or a zero count with __builtin_frame_address,\n\t we require a stable offset from the current frame pointer to the\n\t previous one, so we must use the hard frame pointer, and\n\t we must disable frame pointer elimination. */", "/* Tell reload not to eliminate the frame pointer. */", "/* On the SPARC, the return address is not in the frame, it is in a\n register. There is no way to access it off of the current frame\n pointer, but it can be accessed off the previous frame pointer by\n reading the value from the register window save area. */", "/* Scan back COUNT frames to the specified frame. */", "/* Assume the dynamic chain pointer is in the word that the\n\t frame address points to, unless otherwise specified. */", "/* For __builtin_frame_address, return what we've got. But, on\n the SPARC for example, we may have to add a bias. */", "/* For __builtin_return_address, get the return address from that frame. */" ]
[ { "param": "fndecl_code", "type": "enum built_in_function" }, { "param": "count", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fndecl_code", "type": "enum built_in_function", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "count", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_setjmp_setup
void
void expand_builtin_setjmp_setup (rtx buf_addr, rtx receiver_label) { machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); rtx stack_save; rtx mem; if (setjmp_alias_set == -1) setjmp_alias_set = new_alias_set (); buf_addr = convert_memory_address (Pmode, buf_addr); buf_addr = force_reg (Pmode, force_operand (buf_addr, NULL_RTX)); /* We store the frame pointer and the address of receiver_label in the buffer and use the rest of it for the stack save area, which is machine-dependent. */ mem = gen_rtx_MEM (Pmode, buf_addr); set_mem_alias_set (mem, setjmp_alias_set); emit_move_insn (mem, targetm.builtin_setjmp_frame_value ()); mem = gen_rtx_MEM (Pmode, plus_constant (Pmode, buf_addr, GET_MODE_SIZE (Pmode))), set_mem_alias_set (mem, setjmp_alias_set); emit_move_insn (validize_mem (mem), force_reg (Pmode, gen_rtx_LABEL_REF (Pmode, receiver_label))); stack_save = gen_rtx_MEM (sa_mode, plus_constant (Pmode, buf_addr, 2 * GET_MODE_SIZE (Pmode))); set_mem_alias_set (stack_save, setjmp_alias_set); emit_stack_save (SAVE_NONLOCAL, &stack_save); /* If there is further processing to do, do it. */ if (targetm.have_builtin_setjmp_setup ()) emit_insn (targetm.gen_builtin_setjmp_setup (buf_addr)); /* We have a nonlocal label. */ cfun->has_nonlocal_label = 1; }
/* Construct the leading half of a __builtin_setjmp call. Control will return to RECEIVER_LABEL. This is also called directly by the SJLJ exception handling code. */
Construct the leading half of a __builtin_setjmp call. Control will return to RECEIVER_LABEL. This is also called directly by the SJLJ exception handling code.
[ "Construct", "the", "leading", "half", "of", "a", "__builtin_setjmp", "call", ".", "Control", "will", "return", "to", "RECEIVER_LABEL", ".", "This", "is", "also", "called", "directly", "by", "the", "SJLJ", "exception", "handling", "code", "." ]
void expand_builtin_setjmp_setup (rtx buf_addr, rtx receiver_label) { machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); rtx stack_save; rtx mem; if (setjmp_alias_set == -1) setjmp_alias_set = new_alias_set (); buf_addr = convert_memory_address (Pmode, buf_addr); buf_addr = force_reg (Pmode, force_operand (buf_addr, NULL_RTX)); mem = gen_rtx_MEM (Pmode, buf_addr); set_mem_alias_set (mem, setjmp_alias_set); emit_move_insn (mem, targetm.builtin_setjmp_frame_value ()); mem = gen_rtx_MEM (Pmode, plus_constant (Pmode, buf_addr, GET_MODE_SIZE (Pmode))), set_mem_alias_set (mem, setjmp_alias_set); emit_move_insn (validize_mem (mem), force_reg (Pmode, gen_rtx_LABEL_REF (Pmode, receiver_label))); stack_save = gen_rtx_MEM (sa_mode, plus_constant (Pmode, buf_addr, 2 * GET_MODE_SIZE (Pmode))); set_mem_alias_set (stack_save, setjmp_alias_set); emit_stack_save (SAVE_NONLOCAL, &stack_save); if (targetm.have_builtin_setjmp_setup ()) emit_insn (targetm.gen_builtin_setjmp_setup (buf_addr)); cfun->has_nonlocal_label = 1; }
[ "void", "expand_builtin_setjmp_setup", "(", "rtx", "buf_addr", ",", "rtx", "receiver_label", ")", "{", "machine_mode", "sa_mode", "=", "STACK_SAVEAREA_MODE", "(", "SAVE_NONLOCAL", ")", ";", "rtx", "stack_save", ";", "rtx", "mem", ";", "if", "(", "setjmp_alias_set", "==", "-1", ")", "setjmp_alias_set", "=", "new_alias_set", "(", ")", ";", "buf_addr", "=", "convert_memory_address", "(", "Pmode", ",", "buf_addr", ")", ";", "buf_addr", "=", "force_reg", "(", "Pmode", ",", "force_operand", "(", "buf_addr", ",", "NULL_RTX", ")", ")", ";", "mem", "=", "gen_rtx_MEM", "(", "Pmode", ",", "buf_addr", ")", ";", "set_mem_alias_set", "(", "mem", ",", "setjmp_alias_set", ")", ";", "emit_move_insn", "(", "mem", ",", "targetm", ".", "builtin_setjmp_frame_value", "(", ")", ")", ";", "mem", "=", "gen_rtx_MEM", "(", "Pmode", ",", "plus_constant", "(", "Pmode", ",", "buf_addr", ",", "GET_MODE_SIZE", "(", "Pmode", ")", ")", ")", ",", "set_mem_alias_set", "(", "mem", ",", "setjmp_alias_set", ")", ";", "emit_move_insn", "(", "validize_mem", "(", "mem", ")", ",", "force_reg", "(", "Pmode", ",", "gen_rtx_LABEL_REF", "(", "Pmode", ",", "receiver_label", ")", ")", ")", ";", "stack_save", "=", "gen_rtx_MEM", "(", "sa_mode", ",", "plus_constant", "(", "Pmode", ",", "buf_addr", ",", "2", "*", "GET_MODE_SIZE", "(", "Pmode", ")", ")", ")", ";", "set_mem_alias_set", "(", "stack_save", ",", "setjmp_alias_set", ")", ";", "emit_stack_save", "(", "SAVE_NONLOCAL", ",", "&", "stack_save", ")", ";", "if", "(", "targetm", ".", "have_builtin_setjmp_setup", "(", ")", ")", "emit_insn", "(", "targetm", ".", "gen_builtin_setjmp_setup", "(", "buf_addr", ")", ")", ";", "cfun", "->", "has_nonlocal_label", "=", "1", ";", "}" ]
Construct the leading half of a __builtin_setjmp call.
[ "Construct", "the", "leading", "half", "of", "a", "__builtin_setjmp", "call", "." ]
[ "/* We store the frame pointer and the address of receiver_label in\n the buffer and use the rest of it for the stack save area, which\n is machine-dependent. */", "/* If there is further processing to do, do it. */", "/* We have a nonlocal label. */" ]
[ { "param": "buf_addr", "type": "rtx" }, { "param": "receiver_label", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buf_addr", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "receiver_label", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_setjmp_receiver
void
void expand_builtin_setjmp_receiver (rtx receiver_label) { rtx chain; /* Mark the FP as used when we get here, so we have to make sure it's marked as used by this function. */ emit_use (hard_frame_pointer_rtx); /* Mark the static chain as clobbered here so life information doesn't get messed up for it. */ chain = rtx_for_static_chain (current_function_decl, true); if (chain && REG_P (chain)) emit_clobber (chain); /* Now put in the code to restore the frame pointer, and argument pointer, if needed. */ if (! targetm.have_nonlocal_goto ()) { /* First adjust our frame pointer to its actual value. It was previously set to the start of the virtual area corresponding to the stacked variables when we branched here and now needs to be adjusted to the actual hardware fp value. Assignments to virtual registers are converted by instantiate_virtual_regs into the corresponding assignment to the underlying register (fp in this case) that makes the original assignment true. So the following insn will actually be decrementing fp by TARGET_STARTING_FRAME_OFFSET. */ emit_move_insn (virtual_stack_vars_rtx, hard_frame_pointer_rtx); /* Restoring the frame pointer also modifies the hard frame pointer. Mark it used (so that the previous assignment remains live once the frame pointer is eliminated) and clobbered (to represent the implicit update from the assignment). */ emit_use (hard_frame_pointer_rtx); emit_clobber (hard_frame_pointer_rtx); } if (!HARD_FRAME_POINTER_IS_ARG_POINTER && fixed_regs[ARG_POINTER_REGNUM]) { /* If the argument pointer can be eliminated in favor of the frame pointer, we don't need to restore it. We assume here that if such an elimination is present, it can always be used. This is the case on all known machines; if we don't make this assumption, we do unnecessary saving on many machines. */ size_t i; static const struct elims {const int from, to;} elim_regs[] = ELIMINABLE_REGS; for (i = 0; i < ARRAY_SIZE (elim_regs); i++) if (elim_regs[i].from == ARG_POINTER_REGNUM && elim_regs[i].to == HARD_FRAME_POINTER_REGNUM) break; if (i == ARRAY_SIZE (elim_regs)) { /* Now restore our arg pointer from the address at which it was saved in our stack frame. */ emit_move_insn (crtl->args.internal_arg_pointer, copy_to_reg (get_arg_pointer_save_area ())); } } if (receiver_label != NULL && targetm.have_builtin_setjmp_receiver ()) emit_insn (targetm.gen_builtin_setjmp_receiver (receiver_label)); else if (targetm.have_nonlocal_goto_receiver ()) emit_insn (targetm.gen_nonlocal_goto_receiver ()); else { /* Nothing */ } /* We must not allow the code we just generated to be reordered by scheduling. Specifically, the update of the frame pointer must happen immediately, not later. */ emit_insn (gen_blockage ()); }
/* Construct the trailing part of a __builtin_setjmp call. This is also called directly by the SJLJ exception handling code. If RECEIVER_LABEL is NULL, instead contruct a nonlocal goto handler. */
Construct the trailing part of a __builtin_setjmp call. This is also called directly by the SJLJ exception handling code. If RECEIVER_LABEL is NULL, instead contruct a nonlocal goto handler.
[ "Construct", "the", "trailing", "part", "of", "a", "__builtin_setjmp", "call", ".", "This", "is", "also", "called", "directly", "by", "the", "SJLJ", "exception", "handling", "code", ".", "If", "RECEIVER_LABEL", "is", "NULL", "instead", "contruct", "a", "nonlocal", "goto", "handler", "." ]
void expand_builtin_setjmp_receiver (rtx receiver_label) { rtx chain; emit_use (hard_frame_pointer_rtx); chain = rtx_for_static_chain (current_function_decl, true); if (chain && REG_P (chain)) emit_clobber (chain); if (! targetm.have_nonlocal_goto ()) { emit_move_insn (virtual_stack_vars_rtx, hard_frame_pointer_rtx); emit_use (hard_frame_pointer_rtx); emit_clobber (hard_frame_pointer_rtx); } if (!HARD_FRAME_POINTER_IS_ARG_POINTER && fixed_regs[ARG_POINTER_REGNUM]) { size_t i; static const struct elims {const int from, to;} elim_regs[] = ELIMINABLE_REGS; for (i = 0; i < ARRAY_SIZE (elim_regs); i++) if (elim_regs[i].from == ARG_POINTER_REGNUM && elim_regs[i].to == HARD_FRAME_POINTER_REGNUM) break; if (i == ARRAY_SIZE (elim_regs)) { emit_move_insn (crtl->args.internal_arg_pointer, copy_to_reg (get_arg_pointer_save_area ())); } } if (receiver_label != NULL && targetm.have_builtin_setjmp_receiver ()) emit_insn (targetm.gen_builtin_setjmp_receiver (receiver_label)); else if (targetm.have_nonlocal_goto_receiver ()) emit_insn (targetm.gen_nonlocal_goto_receiver ()); else { } emit_insn (gen_blockage ()); }
[ "void", "expand_builtin_setjmp_receiver", "(", "rtx", "receiver_label", ")", "{", "rtx", "chain", ";", "emit_use", "(", "hard_frame_pointer_rtx", ")", ";", "chain", "=", "rtx_for_static_chain", "(", "current_function_decl", ",", "true", ")", ";", "if", "(", "chain", "&&", "REG_P", "(", "chain", ")", ")", "emit_clobber", "(", "chain", ")", ";", "if", "(", "!", "targetm", ".", "have_nonlocal_goto", "(", ")", ")", "{", "emit_move_insn", "(", "virtual_stack_vars_rtx", ",", "hard_frame_pointer_rtx", ")", ";", "emit_use", "(", "hard_frame_pointer_rtx", ")", ";", "emit_clobber", "(", "hard_frame_pointer_rtx", ")", ";", "}", "if", "(", "!", "HARD_FRAME_POINTER_IS_ARG_POINTER", "&&", "fixed_regs", "[", "ARG_POINTER_REGNUM", "]", ")", "{", "size_t", "i", ";", "static", "const", "struct", "elims", "{", "const", "int", "from", ",", "to", ";", "}", "elim_regs", "[", "]", "=", "ELIMINABLE_REGS", ";", "for", "(", "i", "=", "0", ";", "i", "<", "ARRAY_SIZE", "(", "elim_regs", ")", ";", "i", "++", ")", "if", "(", "elim_regs", "[", "i", "]", ".", "from", "==", "ARG_POINTER_REGNUM", "&&", "elim_regs", "[", "i", "]", ".", "to", "==", "HARD_FRAME_POINTER_REGNUM", ")", "break", ";", "if", "(", "i", "==", "ARRAY_SIZE", "(", "elim_regs", ")", ")", "{", "emit_move_insn", "(", "crtl", "->", "args", ".", "internal_arg_pointer", ",", "copy_to_reg", "(", "get_arg_pointer_save_area", "(", ")", ")", ")", ";", "}", "}", "if", "(", "receiver_label", "!=", "NULL", "&&", "targetm", ".", "have_builtin_setjmp_receiver", "(", ")", ")", "emit_insn", "(", "targetm", ".", "gen_builtin_setjmp_receiver", "(", "receiver_label", ")", ")", ";", "else", "if", "(", "targetm", ".", "have_nonlocal_goto_receiver", "(", ")", ")", "emit_insn", "(", "targetm", ".", "gen_nonlocal_goto_receiver", "(", ")", ")", ";", "else", "{", "}", "emit_insn", "(", "gen_blockage", "(", ")", ")", ";", "}" ]
Construct the trailing part of a __builtin_setjmp call.
[ "Construct", "the", "trailing", "part", "of", "a", "__builtin_setjmp", "call", "." ]
[ "/* Mark the FP as used when we get here, so we have to make sure it's\n marked as used by this function. */", "/* Mark the static chain as clobbered here so life information\n doesn't get messed up for it. */", "/* Now put in the code to restore the frame pointer, and argument\n pointer, if needed. */", "/* First adjust our frame pointer to its actual value. It was\n\t previously set to the start of the virtual area corresponding to\n\t the stacked variables when we branched here and now needs to be\n\t adjusted to the actual hardware fp value.\n\n\t Assignments to virtual registers are converted by\n\t instantiate_virtual_regs into the corresponding assignment\n\t to the underlying register (fp in this case) that makes\n\t the original assignment true.\n\t So the following insn will actually be decrementing fp by\n\t TARGET_STARTING_FRAME_OFFSET. */", "/* Restoring the frame pointer also modifies the hard frame pointer.\n\t Mark it used (so that the previous assignment remains live once\n\t the frame pointer is eliminated) and clobbered (to represent the\n\t implicit update from the assignment). */", "/* If the argument pointer can be eliminated in favor of the\n\t frame pointer, we don't need to restore it. We assume here\n\t that if such an elimination is present, it can always be used.\n\t This is the case on all known machines; if we don't make this\n\t assumption, we do unnecessary saving on many machines. */", "/* Now restore our arg pointer from the address at which it\n\t was saved in our stack frame. */", "/* Nothing */", "/* We must not allow the code we just generated to be reordered by\n scheduling. Specifically, the update of the frame pointer must\n happen immediately, not later. */" ]
[ { "param": "receiver_label", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "receiver_label", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_longjmp
void
static void expand_builtin_longjmp (rtx buf_addr, rtx value) { rtx fp, lab, stack; rtx_insn *insn, *last; machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); /* DRAP is needed for stack realign if longjmp is expanded to current function */ if (SUPPORTS_STACK_ALIGNMENT) crtl->need_drap = true; if (setjmp_alias_set == -1) setjmp_alias_set = new_alias_set (); buf_addr = convert_memory_address (Pmode, buf_addr); buf_addr = force_reg (Pmode, buf_addr); /* We require that the user must pass a second argument of 1, because that is what builtin_setjmp will return. */ gcc_assert (value == const1_rtx); last = get_last_insn (); if (targetm.have_builtin_longjmp ()) emit_insn (targetm.gen_builtin_longjmp (buf_addr)); else { fp = gen_rtx_MEM (Pmode, buf_addr); lab = gen_rtx_MEM (Pmode, plus_constant (Pmode, buf_addr, GET_MODE_SIZE (Pmode))); stack = gen_rtx_MEM (sa_mode, plus_constant (Pmode, buf_addr, 2 * GET_MODE_SIZE (Pmode))); set_mem_alias_set (fp, setjmp_alias_set); set_mem_alias_set (lab, setjmp_alias_set); set_mem_alias_set (stack, setjmp_alias_set); /* Pick up FP, label, and SP from the block and jump. This code is from expand_goto in stmt.c; see there for detailed comments. */ if (targetm.have_nonlocal_goto ()) /* We have to pass a value to the nonlocal_goto pattern that will get copied into the static_chain pointer, but it does not matter what that value is, because builtin_setjmp does not use it. */ emit_insn (targetm.gen_nonlocal_goto (value, lab, stack, fp)); else { lab = copy_to_reg (lab); emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); emit_move_insn (hard_frame_pointer_rtx, fp); emit_stack_restore (SAVE_NONLOCAL, stack); emit_use (hard_frame_pointer_rtx); emit_use (stack_pointer_rtx); emit_indirect_jump (lab); } } /* Search backwards and mark the jump insn as a non-local goto. Note that this precludes the use of __builtin_longjmp to a __builtin_setjmp target in the same function. However, we've already cautioned the user that these functions are for internal exception handling use only. */ for (insn = get_last_insn (); insn; insn = PREV_INSN (insn)) { gcc_assert (insn != last); if (JUMP_P (insn)) { add_reg_note (insn, REG_NON_LOCAL_GOTO, const0_rtx); break; } else if (CALL_P (insn)) break; } }
/* __builtin_longjmp is passed a pointer to an array of five words (not all will be used on all machines). It operates similarly to the C library function of the same name, but is more efficient. Much of the code below is copied from the handling of non-local gotos. */
builtin_longjmp is passed a pointer to an array of five words (not all will be used on all machines). It operates similarly to the C library function of the same name, but is more efficient. Much of the code below is copied from the handling of non-local gotos.
[ "builtin_longjmp", "is", "passed", "a", "pointer", "to", "an", "array", "of", "five", "words", "(", "not", "all", "will", "be", "used", "on", "all", "machines", ")", ".", "It", "operates", "similarly", "to", "the", "C", "library", "function", "of", "the", "same", "name", "but", "is", "more", "efficient", ".", "Much", "of", "the", "code", "below", "is", "copied", "from", "the", "handling", "of", "non", "-", "local", "gotos", "." ]
static void expand_builtin_longjmp (rtx buf_addr, rtx value) { rtx fp, lab, stack; rtx_insn *insn, *last; machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); if (SUPPORTS_STACK_ALIGNMENT) crtl->need_drap = true; if (setjmp_alias_set == -1) setjmp_alias_set = new_alias_set (); buf_addr = convert_memory_address (Pmode, buf_addr); buf_addr = force_reg (Pmode, buf_addr); gcc_assert (value == const1_rtx); last = get_last_insn (); if (targetm.have_builtin_longjmp ()) emit_insn (targetm.gen_builtin_longjmp (buf_addr)); else { fp = gen_rtx_MEM (Pmode, buf_addr); lab = gen_rtx_MEM (Pmode, plus_constant (Pmode, buf_addr, GET_MODE_SIZE (Pmode))); stack = gen_rtx_MEM (sa_mode, plus_constant (Pmode, buf_addr, 2 * GET_MODE_SIZE (Pmode))); set_mem_alias_set (fp, setjmp_alias_set); set_mem_alias_set (lab, setjmp_alias_set); set_mem_alias_set (stack, setjmp_alias_set); if (targetm.have_nonlocal_goto ()) emit_insn (targetm.gen_nonlocal_goto (value, lab, stack, fp)); else { lab = copy_to_reg (lab); emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); emit_move_insn (hard_frame_pointer_rtx, fp); emit_stack_restore (SAVE_NONLOCAL, stack); emit_use (hard_frame_pointer_rtx); emit_use (stack_pointer_rtx); emit_indirect_jump (lab); } } for (insn = get_last_insn (); insn; insn = PREV_INSN (insn)) { gcc_assert (insn != last); if (JUMP_P (insn)) { add_reg_note (insn, REG_NON_LOCAL_GOTO, const0_rtx); break; } else if (CALL_P (insn)) break; } }
[ "static", "void", "expand_builtin_longjmp", "(", "rtx", "buf_addr", ",", "rtx", "value", ")", "{", "rtx", "fp", ",", "lab", ",", "stack", ";", "rtx_insn", "*", "insn", ",", "*", "last", ";", "machine_mode", "sa_mode", "=", "STACK_SAVEAREA_MODE", "(", "SAVE_NONLOCAL", ")", ";", "if", "(", "SUPPORTS_STACK_ALIGNMENT", ")", "crtl", "->", "need_drap", "=", "true", ";", "if", "(", "setjmp_alias_set", "==", "-1", ")", "setjmp_alias_set", "=", "new_alias_set", "(", ")", ";", "buf_addr", "=", "convert_memory_address", "(", "Pmode", ",", "buf_addr", ")", ";", "buf_addr", "=", "force_reg", "(", "Pmode", ",", "buf_addr", ")", ";", "gcc_assert", "(", "value", "==", "const1_rtx", ")", ";", "last", "=", "get_last_insn", "(", ")", ";", "if", "(", "targetm", ".", "have_builtin_longjmp", "(", ")", ")", "emit_insn", "(", "targetm", ".", "gen_builtin_longjmp", "(", "buf_addr", ")", ")", ";", "else", "{", "fp", "=", "gen_rtx_MEM", "(", "Pmode", ",", "buf_addr", ")", ";", "lab", "=", "gen_rtx_MEM", "(", "Pmode", ",", "plus_constant", "(", "Pmode", ",", "buf_addr", ",", "GET_MODE_SIZE", "(", "Pmode", ")", ")", ")", ";", "stack", "=", "gen_rtx_MEM", "(", "sa_mode", ",", "plus_constant", "(", "Pmode", ",", "buf_addr", ",", "2", "*", "GET_MODE_SIZE", "(", "Pmode", ")", ")", ")", ";", "set_mem_alias_set", "(", "fp", ",", "setjmp_alias_set", ")", ";", "set_mem_alias_set", "(", "lab", ",", "setjmp_alias_set", ")", ";", "set_mem_alias_set", "(", "stack", ",", "setjmp_alias_set", ")", ";", "if", "(", "targetm", ".", "have_nonlocal_goto", "(", ")", ")", "emit_insn", "(", "targetm", ".", "gen_nonlocal_goto", "(", "value", ",", "lab", ",", "stack", ",", "fp", ")", ")", ";", "else", "{", "lab", "=", "copy_to_reg", "(", "lab", ")", ";", "emit_clobber", "(", "gen_rtx_MEM", "(", "BLKmode", ",", "gen_rtx_SCRATCH", "(", "VOIDmode", ")", ")", ")", ";", "emit_clobber", "(", "gen_rtx_MEM", "(", "BLKmode", ",", "hard_frame_pointer_rtx", ")", ")", ";", "emit_move_insn", "(", "hard_frame_pointer_rtx", ",", "fp", ")", ";", "emit_stack_restore", "(", "SAVE_NONLOCAL", ",", "stack", ")", ";", "emit_use", "(", "hard_frame_pointer_rtx", ")", ";", "emit_use", "(", "stack_pointer_rtx", ")", ";", "emit_indirect_jump", "(", "lab", ")", ";", "}", "}", "for", "(", "insn", "=", "get_last_insn", "(", ")", ";", "insn", ";", "insn", "=", "PREV_INSN", "(", "insn", ")", ")", "{", "gcc_assert", "(", "insn", "!=", "last", ")", ";", "if", "(", "JUMP_P", "(", "insn", ")", ")", "{", "add_reg_note", "(", "insn", ",", "REG_NON_LOCAL_GOTO", ",", "const0_rtx", ")", ";", "break", ";", "}", "else", "if", "(", "CALL_P", "(", "insn", ")", ")", "break", ";", "}", "}" ]
__builtin_longjmp is passed a pointer to an array of five words (not all will be used on all machines).
[ "__builtin_longjmp", "is", "passed", "a", "pointer", "to", "an", "array", "of", "five", "words", "(", "not", "all", "will", "be", "used", "on", "all", "machines", ")", "." ]
[ "/* DRAP is needed for stack realign if longjmp is expanded to current\n function */", "/* We require that the user must pass a second argument of 1, because\n that is what builtin_setjmp will return. */", "/* Pick up FP, label, and SP from the block and jump. This code is\n\t from expand_goto in stmt.c; see there for detailed comments. */", "/* We have to pass a value to the nonlocal_goto pattern that will\n\t get copied into the static_chain pointer, but it does not matter\n\t what that value is, because builtin_setjmp does not use it. */", "/* Search backwards and mark the jump insn as a non-local goto.\n Note that this precludes the use of __builtin_longjmp to a\n __builtin_setjmp target in the same function. However, we've\n already cautioned the user that these functions are for\n internal exception handling use only. */" ]
[ { "param": "buf_addr", "type": "rtx" }, { "param": "value", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buf_addr", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "value", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
validate_arglist
bool
static bool validate_arglist (const_tree callexpr, ...) { enum tree_code code; bool res = 0; va_list ap; const_call_expr_arg_iterator iter; const_tree arg; va_start (ap, callexpr); init_const_call_expr_arg_iterator (callexpr, &iter); /* Get a bitmap of pointer argument numbers declared attribute nonnull. */ tree fn = CALL_EXPR_FN (callexpr); bitmap argmap = get_nonnull_args (TREE_TYPE (TREE_TYPE (fn))); for (unsigned argno = 1; ; ++argno) { code = (enum tree_code) va_arg (ap, int); switch (code) { case 0: /* This signifies an ellipses, any further arguments are all ok. */ res = true; goto end; case VOID_TYPE: /* This signifies an endlink, if no arguments remain, return true, otherwise return false. */ res = !more_const_call_expr_args_p (&iter); goto end; case POINTER_TYPE: /* The actual argument must be nonnull when either the whole called function has been declared nonnull, or when the formal argument corresponding to the actual argument has been. */ if (argmap && (bitmap_empty_p (argmap) || bitmap_bit_p (argmap, argno))) { arg = next_const_call_expr_arg (&iter); if (!validate_arg (arg, code) || integer_zerop (arg)) goto end; break; } /* FALLTHRU */ default: /* If no parameters remain or the parameter's code does not match the specified code, return false. Otherwise continue checking any remaining arguments. */ arg = next_const_call_expr_arg (&iter); if (!validate_arg (arg, code)) goto end; break; } } /* We need gotos here since we can only have one VA_CLOSE in a function. */ end: ; va_end (ap); BITMAP_FREE (argmap); return res; }
/* This function validates the types of a function call argument list against a specified list of tree_codes. If the last specifier is a 0, that represents an ellipsis, otherwise the last specifier must be a VOID_TYPE. */
This function validates the types of a function call argument list against a specified list of tree_codes. If the last specifier is a 0, that represents an ellipsis, otherwise the last specifier must be a VOID_TYPE.
[ "This", "function", "validates", "the", "types", "of", "a", "function", "call", "argument", "list", "against", "a", "specified", "list", "of", "tree_codes", ".", "If", "the", "last", "specifier", "is", "a", "0", "that", "represents", "an", "ellipsis", "otherwise", "the", "last", "specifier", "must", "be", "a", "VOID_TYPE", "." ]
static bool validate_arglist (const_tree callexpr, ...) { enum tree_code code; bool res = 0; va_list ap; const_call_expr_arg_iterator iter; const_tree arg; va_start (ap, callexpr); init_const_call_expr_arg_iterator (callexpr, &iter); tree fn = CALL_EXPR_FN (callexpr); bitmap argmap = get_nonnull_args (TREE_TYPE (TREE_TYPE (fn))); for (unsigned argno = 1; ; ++argno) { code = (enum tree_code) va_arg (ap, int); switch (code) { case 0: res = true; goto end; case VOID_TYPE: res = !more_const_call_expr_args_p (&iter); goto end; case POINTER_TYPE: if (argmap && (bitmap_empty_p (argmap) || bitmap_bit_p (argmap, argno))) { arg = next_const_call_expr_arg (&iter); if (!validate_arg (arg, code) || integer_zerop (arg)) goto end; break; } default: arg = next_const_call_expr_arg (&iter); if (!validate_arg (arg, code)) goto end; break; } } end: ; va_end (ap); BITMAP_FREE (argmap); return res; }
[ "static", "bool", "validate_arglist", "(", "const_tree", "callexpr", ",", "...", ")", "{", "enum", "tree_code", "code", ";", "bool", "res", "=", "0", ";", "va_list", "ap", ";", "const_call_expr_arg_iterator", "iter", ";", "const_tree", "arg", ";", "va_start", "(", "ap", ",", "callexpr", ")", ";", "init_const_call_expr_arg_iterator", "(", "callexpr", ",", "&", "iter", ")", ";", "tree", "fn", "=", "CALL_EXPR_FN", "(", "callexpr", ")", ";", "bitmap", "argmap", "=", "get_nonnull_args", "(", "TREE_TYPE", "(", "TREE_TYPE", "(", "fn", ")", ")", ")", ";", "for", "(", "unsigned", "argno", "=", "1", ";", ";", "++", "argno", ")", "{", "code", "=", "(", "enum", "tree_code", ")", "va_arg", "(", "ap", ",", "int", ")", ";", "switch", "(", "code", ")", "{", "case", "0", ":", "res", "=", "true", ";", "goto", "end", ";", "case", "VOID_TYPE", ":", "res", "=", "!", "more_const_call_expr_args_p", "(", "&", "iter", ")", ";", "goto", "end", ";", "case", "POINTER_TYPE", ":", "if", "(", "argmap", "&&", "(", "bitmap_empty_p", "(", "argmap", ")", "||", "bitmap_bit_p", "(", "argmap", ",", "argno", ")", ")", ")", "{", "arg", "=", "next_const_call_expr_arg", "(", "&", "iter", ")", ";", "if", "(", "!", "validate_arg", "(", "arg", ",", "code", ")", "||", "integer_zerop", "(", "arg", ")", ")", "goto", "end", ";", "break", ";", "}", "default", ":", "arg", "=", "next_const_call_expr_arg", "(", "&", "iter", ")", ";", "if", "(", "!", "validate_arg", "(", "arg", ",", "code", ")", ")", "goto", "end", ";", "break", ";", "}", "}", "end", ":", ";", "va_end", "(", "ap", ")", ";", "BITMAP_FREE", "(", "argmap", ")", ";", "return", "res", ";", "}" ]
This function validates the types of a function call argument list against a specified list of tree_codes.
[ "This", "function", "validates", "the", "types", "of", "a", "function", "call", "argument", "list", "against", "a", "specified", "list", "of", "tree_codes", "." ]
[ "/* Get a bitmap of pointer argument numbers declared attribute nonnull. */", "/* This signifies an ellipses, any further arguments are all ok. */", "/* This signifies an endlink, if no arguments remain, return\n\t true, otherwise return false. */", "/* The actual argument must be nonnull when either the whole\n\t called function has been declared nonnull, or when the formal\n\t argument corresponding to the actual argument has been. */", "/* FALLTHRU */", "/* If no parameters remain or the parameter's code does not\n\t match the specified code, return false. Otherwise continue\n\t checking any remaining arguments. */", "/* We need gotos here since we can only have one VA_CLOSE in a\n function. */" ]
[ { "param": "callexpr", "type": "const_tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "callexpr", "type": "const_tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_nonlocal_goto
rtx
static rtx expand_builtin_nonlocal_goto (tree exp) { tree t_label, t_save_area; rtx r_label, r_save_area, r_fp, r_sp; rtx_insn *insn; if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; t_label = CALL_EXPR_ARG (exp, 0); t_save_area = CALL_EXPR_ARG (exp, 1); r_label = expand_normal (t_label); r_label = convert_memory_address (Pmode, r_label); r_save_area = expand_normal (t_save_area); r_save_area = convert_memory_address (Pmode, r_save_area); /* Copy the address of the save location to a register just in case it was based on the frame pointer. */ r_save_area = copy_to_reg (r_save_area); r_fp = gen_rtx_MEM (Pmode, r_save_area); r_sp = gen_rtx_MEM (STACK_SAVEAREA_MODE (SAVE_NONLOCAL), plus_constant (Pmode, r_save_area, GET_MODE_SIZE (Pmode))); crtl->has_nonlocal_goto = 1; /* ??? We no longer need to pass the static chain value, afaik. */ if (targetm.have_nonlocal_goto ()) emit_insn (targetm.gen_nonlocal_goto (const0_rtx, r_label, r_sp, r_fp)); else { r_label = copy_to_reg (r_label); emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); /* Restore frame pointer for containing function. */ emit_move_insn (hard_frame_pointer_rtx, r_fp); emit_stack_restore (SAVE_NONLOCAL, r_sp); /* USE of hard_frame_pointer_rtx added for consistency; not clear if really needed. */ emit_use (hard_frame_pointer_rtx); emit_use (stack_pointer_rtx); /* If the architecture is using a GP register, we must conservatively assume that the target function makes use of it. The prologue of functions with nonlocal gotos must therefore initialize the GP register to the appropriate value, and we must then make sure that this value is live at the point of the jump. (Note that this doesn't necessarily apply to targets with a nonlocal_goto pattern; they are free to implement it in their own way. Note also that this is a no-op if the GP register is a global invariant.) */ unsigned regnum = PIC_OFFSET_TABLE_REGNUM; if (regnum != INVALID_REGNUM && fixed_regs[regnum]) emit_use (pic_offset_table_rtx); emit_indirect_jump (r_label); } /* Search backwards to the jump insn and mark it as a non-local goto. */ for (insn = get_last_insn (); insn; insn = PREV_INSN (insn)) { if (JUMP_P (insn)) { add_reg_note (insn, REG_NON_LOCAL_GOTO, const0_rtx); break; } else if (CALL_P (insn)) break; } return const0_rtx; }
/* Expand a call to __builtin_nonlocal_goto. We're passed the target label and the address of the save area. */
Expand a call to __builtin_nonlocal_goto. We're passed the target label and the address of the save area.
[ "Expand", "a", "call", "to", "__builtin_nonlocal_goto", ".", "We", "'", "re", "passed", "the", "target", "label", "and", "the", "address", "of", "the", "save", "area", "." ]
static rtx expand_builtin_nonlocal_goto (tree exp) { tree t_label, t_save_area; rtx r_label, r_save_area, r_fp, r_sp; rtx_insn *insn; if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; t_label = CALL_EXPR_ARG (exp, 0); t_save_area = CALL_EXPR_ARG (exp, 1); r_label = expand_normal (t_label); r_label = convert_memory_address (Pmode, r_label); r_save_area = expand_normal (t_save_area); r_save_area = convert_memory_address (Pmode, r_save_area); r_save_area = copy_to_reg (r_save_area); r_fp = gen_rtx_MEM (Pmode, r_save_area); r_sp = gen_rtx_MEM (STACK_SAVEAREA_MODE (SAVE_NONLOCAL), plus_constant (Pmode, r_save_area, GET_MODE_SIZE (Pmode))); crtl->has_nonlocal_goto = 1; if (targetm.have_nonlocal_goto ()) emit_insn (targetm.gen_nonlocal_goto (const0_rtx, r_label, r_sp, r_fp)); else { r_label = copy_to_reg (r_label); emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); emit_move_insn (hard_frame_pointer_rtx, r_fp); emit_stack_restore (SAVE_NONLOCAL, r_sp); emit_use (hard_frame_pointer_rtx); emit_use (stack_pointer_rtx); unsigned regnum = PIC_OFFSET_TABLE_REGNUM; if (regnum != INVALID_REGNUM && fixed_regs[regnum]) emit_use (pic_offset_table_rtx); emit_indirect_jump (r_label); } for (insn = get_last_insn (); insn; insn = PREV_INSN (insn)) { if (JUMP_P (insn)) { add_reg_note (insn, REG_NON_LOCAL_GOTO, const0_rtx); break; } else if (CALL_P (insn)) break; } return const0_rtx; }
[ "static", "rtx", "expand_builtin_nonlocal_goto", "(", "tree", "exp", ")", "{", "tree", "t_label", ",", "t_save_area", ";", "rtx", "r_label", ",", "r_save_area", ",", "r_fp", ",", "r_sp", ";", "rtx_insn", "*", "insn", ";", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "t_label", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "t_save_area", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "r_label", "=", "expand_normal", "(", "t_label", ")", ";", "r_label", "=", "convert_memory_address", "(", "Pmode", ",", "r_label", ")", ";", "r_save_area", "=", "expand_normal", "(", "t_save_area", ")", ";", "r_save_area", "=", "convert_memory_address", "(", "Pmode", ",", "r_save_area", ")", ";", "r_save_area", "=", "copy_to_reg", "(", "r_save_area", ")", ";", "r_fp", "=", "gen_rtx_MEM", "(", "Pmode", ",", "r_save_area", ")", ";", "r_sp", "=", "gen_rtx_MEM", "(", "STACK_SAVEAREA_MODE", "(", "SAVE_NONLOCAL", ")", ",", "plus_constant", "(", "Pmode", ",", "r_save_area", ",", "GET_MODE_SIZE", "(", "Pmode", ")", ")", ")", ";", "crtl", "->", "has_nonlocal_goto", "=", "1", ";", "if", "(", "targetm", ".", "have_nonlocal_goto", "(", ")", ")", "emit_insn", "(", "targetm", ".", "gen_nonlocal_goto", "(", "const0_rtx", ",", "r_label", ",", "r_sp", ",", "r_fp", ")", ")", ";", "else", "{", "r_label", "=", "copy_to_reg", "(", "r_label", ")", ";", "emit_clobber", "(", "gen_rtx_MEM", "(", "BLKmode", ",", "gen_rtx_SCRATCH", "(", "VOIDmode", ")", ")", ")", ";", "emit_clobber", "(", "gen_rtx_MEM", "(", "BLKmode", ",", "hard_frame_pointer_rtx", ")", ")", ";", "emit_move_insn", "(", "hard_frame_pointer_rtx", ",", "r_fp", ")", ";", "emit_stack_restore", "(", "SAVE_NONLOCAL", ",", "r_sp", ")", ";", "emit_use", "(", "hard_frame_pointer_rtx", ")", ";", "emit_use", "(", "stack_pointer_rtx", ")", ";", "unsigned", "regnum", "=", "PIC_OFFSET_TABLE_REGNUM", ";", "if", "(", "regnum", "!=", "INVALID_REGNUM", "&&", "fixed_regs", "[", "regnum", "]", ")", "emit_use", "(", "pic_offset_table_rtx", ")", ";", "emit_indirect_jump", "(", "r_label", ")", ";", "}", "for", "(", "insn", "=", "get_last_insn", "(", ")", ";", "insn", ";", "insn", "=", "PREV_INSN", "(", "insn", ")", ")", "{", "if", "(", "JUMP_P", "(", "insn", ")", ")", "{", "add_reg_note", "(", "insn", ",", "REG_NON_LOCAL_GOTO", ",", "const0_rtx", ")", ";", "break", ";", "}", "else", "if", "(", "CALL_P", "(", "insn", ")", ")", "break", ";", "}", "return", "const0_rtx", ";", "}" ]
Expand a call to __builtin_nonlocal_goto.
[ "Expand", "a", "call", "to", "__builtin_nonlocal_goto", "." ]
[ "/* Copy the address of the save location to a register just in case it was\n based on the frame pointer. */", "/* ??? We no longer need to pass the static chain value, afaik. */", "/* Restore frame pointer for containing function. */", "/* USE of hard_frame_pointer_rtx added for consistency;\n\t not clear if really needed. */", "/* If the architecture is using a GP register, we must\n\t conservatively assume that the target function makes use of it.\n\t The prologue of functions with nonlocal gotos must therefore\n\t initialize the GP register to the appropriate value, and we\n\t must then make sure that this value is live at the point\n\t of the jump. (Note that this doesn't necessarily apply\n\t to targets with a nonlocal_goto pattern; they are free\n\t to implement it in their own way. Note also that this is\n\t a no-op if the GP register is a global invariant.) */", "/* Search backwards to the jump insn and mark it as a\n non-local goto. */" ]
[ { "param": "exp", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_update_setjmp_buf
void
void expand_builtin_update_setjmp_buf (rtx buf_addr) { machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); buf_addr = convert_memory_address (Pmode, buf_addr); rtx stack_save = gen_rtx_MEM (sa_mode, memory_address (sa_mode, plus_constant (Pmode, buf_addr, 2 * GET_MODE_SIZE (Pmode)))); emit_stack_save (SAVE_NONLOCAL, &stack_save); }
/* __builtin_update_setjmp_buf is passed a pointer to an array of five words (not all will be used on all machines) that was passed to __builtin_setjmp. It updates the stack pointer in that block to the current value. This is also called directly by the SJLJ exception handling code. */
builtin_update_setjmp_buf is passed a pointer to an array of five words (not all will be used on all machines) that was passed to __builtin_setjmp. It updates the stack pointer in that block to the current value. This is also called directly by the SJLJ exception handling code.
[ "builtin_update_setjmp_buf", "is", "passed", "a", "pointer", "to", "an", "array", "of", "five", "words", "(", "not", "all", "will", "be", "used", "on", "all", "machines", ")", "that", "was", "passed", "to", "__builtin_setjmp", ".", "It", "updates", "the", "stack", "pointer", "in", "that", "block", "to", "the", "current", "value", ".", "This", "is", "also", "called", "directly", "by", "the", "SJLJ", "exception", "handling", "code", "." ]
void expand_builtin_update_setjmp_buf (rtx buf_addr) { machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); buf_addr = convert_memory_address (Pmode, buf_addr); rtx stack_save = gen_rtx_MEM (sa_mode, memory_address (sa_mode, plus_constant (Pmode, buf_addr, 2 * GET_MODE_SIZE (Pmode)))); emit_stack_save (SAVE_NONLOCAL, &stack_save); }
[ "void", "expand_builtin_update_setjmp_buf", "(", "rtx", "buf_addr", ")", "{", "machine_mode", "sa_mode", "=", "STACK_SAVEAREA_MODE", "(", "SAVE_NONLOCAL", ")", ";", "buf_addr", "=", "convert_memory_address", "(", "Pmode", ",", "buf_addr", ")", ";", "rtx", "stack_save", "=", "gen_rtx_MEM", "(", "sa_mode", ",", "memory_address", "(", "sa_mode", ",", "plus_constant", "(", "Pmode", ",", "buf_addr", ",", "2", "*", "GET_MODE_SIZE", "(", "Pmode", ")", ")", ")", ")", ";", "emit_stack_save", "(", "SAVE_NONLOCAL", ",", "&", "stack_save", ")", ";", "}" ]
__builtin_update_setjmp_buf is passed a pointer to an array of five words (not all will be used on all machines) that was passed to __builtin_setjmp.
[ "__builtin_update_setjmp_buf", "is", "passed", "a", "pointer", "to", "an", "array", "of", "five", "words", "(", "not", "all", "will", "be", "used", "on", "all", "machines", ")", "that", "was", "passed", "to", "__builtin_setjmp", "." ]
[]
[ { "param": "buf_addr", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buf_addr", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_prefetch
void
static void expand_builtin_prefetch (tree exp) { tree arg0, arg1, arg2; int nargs; rtx op0, op1, op2; if (!validate_arglist (exp, POINTER_TYPE, 0)) return; arg0 = CALL_EXPR_ARG (exp, 0); /* Arguments 1 and 2 are optional; argument 1 (read/write) defaults to zero (read) and argument 2 (locality) defaults to 3 (high degree of locality). */ nargs = call_expr_nargs (exp); if (nargs > 1) arg1 = CALL_EXPR_ARG (exp, 1); else arg1 = integer_zero_node; if (nargs > 2) arg2 = CALL_EXPR_ARG (exp, 2); else arg2 = integer_three_node; /* Argument 0 is an address. */ op0 = expand_expr (arg0, NULL_RTX, Pmode, EXPAND_NORMAL); /* Argument 1 (read/write flag) must be a compile-time constant int. */ if (TREE_CODE (arg1) != INTEGER_CST) { error ("second argument to %<__builtin_prefetch%> must be a constant"); arg1 = integer_zero_node; } op1 = expand_normal (arg1); /* Argument 1 must be either zero or one. */ if (INTVAL (op1) != 0 && INTVAL (op1) != 1) { warning (0, "invalid second argument to %<__builtin_prefetch%>;" " using zero"); op1 = const0_rtx; } /* Argument 2 (locality) must be a compile-time constant int. */ if (TREE_CODE (arg2) != INTEGER_CST) { error ("third argument to %<__builtin_prefetch%> must be a constant"); arg2 = integer_zero_node; } op2 = expand_normal (arg2); /* Argument 2 must be 0, 1, 2, or 3. */ if (INTVAL (op2) < 0 || INTVAL (op2) > 3) { warning (0, "invalid third argument to %<__builtin_prefetch%>; using zero"); op2 = const0_rtx; } if (targetm.have_prefetch ()) { struct expand_operand ops[3]; create_address_operand (&ops[0], op0); create_integer_operand (&ops[1], INTVAL (op1)); create_integer_operand (&ops[2], INTVAL (op2)); if (maybe_expand_insn (targetm.code_for_prefetch, 3, ops)) return; } /* Don't do anything with direct references to volatile memory, but generate code to handle other side effects. */ if (!MEM_P (op0) && side_effects_p (op0)) emit_insn (op0); }
/* Expand a call to __builtin_prefetch. For a target that does not support data prefetch, evaluate the memory address argument in case it has side effects. */
Expand a call to __builtin_prefetch. For a target that does not support data prefetch, evaluate the memory address argument in case it has side effects.
[ "Expand", "a", "call", "to", "__builtin_prefetch", ".", "For", "a", "target", "that", "does", "not", "support", "data", "prefetch", "evaluate", "the", "memory", "address", "argument", "in", "case", "it", "has", "side", "effects", "." ]
static void expand_builtin_prefetch (tree exp) { tree arg0, arg1, arg2; int nargs; rtx op0, op1, op2; if (!validate_arglist (exp, POINTER_TYPE, 0)) return; arg0 = CALL_EXPR_ARG (exp, 0); nargs = call_expr_nargs (exp); if (nargs > 1) arg1 = CALL_EXPR_ARG (exp, 1); else arg1 = integer_zero_node; if (nargs > 2) arg2 = CALL_EXPR_ARG (exp, 2); else arg2 = integer_three_node; op0 = expand_expr (arg0, NULL_RTX, Pmode, EXPAND_NORMAL); if (TREE_CODE (arg1) != INTEGER_CST) { error ("second argument to %<__builtin_prefetch%> must be a constant"); arg1 = integer_zero_node; } op1 = expand_normal (arg1); if (INTVAL (op1) != 0 && INTVAL (op1) != 1) { warning (0, "invalid second argument to %<__builtin_prefetch%>;" " using zero"); op1 = const0_rtx; } if (TREE_CODE (arg2) != INTEGER_CST) { error ("third argument to %<__builtin_prefetch%> must be a constant"); arg2 = integer_zero_node; } op2 = expand_normal (arg2); if (INTVAL (op2) < 0 || INTVAL (op2) > 3) { warning (0, "invalid third argument to %<__builtin_prefetch%>; using zero"); op2 = const0_rtx; } if (targetm.have_prefetch ()) { struct expand_operand ops[3]; create_address_operand (&ops[0], op0); create_integer_operand (&ops[1], INTVAL (op1)); create_integer_operand (&ops[2], INTVAL (op2)); if (maybe_expand_insn (targetm.code_for_prefetch, 3, ops)) return; } if (!MEM_P (op0) && side_effects_p (op0)) emit_insn (op0); }
[ "static", "void", "expand_builtin_prefetch", "(", "tree", "exp", ")", "{", "tree", "arg0", ",", "arg1", ",", "arg2", ";", "int", "nargs", ";", "rtx", "op0", ",", "op1", ",", "op2", ";", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "0", ")", ")", "return", ";", "arg0", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "nargs", "=", "call_expr_nargs", "(", "exp", ")", ";", "if", "(", "nargs", ">", "1", ")", "arg1", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "else", "arg1", "=", "integer_zero_node", ";", "if", "(", "nargs", ">", "2", ")", "arg2", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "else", "arg2", "=", "integer_three_node", ";", "op0", "=", "expand_expr", "(", "arg0", ",", "NULL_RTX", ",", "Pmode", ",", "EXPAND_NORMAL", ")", ";", "if", "(", "TREE_CODE", "(", "arg1", ")", "!=", "INTEGER_CST", ")", "{", "error", "(", "\"", "\"", ")", ";", "arg1", "=", "integer_zero_node", ";", "}", "op1", "=", "expand_normal", "(", "arg1", ")", ";", "if", "(", "INTVAL", "(", "op1", ")", "!=", "0", "&&", "INTVAL", "(", "op1", ")", "!=", "1", ")", "{", "warning", "(", "0", ",", "\"", "\"", "\"", "\"", ")", ";", "op1", "=", "const0_rtx", ";", "}", "if", "(", "TREE_CODE", "(", "arg2", ")", "!=", "INTEGER_CST", ")", "{", "error", "(", "\"", "\"", ")", ";", "arg2", "=", "integer_zero_node", ";", "}", "op2", "=", "expand_normal", "(", "arg2", ")", ";", "if", "(", "INTVAL", "(", "op2", ")", "<", "0", "||", "INTVAL", "(", "op2", ")", ">", "3", ")", "{", "warning", "(", "0", ",", "\"", "\"", ")", ";", "op2", "=", "const0_rtx", ";", "}", "if", "(", "targetm", ".", "have_prefetch", "(", ")", ")", "{", "struct", "expand_operand", "ops", "[", "3", "]", ";", "create_address_operand", "(", "&", "ops", "[", "0", "]", ",", "op0", ")", ";", "create_integer_operand", "(", "&", "ops", "[", "1", "]", ",", "INTVAL", "(", "op1", ")", ")", ";", "create_integer_operand", "(", "&", "ops", "[", "2", "]", ",", "INTVAL", "(", "op2", ")", ")", ";", "if", "(", "maybe_expand_insn", "(", "targetm", ".", "code_for_prefetch", ",", "3", ",", "ops", ")", ")", "return", ";", "}", "if", "(", "!", "MEM_P", "(", "op0", ")", "&&", "side_effects_p", "(", "op0", ")", ")", "emit_insn", "(", "op0", ")", ";", "}" ]
Expand a call to __builtin_prefetch.
[ "Expand", "a", "call", "to", "__builtin_prefetch", "." ]
[ "/* Arguments 1 and 2 are optional; argument 1 (read/write) defaults to\n zero (read) and argument 2 (locality) defaults to 3 (high degree of\n locality). */", "/* Argument 0 is an address. */", "/* Argument 1 (read/write flag) must be a compile-time constant int. */", "/* Argument 1 must be either zero or one. */", "/* Argument 2 (locality) must be a compile-time constant int. */", "/* Argument 2 must be 0, 1, 2, or 3. */", "/* Don't do anything with direct references to volatile memory, but\n generate code to handle other side effects. */" ]
[ { "param": "exp", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
apply_args_size
int
static int apply_args_size (void) { static int size = -1; int align; unsigned int regno; /* The values computed by this function never change. */ if (size < 0) { /* The first value is the incoming arg-pointer. */ size = GET_MODE_SIZE (Pmode); /* The second value is the structure value address unless this is passed as an "invisible" first argument. */ if (targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 0)) size += GET_MODE_SIZE (Pmode); for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (FUNCTION_ARG_REGNO_P (regno)) { fixed_size_mode mode = targetm.calls.get_raw_arg_mode (regno); gcc_assert (mode != VOIDmode); align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; if (size % align != 0) size = CEIL (size, align) * align; size += GET_MODE_SIZE (mode); apply_args_mode[regno] = mode; } else { apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode); } } return size; }
/* Return the size required for the block returned by __builtin_apply_args, and initialize apply_args_mode. */
Return the size required for the block returned by __builtin_apply_args, and initialize apply_args_mode.
[ "Return", "the", "size", "required", "for", "the", "block", "returned", "by", "__builtin_apply_args", "and", "initialize", "apply_args_mode", "." ]
static int apply_args_size (void) { static int size = -1; int align; unsigned int regno; if (size < 0) { size = GET_MODE_SIZE (Pmode); if (targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 0)) size += GET_MODE_SIZE (Pmode); for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (FUNCTION_ARG_REGNO_P (regno)) { fixed_size_mode mode = targetm.calls.get_raw_arg_mode (regno); gcc_assert (mode != VOIDmode); align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; if (size % align != 0) size = CEIL (size, align) * align; size += GET_MODE_SIZE (mode); apply_args_mode[regno] = mode; } else { apply_args_mode[regno] = as_a <fixed_size_mode> (VOIDmode); } } return size; }
[ "static", "int", "apply_args_size", "(", "void", ")", "{", "static", "int", "size", "=", "-1", ";", "int", "align", ";", "unsigned", "int", "regno", ";", "if", "(", "size", "<", "0", ")", "{", "size", "=", "GET_MODE_SIZE", "(", "Pmode", ")", ";", "if", "(", "targetm", ".", "calls", ".", "struct_value_rtx", "(", "cfun", "?", "TREE_TYPE", "(", "cfun", "->", "decl", ")", ":", "0", ",", "0", ")", ")", "size", "+=", "GET_MODE_SIZE", "(", "Pmode", ")", ";", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "FUNCTION_ARG_REGNO_P", "(", "regno", ")", ")", "{", "fixed_size_mode", "mode", "=", "targetm", ".", "calls", ".", "get_raw_arg_mode", "(", "regno", ")", ";", "gcc_assert", "(", "mode", "!=", "VOIDmode", ")", ";", "align", "=", "GET_MODE_ALIGNMENT", "(", "mode", ")", "/", "BITS_PER_UNIT", ";", "if", "(", "size", "%", "align", "!=", "0", ")", "size", "=", "CEIL", "(", "size", ",", "align", ")", "*", "align", ";", "size", "+=", "GET_MODE_SIZE", "(", "mode", ")", ";", "apply_args_mode", "[", "regno", "]", "=", "mode", ";", "}", "else", "{", "apply_args_mode", "[", "regno", "]", "=", "as_a", "<", "fixed_size_mode", ">", "(", "VOIDmode", ")", ";", "}", "}", "return", "size", ";", "}" ]
Return the size required for the block returned by __builtin_apply_args, and initialize apply_args_mode.
[ "Return", "the", "size", "required", "for", "the", "block", "returned", "by", "__builtin_apply_args", "and", "initialize", "apply_args_mode", "." ]
[ "/* The values computed by this function never change. */", "/* The first value is the incoming arg-pointer. */", "/* The second value is the structure value address unless this is\n\t passed as an \"invisible\" first argument. */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
apply_result_size
int
static int apply_result_size (void) { static int size = -1; int align, regno; /* The values computed by this function never change. */ if (size < 0) { size = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (targetm.calls.function_value_regno_p (regno)) { fixed_size_mode mode = targetm.calls.get_raw_result_mode (regno); gcc_assert (mode != VOIDmode); align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; if (size % align != 0) size = CEIL (size, align) * align; size += GET_MODE_SIZE (mode); apply_result_mode[regno] = mode; } else apply_result_mode[regno] = as_a <fixed_size_mode> (VOIDmode); /* Allow targets that use untyped_call and untyped_return to override the size so that machine-specific information can be stored here. */ #ifdef APPLY_RESULT_SIZE size = APPLY_RESULT_SIZE; #endif } return size; }
/* Return the size required for the block returned by __builtin_apply, and initialize apply_result_mode. */
Return the size required for the block returned by __builtin_apply, and initialize apply_result_mode.
[ "Return", "the", "size", "required", "for", "the", "block", "returned", "by", "__builtin_apply", "and", "initialize", "apply_result_mode", "." ]
static int apply_result_size (void) { static int size = -1; int align, regno; if (size < 0) { size = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (targetm.calls.function_value_regno_p (regno)) { fixed_size_mode mode = targetm.calls.get_raw_result_mode (regno); gcc_assert (mode != VOIDmode); align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; if (size % align != 0) size = CEIL (size, align) * align; size += GET_MODE_SIZE (mode); apply_result_mode[regno] = mode; } else apply_result_mode[regno] = as_a <fixed_size_mode> (VOIDmode); #ifdef APPLY_RESULT_SIZE size = APPLY_RESULT_SIZE; #endif } return size; }
[ "static", "int", "apply_result_size", "(", "void", ")", "{", "static", "int", "size", "=", "-1", ";", "int", "align", ",", "regno", ";", "if", "(", "size", "<", "0", ")", "{", "size", "=", "0", ";", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "targetm", ".", "calls", ".", "function_value_regno_p", "(", "regno", ")", ")", "{", "fixed_size_mode", "mode", "=", "targetm", ".", "calls", ".", "get_raw_result_mode", "(", "regno", ")", ";", "gcc_assert", "(", "mode", "!=", "VOIDmode", ")", ";", "align", "=", "GET_MODE_ALIGNMENT", "(", "mode", ")", "/", "BITS_PER_UNIT", ";", "if", "(", "size", "%", "align", "!=", "0", ")", "size", "=", "CEIL", "(", "size", ",", "align", ")", "*", "align", ";", "size", "+=", "GET_MODE_SIZE", "(", "mode", ")", ";", "apply_result_mode", "[", "regno", "]", "=", "mode", ";", "}", "else", "apply_result_mode", "[", "regno", "]", "=", "as_a", "<", "fixed_size_mode", ">", "(", "VOIDmode", ")", ";", "#ifdef", "APPLY_RESULT_SIZE", "size", "=", "APPLY_RESULT_SIZE", ";", "#endif", "}", "return", "size", ";", "}" ]
Return the size required for the block returned by __builtin_apply, and initialize apply_result_mode.
[ "Return", "the", "size", "required", "for", "the", "block", "returned", "by", "__builtin_apply", "and", "initialize", "apply_result_mode", "." ]
[ "/* The values computed by this function never change. */", "/* Allow targets that use untyped_call and untyped_return to override\n\t the size so that machine-specific information can be stored here. */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
result_vector
rtx
static rtx result_vector (int savep, rtx result) { int regno, size, align, nelts; fixed_size_mode mode; rtx reg, mem; rtx *savevec = XALLOCAVEC (rtx, FIRST_PSEUDO_REGISTER); size = nelts = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if ((mode = apply_result_mode[regno]) != VOIDmode) { align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; if (size % align != 0) size = CEIL (size, align) * align; reg = gen_rtx_REG (mode, savep ? regno : INCOMING_REGNO (regno)); mem = adjust_address (result, mode, size); savevec[nelts++] = (savep ? gen_rtx_SET (mem, reg) : gen_rtx_SET (reg, mem)); size += GET_MODE_SIZE (mode); } return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelts, savevec)); }
/* Create a vector describing the result block RESULT. If SAVEP is true, the result block is used to save the values; otherwise it is used to restore the values. */
Create a vector describing the result block RESULT. If SAVEP is true, the result block is used to save the values; otherwise it is used to restore the values.
[ "Create", "a", "vector", "describing", "the", "result", "block", "RESULT", ".", "If", "SAVEP", "is", "true", "the", "result", "block", "is", "used", "to", "save", "the", "values", ";", "otherwise", "it", "is", "used", "to", "restore", "the", "values", "." ]
static rtx result_vector (int savep, rtx result) { int regno, size, align, nelts; fixed_size_mode mode; rtx reg, mem; rtx *savevec = XALLOCAVEC (rtx, FIRST_PSEUDO_REGISTER); size = nelts = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if ((mode = apply_result_mode[regno]) != VOIDmode) { align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; if (size % align != 0) size = CEIL (size, align) * align; reg = gen_rtx_REG (mode, savep ? regno : INCOMING_REGNO (regno)); mem = adjust_address (result, mode, size); savevec[nelts++] = (savep ? gen_rtx_SET (mem, reg) : gen_rtx_SET (reg, mem)); size += GET_MODE_SIZE (mode); } return gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (nelts, savevec)); }
[ "static", "rtx", "result_vector", "(", "int", "savep", ",", "rtx", "result", ")", "{", "int", "regno", ",", "size", ",", "align", ",", "nelts", ";", "fixed_size_mode", "mode", ";", "rtx", "reg", ",", "mem", ";", "rtx", "*", "savevec", "=", "XALLOCAVEC", "(", "rtx", ",", "FIRST_PSEUDO_REGISTER", ")", ";", "size", "=", "nelts", "=", "0", ";", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "(", "mode", "=", "apply_result_mode", "[", "regno", "]", ")", "!=", "VOIDmode", ")", "{", "align", "=", "GET_MODE_ALIGNMENT", "(", "mode", ")", "/", "BITS_PER_UNIT", ";", "if", "(", "size", "%", "align", "!=", "0", ")", "size", "=", "CEIL", "(", "size", ",", "align", ")", "*", "align", ";", "reg", "=", "gen_rtx_REG", "(", "mode", ",", "savep", "?", "regno", ":", "INCOMING_REGNO", "(", "regno", ")", ")", ";", "mem", "=", "adjust_address", "(", "result", ",", "mode", ",", "size", ")", ";", "savevec", "[", "nelts", "++", "]", "=", "(", "savep", "?", "gen_rtx_SET", "(", "mem", ",", "reg", ")", ":", "gen_rtx_SET", "(", "reg", ",", "mem", ")", ")", ";", "size", "+=", "GET_MODE_SIZE", "(", "mode", ")", ";", "}", "return", "gen_rtx_PARALLEL", "(", "VOIDmode", ",", "gen_rtvec_v", "(", "nelts", ",", "savevec", ")", ")", ";", "}" ]
Create a vector describing the result block RESULT.
[ "Create", "a", "vector", "describing", "the", "result", "block", "RESULT", "." ]
[]
[ { "param": "savep", "type": "int" }, { "param": "result", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "savep", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "result", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_apply_args
rtx
static rtx expand_builtin_apply_args (void) { /* Don't do __builtin_apply_args more than once in a function. Save the result of the first call and reuse it. */ if (apply_args_value != 0) return apply_args_value; { /* When this function is called, it means that registers must be saved on entry to this function. So we migrate the call to the first insn of this function. */ rtx temp; start_sequence (); temp = expand_builtin_apply_args_1 (); rtx_insn *seq = get_insns (); end_sequence (); apply_args_value = temp; /* Put the insns after the NOTE that starts the function. If this is inside a start_sequence, make the outer-level insn chain current, so the code is placed at the start of the function. If internal_arg_pointer is a non-virtual pseudo, it needs to be placed after the function that initializes that pseudo. */ push_topmost_sequence (); if (REG_P (crtl->args.internal_arg_pointer) && REGNO (crtl->args.internal_arg_pointer) > LAST_VIRTUAL_REGISTER) emit_insn_before (seq, parm_birth_insn); else emit_insn_before (seq, NEXT_INSN (entry_of_function ())); pop_topmost_sequence (); return temp; } }
/* __builtin_apply_args returns block of memory allocated on the stack into which is stored the arg pointer, structure value address, static chain, and all the registers that might possibly be used in performing a function call. The code is moved to the start of the function so the incoming values are saved. */
builtin_apply_args returns block of memory allocated on the stack into which is stored the arg pointer, structure value address, static chain, and all the registers that might possibly be used in performing a function call. The code is moved to the start of the function so the incoming values are saved.
[ "builtin_apply_args", "returns", "block", "of", "memory", "allocated", "on", "the", "stack", "into", "which", "is", "stored", "the", "arg", "pointer", "structure", "value", "address", "static", "chain", "and", "all", "the", "registers", "that", "might", "possibly", "be", "used", "in", "performing", "a", "function", "call", ".", "The", "code", "is", "moved", "to", "the", "start", "of", "the", "function", "so", "the", "incoming", "values", "are", "saved", "." ]
static rtx expand_builtin_apply_args (void) { if (apply_args_value != 0) return apply_args_value; { rtx temp; start_sequence (); temp = expand_builtin_apply_args_1 (); rtx_insn *seq = get_insns (); end_sequence (); apply_args_value = temp; push_topmost_sequence (); if (REG_P (crtl->args.internal_arg_pointer) && REGNO (crtl->args.internal_arg_pointer) > LAST_VIRTUAL_REGISTER) emit_insn_before (seq, parm_birth_insn); else emit_insn_before (seq, NEXT_INSN (entry_of_function ())); pop_topmost_sequence (); return temp; } }
[ "static", "rtx", "expand_builtin_apply_args", "(", "void", ")", "{", "if", "(", "apply_args_value", "!=", "0", ")", "return", "apply_args_value", ";", "{", "rtx", "temp", ";", "start_sequence", "(", ")", ";", "temp", "=", "expand_builtin_apply_args_1", "(", ")", ";", "rtx_insn", "*", "seq", "=", "get_insns", "(", ")", ";", "end_sequence", "(", ")", ";", "apply_args_value", "=", "temp", ";", "push_topmost_sequence", "(", ")", ";", "if", "(", "REG_P", "(", "crtl", "->", "args", ".", "internal_arg_pointer", ")", "&&", "REGNO", "(", "crtl", "->", "args", ".", "internal_arg_pointer", ")", ">", "LAST_VIRTUAL_REGISTER", ")", "emit_insn_before", "(", "seq", ",", "parm_birth_insn", ")", ";", "else", "emit_insn_before", "(", "seq", ",", "NEXT_INSN", "(", "entry_of_function", "(", ")", ")", ")", ";", "pop_topmost_sequence", "(", ")", ";", "return", "temp", ";", "}", "}" ]
__builtin_apply_args returns block of memory allocated on the stack into which is stored the arg pointer, structure value address, static chain, and all the registers that might possibly be used in performing a function call.
[ "__builtin_apply_args", "returns", "block", "of", "memory", "allocated", "on", "the", "stack", "into", "which", "is", "stored", "the", "arg", "pointer", "structure", "value", "address", "static", "chain", "and", "all", "the", "registers", "that", "might", "possibly", "be", "used", "in", "performing", "a", "function", "call", "." ]
[ "/* Don't do __builtin_apply_args more than once in a function.\n Save the result of the first call and reuse it. */", "/* When this function is called, it means that registers must be\n saved on entry to this function. So we migrate the\n call to the first insn of this function. */", "/* Put the insns after the NOTE that starts the function.\n If this is inside a start_sequence, make the outer-level insn\n chain current, so the code is placed at the start of the\n function. If internal_arg_pointer is a non-virtual pseudo,\n it needs to be placed after the function that initializes\n that pseudo. */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_apply
rtx
static rtx expand_builtin_apply (rtx function, rtx arguments, rtx argsize) { int size, align, regno; fixed_size_mode mode; rtx incoming_args, result, reg, dest, src; rtx_call_insn *call_insn; rtx old_stack_level = 0; rtx call_fusage = 0; rtx struct_value = targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 0); arguments = convert_memory_address (Pmode, arguments); /* Create a block where the return registers can be saved. */ result = assign_stack_local (BLKmode, apply_result_size (), -1); /* Fetch the arg pointer from the ARGUMENTS block. */ incoming_args = gen_reg_rtx (Pmode); emit_move_insn (incoming_args, gen_rtx_MEM (Pmode, arguments)); if (!STACK_GROWS_DOWNWARD) incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize, incoming_args, 0, OPTAB_LIB_WIDEN); /* Push a new argument block and copy the arguments. Do not allow the (potential) memcpy call below to interfere with our stack manipulations. */ do_pending_stack_adjust (); NO_DEFER_POP; /* Save the stack with nonlocal if available. */ if (targetm.have_save_stack_nonlocal ()) emit_stack_save (SAVE_NONLOCAL, &old_stack_level); else emit_stack_save (SAVE_BLOCK, &old_stack_level); /* Allocate a block of memory onto the stack and copy the memory arguments to the outgoing arguments address. We can pass TRUE as the 4th argument because we just saved the stack pointer and will restore it right after the call. */ allocate_dynamic_stack_space (argsize, 0, BIGGEST_ALIGNMENT, -1, true); /* Set DRAP flag to true, even though allocate_dynamic_stack_space may have already set current_function_calls_alloca to true. current_function_calls_alloca won't be set if argsize is zero, so we have to guarantee need_drap is true here. */ if (SUPPORTS_STACK_ALIGNMENT) crtl->need_drap = true; dest = virtual_outgoing_args_rtx; if (!STACK_GROWS_DOWNWARD) { if (CONST_INT_P (argsize)) dest = plus_constant (Pmode, dest, -INTVAL (argsize)); else dest = gen_rtx_PLUS (Pmode, dest, negate_rtx (Pmode, argsize)); } dest = gen_rtx_MEM (BLKmode, dest); set_mem_align (dest, PARM_BOUNDARY); src = gen_rtx_MEM (BLKmode, incoming_args); set_mem_align (src, PARM_BOUNDARY); emit_block_move (dest, src, argsize, BLOCK_OP_NORMAL); /* Refer to the argument block. */ apply_args_size (); arguments = gen_rtx_MEM (BLKmode, arguments); set_mem_align (arguments, PARM_BOUNDARY); /* Walk past the arg-pointer and structure value address. */ size = GET_MODE_SIZE (Pmode); if (struct_value) size += GET_MODE_SIZE (Pmode); /* Restore each of the registers previously saved. Make USE insns for each of these registers for use in making the call. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if ((mode = apply_args_mode[regno]) != VOIDmode) { align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; if (size % align != 0) size = CEIL (size, align) * align; reg = gen_rtx_REG (mode, regno); emit_move_insn (reg, adjust_address (arguments, mode, size)); use_reg (&call_fusage, reg); size += GET_MODE_SIZE (mode); } /* Restore the structure value address unless this is passed as an "invisible" first argument. */ size = GET_MODE_SIZE (Pmode); if (struct_value) { rtx value = gen_reg_rtx (Pmode); emit_move_insn (value, adjust_address (arguments, Pmode, size)); emit_move_insn (struct_value, value); if (REG_P (struct_value)) use_reg (&call_fusage, struct_value); size += GET_MODE_SIZE (Pmode); } /* All arguments and registers used for the call are set up by now! */ function = prepare_call_address (NULL, function, NULL, &call_fusage, 0, 0); /* Ensure address is valid. SYMBOL_REF is already valid, so no need, and we don't want to load it into a register as an optimization, because prepare_call_address already did it if it should be done. */ if (GET_CODE (function) != SYMBOL_REF) function = memory_address (FUNCTION_MODE, function); /* Generate the actual call instruction and save the return value. */ if (targetm.have_untyped_call ()) { rtx mem = gen_rtx_MEM (FUNCTION_MODE, function); emit_call_insn (targetm.gen_untyped_call (mem, result, result_vector (1, result))); } else if (targetm.have_call_value ()) { rtx valreg = 0; /* Locate the unique return register. It is not possible to express a call that sets more than one return register using call_value; use untyped_call for that. In fact, untyped_call only needs to save the return registers in the given block. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if ((mode = apply_result_mode[regno]) != VOIDmode) { gcc_assert (!valreg); /* have_untyped_call required. */ valreg = gen_rtx_REG (mode, regno); } emit_insn (targetm.gen_call_value (valreg, gen_rtx_MEM (FUNCTION_MODE, function), const0_rtx, NULL_RTX, const0_rtx)); emit_move_insn (adjust_address (result, GET_MODE (valreg), 0), valreg); } else gcc_unreachable (); /* Find the CALL insn we just emitted, and attach the register usage information. */ call_insn = last_call_insn (); add_function_usage_to (call_insn, call_fusage); /* Restore the stack. */ if (targetm.have_save_stack_nonlocal ()) emit_stack_restore (SAVE_NONLOCAL, old_stack_level); else emit_stack_restore (SAVE_BLOCK, old_stack_level); fixup_args_size_notes (call_insn, get_last_insn (), 0); OK_DEFER_POP; /* Return the address of the result block. */ result = copy_addr_to_reg (XEXP (result, 0)); return convert_memory_address (ptr_mode, result); }
/* Perform an untyped call and save the state required to perform an untyped return of whatever value was returned by the given function. */
Perform an untyped call and save the state required to perform an untyped return of whatever value was returned by the given function.
[ "Perform", "an", "untyped", "call", "and", "save", "the", "state", "required", "to", "perform", "an", "untyped", "return", "of", "whatever", "value", "was", "returned", "by", "the", "given", "function", "." ]
static rtx expand_builtin_apply (rtx function, rtx arguments, rtx argsize) { int size, align, regno; fixed_size_mode mode; rtx incoming_args, result, reg, dest, src; rtx_call_insn *call_insn; rtx old_stack_level = 0; rtx call_fusage = 0; rtx struct_value = targetm.calls.struct_value_rtx (cfun ? TREE_TYPE (cfun->decl) : 0, 0); arguments = convert_memory_address (Pmode, arguments); result = assign_stack_local (BLKmode, apply_result_size (), -1); incoming_args = gen_reg_rtx (Pmode); emit_move_insn (incoming_args, gen_rtx_MEM (Pmode, arguments)); if (!STACK_GROWS_DOWNWARD) incoming_args = expand_simple_binop (Pmode, MINUS, incoming_args, argsize, incoming_args, 0, OPTAB_LIB_WIDEN); do_pending_stack_adjust (); NO_DEFER_POP; if (targetm.have_save_stack_nonlocal ()) emit_stack_save (SAVE_NONLOCAL, &old_stack_level); else emit_stack_save (SAVE_BLOCK, &old_stack_level); allocate_dynamic_stack_space (argsize, 0, BIGGEST_ALIGNMENT, -1, true); if (SUPPORTS_STACK_ALIGNMENT) crtl->need_drap = true; dest = virtual_outgoing_args_rtx; if (!STACK_GROWS_DOWNWARD) { if (CONST_INT_P (argsize)) dest = plus_constant (Pmode, dest, -INTVAL (argsize)); else dest = gen_rtx_PLUS (Pmode, dest, negate_rtx (Pmode, argsize)); } dest = gen_rtx_MEM (BLKmode, dest); set_mem_align (dest, PARM_BOUNDARY); src = gen_rtx_MEM (BLKmode, incoming_args); set_mem_align (src, PARM_BOUNDARY); emit_block_move (dest, src, argsize, BLOCK_OP_NORMAL); apply_args_size (); arguments = gen_rtx_MEM (BLKmode, arguments); set_mem_align (arguments, PARM_BOUNDARY); size = GET_MODE_SIZE (Pmode); if (struct_value) size += GET_MODE_SIZE (Pmode); for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if ((mode = apply_args_mode[regno]) != VOIDmode) { align = GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT; if (size % align != 0) size = CEIL (size, align) * align; reg = gen_rtx_REG (mode, regno); emit_move_insn (reg, adjust_address (arguments, mode, size)); use_reg (&call_fusage, reg); size += GET_MODE_SIZE (mode); } size = GET_MODE_SIZE (Pmode); if (struct_value) { rtx value = gen_reg_rtx (Pmode); emit_move_insn (value, adjust_address (arguments, Pmode, size)); emit_move_insn (struct_value, value); if (REG_P (struct_value)) use_reg (&call_fusage, struct_value); size += GET_MODE_SIZE (Pmode); } function = prepare_call_address (NULL, function, NULL, &call_fusage, 0, 0); if (GET_CODE (function) != SYMBOL_REF) function = memory_address (FUNCTION_MODE, function); if (targetm.have_untyped_call ()) { rtx mem = gen_rtx_MEM (FUNCTION_MODE, function); emit_call_insn (targetm.gen_untyped_call (mem, result, result_vector (1, result))); } else if (targetm.have_call_value ()) { rtx valreg = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if ((mode = apply_result_mode[regno]) != VOIDmode) { gcc_assert (!valreg); valreg = gen_rtx_REG (mode, regno); } emit_insn (targetm.gen_call_value (valreg, gen_rtx_MEM (FUNCTION_MODE, function), const0_rtx, NULL_RTX, const0_rtx)); emit_move_insn (adjust_address (result, GET_MODE (valreg), 0), valreg); } else gcc_unreachable (); call_insn = last_call_insn (); add_function_usage_to (call_insn, call_fusage); if (targetm.have_save_stack_nonlocal ()) emit_stack_restore (SAVE_NONLOCAL, old_stack_level); else emit_stack_restore (SAVE_BLOCK, old_stack_level); fixup_args_size_notes (call_insn, get_last_insn (), 0); OK_DEFER_POP; result = copy_addr_to_reg (XEXP (result, 0)); return convert_memory_address (ptr_mode, result); }
[ "static", "rtx", "expand_builtin_apply", "(", "rtx", "function", ",", "rtx", "arguments", ",", "rtx", "argsize", ")", "{", "int", "size", ",", "align", ",", "regno", ";", "fixed_size_mode", "mode", ";", "rtx", "incoming_args", ",", "result", ",", "reg", ",", "dest", ",", "src", ";", "rtx_call_insn", "*", "call_insn", ";", "rtx", "old_stack_level", "=", "0", ";", "rtx", "call_fusage", "=", "0", ";", "rtx", "struct_value", "=", "targetm", ".", "calls", ".", "struct_value_rtx", "(", "cfun", "?", "TREE_TYPE", "(", "cfun", "->", "decl", ")", ":", "0", ",", "0", ")", ";", "arguments", "=", "convert_memory_address", "(", "Pmode", ",", "arguments", ")", ";", "result", "=", "assign_stack_local", "(", "BLKmode", ",", "apply_result_size", "(", ")", ",", "-1", ")", ";", "incoming_args", "=", "gen_reg_rtx", "(", "Pmode", ")", ";", "emit_move_insn", "(", "incoming_args", ",", "gen_rtx_MEM", "(", "Pmode", ",", "arguments", ")", ")", ";", "if", "(", "!", "STACK_GROWS_DOWNWARD", ")", "incoming_args", "=", "expand_simple_binop", "(", "Pmode", ",", "MINUS", ",", "incoming_args", ",", "argsize", ",", "incoming_args", ",", "0", ",", "OPTAB_LIB_WIDEN", ")", ";", "do_pending_stack_adjust", "(", ")", ";", "NO_DEFER_POP", ";", "if", "(", "targetm", ".", "have_save_stack_nonlocal", "(", ")", ")", "emit_stack_save", "(", "SAVE_NONLOCAL", ",", "&", "old_stack_level", ")", ";", "else", "emit_stack_save", "(", "SAVE_BLOCK", ",", "&", "old_stack_level", ")", ";", "allocate_dynamic_stack_space", "(", "argsize", ",", "0", ",", "BIGGEST_ALIGNMENT", ",", "-1", ",", "true", ")", ";", "if", "(", "SUPPORTS_STACK_ALIGNMENT", ")", "crtl", "->", "need_drap", "=", "true", ";", "dest", "=", "virtual_outgoing_args_rtx", ";", "if", "(", "!", "STACK_GROWS_DOWNWARD", ")", "{", "if", "(", "CONST_INT_P", "(", "argsize", ")", ")", "dest", "=", "plus_constant", "(", "Pmode", ",", "dest", ",", "-", "INTVAL", "(", "argsize", ")", ")", ";", "else", "dest", "=", "gen_rtx_PLUS", "(", "Pmode", ",", "dest", ",", "negate_rtx", "(", "Pmode", ",", "argsize", ")", ")", ";", "}", "dest", "=", "gen_rtx_MEM", "(", "BLKmode", ",", "dest", ")", ";", "set_mem_align", "(", "dest", ",", "PARM_BOUNDARY", ")", ";", "src", "=", "gen_rtx_MEM", "(", "BLKmode", ",", "incoming_args", ")", ";", "set_mem_align", "(", "src", ",", "PARM_BOUNDARY", ")", ";", "emit_block_move", "(", "dest", ",", "src", ",", "argsize", ",", "BLOCK_OP_NORMAL", ")", ";", "apply_args_size", "(", ")", ";", "arguments", "=", "gen_rtx_MEM", "(", "BLKmode", ",", "arguments", ")", ";", "set_mem_align", "(", "arguments", ",", "PARM_BOUNDARY", ")", ";", "size", "=", "GET_MODE_SIZE", "(", "Pmode", ")", ";", "if", "(", "struct_value", ")", "size", "+=", "GET_MODE_SIZE", "(", "Pmode", ")", ";", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "(", "mode", "=", "apply_args_mode", "[", "regno", "]", ")", "!=", "VOIDmode", ")", "{", "align", "=", "GET_MODE_ALIGNMENT", "(", "mode", ")", "/", "BITS_PER_UNIT", ";", "if", "(", "size", "%", "align", "!=", "0", ")", "size", "=", "CEIL", "(", "size", ",", "align", ")", "*", "align", ";", "reg", "=", "gen_rtx_REG", "(", "mode", ",", "regno", ")", ";", "emit_move_insn", "(", "reg", ",", "adjust_address", "(", "arguments", ",", "mode", ",", "size", ")", ")", ";", "use_reg", "(", "&", "call_fusage", ",", "reg", ")", ";", "size", "+=", "GET_MODE_SIZE", "(", "mode", ")", ";", "}", "size", "=", "GET_MODE_SIZE", "(", "Pmode", ")", ";", "if", "(", "struct_value", ")", "{", "rtx", "value", "=", "gen_reg_rtx", "(", "Pmode", ")", ";", "emit_move_insn", "(", "value", ",", "adjust_address", "(", "arguments", ",", "Pmode", ",", "size", ")", ")", ";", "emit_move_insn", "(", "struct_value", ",", "value", ")", ";", "if", "(", "REG_P", "(", "struct_value", ")", ")", "use_reg", "(", "&", "call_fusage", ",", "struct_value", ")", ";", "size", "+=", "GET_MODE_SIZE", "(", "Pmode", ")", ";", "}", "function", "=", "prepare_call_address", "(", "NULL", ",", "function", ",", "NULL", ",", "&", "call_fusage", ",", "0", ",", "0", ")", ";", "if", "(", "GET_CODE", "(", "function", ")", "!=", "SYMBOL_REF", ")", "function", "=", "memory_address", "(", "FUNCTION_MODE", ",", "function", ")", ";", "if", "(", "targetm", ".", "have_untyped_call", "(", ")", ")", "{", "rtx", "mem", "=", "gen_rtx_MEM", "(", "FUNCTION_MODE", ",", "function", ")", ";", "emit_call_insn", "(", "targetm", ".", "gen_untyped_call", "(", "mem", ",", "result", ",", "result_vector", "(", "1", ",", "result", ")", ")", ")", ";", "}", "else", "if", "(", "targetm", ".", "have_call_value", "(", ")", ")", "{", "rtx", "valreg", "=", "0", ";", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "(", "mode", "=", "apply_result_mode", "[", "regno", "]", ")", "!=", "VOIDmode", ")", "{", "gcc_assert", "(", "!", "valreg", ")", ";", "valreg", "=", "gen_rtx_REG", "(", "mode", ",", "regno", ")", ";", "}", "emit_insn", "(", "targetm", ".", "gen_call_value", "(", "valreg", ",", "gen_rtx_MEM", "(", "FUNCTION_MODE", ",", "function", ")", ",", "const0_rtx", ",", "NULL_RTX", ",", "const0_rtx", ")", ")", ";", "emit_move_insn", "(", "adjust_address", "(", "result", ",", "GET_MODE", "(", "valreg", ")", ",", "0", ")", ",", "valreg", ")", ";", "}", "else", "gcc_unreachable", "(", ")", ";", "call_insn", "=", "last_call_insn", "(", ")", ";", "add_function_usage_to", "(", "call_insn", ",", "call_fusage", ")", ";", "if", "(", "targetm", ".", "have_save_stack_nonlocal", "(", ")", ")", "emit_stack_restore", "(", "SAVE_NONLOCAL", ",", "old_stack_level", ")", ";", "else", "emit_stack_restore", "(", "SAVE_BLOCK", ",", "old_stack_level", ")", ";", "fixup_args_size_notes", "(", "call_insn", ",", "get_last_insn", "(", ")", ",", "0", ")", ";", "OK_DEFER_POP", ";", "result", "=", "copy_addr_to_reg", "(", "XEXP", "(", "result", ",", "0", ")", ")", ";", "return", "convert_memory_address", "(", "ptr_mode", ",", "result", ")", ";", "}" ]
Perform an untyped call and save the state required to perform an untyped return of whatever value was returned by the given function.
[ "Perform", "an", "untyped", "call", "and", "save", "the", "state", "required", "to", "perform", "an", "untyped", "return", "of", "whatever", "value", "was", "returned", "by", "the", "given", "function", "." ]
[ "/* Create a block where the return registers can be saved. */", "/* Fetch the arg pointer from the ARGUMENTS block. */", "/* Push a new argument block and copy the arguments. Do not allow\n the (potential) memcpy call below to interfere with our stack\n manipulations. */", "/* Save the stack with nonlocal if available. */", "/* Allocate a block of memory onto the stack and copy the memory\n arguments to the outgoing arguments address. We can pass TRUE\n as the 4th argument because we just saved the stack pointer\n and will restore it right after the call. */", "/* Set DRAP flag to true, even though allocate_dynamic_stack_space\n may have already set current_function_calls_alloca to true.\n current_function_calls_alloca won't be set if argsize is zero,\n so we have to guarantee need_drap is true here. */", "/* Refer to the argument block. */", "/* Walk past the arg-pointer and structure value address. */", "/* Restore each of the registers previously saved. Make USE insns\n for each of these registers for use in making the call. */", "/* Restore the structure value address unless this is passed as an\n \"invisible\" first argument. */", "/* All arguments and registers used for the call are set up by now! */", "/* Ensure address is valid. SYMBOL_REF is already valid, so no need,\n and we don't want to load it into a register as an optimization,\n because prepare_call_address already did it if it should be done. */", "/* Generate the actual call instruction and save the return value. */", "/* Locate the unique return register. It is not possible to\n\t express a call that sets more than one return register using\n\t call_value; use untyped_call for that. In fact, untyped_call\n\t only needs to save the return registers in the given block. */", "/* have_untyped_call required. */", "/* Find the CALL insn we just emitted, and attach the register usage\n information. */", "/* Restore the stack. */", "/* Return the address of the result block. */" ]
[ { "param": "function", "type": "rtx" }, { "param": "arguments", "type": "rtx" }, { "param": "argsize", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "function", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arguments", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "argsize", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
mathfn_built_in_1
tree
static tree mathfn_built_in_1 (tree type, combined_fn fn, bool implicit_p) { built_in_function fcode2 = mathfn_built_in_2 (type, fn); if (fcode2 == END_BUILTINS) return NULL_TREE; if (implicit_p && !builtin_decl_implicit_p (fcode2)) return NULL_TREE; return builtin_decl_explicit (fcode2); }
/* Return mathematic function equivalent to FN but operating directly on TYPE, if available. If IMPLICIT_P is true use the implicit builtin declaration, otherwise use the explicit declaration. If we can't do the conversion, return null. */
Return mathematic function equivalent to FN but operating directly on TYPE, if available. If IMPLICIT_P is true use the implicit builtin declaration, otherwise use the explicit declaration. If we can't do the conversion, return null.
[ "Return", "mathematic", "function", "equivalent", "to", "FN", "but", "operating", "directly", "on", "TYPE", "if", "available", ".", "If", "IMPLICIT_P", "is", "true", "use", "the", "implicit", "builtin", "declaration", "otherwise", "use", "the", "explicit", "declaration", ".", "If", "we", "can", "'", "t", "do", "the", "conversion", "return", "null", "." ]
static tree mathfn_built_in_1 (tree type, combined_fn fn, bool implicit_p) { built_in_function fcode2 = mathfn_built_in_2 (type, fn); if (fcode2 == END_BUILTINS) return NULL_TREE; if (implicit_p && !builtin_decl_implicit_p (fcode2)) return NULL_TREE; return builtin_decl_explicit (fcode2); }
[ "static", "tree", "mathfn_built_in_1", "(", "tree", "type", ",", "combined_fn", "fn", ",", "bool", "implicit_p", ")", "{", "built_in_function", "fcode2", "=", "mathfn_built_in_2", "(", "type", ",", "fn", ")", ";", "if", "(", "fcode2", "==", "END_BUILTINS", ")", "return", "NULL_TREE", ";", "if", "(", "implicit_p", "&&", "!", "builtin_decl_implicit_p", "(", "fcode2", ")", ")", "return", "NULL_TREE", ";", "return", "builtin_decl_explicit", "(", "fcode2", ")", ";", "}" ]
Return mathematic function equivalent to FN but operating directly on TYPE, if available.
[ "Return", "mathematic", "function", "equivalent", "to", "FN", "but", "operating", "directly", "on", "TYPE", "if", "available", "." ]
[]
[ { "param": "type", "type": "tree" }, { "param": "fn", "type": "combined_fn" }, { "param": "implicit_p", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "type", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fn", "type": "combined_fn", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "implicit_p", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
mathfn_built_in
tree
tree mathfn_built_in (tree type, combined_fn fn) { return mathfn_built_in_1 (type, fn, /*implicit=*/ 1); }
/* Like mathfn_built_in_1, but always use the implicit array. */
Like mathfn_built_in_1, but always use the implicit array.
[ "Like", "mathfn_built_in_1", "but", "always", "use", "the", "implicit", "array", "." ]
tree mathfn_built_in (tree type, combined_fn fn) { return mathfn_built_in_1 (type, fn, 1); }
[ "tree", "mathfn_built_in", "(", "tree", "type", ",", "combined_fn", "fn", ")", "{", "return", "mathfn_built_in_1", "(", "type", ",", "fn", ",", "1", ")", ";", "}" ]
Like mathfn_built_in_1, but always use the implicit array.
[ "Like", "mathfn_built_in_1", "but", "always", "use", "the", "implicit", "array", "." ]
[ "/*implicit=*/" ]
[ { "param": "type", "type": "tree" }, { "param": "fn", "type": "combined_fn" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "type", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fn", "type": "combined_fn", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
replacement_internal_fn
internal_fn
internal_fn replacement_internal_fn (gcall *call) { if (gimple_call_builtin_p (call, BUILT_IN_NORMAL)) { internal_fn ifn = associated_internal_fn (gimple_call_fndecl (call)); if (ifn != IFN_LAST) { tree_pair types = direct_internal_fn_types (ifn, call); optimization_type opt_type = bb_optimization_type (gimple_bb (call)); if (direct_internal_fn_supported_p (ifn, types, opt_type)) return ifn; } } return IFN_LAST; }
/* If CALL is a call to a BUILT_IN_NORMAL function that could be replaced on the current target by a call to an internal function, return the code of that internal function, otherwise return IFN_LAST. The caller is responsible for ensuring that any side-effects of the built-in call are dealt with correctly. E.g. if CALL sets errno, the caller must decide that the errno result isn't needed or make it available in some other way. */
If CALL is a call to a BUILT_IN_NORMAL function that could be replaced on the current target by a call to an internal function, return the code of that internal function, otherwise return IFN_LAST. The caller is responsible for ensuring that any side-effects of the built-in call are dealt with correctly.
[ "If", "CALL", "is", "a", "call", "to", "a", "BUILT_IN_NORMAL", "function", "that", "could", "be", "replaced", "on", "the", "current", "target", "by", "a", "call", "to", "an", "internal", "function", "return", "the", "code", "of", "that", "internal", "function", "otherwise", "return", "IFN_LAST", ".", "The", "caller", "is", "responsible", "for", "ensuring", "that", "any", "side", "-", "effects", "of", "the", "built", "-", "in", "call", "are", "dealt", "with", "correctly", "." ]
internal_fn replacement_internal_fn (gcall *call) { if (gimple_call_builtin_p (call, BUILT_IN_NORMAL)) { internal_fn ifn = associated_internal_fn (gimple_call_fndecl (call)); if (ifn != IFN_LAST) { tree_pair types = direct_internal_fn_types (ifn, call); optimization_type opt_type = bb_optimization_type (gimple_bb (call)); if (direct_internal_fn_supported_p (ifn, types, opt_type)) return ifn; } } return IFN_LAST; }
[ "internal_fn", "replacement_internal_fn", "(", "gcall", "*", "call", ")", "{", "if", "(", "gimple_call_builtin_p", "(", "call", ",", "BUILT_IN_NORMAL", ")", ")", "{", "internal_fn", "ifn", "=", "associated_internal_fn", "(", "gimple_call_fndecl", "(", "call", ")", ")", ";", "if", "(", "ifn", "!=", "IFN_LAST", ")", "{", "tree_pair", "types", "=", "direct_internal_fn_types", "(", "ifn", ",", "call", ")", ";", "optimization_type", "opt_type", "=", "bb_optimization_type", "(", "gimple_bb", "(", "call", ")", ")", ";", "if", "(", "direct_internal_fn_supported_p", "(", "ifn", ",", "types", ",", "opt_type", ")", ")", "return", "ifn", ";", "}", "}", "return", "IFN_LAST", ";", "}" ]
If CALL is a call to a BUILT_IN_NORMAL function that could be replaced on the current target by a call to an internal function, return the code of that internal function, otherwise return IFN_LAST.
[ "If", "CALL", "is", "a", "call", "to", "a", "BUILT_IN_NORMAL", "function", "that", "could", "be", "replaced", "on", "the", "current", "target", "by", "a", "call", "to", "an", "internal", "function", "return", "the", "code", "of", "that", "internal", "function", "otherwise", "return", "IFN_LAST", "." ]
[]
[ { "param": "call", "type": "gcall" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "call", "type": "gcall", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_powi
rtx
static rtx expand_builtin_powi (tree exp, rtx target) { tree arg0, arg1; rtx op0, op1; machine_mode mode; machine_mode mode2; if (! validate_arglist (exp, REAL_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; arg0 = CALL_EXPR_ARG (exp, 0); arg1 = CALL_EXPR_ARG (exp, 1); mode = TYPE_MODE (TREE_TYPE (exp)); /* Emit a libcall to libgcc. */ /* Mode of the 2nd argument must match that of an int. */ mode2 = int_mode_for_size (INT_TYPE_SIZE, 0).require (); if (target == NULL_RTX) target = gen_reg_rtx (mode); op0 = expand_expr (arg0, NULL_RTX, mode, EXPAND_NORMAL); if (GET_MODE (op0) != mode) op0 = convert_to_mode (mode, op0, 0); op1 = expand_expr (arg1, NULL_RTX, mode2, EXPAND_NORMAL); if (GET_MODE (op1) != mode2) op1 = convert_to_mode (mode2, op1, 0); target = emit_library_call_value (optab_libfunc (powi_optab, mode), target, LCT_CONST, mode, op0, mode, op1, mode2); return target; }
/* Expand a call to the powi built-in mathematical function. Return NULL_RTX if a normal call should be emitted rather than expanding the function in-line. EXP is the expression that is a call to the builtin function; if convenient, the result should be placed in TARGET. */
Expand a call to the powi built-in mathematical function. Return NULL_RTX if a normal call should be emitted rather than expanding the function in-line. EXP is the expression that is a call to the builtin function; if convenient, the result should be placed in TARGET.
[ "Expand", "a", "call", "to", "the", "powi", "built", "-", "in", "mathematical", "function", ".", "Return", "NULL_RTX", "if", "a", "normal", "call", "should", "be", "emitted", "rather", "than", "expanding", "the", "function", "in", "-", "line", ".", "EXP", "is", "the", "expression", "that", "is", "a", "call", "to", "the", "builtin", "function", ";", "if", "convenient", "the", "result", "should", "be", "placed", "in", "TARGET", "." ]
static rtx expand_builtin_powi (tree exp, rtx target) { tree arg0, arg1; rtx op0, op1; machine_mode mode; machine_mode mode2; if (! validate_arglist (exp, REAL_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; arg0 = CALL_EXPR_ARG (exp, 0); arg1 = CALL_EXPR_ARG (exp, 1); mode = TYPE_MODE (TREE_TYPE (exp)); mode2 = int_mode_for_size (INT_TYPE_SIZE, 0).require (); if (target == NULL_RTX) target = gen_reg_rtx (mode); op0 = expand_expr (arg0, NULL_RTX, mode, EXPAND_NORMAL); if (GET_MODE (op0) != mode) op0 = convert_to_mode (mode, op0, 0); op1 = expand_expr (arg1, NULL_RTX, mode2, EXPAND_NORMAL); if (GET_MODE (op1) != mode2) op1 = convert_to_mode (mode2, op1, 0); target = emit_library_call_value (optab_libfunc (powi_optab, mode), target, LCT_CONST, mode, op0, mode, op1, mode2); return target; }
[ "static", "rtx", "expand_builtin_powi", "(", "tree", "exp", ",", "rtx", "target", ")", "{", "tree", "arg0", ",", "arg1", ";", "rtx", "op0", ",", "op1", ";", "machine_mode", "mode", ";", "machine_mode", "mode2", ";", "if", "(", "!", "validate_arglist", "(", "exp", ",", "REAL_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "arg0", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "arg1", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "mode", "=", "TYPE_MODE", "(", "TREE_TYPE", "(", "exp", ")", ")", ";", "mode2", "=", "int_mode_for_size", "(", "INT_TYPE_SIZE", ",", "0", ")", ".", "require", "(", ")", ";", "if", "(", "target", "==", "NULL_RTX", ")", "target", "=", "gen_reg_rtx", "(", "mode", ")", ";", "op0", "=", "expand_expr", "(", "arg0", ",", "NULL_RTX", ",", "mode", ",", "EXPAND_NORMAL", ")", ";", "if", "(", "GET_MODE", "(", "op0", ")", "!=", "mode", ")", "op0", "=", "convert_to_mode", "(", "mode", ",", "op0", ",", "0", ")", ";", "op1", "=", "expand_expr", "(", "arg1", ",", "NULL_RTX", ",", "mode2", ",", "EXPAND_NORMAL", ")", ";", "if", "(", "GET_MODE", "(", "op1", ")", "!=", "mode2", ")", "op1", "=", "convert_to_mode", "(", "mode2", ",", "op1", ",", "0", ")", ";", "target", "=", "emit_library_call_value", "(", "optab_libfunc", "(", "powi_optab", ",", "mode", ")", ",", "target", ",", "LCT_CONST", ",", "mode", ",", "op0", ",", "mode", ",", "op1", ",", "mode2", ")", ";", "return", "target", ";", "}" ]
Expand a call to the powi built-in mathematical function.
[ "Expand", "a", "call", "to", "the", "powi", "built", "-", "in", "mathematical", "function", "." ]
[ "/* Emit a libcall to libgcc. */", "/* Mode of the 2nd argument must match that of an int. */" ]
[ { "param": "exp", "type": "tree" }, { "param": "target", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_strlen
rtx
static rtx expand_builtin_strlen (tree exp, rtx target, machine_mode target_mode) { if (!validate_arglist (exp, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; struct expand_operand ops[4]; rtx pat; tree len; tree src = CALL_EXPR_ARG (exp, 0); rtx src_reg; rtx_insn *before_strlen; machine_mode insn_mode; enum insn_code icode = CODE_FOR_nothing; unsigned int align; /* If the length can be computed at compile-time, return it. */ len = c_strlen (src, 0); if (len) return expand_expr (len, target, target_mode, EXPAND_NORMAL); /* If the length can be computed at compile-time and is constant integer, but there are side-effects in src, evaluate src for side-effects, then return len. E.g. x = strlen (i++ ? "xfoo" + 1 : "bar"); can be optimized into: i++; x = 3; */ len = c_strlen (src, 1); if (len && TREE_CODE (len) == INTEGER_CST) { expand_expr (src, const0_rtx, VOIDmode, EXPAND_NORMAL); return expand_expr (len, target, target_mode, EXPAND_NORMAL); } align = get_pointer_alignment (src) / BITS_PER_UNIT; /* If SRC is not a pointer type, don't do this operation inline. */ if (align == 0) return NULL_RTX; /* Bail out if we can't compute strlen in the right mode. */ FOR_EACH_MODE_FROM (insn_mode, target_mode) { icode = optab_handler (strlen_optab, insn_mode); if (icode != CODE_FOR_nothing) break; } if (insn_mode == VOIDmode) return NULL_RTX; /* Make a place to hold the source address. We will not expand the actual source until we are sure that the expansion will not fail -- there are trees that cannot be expanded twice. */ src_reg = gen_reg_rtx (Pmode); /* Mark the beginning of the strlen sequence so we can emit the source operand later. */ before_strlen = get_last_insn (); create_output_operand (&ops[0], target, insn_mode); create_fixed_operand (&ops[1], gen_rtx_MEM (BLKmode, src_reg)); create_integer_operand (&ops[2], 0); create_integer_operand (&ops[3], align); if (!maybe_expand_insn (icode, 4, ops)) return NULL_RTX; /* Check to see if the argument was declared attribute nonstring and if so, issue a warning since at this point it's not known to be nul-terminated. */ maybe_warn_nonstring_arg (get_callee_fndecl (exp), exp); /* Now that we are assured of success, expand the source. */ start_sequence (); pat = expand_expr (src, src_reg, Pmode, EXPAND_NORMAL); if (pat != src_reg) { #ifdef POINTERS_EXTEND_UNSIGNED if (GET_MODE (pat) != Pmode) pat = convert_to_mode (Pmode, pat, POINTERS_EXTEND_UNSIGNED); #endif emit_move_insn (src_reg, pat); } pat = get_insns (); end_sequence (); if (before_strlen) emit_insn_after (pat, before_strlen); else emit_insn_before (pat, get_insns ()); /* Return the value in the proper mode for this function. */ if (GET_MODE (ops[0].value) == target_mode) target = ops[0].value; else if (target != 0) convert_move (target, ops[0].value, 0); else target = convert_to_mode (target_mode, ops[0].value, 0); return target; }
/* Expand expression EXP which is a call to the strlen builtin. Return NULL_RTX if we failed the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient. */
Expand expression EXP which is a call to the strlen builtin. Return NULL_RTX if we failed the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient.
[ "Expand", "expression", "EXP", "which", "is", "a", "call", "to", "the", "strlen", "builtin", ".", "Return", "NULL_RTX", "if", "we", "failed", "the", "caller", "should", "emit", "a", "normal", "call", "otherwise", "try", "to", "get", "the", "result", "in", "TARGET", "if", "convenient", "." ]
static rtx expand_builtin_strlen (tree exp, rtx target, machine_mode target_mode) { if (!validate_arglist (exp, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; struct expand_operand ops[4]; rtx pat; tree len; tree src = CALL_EXPR_ARG (exp, 0); rtx src_reg; rtx_insn *before_strlen; machine_mode insn_mode; enum insn_code icode = CODE_FOR_nothing; unsigned int align; len = c_strlen (src, 0); if (len) return expand_expr (len, target, target_mode, EXPAND_NORMAL); len = c_strlen (src, 1); if (len && TREE_CODE (len) == INTEGER_CST) { expand_expr (src, const0_rtx, VOIDmode, EXPAND_NORMAL); return expand_expr (len, target, target_mode, EXPAND_NORMAL); } align = get_pointer_alignment (src) / BITS_PER_UNIT; if (align == 0) return NULL_RTX; FOR_EACH_MODE_FROM (insn_mode, target_mode) { icode = optab_handler (strlen_optab, insn_mode); if (icode != CODE_FOR_nothing) break; } if (insn_mode == VOIDmode) return NULL_RTX; src_reg = gen_reg_rtx (Pmode); before_strlen = get_last_insn (); create_output_operand (&ops[0], target, insn_mode); create_fixed_operand (&ops[1], gen_rtx_MEM (BLKmode, src_reg)); create_integer_operand (&ops[2], 0); create_integer_operand (&ops[3], align); if (!maybe_expand_insn (icode, 4, ops)) return NULL_RTX; maybe_warn_nonstring_arg (get_callee_fndecl (exp), exp); start_sequence (); pat = expand_expr (src, src_reg, Pmode, EXPAND_NORMAL); if (pat != src_reg) { #ifdef POINTERS_EXTEND_UNSIGNED if (GET_MODE (pat) != Pmode) pat = convert_to_mode (Pmode, pat, POINTERS_EXTEND_UNSIGNED); #endif emit_move_insn (src_reg, pat); } pat = get_insns (); end_sequence (); if (before_strlen) emit_insn_after (pat, before_strlen); else emit_insn_before (pat, get_insns ()); if (GET_MODE (ops[0].value) == target_mode) target = ops[0].value; else if (target != 0) convert_move (target, ops[0].value, 0); else target = convert_to_mode (target_mode, ops[0].value, 0); return target; }
[ "static", "rtx", "expand_builtin_strlen", "(", "tree", "exp", ",", "rtx", "target", ",", "machine_mode", "target_mode", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "struct", "expand_operand", "ops", "[", "4", "]", ";", "rtx", "pat", ";", "tree", "len", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "rtx", "src_reg", ";", "rtx_insn", "*", "before_strlen", ";", "machine_mode", "insn_mode", ";", "enum", "insn_code", "icode", "=", "CODE_FOR_nothing", ";", "unsigned", "int", "align", ";", "len", "=", "c_strlen", "(", "src", ",", "0", ")", ";", "if", "(", "len", ")", "return", "expand_expr", "(", "len", ",", "target", ",", "target_mode", ",", "EXPAND_NORMAL", ")", ";", "len", "=", "c_strlen", "(", "src", ",", "1", ")", ";", "if", "(", "len", "&&", "TREE_CODE", "(", "len", ")", "==", "INTEGER_CST", ")", "{", "expand_expr", "(", "src", ",", "const0_rtx", ",", "VOIDmode", ",", "EXPAND_NORMAL", ")", ";", "return", "expand_expr", "(", "len", ",", "target", ",", "target_mode", ",", "EXPAND_NORMAL", ")", ";", "}", "align", "=", "get_pointer_alignment", "(", "src", ")", "/", "BITS_PER_UNIT", ";", "if", "(", "align", "==", "0", ")", "return", "NULL_RTX", ";", "FOR_EACH_MODE_FROM", "(", "insn_mode", ",", "target_mode", ")", "", "{", "icode", "=", "optab_handler", "(", "strlen_optab", ",", "insn_mode", ")", ";", "if", "(", "icode", "!=", "CODE_FOR_nothing", ")", "break", ";", "}", "if", "(", "insn_mode", "==", "VOIDmode", ")", "return", "NULL_RTX", ";", "src_reg", "=", "gen_reg_rtx", "(", "Pmode", ")", ";", "before_strlen", "=", "get_last_insn", "(", ")", ";", "create_output_operand", "(", "&", "ops", "[", "0", "]", ",", "target", ",", "insn_mode", ")", ";", "create_fixed_operand", "(", "&", "ops", "[", "1", "]", ",", "gen_rtx_MEM", "(", "BLKmode", ",", "src_reg", ")", ")", ";", "create_integer_operand", "(", "&", "ops", "[", "2", "]", ",", "0", ")", ";", "create_integer_operand", "(", "&", "ops", "[", "3", "]", ",", "align", ")", ";", "if", "(", "!", "maybe_expand_insn", "(", "icode", ",", "4", ",", "ops", ")", ")", "return", "NULL_RTX", ";", "maybe_warn_nonstring_arg", "(", "get_callee_fndecl", "(", "exp", ")", ",", "exp", ")", ";", "start_sequence", "(", ")", ";", "pat", "=", "expand_expr", "(", "src", ",", "src_reg", ",", "Pmode", ",", "EXPAND_NORMAL", ")", ";", "if", "(", "pat", "!=", "src_reg", ")", "{", "#ifdef", "POINTERS_EXTEND_UNSIGNED", "if", "(", "GET_MODE", "(", "pat", ")", "!=", "Pmode", ")", "pat", "=", "convert_to_mode", "(", "Pmode", ",", "pat", ",", "POINTERS_EXTEND_UNSIGNED", ")", ";", "#endif", "emit_move_insn", "(", "src_reg", ",", "pat", ")", ";", "}", "pat", "=", "get_insns", "(", ")", ";", "end_sequence", "(", ")", ";", "if", "(", "before_strlen", ")", "emit_insn_after", "(", "pat", ",", "before_strlen", ")", ";", "else", "emit_insn_before", "(", "pat", ",", "get_insns", "(", ")", ")", ";", "if", "(", "GET_MODE", "(", "ops", "[", "0", "]", ".", "value", ")", "==", "target_mode", ")", "target", "=", "ops", "[", "0", "]", ".", "value", ";", "else", "if", "(", "target", "!=", "0", ")", "convert_move", "(", "target", ",", "ops", "[", "0", "]", ".", "value", ",", "0", ")", ";", "else", "target", "=", "convert_to_mode", "(", "target_mode", ",", "ops", "[", "0", "]", ".", "value", ",", "0", ")", ";", "return", "target", ";", "}" ]
Expand expression EXP which is a call to the strlen builtin.
[ "Expand", "expression", "EXP", "which", "is", "a", "call", "to", "the", "strlen", "builtin", "." ]
[ "/* If the length can be computed at compile-time, return it. */", "/* If the length can be computed at compile-time and is constant\n integer, but there are side-effects in src, evaluate\n src for side-effects, then return len.\n E.g. x = strlen (i++ ? \"xfoo\" + 1 : \"bar\");\n can be optimized into: i++; x = 3; */", "/* If SRC is not a pointer type, don't do this operation inline. */", "/* Bail out if we can't compute strlen in the right mode. */", "/* Make a place to hold the source address. We will not expand\n the actual source until we are sure that the expansion will\n not fail -- there are trees that cannot be expanded twice. */", "/* Mark the beginning of the strlen sequence so we can emit the\n source operand later. */", "/* Check to see if the argument was declared attribute nonstring\n and if so, issue a warning since at this point it's not known\n to be nul-terminated. */", "/* Now that we are assured of success, expand the source. */", "/* Return the value in the proper mode for this function. */" ]
[ { "param": "exp", "type": "tree" }, { "param": "target", "type": "rtx" }, { "param": "target_mode", "type": "machine_mode" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target_mode", "type": "machine_mode", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
builtin_memcpy_read_str
rtx
static rtx builtin_memcpy_read_str (void *data, HOST_WIDE_INT offset, scalar_int_mode mode) { const char *str = (const char *) data; gcc_assert (offset >= 0 && ((unsigned HOST_WIDE_INT) offset + GET_MODE_SIZE (mode) <= strlen (str) + 1)); return c_readstr (str + offset, mode); }
/* Callback routine for store_by_pieces. Read GET_MODE_BITSIZE (MODE) bytes from constant string DATA + OFFSET and return it as target constant. */
Callback routine for store_by_pieces. Read GET_MODE_BITSIZE (MODE) bytes from constant string DATA + OFFSET and return it as target constant.
[ "Callback", "routine", "for", "store_by_pieces", ".", "Read", "GET_MODE_BITSIZE", "(", "MODE", ")", "bytes", "from", "constant", "string", "DATA", "+", "OFFSET", "and", "return", "it", "as", "target", "constant", "." ]
static rtx builtin_memcpy_read_str (void *data, HOST_WIDE_INT offset, scalar_int_mode mode) { const char *str = (const char *) data; gcc_assert (offset >= 0 && ((unsigned HOST_WIDE_INT) offset + GET_MODE_SIZE (mode) <= strlen (str) + 1)); return c_readstr (str + offset, mode); }
[ "static", "rtx", "builtin_memcpy_read_str", "(", "void", "*", "data", ",", "HOST_WIDE_INT", "offset", ",", "scalar_int_mode", "mode", ")", "{", "const", "char", "*", "str", "=", "(", "const", "char", "*", ")", "data", ";", "gcc_assert", "(", "offset", ">=", "0", "&&", "(", "(", "unsigned", "HOST_WIDE_INT", ")", "offset", "+", "GET_MODE_SIZE", "(", "mode", ")", "<=", "strlen", "(", "str", ")", "+", "1", ")", ")", ";", "return", "c_readstr", "(", "str", "+", "offset", ",", "mode", ")", ";", "}" ]
Callback routine for store_by_pieces.
[ "Callback", "routine", "for", "store_by_pieces", "." ]
[]
[ { "param": "data", "type": "void" }, { "param": "offset", "type": "HOST_WIDE_INT" }, { "param": "mode", "type": "scalar_int_mode" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "data", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "offset", "type": "HOST_WIDE_INT", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mode", "type": "scalar_int_mode", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
check_memop_access
bool
static bool check_memop_access (tree exp, tree dest, tree src, tree size) { /* For functions like memset and memcpy that operate on raw memory try to determine the size of the largest source and destination object using type-0 Object Size regardless of the object size type specified by the option. */ tree srcsize = src ? compute_objsize (src, 0) : NULL_TREE; tree dstsize = compute_objsize (dest, 0); return check_access (exp, dest, src, size, /*maxread=*/NULL_TREE, srcsize, dstsize); }
/* Helper to determine and check the sizes of the source and the destination of calls to __builtin_{bzero,memcpy,mempcpy,memset} calls. EXP is the call expression, DEST is the destination argument, SRC is the source argument or null, and LEN is the number of bytes. Use Object Size type-0 regardless of the OPT_Wstringop_overflow_ setting. Return true on success (no overflow or invalid sizes), false otherwise. */
Helper to determine and check the sizes of the source and the destination of calls to __builtin_{bzero,memcpy,mempcpy,memset} calls. EXP is the call expression, DEST is the destination argument, SRC is the source argument or null, and LEN is the number of bytes. Use Object Size type-0 regardless of the OPT_Wstringop_overflow_ setting. Return true on success (no overflow or invalid sizes), false otherwise.
[ "Helper", "to", "determine", "and", "check", "the", "sizes", "of", "the", "source", "and", "the", "destination", "of", "calls", "to", "__builtin_", "{", "bzero", "memcpy", "mempcpy", "memset", "}", "calls", ".", "EXP", "is", "the", "call", "expression", "DEST", "is", "the", "destination", "argument", "SRC", "is", "the", "source", "argument", "or", "null", "and", "LEN", "is", "the", "number", "of", "bytes", ".", "Use", "Object", "Size", "type", "-", "0", "regardless", "of", "the", "OPT_Wstringop_overflow_", "setting", ".", "Return", "true", "on", "success", "(", "no", "overflow", "or", "invalid", "sizes", ")", "false", "otherwise", "." ]
static bool check_memop_access (tree exp, tree dest, tree src, tree size) { tree srcsize = src ? compute_objsize (src, 0) : NULL_TREE; tree dstsize = compute_objsize (dest, 0); return check_access (exp, dest, src, size, NULL_TREE, srcsize, dstsize); }
[ "static", "bool", "check_memop_access", "(", "tree", "exp", ",", "tree", "dest", ",", "tree", "src", ",", "tree", "size", ")", "{", "tree", "srcsize", "=", "src", "?", "compute_objsize", "(", "src", ",", "0", ")", ":", "NULL_TREE", ";", "tree", "dstsize", "=", "compute_objsize", "(", "dest", ",", "0", ")", ";", "return", "check_access", "(", "exp", ",", "dest", ",", "src", ",", "size", ",", "NULL_TREE", ",", "srcsize", ",", "dstsize", ")", ";", "}" ]
Helper to determine and check the sizes of the source and the destination of calls to __builtin_{bzero,memcpy,mempcpy,memset} calls.
[ "Helper", "to", "determine", "and", "check", "the", "sizes", "of", "the", "source", "and", "the", "destination", "of", "calls", "to", "__builtin_", "{", "bzero", "memcpy", "mempcpy", "memset", "}", "calls", "." ]
[ "/* For functions like memset and memcpy that operate on raw memory\n try to determine the size of the largest source and destination\n object using type-0 Object Size regardless of the object size\n type specified by the option. */", "/*maxread=*/" ]
[ { "param": "exp", "type": "tree" }, { "param": "dest", "type": "tree" }, { "param": "src", "type": "tree" }, { "param": "size", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dest", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_memchr
rtx
static rtx expand_builtin_memchr (tree exp, rtx) { if (!validate_arglist (exp, POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree arg1 = CALL_EXPR_ARG (exp, 0); tree len = CALL_EXPR_ARG (exp, 2); /* Diagnose calls where the specified length exceeds the size of the object. */ if (warn_stringop_overflow) { tree size = compute_objsize (arg1, 0); check_access (exp, /*dst=*/NULL_TREE, /*src=*/NULL_TREE, len, /*maxread=*/NULL_TREE, size, /*objsize=*/NULL_TREE); } return NULL_RTX; }
/* Validate memchr arguments without performing any expansion. Return NULL_RTX. */
Validate memchr arguments without performing any expansion.
[ "Validate", "memchr", "arguments", "without", "performing", "any", "expansion", "." ]
static rtx expand_builtin_memchr (tree exp, rtx) { if (!validate_arglist (exp, POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree arg1 = CALL_EXPR_ARG (exp, 0); tree len = CALL_EXPR_ARG (exp, 2); if (warn_stringop_overflow) { tree size = compute_objsize (arg1, 0); check_access (exp, NULL_TREE, NULL_TREE, len, NULL_TREE, size, NULL_TREE); } return NULL_RTX; }
[ "static", "rtx", "expand_builtin_memchr", "(", "tree", "exp", ",", "rtx", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "INTEGER_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "tree", "arg1", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "len", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "if", "(", "warn_stringop_overflow", ")", "{", "tree", "size", "=", "compute_objsize", "(", "arg1", ",", "0", ")", ";", "check_access", "(", "exp", ",", "NULL_TREE", ",", "NULL_TREE", ",", "len", ",", "NULL_TREE", ",", "size", ",", "NULL_TREE", ")", ";", "}", "return", "NULL_RTX", ";", "}" ]
Validate memchr arguments without performing any expansion.
[ "Validate", "memchr", "arguments", "without", "performing", "any", "expansion", "." ]
[ "/* Diagnose calls where the specified length exceeds the size\n of the object. */", "/*dst=*/", "/*src=*/", "/*maxread=*/", "/*objsize=*/" ]
[ { "param": "exp", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_memcpy
rtx
static rtx expand_builtin_memcpy (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); check_memop_access (exp, dest, src, len); return expand_builtin_memory_copy_args (dest, src, len, target, exp, /*endp=*/ 0); }
/* Expand a call EXP to the memcpy builtin. Return NULL_RTX if we failed, the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient). */
Expand a call EXP to the memcpy builtin. Return NULL_RTX if we failed, the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient).
[ "Expand", "a", "call", "EXP", "to", "the", "memcpy", "builtin", ".", "Return", "NULL_RTX", "if", "we", "failed", "the", "caller", "should", "emit", "a", "normal", "call", "otherwise", "try", "to", "get", "the", "result", "in", "TARGET", "if", "convenient", "(", "and", "in", "mode", "MODE", "if", "that", "'", "s", "convenient", ")", "." ]
static rtx expand_builtin_memcpy (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); check_memop_access (exp, dest, src, len); return expand_builtin_memory_copy_args (dest, src, len, target, exp, 0); }
[ "static", "rtx", "expand_builtin_memcpy", "(", "tree", "exp", ",", "rtx", "target", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "tree", "len", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "check_memop_access", "(", "exp", ",", "dest", ",", "src", ",", "len", ")", ";", "return", "expand_builtin_memory_copy_args", "(", "dest", ",", "src", ",", "len", ",", "target", ",", "exp", ",", "0", ")", ";", "}" ]
Expand a call EXP to the memcpy builtin.
[ "Expand", "a", "call", "EXP", "to", "the", "memcpy", "builtin", "." ]
[ "/*endp=*/" ]
[ { "param": "exp", "type": "tree" }, { "param": "target", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_memmove
rtx
static rtx expand_builtin_memmove (tree exp, rtx) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); check_memop_access (exp, dest, src, len); return NULL_RTX; }
/* Check a call EXP to the memmove built-in for validity. Return NULL_RTX on both success and failure. */
Check a call EXP to the memmove built-in for validity. Return NULL_RTX on both success and failure.
[ "Check", "a", "call", "EXP", "to", "the", "memmove", "built", "-", "in", "for", "validity", ".", "Return", "NULL_RTX", "on", "both", "success", "and", "failure", "." ]
static rtx expand_builtin_memmove (tree exp, rtx) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); check_memop_access (exp, dest, src, len); return NULL_RTX; }
[ "static", "rtx", "expand_builtin_memmove", "(", "tree", "exp", ",", "rtx", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "tree", "len", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "check_memop_access", "(", "exp", ",", "dest", ",", "src", ",", "len", ")", ";", "return", "NULL_RTX", ";", "}" ]
Check a call EXP to the memmove built-in for validity.
[ "Check", "a", "call", "EXP", "to", "the", "memmove", "built", "-", "in", "for", "validity", "." ]
[]
[ { "param": "exp", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_memcpy_with_bounds
rtx
static rtx expand_builtin_memcpy_with_bounds (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_BOUNDS_TYPE, POINTER_TYPE, POINTER_BOUNDS_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; else { tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 2); tree len = CALL_EXPR_ARG (exp, 4); rtx res = expand_builtin_memory_copy_args (dest, src, len, target, exp, /*end_p=*/ 0); /* Return src bounds with the result. */ if (res) { rtx bnd = force_reg (targetm.chkp_bound_mode (), expand_normal (CALL_EXPR_ARG (exp, 1))); res = chkp_join_splitted_slot (res, bnd); } return res; } }
/* Expand an instrumented call EXP to the memcpy builtin. Return NULL_RTX if we failed, the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient). */
Expand an instrumented call EXP to the memcpy builtin. Return NULL_RTX if we failed, the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient).
[ "Expand", "an", "instrumented", "call", "EXP", "to", "the", "memcpy", "builtin", ".", "Return", "NULL_RTX", "if", "we", "failed", "the", "caller", "should", "emit", "a", "normal", "call", "otherwise", "try", "to", "get", "the", "result", "in", "TARGET", "if", "convenient", "(", "and", "in", "mode", "MODE", "if", "that", "'", "s", "convenient", ")", "." ]
static rtx expand_builtin_memcpy_with_bounds (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_BOUNDS_TYPE, POINTER_TYPE, POINTER_BOUNDS_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; else { tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 2); tree len = CALL_EXPR_ARG (exp, 4); rtx res = expand_builtin_memory_copy_args (dest, src, len, target, exp, 0); if (res) { rtx bnd = force_reg (targetm.chkp_bound_mode (), expand_normal (CALL_EXPR_ARG (exp, 1))); res = chkp_join_splitted_slot (res, bnd); } return res; } }
[ "static", "rtx", "expand_builtin_memcpy_with_bounds", "(", "tree", "exp", ",", "rtx", "target", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_BOUNDS_TYPE", ",", "POINTER_TYPE", ",", "POINTER_BOUNDS_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "else", "{", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "tree", "len", "=", "CALL_EXPR_ARG", "(", "exp", ",", "4", ")", ";", "rtx", "res", "=", "expand_builtin_memory_copy_args", "(", "dest", ",", "src", ",", "len", ",", "target", ",", "exp", ",", "0", ")", ";", "if", "(", "res", ")", "{", "rtx", "bnd", "=", "force_reg", "(", "targetm", ".", "chkp_bound_mode", "(", ")", ",", "expand_normal", "(", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ")", ")", ";", "res", "=", "chkp_join_splitted_slot", "(", "res", ",", "bnd", ")", ";", "}", "return", "res", ";", "}", "}" ]
Expand an instrumented call EXP to the memcpy builtin.
[ "Expand", "an", "instrumented", "call", "EXP", "to", "the", "memcpy", "builtin", "." ]
[ "/*end_p=*/", "/* Return src bounds with the result. */" ]
[ { "param": "exp", "type": "tree" }, { "param": "target", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_mempcpy
rtx
static rtx expand_builtin_mempcpy (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); /* Policy does not generally allow using compute_objsize (which is used internally by check_memop_size) to change code generation or drive optimization decisions. In this instance it is safe because the code we generate has the same semantics regardless of the return value of check_memop_sizes. Exactly the same amount of data is copied and the return value is exactly the same in both cases. Furthermore, check_memop_size always uses mode 0 for the call to compute_objsize, so the imprecise nature of compute_objsize is avoided. */ /* Avoid expanding mempcpy into memcpy when the call is determined to overflow the buffer. This also prevents the same overflow from being diagnosed again when expanding memcpy. */ if (!check_memop_access (exp, dest, src, len)) return NULL_RTX; return expand_builtin_mempcpy_args (dest, src, len, target, exp, /*endp=*/ 1); }
/* Expand a call EXP to the mempcpy builtin. Return NULL_RTX if we failed; the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient). If ENDP is 0 return the destination pointer, if ENDP is 1 return the end pointer ala mempcpy, and if ENDP is 2 return the end pointer minus one ala stpcpy. */
Expand a call EXP to the mempcpy builtin. Return NULL_RTX if we failed; the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient). If ENDP is 0 return the destination pointer, if ENDP is 1 return the end pointer ala mempcpy, and if ENDP is 2 return the end pointer minus one ala stpcpy.
[ "Expand", "a", "call", "EXP", "to", "the", "mempcpy", "builtin", ".", "Return", "NULL_RTX", "if", "we", "failed", ";", "the", "caller", "should", "emit", "a", "normal", "call", "otherwise", "try", "to", "get", "the", "result", "in", "TARGET", "if", "convenient", "(", "and", "in", "mode", "MODE", "if", "that", "'", "s", "convenient", ")", ".", "If", "ENDP", "is", "0", "return", "the", "destination", "pointer", "if", "ENDP", "is", "1", "return", "the", "end", "pointer", "ala", "mempcpy", "and", "if", "ENDP", "is", "2", "return", "the", "end", "pointer", "minus", "one", "ala", "stpcpy", "." ]
static rtx expand_builtin_mempcpy (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); if (!check_memop_access (exp, dest, src, len)) return NULL_RTX; return expand_builtin_mempcpy_args (dest, src, len, target, exp, 1); }
[ "static", "rtx", "expand_builtin_mempcpy", "(", "tree", "exp", ",", "rtx", "target", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "tree", "len", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "if", "(", "!", "check_memop_access", "(", "exp", ",", "dest", ",", "src", ",", "len", ")", ")", "return", "NULL_RTX", ";", "return", "expand_builtin_mempcpy_args", "(", "dest", ",", "src", ",", "len", ",", "target", ",", "exp", ",", "1", ")", ";", "}" ]
Expand a call EXP to the mempcpy builtin.
[ "Expand", "a", "call", "EXP", "to", "the", "mempcpy", "builtin", "." ]
[ "/* Policy does not generally allow using compute_objsize (which\n is used internally by check_memop_size) to change code generation\n or drive optimization decisions.\n\n In this instance it is safe because the code we generate has\n the same semantics regardless of the return value of\n check_memop_sizes. Exactly the same amount of data is copied\n and the return value is exactly the same in both cases.\n\n Furthermore, check_memop_size always uses mode 0 for the call to\n compute_objsize, so the imprecise nature of compute_objsize is\n avoided. */", "/* Avoid expanding mempcpy into memcpy when the call is determined\n to overflow the buffer. This also prevents the same overflow\n from being diagnosed again when expanding memcpy. */", "/*endp=*/" ]
[ { "param": "exp", "type": "tree" }, { "param": "target", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_mempcpy_with_bounds
rtx
static rtx expand_builtin_mempcpy_with_bounds (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_BOUNDS_TYPE, POINTER_TYPE, POINTER_BOUNDS_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; else { tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 2); tree len = CALL_EXPR_ARG (exp, 4); rtx res = expand_builtin_mempcpy_args (dest, src, len, target, exp, 1); /* Return src bounds with the result. */ if (res) { rtx bnd = force_reg (targetm.chkp_bound_mode (), expand_normal (CALL_EXPR_ARG (exp, 1))); res = chkp_join_splitted_slot (res, bnd); } return res; } }
/* Expand an instrumented call EXP to the mempcpy builtin. Return NULL_RTX if we failed, the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient). */
Expand an instrumented call EXP to the mempcpy builtin. Return NULL_RTX if we failed, the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient).
[ "Expand", "an", "instrumented", "call", "EXP", "to", "the", "mempcpy", "builtin", ".", "Return", "NULL_RTX", "if", "we", "failed", "the", "caller", "should", "emit", "a", "normal", "call", "otherwise", "try", "to", "get", "the", "result", "in", "TARGET", "if", "convenient", "(", "and", "in", "mode", "MODE", "if", "that", "'", "s", "convenient", ")", "." ]
static rtx expand_builtin_mempcpy_with_bounds (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_BOUNDS_TYPE, POINTER_TYPE, POINTER_BOUNDS_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; else { tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 2); tree len = CALL_EXPR_ARG (exp, 4); rtx res = expand_builtin_mempcpy_args (dest, src, len, target, exp, 1); if (res) { rtx bnd = force_reg (targetm.chkp_bound_mode (), expand_normal (CALL_EXPR_ARG (exp, 1))); res = chkp_join_splitted_slot (res, bnd); } return res; } }
[ "static", "rtx", "expand_builtin_mempcpy_with_bounds", "(", "tree", "exp", ",", "rtx", "target", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_BOUNDS_TYPE", ",", "POINTER_TYPE", ",", "POINTER_BOUNDS_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "else", "{", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "tree", "len", "=", "CALL_EXPR_ARG", "(", "exp", ",", "4", ")", ";", "rtx", "res", "=", "expand_builtin_mempcpy_args", "(", "dest", ",", "src", ",", "len", ",", "target", ",", "exp", ",", "1", ")", ";", "if", "(", "res", ")", "{", "rtx", "bnd", "=", "force_reg", "(", "targetm", ".", "chkp_bound_mode", "(", ")", ",", "expand_normal", "(", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ")", ")", ";", "res", "=", "chkp_join_splitted_slot", "(", "res", ",", "bnd", ")", ";", "}", "return", "res", ";", "}", "}" ]
Expand an instrumented call EXP to the mempcpy builtin.
[ "Expand", "an", "instrumented", "call", "EXP", "to", "the", "mempcpy", "builtin", "." ]
[ "/* Return src bounds with the result. */" ]
[ { "param": "exp", "type": "tree" }, { "param": "target", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_movstr
rtx
static rtx expand_movstr (tree dest, tree src, rtx target, int endp) { struct expand_operand ops[3]; rtx dest_mem; rtx src_mem; if (!targetm.have_movstr ()) return NULL_RTX; dest_mem = get_memory_rtx (dest, NULL); src_mem = get_memory_rtx (src, NULL); if (!endp) { target = force_reg (Pmode, XEXP (dest_mem, 0)); dest_mem = replace_equiv_address (dest_mem, target); } create_output_operand (&ops[0], endp ? target : NULL_RTX, Pmode); create_fixed_operand (&ops[1], dest_mem); create_fixed_operand (&ops[2], src_mem); if (!maybe_expand_insn (targetm.code_for_movstr, 3, ops)) return NULL_RTX; if (endp && target != const0_rtx) { target = ops[0].value; /* movstr is supposed to set end to the address of the NUL terminator. If the caller requested a mempcpy-like return value, adjust it. */ if (endp == 1) { rtx tem = plus_constant (GET_MODE (target), gen_lowpart (GET_MODE (target), target), 1); emit_move_insn (target, force_operand (tem, NULL_RTX)); } } return target; }
/* Expand into a movstr instruction, if one is available. Return NULL_RTX if we failed, the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient. If ENDP is 0 return the destination pointer, if ENDP is 1 return the end pointer ala mempcpy, and if ENDP is 2 return the end pointer minus one ala stpcpy. */
Expand into a movstr instruction, if one is available. Return NULL_RTX if we failed, the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient. If ENDP is 0 return the destination pointer, if ENDP is 1 return the end pointer ala mempcpy, and if ENDP is 2 return the end pointer minus one ala stpcpy.
[ "Expand", "into", "a", "movstr", "instruction", "if", "one", "is", "available", ".", "Return", "NULL_RTX", "if", "we", "failed", "the", "caller", "should", "emit", "a", "normal", "call", "otherwise", "try", "to", "get", "the", "result", "in", "TARGET", "if", "convenient", ".", "If", "ENDP", "is", "0", "return", "the", "destination", "pointer", "if", "ENDP", "is", "1", "return", "the", "end", "pointer", "ala", "mempcpy", "and", "if", "ENDP", "is", "2", "return", "the", "end", "pointer", "minus", "one", "ala", "stpcpy", "." ]
static rtx expand_movstr (tree dest, tree src, rtx target, int endp) { struct expand_operand ops[3]; rtx dest_mem; rtx src_mem; if (!targetm.have_movstr ()) return NULL_RTX; dest_mem = get_memory_rtx (dest, NULL); src_mem = get_memory_rtx (src, NULL); if (!endp) { target = force_reg (Pmode, XEXP (dest_mem, 0)); dest_mem = replace_equiv_address (dest_mem, target); } create_output_operand (&ops[0], endp ? target : NULL_RTX, Pmode); create_fixed_operand (&ops[1], dest_mem); create_fixed_operand (&ops[2], src_mem); if (!maybe_expand_insn (targetm.code_for_movstr, 3, ops)) return NULL_RTX; if (endp && target != const0_rtx) { target = ops[0].value; if (endp == 1) { rtx tem = plus_constant (GET_MODE (target), gen_lowpart (GET_MODE (target), target), 1); emit_move_insn (target, force_operand (tem, NULL_RTX)); } } return target; }
[ "static", "rtx", "expand_movstr", "(", "tree", "dest", ",", "tree", "src", ",", "rtx", "target", ",", "int", "endp", ")", "{", "struct", "expand_operand", "ops", "[", "3", "]", ";", "rtx", "dest_mem", ";", "rtx", "src_mem", ";", "if", "(", "!", "targetm", ".", "have_movstr", "(", ")", ")", "return", "NULL_RTX", ";", "dest_mem", "=", "get_memory_rtx", "(", "dest", ",", "NULL", ")", ";", "src_mem", "=", "get_memory_rtx", "(", "src", ",", "NULL", ")", ";", "if", "(", "!", "endp", ")", "{", "target", "=", "force_reg", "(", "Pmode", ",", "XEXP", "(", "dest_mem", ",", "0", ")", ")", ";", "dest_mem", "=", "replace_equiv_address", "(", "dest_mem", ",", "target", ")", ";", "}", "create_output_operand", "(", "&", "ops", "[", "0", "]", ",", "endp", "?", "target", ":", "NULL_RTX", ",", "Pmode", ")", ";", "create_fixed_operand", "(", "&", "ops", "[", "1", "]", ",", "dest_mem", ")", ";", "create_fixed_operand", "(", "&", "ops", "[", "2", "]", ",", "src_mem", ")", ";", "if", "(", "!", "maybe_expand_insn", "(", "targetm", ".", "code_for_movstr", ",", "3", ",", "ops", ")", ")", "return", "NULL_RTX", ";", "if", "(", "endp", "&&", "target", "!=", "const0_rtx", ")", "{", "target", "=", "ops", "[", "0", "]", ".", "value", ";", "if", "(", "endp", "==", "1", ")", "{", "rtx", "tem", "=", "plus_constant", "(", "GET_MODE", "(", "target", ")", ",", "gen_lowpart", "(", "GET_MODE", "(", "target", ")", ",", "target", ")", ",", "1", ")", ";", "emit_move_insn", "(", "target", ",", "force_operand", "(", "tem", ",", "NULL_RTX", ")", ")", ";", "}", "}", "return", "target", ";", "}" ]
Expand into a movstr instruction, if one is available.
[ "Expand", "into", "a", "movstr", "instruction", "if", "one", "is", "available", "." ]
[ "/* movstr is supposed to set end to the address of the NUL\n\t terminator. If the caller requested a mempcpy-like return value,\n\t adjust it. */" ]
[ { "param": "dest", "type": "tree" }, { "param": "src", "type": "tree" }, { "param": "target", "type": "rtx" }, { "param": "endp", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dest", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "endp", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_strcat
rtx
static rtx expand_builtin_strcat (tree exp, rtx) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, VOID_TYPE) || !warn_stringop_overflow) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); /* There is no way here to determine the length of the string in the destination to which the SRC string is being appended so just diagnose cases when the souce string is longer than the destination object. */ tree destsize = compute_objsize (dest, warn_stringop_overflow - 1); check_access (exp, dest, src, /*size=*/NULL_TREE, /*maxread=*/NULL_TREE, src, destsize); return NULL_RTX; }
/* Do some very basic size validation of a call to the strcpy builtin given by EXP. Return NULL_RTX to have the built-in expand to a call to the library function. */
Do some very basic size validation of a call to the strcpy builtin given by EXP. Return NULL_RTX to have the built-in expand to a call to the library function.
[ "Do", "some", "very", "basic", "size", "validation", "of", "a", "call", "to", "the", "strcpy", "builtin", "given", "by", "EXP", ".", "Return", "NULL_RTX", "to", "have", "the", "built", "-", "in", "expand", "to", "a", "call", "to", "the", "library", "function", "." ]
static rtx expand_builtin_strcat (tree exp, rtx) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, VOID_TYPE) || !warn_stringop_overflow) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree destsize = compute_objsize (dest, warn_stringop_overflow - 1); check_access (exp, dest, src, NULL_TREE, NULL_TREE, src, destsize); return NULL_RTX; }
[ "static", "rtx", "expand_builtin_strcat", "(", "tree", "exp", ",", "rtx", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "VOID_TYPE", ")", "||", "!", "warn_stringop_overflow", ")", "return", "NULL_RTX", ";", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "tree", "destsize", "=", "compute_objsize", "(", "dest", ",", "warn_stringop_overflow", "-", "1", ")", ";", "check_access", "(", "exp", ",", "dest", ",", "src", ",", "NULL_TREE", ",", "NULL_TREE", ",", "src", ",", "destsize", ")", ";", "return", "NULL_RTX", ";", "}" ]
Do some very basic size validation of a call to the strcpy builtin given by EXP.
[ "Do", "some", "very", "basic", "size", "validation", "of", "a", "call", "to", "the", "strcpy", "builtin", "given", "by", "EXP", "." ]
[ "/* There is no way here to determine the length of the string in\n the destination to which the SRC string is being appended so\n just diagnose cases when the souce string is longer than\n the destination object. */", "/*size=*/", "/*maxread=*/" ]
[ { "param": "exp", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_strcpy
rtx
static rtx expand_builtin_strcpy (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); if (warn_stringop_overflow) { tree destsize = compute_objsize (dest, warn_stringop_overflow - 1); check_access (exp, dest, src, /*size=*/NULL_TREE, /*maxread=*/NULL_TREE, src, destsize); } return expand_builtin_strcpy_args (dest, src, target); }
/* Expand expression EXP, which is a call to the strcpy builtin. Return NULL_RTX if we failed the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient). */
Expand expression EXP, which is a call to the strcpy builtin. Return NULL_RTX if we failed the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient).
[ "Expand", "expression", "EXP", "which", "is", "a", "call", "to", "the", "strcpy", "builtin", ".", "Return", "NULL_RTX", "if", "we", "failed", "the", "caller", "should", "emit", "a", "normal", "call", "otherwise", "try", "to", "get", "the", "result", "in", "TARGET", "if", "convenient", "(", "and", "in", "mode", "MODE", "if", "that", "'", "s", "convenient", ")", "." ]
static rtx expand_builtin_strcpy (tree exp, rtx target) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); if (warn_stringop_overflow) { tree destsize = compute_objsize (dest, warn_stringop_overflow - 1); check_access (exp, dest, src, NULL_TREE, NULL_TREE, src, destsize); } return expand_builtin_strcpy_args (dest, src, target); }
[ "static", "rtx", "expand_builtin_strcpy", "(", "tree", "exp", ",", "rtx", "target", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "if", "(", "warn_stringop_overflow", ")", "{", "tree", "destsize", "=", "compute_objsize", "(", "dest", ",", "warn_stringop_overflow", "-", "1", ")", ";", "check_access", "(", "exp", ",", "dest", ",", "src", ",", "NULL_TREE", ",", "NULL_TREE", ",", "src", ",", "destsize", ")", ";", "}", "return", "expand_builtin_strcpy_args", "(", "dest", ",", "src", ",", "target", ")", ";", "}" ]
Expand expression EXP, which is a call to the strcpy builtin.
[ "Expand", "expression", "EXP", "which", "is", "a", "call", "to", "the", "strcpy", "builtin", "." ]
[ "/*size=*/", "/*maxread=*/" ]
[ { "param": "exp", "type": "tree" }, { "param": "target", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_stpcpy
rtx
static rtx expand_builtin_stpcpy (tree exp, rtx target, machine_mode mode) { tree dst, src; location_t loc = EXPR_LOCATION (exp); if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; dst = CALL_EXPR_ARG (exp, 0); src = CALL_EXPR_ARG (exp, 1); if (warn_stringop_overflow) { tree destsize = compute_objsize (dst, warn_stringop_overflow - 1); check_access (exp, dst, src, /*size=*/NULL_TREE, /*maxread=*/NULL_TREE, src, destsize); } /* If return value is ignored, transform stpcpy into strcpy. */ if (target == const0_rtx && builtin_decl_implicit (BUILT_IN_STRCPY)) { tree fn = builtin_decl_implicit (BUILT_IN_STRCPY); tree result = build_call_nofold_loc (loc, fn, 2, dst, src); return expand_expr (result, target, mode, EXPAND_NORMAL); } else { tree len, lenp1; rtx ret; /* Ensure we get an actual string whose length can be evaluated at compile-time, not an expression containing a string. This is because the latter will potentially produce pessimized code when used to produce the return value. */ if (! c_getstr (src) || ! (len = c_strlen (src, 0))) return expand_movstr (dst, src, target, /*endp=*/2); lenp1 = size_binop_loc (loc, PLUS_EXPR, len, ssize_int (1)); ret = expand_builtin_mempcpy_args (dst, src, lenp1, target, exp, /*endp=*/2); if (ret) return ret; if (TREE_CODE (len) == INTEGER_CST) { rtx len_rtx = expand_normal (len); if (CONST_INT_P (len_rtx)) { ret = expand_builtin_strcpy_args (dst, src, target); if (ret) { if (! target) { if (mode != VOIDmode) target = gen_reg_rtx (mode); else target = gen_reg_rtx (GET_MODE (ret)); } if (GET_MODE (target) != GET_MODE (ret)) ret = gen_lowpart (GET_MODE (target), ret); ret = plus_constant (GET_MODE (ret), ret, INTVAL (len_rtx)); ret = emit_move_insn (target, force_operand (ret, NULL_RTX)); gcc_assert (ret); return target; } } } return expand_movstr (dst, src, target, /*endp=*/2); } }
/* Expand a call EXP to the stpcpy builtin. Return NULL_RTX if we failed the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient). */
Expand a call EXP to the stpcpy builtin. Return NULL_RTX if we failed the caller should emit a normal call, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient).
[ "Expand", "a", "call", "EXP", "to", "the", "stpcpy", "builtin", ".", "Return", "NULL_RTX", "if", "we", "failed", "the", "caller", "should", "emit", "a", "normal", "call", "otherwise", "try", "to", "get", "the", "result", "in", "TARGET", "if", "convenient", "(", "and", "in", "mode", "MODE", "if", "that", "'", "s", "convenient", ")", "." ]
static rtx expand_builtin_stpcpy (tree exp, rtx target, machine_mode mode) { tree dst, src; location_t loc = EXPR_LOCATION (exp); if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; dst = CALL_EXPR_ARG (exp, 0); src = CALL_EXPR_ARG (exp, 1); if (warn_stringop_overflow) { tree destsize = compute_objsize (dst, warn_stringop_overflow - 1); check_access (exp, dst, src, NULL_TREE, NULL_TREE, src, destsize); } if (target == const0_rtx && builtin_decl_implicit (BUILT_IN_STRCPY)) { tree fn = builtin_decl_implicit (BUILT_IN_STRCPY); tree result = build_call_nofold_loc (loc, fn, 2, dst, src); return expand_expr (result, target, mode, EXPAND_NORMAL); } else { tree len, lenp1; rtx ret; if (! c_getstr (src) || ! (len = c_strlen (src, 0))) return expand_movstr (dst, src, target, 2); lenp1 = size_binop_loc (loc, PLUS_EXPR, len, ssize_int (1)); ret = expand_builtin_mempcpy_args (dst, src, lenp1, target, exp, 2); if (ret) return ret; if (TREE_CODE (len) == INTEGER_CST) { rtx len_rtx = expand_normal (len); if (CONST_INT_P (len_rtx)) { ret = expand_builtin_strcpy_args (dst, src, target); if (ret) { if (! target) { if (mode != VOIDmode) target = gen_reg_rtx (mode); else target = gen_reg_rtx (GET_MODE (ret)); } if (GET_MODE (target) != GET_MODE (ret)) ret = gen_lowpart (GET_MODE (target), ret); ret = plus_constant (GET_MODE (ret), ret, INTVAL (len_rtx)); ret = emit_move_insn (target, force_operand (ret, NULL_RTX)); gcc_assert (ret); return target; } } } return expand_movstr (dst, src, target, 2); } }
[ "static", "rtx", "expand_builtin_stpcpy", "(", "tree", "exp", ",", "rtx", "target", ",", "machine_mode", "mode", ")", "{", "tree", "dst", ",", "src", ";", "location_t", "loc", "=", "EXPR_LOCATION", "(", "exp", ")", ";", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "dst", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "if", "(", "warn_stringop_overflow", ")", "{", "tree", "destsize", "=", "compute_objsize", "(", "dst", ",", "warn_stringop_overflow", "-", "1", ")", ";", "check_access", "(", "exp", ",", "dst", ",", "src", ",", "NULL_TREE", ",", "NULL_TREE", ",", "src", ",", "destsize", ")", ";", "}", "if", "(", "target", "==", "const0_rtx", "&&", "builtin_decl_implicit", "(", "BUILT_IN_STRCPY", ")", ")", "{", "tree", "fn", "=", "builtin_decl_implicit", "(", "BUILT_IN_STRCPY", ")", ";", "tree", "result", "=", "build_call_nofold_loc", "(", "loc", ",", "fn", ",", "2", ",", "dst", ",", "src", ")", ";", "return", "expand_expr", "(", "result", ",", "target", ",", "mode", ",", "EXPAND_NORMAL", ")", ";", "}", "else", "{", "tree", "len", ",", "lenp1", ";", "rtx", "ret", ";", "if", "(", "!", "c_getstr", "(", "src", ")", "||", "!", "(", "len", "=", "c_strlen", "(", "src", ",", "0", ")", ")", ")", "return", "expand_movstr", "(", "dst", ",", "src", ",", "target", ",", "2", ")", ";", "lenp1", "=", "size_binop_loc", "(", "loc", ",", "PLUS_EXPR", ",", "len", ",", "ssize_int", "(", "1", ")", ")", ";", "ret", "=", "expand_builtin_mempcpy_args", "(", "dst", ",", "src", ",", "lenp1", ",", "target", ",", "exp", ",", "2", ")", ";", "if", "(", "ret", ")", "return", "ret", ";", "if", "(", "TREE_CODE", "(", "len", ")", "==", "INTEGER_CST", ")", "{", "rtx", "len_rtx", "=", "expand_normal", "(", "len", ")", ";", "if", "(", "CONST_INT_P", "(", "len_rtx", ")", ")", "{", "ret", "=", "expand_builtin_strcpy_args", "(", "dst", ",", "src", ",", "target", ")", ";", "if", "(", "ret", ")", "{", "if", "(", "!", "target", ")", "{", "if", "(", "mode", "!=", "VOIDmode", ")", "target", "=", "gen_reg_rtx", "(", "mode", ")", ";", "else", "target", "=", "gen_reg_rtx", "(", "GET_MODE", "(", "ret", ")", ")", ";", "}", "if", "(", "GET_MODE", "(", "target", ")", "!=", "GET_MODE", "(", "ret", ")", ")", "ret", "=", "gen_lowpart", "(", "GET_MODE", "(", "target", ")", ",", "ret", ")", ";", "ret", "=", "plus_constant", "(", "GET_MODE", "(", "ret", ")", ",", "ret", ",", "INTVAL", "(", "len_rtx", ")", ")", ";", "ret", "=", "emit_move_insn", "(", "target", ",", "force_operand", "(", "ret", ",", "NULL_RTX", ")", ")", ";", "gcc_assert", "(", "ret", ")", ";", "return", "target", ";", "}", "}", "}", "return", "expand_movstr", "(", "dst", ",", "src", ",", "target", ",", "2", ")", ";", "}", "}" ]
Expand a call EXP to the stpcpy builtin.
[ "Expand", "a", "call", "EXP", "to", "the", "stpcpy", "builtin", "." ]
[ "/*size=*/", "/*maxread=*/", "/* If return value is ignored, transform stpcpy into strcpy. */", "/* Ensure we get an actual string whose length can be evaluated at\n\t compile-time, not an expression containing a string. This is\n\t because the latter will potentially produce pessimized code\n\t when used to produce the return value. */", "/*endp=*/", "/*endp=*/", "/*endp=*/" ]
[ { "param": "exp", "type": "tree" }, { "param": "target", "type": "rtx" }, { "param": "mode", "type": "machine_mode" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mode", "type": "machine_mode", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
expand_builtin_stpncpy
rtx
static rtx expand_builtin_stpncpy (tree exp, rtx) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE) || !warn_stringop_overflow) return NULL_RTX; /* The source and destination of the call. */ tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); /* The exact number of bytes to write (not the maximum). */ tree len = CALL_EXPR_ARG (exp, 2); /* The size of the destination object. */ tree destsize = compute_objsize (dest, warn_stringop_overflow - 1); check_access (exp, dest, src, len, /*maxread=*/NULL_TREE, src, destsize); return NULL_RTX; }
/* Check a call EXP to the stpncpy built-in for validity. Return NULL_RTX on both success and failure. */
Check a call EXP to the stpncpy built-in for validity. Return NULL_RTX on both success and failure.
[ "Check", "a", "call", "EXP", "to", "the", "stpncpy", "built", "-", "in", "for", "validity", ".", "Return", "NULL_RTX", "on", "both", "success", "and", "failure", "." ]
static rtx expand_builtin_stpncpy (tree exp, rtx) { if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE) || !warn_stringop_overflow) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); tree destsize = compute_objsize (dest, warn_stringop_overflow - 1); check_access (exp, dest, src, len, NULL_TREE, src, destsize); return NULL_RTX; }
[ "static", "rtx", "expand_builtin_stpncpy", "(", "tree", "exp", ",", "rtx", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", "||", "!", "warn_stringop_overflow", ")", "return", "NULL_RTX", ";", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "tree", "len", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "tree", "destsize", "=", "compute_objsize", "(", "dest", ",", "warn_stringop_overflow", "-", "1", ")", ";", "check_access", "(", "exp", ",", "dest", ",", "src", ",", "len", ",", "NULL_TREE", ",", "src", ",", "destsize", ")", ";", "return", "NULL_RTX", ";", "}" ]
Check a call EXP to the stpncpy built-in for validity.
[ "Check", "a", "call", "EXP", "to", "the", "stpncpy", "built", "-", "in", "for", "validity", "." ]
[ "/* The source and destination of the call. */", "/* The exact number of bytes to write (not the maximum). */", "/* The size of the destination object. */", "/*maxread=*/" ]
[ { "param": "exp", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }