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
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
builtin_strncpy_read_str
rtx
rtx builtin_strncpy_read_str (void *data, HOST_WIDE_INT offset, scalar_int_mode mode) { const char *str = (const char *) data; if ((unsigned HOST_WIDE_INT) offset > strlen (str)) return const0_rtx; 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", "." ]
rtx builtin_strncpy_read_str (void *data, HOST_WIDE_INT offset, scalar_int_mode mode) { const char *str = (const char *) data; if ((unsigned HOST_WIDE_INT) offset > strlen (str)) return const0_rtx; return c_readstr (str + offset, mode); }
[ "rtx", "builtin_strncpy_read_str", "(", "void", "*", "data", ",", "HOST_WIDE_INT", "offset", ",", "scalar_int_mode", "mode", ")", "{", "const", "char", "*", "str", "=", "(", "const", "char", "*", ")", "data", ";", "if", "(", "(", "unsigned", "HOST_WIDE_INT", ")", "offset", ">", "strlen", "(", "str", ")", ")", "return", "const0_rtx", ";", "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_strncat_sizes
bool
static bool check_strncat_sizes (tree exp, tree objsize) { tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree maxread = CALL_EXPR_ARG (exp, 2); /* Try to determine the range of lengths that the source expression refers to. */ tree lenrange[2]; get_range_strlen (src, lenrange); /* Try to verify that the destination is big enough for the shortest string. */ if (!objsize && warn_stringop_overflow) { /* If it hasn't been provided by __strncat_chk, try to determine the size of the destination object into which the source is being copied. */ objsize = compute_objsize (dest, warn_stringop_overflow - 1); } /* Add one for the terminating nul. */ tree srclen = (lenrange[0] ? fold_build2 (PLUS_EXPR, size_type_node, lenrange[0], size_one_node) : NULL_TREE); /* The strncat function copies at most MAXREAD bytes and always appends the terminating nul so the specified upper bound should never be equal to (or greater than) the size of the destination. */ if (tree_fits_uhwi_p (maxread) && tree_fits_uhwi_p (objsize) && tree_int_cst_equal (objsize, maxread)) { location_t loc = tree_nonartificial_location (exp); loc = expansion_point_location_if_in_system_header (loc); warning_at (loc, OPT_Wstringop_overflow_, "%K%qD specified bound %E equals destination size", exp, get_callee_fndecl (exp), maxread); return false; } if (!srclen || (maxread && tree_fits_uhwi_p (maxread) && tree_fits_uhwi_p (srclen) && tree_int_cst_lt (maxread, srclen))) srclen = maxread; /* The number of bytes to write is LEN but check_access will also check SRCLEN if LEN's value isn't known. */ return check_access (exp, dest, src, /*size=*/NULL_TREE, maxread, srclen, objsize); }
/* Helper to check the sizes of sequences and the destination of calls to __builtin_strncat and __builtin___strncat_chk. Returns true on success (no overflow or invalid sizes), false otherwise. */
Helper to check the sizes of sequences and the destination of calls to __builtin_strncat and __builtin___strncat_chk. Returns true on success (no overflow or invalid sizes), false otherwise.
[ "Helper", "to", "check", "the", "sizes", "of", "sequences", "and", "the", "destination", "of", "calls", "to", "__builtin_strncat", "and", "__builtin___strncat_chk", ".", "Returns", "true", "on", "success", "(", "no", "overflow", "or", "invalid", "sizes", ")", "false", "otherwise", "." ]
static bool check_strncat_sizes (tree exp, tree objsize) { tree dest = CALL_EXPR_ARG (exp, 0); tree src = CALL_EXPR_ARG (exp, 1); tree maxread = CALL_EXPR_ARG (exp, 2); tree lenrange[2]; get_range_strlen (src, lenrange); if (!objsize && warn_stringop_overflow) { objsize = compute_objsize (dest, warn_stringop_overflow - 1); } tree srclen = (lenrange[0] ? fold_build2 (PLUS_EXPR, size_type_node, lenrange[0], size_one_node) : NULL_TREE); if (tree_fits_uhwi_p (maxread) && tree_fits_uhwi_p (objsize) && tree_int_cst_equal (objsize, maxread)) { location_t loc = tree_nonartificial_location (exp); loc = expansion_point_location_if_in_system_header (loc); warning_at (loc, OPT_Wstringop_overflow_, "%K%qD specified bound %E equals destination size", exp, get_callee_fndecl (exp), maxread); return false; } if (!srclen || (maxread && tree_fits_uhwi_p (maxread) && tree_fits_uhwi_p (srclen) && tree_int_cst_lt (maxread, srclen))) srclen = maxread; return check_access (exp, dest, src, NULL_TREE, maxread, srclen, objsize); }
[ "static", "bool", "check_strncat_sizes", "(", "tree", "exp", ",", "tree", "objsize", ")", "{", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "src", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "tree", "maxread", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "tree", "lenrange", "[", "2", "]", ";", "get_range_strlen", "(", "src", ",", "lenrange", ")", ";", "if", "(", "!", "objsize", "&&", "warn_stringop_overflow", ")", "{", "objsize", "=", "compute_objsize", "(", "dest", ",", "warn_stringop_overflow", "-", "1", ")", ";", "}", "tree", "srclen", "=", "(", "lenrange", "[", "0", "]", "?", "fold_build2", "(", "PLUS_EXPR", ",", "size_type_node", ",", "lenrange", "[", "0", "]", ",", "size_one_node", ")", ":", "NULL_TREE", ")", ";", "if", "(", "tree_fits_uhwi_p", "(", "maxread", ")", "&&", "tree_fits_uhwi_p", "(", "objsize", ")", "&&", "tree_int_cst_equal", "(", "objsize", ",", "maxread", ")", ")", "{", "location_t", "loc", "=", "tree_nonartificial_location", "(", "exp", ")", ";", "loc", "=", "expansion_point_location_if_in_system_header", "(", "loc", ")", ";", "warning_at", "(", "loc", ",", "OPT_Wstringop_overflow_", ",", "\"", "\"", ",", "exp", ",", "get_callee_fndecl", "(", "exp", ")", ",", "maxread", ")", ";", "return", "false", ";", "}", "if", "(", "!", "srclen", "||", "(", "maxread", "&&", "tree_fits_uhwi_p", "(", "maxread", ")", "&&", "tree_fits_uhwi_p", "(", "srclen", ")", "&&", "tree_int_cst_lt", "(", "maxread", ",", "srclen", ")", ")", ")", "srclen", "=", "maxread", ";", "return", "check_access", "(", "exp", ",", "dest", ",", "src", ",", "NULL_TREE", ",", "maxread", ",", "srclen", ",", "objsize", ")", ";", "}" ]
Helper to check the sizes of sequences and the destination of calls to __builtin_strncat and __builtin___strncat_chk.
[ "Helper", "to", "check", "the", "sizes", "of", "sequences", "and", "the", "destination", "of", "calls", "to", "__builtin_strncat", "and", "__builtin___strncat_chk", "." ]
[ "/* Try to determine the range of lengths that the source expression\n refers to. */", "/* Try to verify that the destination is big enough for the shortest\n string. */", "/* If it hasn't been provided by __strncat_chk, try to determine\n\t the size of the destination object into which the source is\n\t being copied. */", "/* Add one for the terminating nul. */", "/* The strncat function copies at most MAXREAD bytes and always appends\n the terminating nul so the specified upper bound should never be equal\n to (or greater than) the size of the destination. */", "/* The number of bytes to write is LEN but check_access will also\n check SRCLEN if LEN's value isn't known. */", "/*size=*/" ]
[ { "param": "exp", "type": "tree" }, { "param": "objsize", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "objsize", "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_strncat
rtx
static rtx expand_builtin_strncat (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); /* The upper bound on the number of bytes to write. */ tree maxread = CALL_EXPR_ARG (exp, 2); /* The length of the source sequence. */ tree slen = c_strlen (src, 1); /* Try to determine the range of lengths that the source expression refers to. */ tree lenrange[2]; if (slen) lenrange[0] = lenrange[1] = slen; else get_range_strlen (src, lenrange); /* Try to verify that the destination is big enough for the shortest string. First try to determine the size of the destination object into which the source is being copied. */ tree destsize = compute_objsize (dest, warn_stringop_overflow - 1); /* Add one for the terminating nul. */ tree srclen = (lenrange[0] ? fold_build2 (PLUS_EXPR, size_type_node, lenrange[0], size_one_node) : NULL_TREE); /* The strncat function copies at most MAXREAD bytes and always appends the terminating nul so the specified upper bound should never be equal to (or greater than) the size of the destination. */ if (tree_fits_uhwi_p (maxread) && tree_fits_uhwi_p (destsize) && tree_int_cst_equal (destsize, maxread)) { location_t loc = tree_nonartificial_location (exp); loc = expansion_point_location_if_in_system_header (loc); warning_at (loc, OPT_Wstringop_overflow_, "%K%qD specified bound %E equals destination size", exp, get_callee_fndecl (exp), maxread); return NULL_RTX; } if (!srclen || (maxread && tree_fits_uhwi_p (maxread) && tree_fits_uhwi_p (srclen) && tree_int_cst_lt (maxread, srclen))) srclen = maxread; /* The number of bytes to write is SRCLEN. */ check_access (exp, dest, src, NULL_TREE, maxread, srclen, destsize); return NULL_RTX; }
/* Similar to expand_builtin_strcat, 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. */
Similar to expand_builtin_strcat, 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.
[ "Similar", "to", "expand_builtin_strcat", "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_strncat (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 maxread = CALL_EXPR_ARG (exp, 2); tree slen = c_strlen (src, 1); tree lenrange[2]; if (slen) lenrange[0] = lenrange[1] = slen; else get_range_strlen (src, lenrange); tree destsize = compute_objsize (dest, warn_stringop_overflow - 1); tree srclen = (lenrange[0] ? fold_build2 (PLUS_EXPR, size_type_node, lenrange[0], size_one_node) : NULL_TREE); if (tree_fits_uhwi_p (maxread) && tree_fits_uhwi_p (destsize) && tree_int_cst_equal (destsize, maxread)) { location_t loc = tree_nonartificial_location (exp); loc = expansion_point_location_if_in_system_header (loc); warning_at (loc, OPT_Wstringop_overflow_, "%K%qD specified bound %E equals destination size", exp, get_callee_fndecl (exp), maxread); return NULL_RTX; } if (!srclen || (maxread && tree_fits_uhwi_p (maxread) && tree_fits_uhwi_p (srclen) && tree_int_cst_lt (maxread, srclen))) srclen = maxread; check_access (exp, dest, src, NULL_TREE, maxread, srclen, destsize); return NULL_RTX; }
[ "static", "rtx", "expand_builtin_strncat", "(", "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", "maxread", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "tree", "slen", "=", "c_strlen", "(", "src", ",", "1", ")", ";", "tree", "lenrange", "[", "2", "]", ";", "if", "(", "slen", ")", "lenrange", "[", "0", "]", "=", "lenrange", "[", "1", "]", "=", "slen", ";", "else", "get_range_strlen", "(", "src", ",", "lenrange", ")", ";", "tree", "destsize", "=", "compute_objsize", "(", "dest", ",", "warn_stringop_overflow", "-", "1", ")", ";", "tree", "srclen", "=", "(", "lenrange", "[", "0", "]", "?", "fold_build2", "(", "PLUS_EXPR", ",", "size_type_node", ",", "lenrange", "[", "0", "]", ",", "size_one_node", ")", ":", "NULL_TREE", ")", ";", "if", "(", "tree_fits_uhwi_p", "(", "maxread", ")", "&&", "tree_fits_uhwi_p", "(", "destsize", ")", "&&", "tree_int_cst_equal", "(", "destsize", ",", "maxread", ")", ")", "{", "location_t", "loc", "=", "tree_nonartificial_location", "(", "exp", ")", ";", "loc", "=", "expansion_point_location_if_in_system_header", "(", "loc", ")", ";", "warning_at", "(", "loc", ",", "OPT_Wstringop_overflow_", ",", "\"", "\"", ",", "exp", ",", "get_callee_fndecl", "(", "exp", ")", ",", "maxread", ")", ";", "return", "NULL_RTX", ";", "}", "if", "(", "!", "srclen", "||", "(", "maxread", "&&", "tree_fits_uhwi_p", "(", "maxread", ")", "&&", "tree_fits_uhwi_p", "(", "srclen", ")", "&&", "tree_int_cst_lt", "(", "maxread", ",", "srclen", ")", ")", ")", "srclen", "=", "maxread", ";", "check_access", "(", "exp", ",", "dest", ",", "src", ",", "NULL_TREE", ",", "maxread", ",", "srclen", ",", "destsize", ")", ";", "return", "NULL_RTX", ";", "}" ]
Similar to expand_builtin_strcat, do some very basic size validation of a call to the strcpy builtin given by EXP.
[ "Similar", "to", "expand_builtin_strcat", "do", "some", "very", "basic", "size", "validation", "of", "a", "call", "to", "the", "strcpy", "builtin", "given", "by", "EXP", "." ]
[ "/* The upper bound on the number of bytes to write. */", "/* The length of the source sequence. */", "/* Try to determine the range of lengths that the source expression\n refers to. */", "/* Try to verify that the destination is big enough for the shortest\n string. First try to determine the size of the destination object\n into which the source is being copied. */", "/* Add one for the terminating nul. */", "/* The strncat function copies at most MAXREAD bytes and always appends\n the terminating nul so the specified upper bound should never be equal\n to (or greater than) the size of the destination. */", "/* The number of bytes to write is SRCLEN. */" ]
[ { "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_memset
rtx
static rtx expand_builtin_memset (tree exp, rtx target, machine_mode mode) { if (!validate_arglist (exp, POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree val = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); check_memop_access (exp, dest, NULL_TREE, len); return expand_builtin_memset_args (dest, val, len, target, mode, exp); }
/* Expand expression EXP, which is a call to the memset 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 memset 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", "memset", "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_memset (tree exp, rtx target, machine_mode mode) { if (!validate_arglist (exp, POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree val = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); check_memop_access (exp, dest, NULL_TREE, len); return expand_builtin_memset_args (dest, val, len, target, mode, exp); }
[ "static", "rtx", "expand_builtin_memset", "(", "tree", "exp", ",", "rtx", "target", ",", "machine_mode", "mode", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "INTEGER_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "val", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "tree", "len", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "check_memop_access", "(", "exp", ",", "dest", ",", "NULL_TREE", ",", "len", ")", ";", "return", "expand_builtin_memset_args", "(", "dest", ",", "val", ",", "len", ",", "target", ",", "mode", ",", "exp", ")", ";", "}" ]
Expand expression EXP, which is a call to the memset builtin.
[ "Expand", "expression", "EXP", "which", "is", "a", "call", "to", "the", "memset", "builtin", "." ]
[]
[ { "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_bzero
rtx
static rtx expand_builtin_bzero (tree exp) { if (!validate_arglist (exp, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree size = CALL_EXPR_ARG (exp, 1); check_memop_access (exp, dest, NULL_TREE, size); /* New argument list transforming bzero(ptr x, int y) to memset(ptr x, int 0, size_t y). This is done this way so that if it isn't expanded inline, we fallback to calling bzero instead of memset. */ location_t loc = EXPR_LOCATION (exp); return expand_builtin_memset_args (dest, integer_zero_node, fold_convert_loc (loc, size_type_node, size), const0_rtx, VOIDmode, exp); }
/* Expand expression EXP, which is a call to the bzero builtin. Return NULL_RTX if we failed the caller should emit a normal call. */
Expand expression EXP, which is a call to the bzero builtin. Return NULL_RTX if we failed the caller should emit a normal call.
[ "Expand", "expression", "EXP", "which", "is", "a", "call", "to", "the", "bzero", "builtin", ".", "Return", "NULL_RTX", "if", "we", "failed", "the", "caller", "should", "emit", "a", "normal", "call", "." ]
static rtx expand_builtin_bzero (tree exp) { if (!validate_arglist (exp, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return NULL_RTX; tree dest = CALL_EXPR_ARG (exp, 0); tree size = CALL_EXPR_ARG (exp, 1); check_memop_access (exp, dest, NULL_TREE, size); location_t loc = EXPR_LOCATION (exp); return expand_builtin_memset_args (dest, integer_zero_node, fold_convert_loc (loc, size_type_node, size), const0_rtx, VOIDmode, exp); }
[ "static", "rtx", "expand_builtin_bzero", "(", "tree", "exp", ")", "{", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "tree", "dest", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "size", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "check_memop_access", "(", "exp", ",", "dest", ",", "NULL_TREE", ",", "size", ")", ";", "location_t", "loc", "=", "EXPR_LOCATION", "(", "exp", ")", ";", "return", "expand_builtin_memset_args", "(", "dest", ",", "integer_zero_node", ",", "fold_convert_loc", "(", "loc", ",", "size_type_node", ",", "size", ")", ",", "const0_rtx", ",", "VOIDmode", ",", "exp", ")", ";", "}" ]
Expand expression EXP, which is a call to the bzero builtin.
[ "Expand", "expression", "EXP", "which", "is", "a", "call", "to", "the", "bzero", "builtin", "." ]
[ "/* New argument list transforming bzero(ptr x, int y) to\n memset(ptr x, int 0, size_t y). This is done this way\n so that if it isn't expanded inline, we fallback to\n calling bzero instead of memset. */" ]
[ { "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_cmpstr
rtx
static rtx expand_cmpstr (insn_code icode, rtx target, rtx arg1_rtx, rtx arg2_rtx, HOST_WIDE_INT align) { machine_mode insn_mode = insn_data[icode].operand[0].mode; if (target && (!REG_P (target) || HARD_REGISTER_P (target))) target = NULL_RTX; struct expand_operand ops[4]; create_output_operand (&ops[0], target, insn_mode); create_fixed_operand (&ops[1], arg1_rtx); create_fixed_operand (&ops[2], arg2_rtx); create_integer_operand (&ops[3], align); if (maybe_expand_insn (icode, 4, ops)) return ops[0].value; return NULL_RTX; }
/* Try to expand cmpstr operation ICODE with the given operands. Return the result rtx on success, otherwise return null. */
Try to expand cmpstr operation ICODE with the given operands. Return the result rtx on success, otherwise return null.
[ "Try", "to", "expand", "cmpstr", "operation", "ICODE", "with", "the", "given", "operands", ".", "Return", "the", "result", "rtx", "on", "success", "otherwise", "return", "null", "." ]
static rtx expand_cmpstr (insn_code icode, rtx target, rtx arg1_rtx, rtx arg2_rtx, HOST_WIDE_INT align) { machine_mode insn_mode = insn_data[icode].operand[0].mode; if (target && (!REG_P (target) || HARD_REGISTER_P (target))) target = NULL_RTX; struct expand_operand ops[4]; create_output_operand (&ops[0], target, insn_mode); create_fixed_operand (&ops[1], arg1_rtx); create_fixed_operand (&ops[2], arg2_rtx); create_integer_operand (&ops[3], align); if (maybe_expand_insn (icode, 4, ops)) return ops[0].value; return NULL_RTX; }
[ "static", "rtx", "expand_cmpstr", "(", "insn_code", "icode", ",", "rtx", "target", ",", "rtx", "arg1_rtx", ",", "rtx", "arg2_rtx", ",", "HOST_WIDE_INT", "align", ")", "{", "machine_mode", "insn_mode", "=", "insn_data", "[", "icode", "]", ".", "operand", "[", "0", "]", ".", "mode", ";", "if", "(", "target", "&&", "(", "!", "REG_P", "(", "target", ")", "||", "HARD_REGISTER_P", "(", "target", ")", ")", ")", "target", "=", "NULL_RTX", ";", "struct", "expand_operand", "ops", "[", "4", "]", ";", "create_output_operand", "(", "&", "ops", "[", "0", "]", ",", "target", ",", "insn_mode", ")", ";", "create_fixed_operand", "(", "&", "ops", "[", "1", "]", ",", "arg1_rtx", ")", ";", "create_fixed_operand", "(", "&", "ops", "[", "2", "]", ",", "arg2_rtx", ")", ";", "create_integer_operand", "(", "&", "ops", "[", "3", "]", ",", "align", ")", ";", "if", "(", "maybe_expand_insn", "(", "icode", ",", "4", ",", "ops", ")", ")", "return", "ops", "[", "0", "]", ".", "value", ";", "return", "NULL_RTX", ";", "}" ]
Try to expand cmpstr operation ICODE with the given operands.
[ "Try", "to", "expand", "cmpstr", "operation", "ICODE", "with", "the", "given", "operands", "." ]
[]
[ { "param": "icode", "type": "insn_code" }, { "param": "target", "type": "rtx" }, { "param": "arg1_rtx", "type": "rtx" }, { "param": "arg2_rtx", "type": "rtx" }, { "param": "align", "type": "HOST_WIDE_INT" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "icode", "type": "insn_code", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "target", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg1_rtx", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg2_rtx", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "align", "type": "HOST_WIDE_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_frame_address
rtx
static rtx expand_builtin_frame_address (tree fndecl, tree exp) { /* The argument must be a nonnegative integer constant. It counts the number of frames to scan up the stack. The value is either the frame pointer value or the return address saved in that frame. */ if (call_expr_nargs (exp) == 0) /* Warning about missing arg was already issued. */ return const0_rtx; else if (! tree_fits_uhwi_p (CALL_EXPR_ARG (exp, 0))) { error ("invalid argument to %qD", fndecl); return const0_rtx; } else { /* Number of frames to scan up the stack. */ unsigned HOST_WIDE_INT count = tree_to_uhwi (CALL_EXPR_ARG (exp, 0)); rtx tem = expand_builtin_return_addr (DECL_FUNCTION_CODE (fndecl), count); /* Some ports cannot access arbitrary stack frames. */ if (tem == NULL) { warning (0, "unsupported argument to %qD", fndecl); return const0_rtx; } if (count) { /* Warn since no effort is made to ensure that any frame beyond the current one exists or can be safely reached. */ warning (OPT_Wframe_address, "calling %qD with " "a nonzero argument is unsafe", fndecl); } /* For __builtin_frame_address, return what we've got. */ if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_FRAME_ADDRESS) return tem; if (!REG_P (tem) && ! CONSTANT_P (tem)) tem = copy_addr_to_reg (tem); return tem; } }
/* Expand a call to one of the builtin functions __builtin_frame_address or __builtin_return_address. */
Expand a call to one of the builtin functions __builtin_frame_address or builtin_return_address.
[ "Expand", "a", "call", "to", "one", "of", "the", "builtin", "functions", "__builtin_frame_address", "or", "builtin_return_address", "." ]
static rtx expand_builtin_frame_address (tree fndecl, tree exp) { if (call_expr_nargs (exp) == 0) return const0_rtx; else if (! tree_fits_uhwi_p (CALL_EXPR_ARG (exp, 0))) { error ("invalid argument to %qD", fndecl); return const0_rtx; } else { unsigned HOST_WIDE_INT count = tree_to_uhwi (CALL_EXPR_ARG (exp, 0)); rtx tem = expand_builtin_return_addr (DECL_FUNCTION_CODE (fndecl), count); if (tem == NULL) { warning (0, "unsupported argument to %qD", fndecl); return const0_rtx; } if (count) { warning (OPT_Wframe_address, "calling %qD with " "a nonzero argument is unsafe", fndecl); } if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_FRAME_ADDRESS) return tem; if (!REG_P (tem) && ! CONSTANT_P (tem)) tem = copy_addr_to_reg (tem); return tem; } }
[ "static", "rtx", "expand_builtin_frame_address", "(", "tree", "fndecl", ",", "tree", "exp", ")", "{", "if", "(", "call_expr_nargs", "(", "exp", ")", "==", "0", ")", "return", "const0_rtx", ";", "else", "if", "(", "!", "tree_fits_uhwi_p", "(", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ")", ")", "{", "error", "(", "\"", "\"", ",", "fndecl", ")", ";", "return", "const0_rtx", ";", "}", "else", "{", "unsigned", "HOST_WIDE_INT", "count", "=", "tree_to_uhwi", "(", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ")", ";", "rtx", "tem", "=", "expand_builtin_return_addr", "(", "DECL_FUNCTION_CODE", "(", "fndecl", ")", ",", "count", ")", ";", "if", "(", "tem", "==", "NULL", ")", "{", "warning", "(", "0", ",", "\"", "\"", ",", "fndecl", ")", ";", "return", "const0_rtx", ";", "}", "if", "(", "count", ")", "{", "warning", "(", "OPT_Wframe_address", ",", "\"", "\"", "\"", "\"", ",", "fndecl", ")", ";", "}", "if", "(", "DECL_FUNCTION_CODE", "(", "fndecl", ")", "==", "BUILT_IN_FRAME_ADDRESS", ")", "return", "tem", ";", "if", "(", "!", "REG_P", "(", "tem", ")", "&&", "!", "CONSTANT_P", "(", "tem", ")", ")", "tem", "=", "copy_addr_to_reg", "(", "tem", ")", ";", "return", "tem", ";", "}", "}" ]
Expand a call to one of the builtin functions __builtin_frame_address or __builtin_return_address.
[ "Expand", "a", "call", "to", "one", "of", "the", "builtin", "functions", "__builtin_frame_address", "or", "__builtin_return_address", "." ]
[ "/* The argument must be a nonnegative integer constant.\n It counts the number of frames to scan up the stack.\n The value is either the frame pointer value or the return\n address saved in that frame. */", "/* Warning about missing arg was already issued. */", "/* Number of frames to scan up the stack. */", "/* Some ports cannot access arbitrary stack frames. */", "/* Warn since no effort is made to ensure that any frame\n\t beyond the current one exists or can be safely reached. */", "/* For __builtin_frame_address, return what we've got. */" ]
[ { "param": "fndecl", "type": "tree" }, { "param": "exp", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fndecl", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "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_alloca
rtx
static rtx expand_builtin_alloca (tree exp) { rtx op0; rtx result; unsigned int align; tree fndecl = get_callee_fndecl (exp); HOST_WIDE_INT max_size; enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); bool alloca_for_var = CALL_ALLOCA_FOR_VAR_P (exp); bool valid_arglist = (fcode == BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX ? validate_arglist (exp, INTEGER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE) : fcode == BUILT_IN_ALLOCA_WITH_ALIGN ? validate_arglist (exp, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE) : validate_arglist (exp, INTEGER_TYPE, VOID_TYPE)); if (!valid_arglist) return NULL_RTX; if ((alloca_for_var && !warn_vla_limit) || (!alloca_for_var && !warn_alloca_limit)) { /* -Walloca-larger-than and -Wvla-larger-than settings override the more general -Walloc-size-larger-than so unless either of the former options is specified check the alloca arguments for overflow. */ tree args[] = { CALL_EXPR_ARG (exp, 0), NULL_TREE }; int idx[] = { 0, -1 }; maybe_warn_alloc_args_overflow (fndecl, exp, args, idx); } /* Compute the argument. */ op0 = expand_normal (CALL_EXPR_ARG (exp, 0)); /* Compute the alignment. */ align = (fcode == BUILT_IN_ALLOCA ? BIGGEST_ALIGNMENT : TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 1))); /* Compute the maximum size. */ max_size = (fcode == BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX ? TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 2)) : -1); /* Allocate the desired space. If the allocation stems from the declaration of a variable-sized object, it cannot accumulate. */ result = allocate_dynamic_stack_space (op0, 0, align, max_size, alloca_for_var); result = convert_memory_address (ptr_mode, result); return result; }
/* Expand EXP, a call to the alloca builtin. Return NULL_RTX if we failed and the caller should emit a normal call. */
Expand EXP, a call to the alloca builtin. Return NULL_RTX if we failed and the caller should emit a normal call.
[ "Expand", "EXP", "a", "call", "to", "the", "alloca", "builtin", ".", "Return", "NULL_RTX", "if", "we", "failed", "and", "the", "caller", "should", "emit", "a", "normal", "call", "." ]
static rtx expand_builtin_alloca (tree exp) { rtx op0; rtx result; unsigned int align; tree fndecl = get_callee_fndecl (exp); HOST_WIDE_INT max_size; enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl); bool alloca_for_var = CALL_ALLOCA_FOR_VAR_P (exp); bool valid_arglist = (fcode == BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX ? validate_arglist (exp, INTEGER_TYPE, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE) : fcode == BUILT_IN_ALLOCA_WITH_ALIGN ? validate_arglist (exp, INTEGER_TYPE, INTEGER_TYPE, VOID_TYPE) : validate_arglist (exp, INTEGER_TYPE, VOID_TYPE)); if (!valid_arglist) return NULL_RTX; if ((alloca_for_var && !warn_vla_limit) || (!alloca_for_var && !warn_alloca_limit)) { tree args[] = { CALL_EXPR_ARG (exp, 0), NULL_TREE }; int idx[] = { 0, -1 }; maybe_warn_alloc_args_overflow (fndecl, exp, args, idx); } op0 = expand_normal (CALL_EXPR_ARG (exp, 0)); align = (fcode == BUILT_IN_ALLOCA ? BIGGEST_ALIGNMENT : TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 1))); max_size = (fcode == BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX ? TREE_INT_CST_LOW (CALL_EXPR_ARG (exp, 2)) : -1); result = allocate_dynamic_stack_space (op0, 0, align, max_size, alloca_for_var); result = convert_memory_address (ptr_mode, result); return result; }
[ "static", "rtx", "expand_builtin_alloca", "(", "tree", "exp", ")", "{", "rtx", "op0", ";", "rtx", "result", ";", "unsigned", "int", "align", ";", "tree", "fndecl", "=", "get_callee_fndecl", "(", "exp", ")", ";", "HOST_WIDE_INT", "max_size", ";", "enum", "built_in_function", "fcode", "=", "DECL_FUNCTION_CODE", "(", "fndecl", ")", ";", "bool", "alloca_for_var", "=", "CALL_ALLOCA_FOR_VAR_P", "(", "exp", ")", ";", "bool", "valid_arglist", "=", "(", "fcode", "==", "BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX", "?", "validate_arglist", "(", "exp", ",", "INTEGER_TYPE", ",", "INTEGER_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ":", "fcode", "==", "BUILT_IN_ALLOCA_WITH_ALIGN", "?", "validate_arglist", "(", "exp", ",", "INTEGER_TYPE", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ":", "validate_arglist", "(", "exp", ",", "INTEGER_TYPE", ",", "VOID_TYPE", ")", ")", ";", "if", "(", "!", "valid_arglist", ")", "return", "NULL_RTX", ";", "if", "(", "(", "alloca_for_var", "&&", "!", "warn_vla_limit", ")", "||", "(", "!", "alloca_for_var", "&&", "!", "warn_alloca_limit", ")", ")", "{", "tree", "args", "[", "]", "=", "{", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ",", "NULL_TREE", "}", ";", "int", "idx", "[", "]", "=", "{", "0", ",", "-1", "}", ";", "maybe_warn_alloc_args_overflow", "(", "fndecl", ",", "exp", ",", "args", ",", "idx", ")", ";", "}", "op0", "=", "expand_normal", "(", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ")", ";", "align", "=", "(", "fcode", "==", "BUILT_IN_ALLOCA", "?", "BIGGEST_ALIGNMENT", ":", "TREE_INT_CST_LOW", "(", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ")", ")", ";", "max_size", "=", "(", "fcode", "==", "BUILT_IN_ALLOCA_WITH_ALIGN_AND_MAX", "?", "TREE_INT_CST_LOW", "(", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ")", ":", "-1", ")", ";", "result", "=", "allocate_dynamic_stack_space", "(", "op0", ",", "0", ",", "align", ",", "max_size", ",", "alloca_for_var", ")", ";", "result", "=", "convert_memory_address", "(", "ptr_mode", ",", "result", ")", ";", "return", "result", ";", "}" ]
Expand EXP, a call to the alloca builtin.
[ "Expand", "EXP", "a", "call", "to", "the", "alloca", "builtin", "." ]
[ "/* -Walloca-larger-than and -Wvla-larger-than settings override\n\t the more general -Walloc-size-larger-than so unless either of\n\t the former options is specified check the alloca arguments for\n\t overflow. */", "/* Compute the argument. */", "/* Compute the alignment. */", "/* Compute the maximum size. */", "/* Allocate the desired space. If the allocation stems from the declaration\n of a variable-sized object, it cannot accumulate. */" ]
[ { "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_asan_emit_allocas_unpoison
rtx
static rtx expand_asan_emit_allocas_unpoison (tree exp) { tree arg0 = CALL_EXPR_ARG (exp, 0); tree arg1 = CALL_EXPR_ARG (exp, 1); rtx top = expand_expr (arg0, NULL_RTX, ptr_mode, EXPAND_NORMAL); rtx bot = expand_expr (arg1, NULL_RTX, ptr_mode, EXPAND_NORMAL); rtx off = expand_simple_binop (Pmode, MINUS, virtual_stack_dynamic_rtx, stack_pointer_rtx, NULL_RTX, 0, OPTAB_LIB_WIDEN); off = convert_modes (ptr_mode, Pmode, off, 0); bot = expand_simple_binop (ptr_mode, PLUS, bot, off, NULL_RTX, 0, OPTAB_LIB_WIDEN); rtx ret = init_one_libfunc ("__asan_allocas_unpoison"); ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode, top, ptr_mode, bot, ptr_mode); return ret; }
/* Emit a call to __asan_allocas_unpoison call in EXP. Add to second argument of the call virtual_stack_dynamic_rtx - stack_pointer_rtx, which is the STACK_DYNAMIC_OFFSET value. See motivation for this in comment to handle_builtin_stack_restore function. */
Emit a call to __asan_allocas_unpoison call in EXP. Add to second argument of the call virtual_stack_dynamic_rtx - stack_pointer_rtx, which is the STACK_DYNAMIC_OFFSET value. See motivation for this in comment to handle_builtin_stack_restore function.
[ "Emit", "a", "call", "to", "__asan_allocas_unpoison", "call", "in", "EXP", ".", "Add", "to", "second", "argument", "of", "the", "call", "virtual_stack_dynamic_rtx", "-", "stack_pointer_rtx", "which", "is", "the", "STACK_DYNAMIC_OFFSET", "value", ".", "See", "motivation", "for", "this", "in", "comment", "to", "handle_builtin_stack_restore", "function", "." ]
static rtx expand_asan_emit_allocas_unpoison (tree exp) { tree arg0 = CALL_EXPR_ARG (exp, 0); tree arg1 = CALL_EXPR_ARG (exp, 1); rtx top = expand_expr (arg0, NULL_RTX, ptr_mode, EXPAND_NORMAL); rtx bot = expand_expr (arg1, NULL_RTX, ptr_mode, EXPAND_NORMAL); rtx off = expand_simple_binop (Pmode, MINUS, virtual_stack_dynamic_rtx, stack_pointer_rtx, NULL_RTX, 0, OPTAB_LIB_WIDEN); off = convert_modes (ptr_mode, Pmode, off, 0); bot = expand_simple_binop (ptr_mode, PLUS, bot, off, NULL_RTX, 0, OPTAB_LIB_WIDEN); rtx ret = init_one_libfunc ("__asan_allocas_unpoison"); ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode, top, ptr_mode, bot, ptr_mode); return ret; }
[ "static", "rtx", "expand_asan_emit_allocas_unpoison", "(", "tree", "exp", ")", "{", "tree", "arg0", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "tree", "arg1", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "rtx", "top", "=", "expand_expr", "(", "arg0", ",", "NULL_RTX", ",", "ptr_mode", ",", "EXPAND_NORMAL", ")", ";", "rtx", "bot", "=", "expand_expr", "(", "arg1", ",", "NULL_RTX", ",", "ptr_mode", ",", "EXPAND_NORMAL", ")", ";", "rtx", "off", "=", "expand_simple_binop", "(", "Pmode", ",", "MINUS", ",", "virtual_stack_dynamic_rtx", ",", "stack_pointer_rtx", ",", "NULL_RTX", ",", "0", ",", "OPTAB_LIB_WIDEN", ")", ";", "off", "=", "convert_modes", "(", "ptr_mode", ",", "Pmode", ",", "off", ",", "0", ")", ";", "bot", "=", "expand_simple_binop", "(", "ptr_mode", ",", "PLUS", ",", "bot", ",", "off", ",", "NULL_RTX", ",", "0", ",", "OPTAB_LIB_WIDEN", ")", ";", "rtx", "ret", "=", "init_one_libfunc", "(", "\"", "\"", ")", ";", "ret", "=", "emit_library_call_value", "(", "ret", ",", "NULL_RTX", ",", "LCT_NORMAL", ",", "ptr_mode", ",", "top", ",", "ptr_mode", ",", "bot", ",", "ptr_mode", ")", ";", "return", "ret", ";", "}" ]
Emit a call to __asan_allocas_unpoison call in EXP.
[ "Emit", "a", "call", "to", "__asan_allocas_unpoison", "call", "in", "EXP", "." ]
[]
[ { "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_init_descriptor
rtx
static rtx expand_builtin_init_descriptor (tree exp) { tree t_descr, t_func, t_chain; rtx m_descr, r_descr, r_func, r_chain; if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; t_descr = CALL_EXPR_ARG (exp, 0); t_func = CALL_EXPR_ARG (exp, 1); t_chain = CALL_EXPR_ARG (exp, 2); r_descr = expand_normal (t_descr); m_descr = gen_rtx_MEM (BLKmode, r_descr); MEM_NOTRAP_P (m_descr) = 1; r_func = expand_normal (t_func); r_chain = expand_normal (t_chain); /* Generate insns to initialize the descriptor. */ emit_move_insn (adjust_address_nv (m_descr, ptr_mode, 0), r_chain); emit_move_insn (adjust_address_nv (m_descr, ptr_mode, POINTER_SIZE / BITS_PER_UNIT), r_func); return const0_rtx; }
/* Expand a call to the builtin descriptor initialization routine. A descriptor is made up of a couple of pointers to the static chain and the code entry in this order. */
Expand a call to the builtin descriptor initialization routine. A descriptor is made up of a couple of pointers to the static chain and the code entry in this order.
[ "Expand", "a", "call", "to", "the", "builtin", "descriptor", "initialization", "routine", ".", "A", "descriptor", "is", "made", "up", "of", "a", "couple", "of", "pointers", "to", "the", "static", "chain", "and", "the", "code", "entry", "in", "this", "order", "." ]
static rtx expand_builtin_init_descriptor (tree exp) { tree t_descr, t_func, t_chain; rtx m_descr, r_descr, r_func, r_chain; if (!validate_arglist (exp, POINTER_TYPE, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; t_descr = CALL_EXPR_ARG (exp, 0); t_func = CALL_EXPR_ARG (exp, 1); t_chain = CALL_EXPR_ARG (exp, 2); r_descr = expand_normal (t_descr); m_descr = gen_rtx_MEM (BLKmode, r_descr); MEM_NOTRAP_P (m_descr) = 1; r_func = expand_normal (t_func); r_chain = expand_normal (t_chain); emit_move_insn (adjust_address_nv (m_descr, ptr_mode, 0), r_chain); emit_move_insn (adjust_address_nv (m_descr, ptr_mode, POINTER_SIZE / BITS_PER_UNIT), r_func); return const0_rtx; }
[ "static", "rtx", "expand_builtin_init_descriptor", "(", "tree", "exp", ")", "{", "tree", "t_descr", ",", "t_func", ",", "t_chain", ";", "rtx", "m_descr", ",", "r_descr", ",", "r_func", ",", "r_chain", ";", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "POINTER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "t_descr", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "t_func", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "t_chain", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "r_descr", "=", "expand_normal", "(", "t_descr", ")", ";", "m_descr", "=", "gen_rtx_MEM", "(", "BLKmode", ",", "r_descr", ")", ";", "MEM_NOTRAP_P", "(", "m_descr", ")", "=", "1", ";", "r_func", "=", "expand_normal", "(", "t_func", ")", ";", "r_chain", "=", "expand_normal", "(", "t_chain", ")", ";", "emit_move_insn", "(", "adjust_address_nv", "(", "m_descr", ",", "ptr_mode", ",", "0", ")", ",", "r_chain", ")", ";", "emit_move_insn", "(", "adjust_address_nv", "(", "m_descr", ",", "ptr_mode", ",", "POINTER_SIZE", "/", "BITS_PER_UNIT", ")", ",", "r_func", ")", ";", "return", "const0_rtx", ";", "}" ]
Expand a call to the builtin descriptor initialization routine.
[ "Expand", "a", "call", "to", "the", "builtin", "descriptor", "initialization", "routine", "." ]
[ "/* Generate insns to initialize the descriptor. */" ]
[ { "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_adjust_descriptor
rtx
static rtx expand_builtin_adjust_descriptor (tree exp) { rtx tramp; if (!validate_arglist (exp, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; tramp = expand_normal (CALL_EXPR_ARG (exp, 0)); /* Unalign the descriptor to allow runtime identification. */ tramp = plus_constant (ptr_mode, tramp, targetm.calls.custom_function_descriptors); return force_operand (tramp, NULL_RTX); }
/* Expand a call to the builtin descriptor adjustment routine. */
Expand a call to the builtin descriptor adjustment routine.
[ "Expand", "a", "call", "to", "the", "builtin", "descriptor", "adjustment", "routine", "." ]
static rtx expand_builtin_adjust_descriptor (tree exp) { rtx tramp; if (!validate_arglist (exp, POINTER_TYPE, VOID_TYPE)) return NULL_RTX; tramp = expand_normal (CALL_EXPR_ARG (exp, 0)); tramp = plus_constant (ptr_mode, tramp, targetm.calls.custom_function_descriptors); return force_operand (tramp, NULL_RTX); }
[ "static", "rtx", "expand_builtin_adjust_descriptor", "(", "tree", "exp", ")", "{", "rtx", "tramp", ";", "if", "(", "!", "validate_arglist", "(", "exp", ",", "POINTER_TYPE", ",", "VOID_TYPE", ")", ")", "return", "NULL_RTX", ";", "tramp", "=", "expand_normal", "(", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ")", ";", "tramp", "=", "plus_constant", "(", "ptr_mode", ",", "tramp", ",", "targetm", ".", "calls", ".", "custom_function_descriptors", ")", ";", "return", "force_operand", "(", "tramp", ",", "NULL_RTX", ")", ";", "}" ]
Expand a call to the builtin descriptor adjustment routine.
[ "Expand", "a", "call", "to", "the", "builtin", "descriptor", "adjustment", "routine", "." ]
[ "/* Unalign the descriptor to allow runtime identification. */" ]
[ { "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_ifn_atomic_compare_exchange_into_call
void
static void expand_ifn_atomic_compare_exchange_into_call (gcall *call, machine_mode mode) { unsigned int z; vec<tree, va_gc> *vec; vec_alloc (vec, 5); vec->quick_push (gimple_call_arg (call, 0)); tree expected = gimple_call_arg (call, 1); rtx x = assign_stack_temp_for_type (mode, GET_MODE_SIZE (mode), TREE_TYPE (expected)); rtx expd = expand_expr (expected, x, mode, EXPAND_NORMAL); if (expd != x) emit_move_insn (x, expd); tree v = make_tree (TREE_TYPE (expected), x); vec->quick_push (build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (expected)), v)); vec->quick_push (gimple_call_arg (call, 2)); /* Skip the boolean weak parameter. */ for (z = 4; z < 6; z++) vec->quick_push (gimple_call_arg (call, z)); /* At present we only have BUILT_IN_ATOMIC_COMPARE_EXCHANGE_{1,2,4,8,16}. */ unsigned int bytes_log2 = exact_log2 (GET_MODE_SIZE (mode).to_constant ()); gcc_assert (bytes_log2 < 5); built_in_function fncode = (built_in_function) ((int) BUILT_IN_ATOMIC_COMPARE_EXCHANGE_1 + bytes_log2); tree fndecl = builtin_decl_explicit (fncode); tree fn = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fndecl)), fndecl); tree exp = build_call_vec (boolean_type_node, fn, vec); tree lhs = gimple_call_lhs (call); rtx boolret = expand_call (exp, NULL_RTX, lhs == NULL_TREE); if (lhs) { rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); if (GET_MODE (boolret) != mode) boolret = convert_modes (mode, GET_MODE (boolret), boolret, 1); x = force_reg (mode, x); write_complex_part (target, boolret, true); write_complex_part (target, x, false); } }
/* Helper function for expand_ifn_atomic_compare_exchange - expand internal ATOMIC_COMPARE_EXCHANGE call into __atomic_compare_exchange_N call. The weak parameter must be dropped to match the expected parameter list and the expected argument changed from value to pointer to memory slot. */
Helper function for expand_ifn_atomic_compare_exchange - expand internal ATOMIC_COMPARE_EXCHANGE call into __atomic_compare_exchange_N call. The weak parameter must be dropped to match the expected parameter list and the expected argument changed from value to pointer to memory slot.
[ "Helper", "function", "for", "expand_ifn_atomic_compare_exchange", "-", "expand", "internal", "ATOMIC_COMPARE_EXCHANGE", "call", "into", "__atomic_compare_exchange_N", "call", ".", "The", "weak", "parameter", "must", "be", "dropped", "to", "match", "the", "expected", "parameter", "list", "and", "the", "expected", "argument", "changed", "from", "value", "to", "pointer", "to", "memory", "slot", "." ]
static void expand_ifn_atomic_compare_exchange_into_call (gcall *call, machine_mode mode) { unsigned int z; vec<tree, va_gc> *vec; vec_alloc (vec, 5); vec->quick_push (gimple_call_arg (call, 0)); tree expected = gimple_call_arg (call, 1); rtx x = assign_stack_temp_for_type (mode, GET_MODE_SIZE (mode), TREE_TYPE (expected)); rtx expd = expand_expr (expected, x, mode, EXPAND_NORMAL); if (expd != x) emit_move_insn (x, expd); tree v = make_tree (TREE_TYPE (expected), x); vec->quick_push (build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (expected)), v)); vec->quick_push (gimple_call_arg (call, 2)); for (z = 4; z < 6; z++) vec->quick_push (gimple_call_arg (call, z)); unsigned int bytes_log2 = exact_log2 (GET_MODE_SIZE (mode).to_constant ()); gcc_assert (bytes_log2 < 5); built_in_function fncode = (built_in_function) ((int) BUILT_IN_ATOMIC_COMPARE_EXCHANGE_1 + bytes_log2); tree fndecl = builtin_decl_explicit (fncode); tree fn = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fndecl)), fndecl); tree exp = build_call_vec (boolean_type_node, fn, vec); tree lhs = gimple_call_lhs (call); rtx boolret = expand_call (exp, NULL_RTX, lhs == NULL_TREE); if (lhs) { rtx target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE); if (GET_MODE (boolret) != mode) boolret = convert_modes (mode, GET_MODE (boolret), boolret, 1); x = force_reg (mode, x); write_complex_part (target, boolret, true); write_complex_part (target, x, false); } }
[ "static", "void", "expand_ifn_atomic_compare_exchange_into_call", "(", "gcall", "*", "call", ",", "machine_mode", "mode", ")", "{", "unsigned", "int", "z", ";", "vec", "<", "tree", ",", "va_gc", ">", "*", "vec", ";", "vec_alloc", "(", "vec", ",", "5", ")", ";", "vec", "->", "quick_push", "(", "gimple_call_arg", "(", "call", ",", "0", ")", ")", ";", "tree", "expected", "=", "gimple_call_arg", "(", "call", ",", "1", ")", ";", "rtx", "x", "=", "assign_stack_temp_for_type", "(", "mode", ",", "GET_MODE_SIZE", "(", "mode", ")", ",", "TREE_TYPE", "(", "expected", ")", ")", ";", "rtx", "expd", "=", "expand_expr", "(", "expected", ",", "x", ",", "mode", ",", "EXPAND_NORMAL", ")", ";", "if", "(", "expd", "!=", "x", ")", "emit_move_insn", "(", "x", ",", "expd", ")", ";", "tree", "v", "=", "make_tree", "(", "TREE_TYPE", "(", "expected", ")", ",", "x", ")", ";", "vec", "->", "quick_push", "(", "build1", "(", "ADDR_EXPR", ",", "build_pointer_type", "(", "TREE_TYPE", "(", "expected", ")", ")", ",", "v", ")", ")", ";", "vec", "->", "quick_push", "(", "gimple_call_arg", "(", "call", ",", "2", ")", ")", ";", "for", "(", "z", "=", "4", ";", "z", "<", "6", ";", "z", "++", ")", "vec", "->", "quick_push", "(", "gimple_call_arg", "(", "call", ",", "z", ")", ")", ";", "unsigned", "int", "bytes_log2", "=", "exact_log2", "(", "GET_MODE_SIZE", "(", "mode", ")", ".", "to_constant", "(", ")", ")", ";", "gcc_assert", "(", "bytes_log2", "<", "5", ")", ";", "built_in_function", "fncode", "=", "(", "built_in_function", ")", "(", "(", "int", ")", "BUILT_IN_ATOMIC_COMPARE_EXCHANGE_1", "+", "bytes_log2", ")", ";", "tree", "fndecl", "=", "builtin_decl_explicit", "(", "fncode", ")", ";", "tree", "fn", "=", "build1", "(", "ADDR_EXPR", ",", "build_pointer_type", "(", "TREE_TYPE", "(", "fndecl", ")", ")", ",", "fndecl", ")", ";", "tree", "exp", "=", "build_call_vec", "(", "boolean_type_node", ",", "fn", ",", "vec", ")", ";", "tree", "lhs", "=", "gimple_call_lhs", "(", "call", ")", ";", "rtx", "boolret", "=", "expand_call", "(", "exp", ",", "NULL_RTX", ",", "lhs", "==", "NULL_TREE", ")", ";", "if", "(", "lhs", ")", "{", "rtx", "target", "=", "expand_expr", "(", "lhs", ",", "NULL_RTX", ",", "VOIDmode", ",", "EXPAND_WRITE", ")", ";", "if", "(", "GET_MODE", "(", "boolret", ")", "!=", "mode", ")", "boolret", "=", "convert_modes", "(", "mode", ",", "GET_MODE", "(", "boolret", ")", ",", "boolret", ",", "1", ")", ";", "x", "=", "force_reg", "(", "mode", ",", "x", ")", ";", "write_complex_part", "(", "target", ",", "boolret", ",", "true", ")", ";", "write_complex_part", "(", "target", ",", "x", ",", "false", ")", ";", "}", "}" ]
Helper function for expand_ifn_atomic_compare_exchange - expand internal ATOMIC_COMPARE_EXCHANGE call into __atomic_compare_exchange_N call.
[ "Helper", "function", "for", "expand_ifn_atomic_compare_exchange", "-", "expand", "internal", "ATOMIC_COMPARE_EXCHANGE", "call", "into", "__atomic_compare_exchange_N", "call", "." ]
[ "/* Skip the boolean weak parameter. */", "/* At present we only have BUILT_IN_ATOMIC_COMPARE_EXCHANGE_{1,2,4,8,16}. */" ]
[ { "param": "call", "type": "gcall" }, { "param": "mode", "type": "machine_mode" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "call", "type": "gcall", "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_atomic_fetch_op
rtx
static rtx expand_builtin_atomic_fetch_op (machine_mode mode, tree exp, rtx target, enum rtx_code code, bool fetch_after, bool ignore, enum built_in_function ext_call) { rtx val, mem, ret; enum memmodel model; tree fndecl; tree addr; model = get_memmodel (CALL_EXPR_ARG (exp, 2)); /* Expand the operands. */ mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode); val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode); /* Only try generating instructions if inlining is turned on. */ if (flag_inline_atomics) { ret = expand_atomic_fetch_op (target, mem, val, code, model, fetch_after); if (ret) return ret; } /* Return if a different routine isn't needed for the library call. */ if (ext_call == BUILT_IN_NONE) return NULL_RTX; /* Change the call to the specified function. */ fndecl = get_callee_fndecl (exp); addr = CALL_EXPR_FN (exp); STRIP_NOPS (addr); gcc_assert (TREE_OPERAND (addr, 0) == fndecl); TREE_OPERAND (addr, 0) = builtin_decl_explicit (ext_call); /* If we will emit code after the call, the call can not be a tail call. If it is emitted as a tail call, a barrier is emitted after it, and then all trailing code is removed. */ if (!ignore) CALL_EXPR_TAILCALL (exp) = 0; /* Expand the call here so we can emit trailing code. */ ret = expand_call (exp, target, ignore); /* Replace the original function just in case it matters. */ TREE_OPERAND (addr, 0) = fndecl; /* Then issue the arithmetic correction to return the right result. */ if (!ignore) { if (code == NOT) { ret = expand_simple_binop (mode, AND, ret, val, NULL_RTX, true, OPTAB_LIB_WIDEN); ret = expand_simple_unop (mode, NOT, ret, target, true); } else ret = expand_simple_binop (mode, code, ret, val, target, true, OPTAB_LIB_WIDEN); } return ret; }
/* Expand the __atomic_fetch_XXX intrinsic: TYPE __atomic_fetch_XXX (TYPE *object, TYPE val, enum memmodel) EXP is the CALL_EXPR. TARGET is an optional place for us to store the results. CODE is the operation, PLUS, MINUS, ADD, XOR, or IOR. FETCH_AFTER is true if returning the result of the operation. FETCH_AFTER is false if returning the value before the operation. IGNORE is true if the result is not used. EXT_CALL is the correct builtin for an external call if this cannot be resolved to an instruction sequence. */
Expand the __atomic_fetch_XXX intrinsic: TYPE __atomic_fetch_XXX (TYPE *object, TYPE val, enum memmodel) EXP is the CALL_EXPR. TARGET is an optional place for us to store the results. CODE is the operation, PLUS, MINUS, ADD, XOR, or IOR. FETCH_AFTER is true if returning the result of the operation. FETCH_AFTER is false if returning the value before the operation. IGNORE is true if the result is not used. EXT_CALL is the correct builtin for an external call if this cannot be resolved to an instruction sequence.
[ "Expand", "the", "__atomic_fetch_XXX", "intrinsic", ":", "TYPE", "__atomic_fetch_XXX", "(", "TYPE", "*", "object", "TYPE", "val", "enum", "memmodel", ")", "EXP", "is", "the", "CALL_EXPR", ".", "TARGET", "is", "an", "optional", "place", "for", "us", "to", "store", "the", "results", ".", "CODE", "is", "the", "operation", "PLUS", "MINUS", "ADD", "XOR", "or", "IOR", ".", "FETCH_AFTER", "is", "true", "if", "returning", "the", "result", "of", "the", "operation", ".", "FETCH_AFTER", "is", "false", "if", "returning", "the", "value", "before", "the", "operation", ".", "IGNORE", "is", "true", "if", "the", "result", "is", "not", "used", ".", "EXT_CALL", "is", "the", "correct", "builtin", "for", "an", "external", "call", "if", "this", "cannot", "be", "resolved", "to", "an", "instruction", "sequence", "." ]
static rtx expand_builtin_atomic_fetch_op (machine_mode mode, tree exp, rtx target, enum rtx_code code, bool fetch_after, bool ignore, enum built_in_function ext_call) { rtx val, mem, ret; enum memmodel model; tree fndecl; tree addr; model = get_memmodel (CALL_EXPR_ARG (exp, 2)); mem = get_builtin_sync_mem (CALL_EXPR_ARG (exp, 0), mode); val = expand_expr_force_mode (CALL_EXPR_ARG (exp, 1), mode); if (flag_inline_atomics) { ret = expand_atomic_fetch_op (target, mem, val, code, model, fetch_after); if (ret) return ret; } if (ext_call == BUILT_IN_NONE) return NULL_RTX; fndecl = get_callee_fndecl (exp); addr = CALL_EXPR_FN (exp); STRIP_NOPS (addr); gcc_assert (TREE_OPERAND (addr, 0) == fndecl); TREE_OPERAND (addr, 0) = builtin_decl_explicit (ext_call); if (!ignore) CALL_EXPR_TAILCALL (exp) = 0; ret = expand_call (exp, target, ignore); TREE_OPERAND (addr, 0) = fndecl; if (!ignore) { if (code == NOT) { ret = expand_simple_binop (mode, AND, ret, val, NULL_RTX, true, OPTAB_LIB_WIDEN); ret = expand_simple_unop (mode, NOT, ret, target, true); } else ret = expand_simple_binop (mode, code, ret, val, target, true, OPTAB_LIB_WIDEN); } return ret; }
[ "static", "rtx", "expand_builtin_atomic_fetch_op", "(", "machine_mode", "mode", ",", "tree", "exp", ",", "rtx", "target", ",", "enum", "rtx_code", "code", ",", "bool", "fetch_after", ",", "bool", "ignore", ",", "enum", "built_in_function", "ext_call", ")", "{", "rtx", "val", ",", "mem", ",", "ret", ";", "enum", "memmodel", "model", ";", "tree", "fndecl", ";", "tree", "addr", ";", "model", "=", "get_memmodel", "(", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ")", ";", "mem", "=", "get_builtin_sync_mem", "(", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ",", "mode", ")", ";", "val", "=", "expand_expr_force_mode", "(", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ",", "mode", ")", ";", "if", "(", "flag_inline_atomics", ")", "{", "ret", "=", "expand_atomic_fetch_op", "(", "target", ",", "mem", ",", "val", ",", "code", ",", "model", ",", "fetch_after", ")", ";", "if", "(", "ret", ")", "return", "ret", ";", "}", "if", "(", "ext_call", "==", "BUILT_IN_NONE", ")", "return", "NULL_RTX", ";", "fndecl", "=", "get_callee_fndecl", "(", "exp", ")", ";", "addr", "=", "CALL_EXPR_FN", "(", "exp", ")", ";", "STRIP_NOPS", "(", "addr", ")", ";", "gcc_assert", "(", "TREE_OPERAND", "(", "addr", ",", "0", ")", "==", "fndecl", ")", ";", "TREE_OPERAND", "(", "addr", ",", "0", ")", "=", "builtin_decl_explicit", "(", "ext_call", ")", ";", "if", "(", "!", "ignore", ")", "CALL_EXPR_TAILCALL", "(", "exp", ")", "=", "0", ";", "ret", "=", "expand_call", "(", "exp", ",", "target", ",", "ignore", ")", ";", "TREE_OPERAND", "(", "addr", ",", "0", ")", "=", "fndecl", ";", "if", "(", "!", "ignore", ")", "{", "if", "(", "code", "==", "NOT", ")", "{", "ret", "=", "expand_simple_binop", "(", "mode", ",", "AND", ",", "ret", ",", "val", ",", "NULL_RTX", ",", "true", ",", "OPTAB_LIB_WIDEN", ")", ";", "ret", "=", "expand_simple_unop", "(", "mode", ",", "NOT", ",", "ret", ",", "target", ",", "true", ")", ";", "}", "else", "ret", "=", "expand_simple_binop", "(", "mode", ",", "code", ",", "ret", ",", "val", ",", "target", ",", "true", ",", "OPTAB_LIB_WIDEN", ")", ";", "}", "return", "ret", ";", "}" ]
Expand the __atomic_fetch_XXX intrinsic: TYPE __atomic_fetch_XXX (TYPE *object, TYPE val, enum memmodel) EXP is the CALL_EXPR.
[ "Expand", "the", "__atomic_fetch_XXX", "intrinsic", ":", "TYPE", "__atomic_fetch_XXX", "(", "TYPE", "*", "object", "TYPE", "val", "enum", "memmodel", ")", "EXP", "is", "the", "CALL_EXPR", "." ]
[ "/* Expand the operands. */", "/* Only try generating instructions if inlining is turned on. */", "/* Return if a different routine isn't needed for the library call. */", "/* Change the call to the specified function. */", "/* If we will emit code after the call, the call can not be a tail call.\n If it is emitted as a tail call, a barrier is emitted after it, and\n then all trailing code is removed. */", "/* Expand the call here so we can emit trailing code. */", "/* Replace the original function just in case it matters. */", "/* Then issue the arithmetic correction to return the right result. */" ]
[ { "param": "mode", "type": "machine_mode" }, { "param": "exp", "type": "tree" }, { "param": "target", "type": "rtx" }, { "param": "code", "type": "enum rtx_code" }, { "param": "fetch_after", "type": "bool" }, { "param": "ignore", "type": "bool" }, { "param": "ext_call", "type": "enum built_in_function" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "mode", "type": "machine_mode", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "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": "code", "type": "enum rtx_code", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fetch_after", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ignore", "type": "bool", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ext_call", "type": "enum built_in_function", "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
fold_builtin_atomic_always_lock_free
tree
static tree fold_builtin_atomic_always_lock_free (tree arg0, tree arg1) { int size; machine_mode mode; unsigned int mode_align, type_align; if (TREE_CODE (arg0) != INTEGER_CST) return NULL_TREE; /* We need a corresponding integer mode for the access to be lock-free. */ size = INTVAL (expand_normal (arg0)) * BITS_PER_UNIT; if (!int_mode_for_size (size, 0).exists (&mode)) return boolean_false_node; mode_align = GET_MODE_ALIGNMENT (mode); if (TREE_CODE (arg1) == INTEGER_CST) { unsigned HOST_WIDE_INT val = UINTVAL (expand_normal (arg1)); /* Either this argument is null, or it's a fake pointer encoding the alignment of the object. */ val = least_bit_hwi (val); val *= BITS_PER_UNIT; if (val == 0 || mode_align < val) type_align = mode_align; else type_align = val; } else { tree ttype = TREE_TYPE (arg1); /* This function is usually invoked and folded immediately by the front end before anything else has a chance to look at it. The pointer parameter at this point is usually cast to a void *, so check for that and look past the cast. */ if (CONVERT_EXPR_P (arg1) && POINTER_TYPE_P (ttype) && VOID_TYPE_P (TREE_TYPE (ttype)) && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0)))) arg1 = TREE_OPERAND (arg1, 0); ttype = TREE_TYPE (arg1); gcc_assert (POINTER_TYPE_P (ttype)); /* Get the underlying type of the object. */ ttype = TREE_TYPE (ttype); type_align = TYPE_ALIGN (ttype); } /* If the object has smaller alignment, the lock free routines cannot be used. */ if (type_align < mode_align) return boolean_false_node; /* Check if a compare_and_swap pattern exists for the mode which represents the required size. The pattern is not allowed to fail, so the existence of the pattern indicates support is present. Also require that an atomic load exists for the required size. */ if (can_compare_and_swap_p (mode, true) && can_atomic_load_p (mode)) return boolean_true_node; else return boolean_false_node; }
/* Return true if (optional) argument ARG1 of size ARG0 is always lock free on this architecture. If ARG1 is NULL, use typical alignment for size ARG0. */
Return true if (optional) argument ARG1 of size ARG0 is always lock free on this architecture. If ARG1 is NULL, use typical alignment for size ARG0.
[ "Return", "true", "if", "(", "optional", ")", "argument", "ARG1", "of", "size", "ARG0", "is", "always", "lock", "free", "on", "this", "architecture", ".", "If", "ARG1", "is", "NULL", "use", "typical", "alignment", "for", "size", "ARG0", "." ]
static tree fold_builtin_atomic_always_lock_free (tree arg0, tree arg1) { int size; machine_mode mode; unsigned int mode_align, type_align; if (TREE_CODE (arg0) != INTEGER_CST) return NULL_TREE; size = INTVAL (expand_normal (arg0)) * BITS_PER_UNIT; if (!int_mode_for_size (size, 0).exists (&mode)) return boolean_false_node; mode_align = GET_MODE_ALIGNMENT (mode); if (TREE_CODE (arg1) == INTEGER_CST) { unsigned HOST_WIDE_INT val = UINTVAL (expand_normal (arg1)); val = least_bit_hwi (val); val *= BITS_PER_UNIT; if (val == 0 || mode_align < val) type_align = mode_align; else type_align = val; } else { tree ttype = TREE_TYPE (arg1); if (CONVERT_EXPR_P (arg1) && POINTER_TYPE_P (ttype) && VOID_TYPE_P (TREE_TYPE (ttype)) && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0)))) arg1 = TREE_OPERAND (arg1, 0); ttype = TREE_TYPE (arg1); gcc_assert (POINTER_TYPE_P (ttype)); ttype = TREE_TYPE (ttype); type_align = TYPE_ALIGN (ttype); } if (type_align < mode_align) return boolean_false_node; if (can_compare_and_swap_p (mode, true) && can_atomic_load_p (mode)) return boolean_true_node; else return boolean_false_node; }
[ "static", "tree", "fold_builtin_atomic_always_lock_free", "(", "tree", "arg0", ",", "tree", "arg1", ")", "{", "int", "size", ";", "machine_mode", "mode", ";", "unsigned", "int", "mode_align", ",", "type_align", ";", "if", "(", "TREE_CODE", "(", "arg0", ")", "!=", "INTEGER_CST", ")", "return", "NULL_TREE", ";", "size", "=", "INTVAL", "(", "expand_normal", "(", "arg0", ")", ")", "*", "BITS_PER_UNIT", ";", "if", "(", "!", "int_mode_for_size", "(", "size", ",", "0", ")", ".", "exists", "(", "&", "mode", ")", ")", "return", "boolean_false_node", ";", "mode_align", "=", "GET_MODE_ALIGNMENT", "(", "mode", ")", ";", "if", "(", "TREE_CODE", "(", "arg1", ")", "==", "INTEGER_CST", ")", "{", "unsigned", "HOST_WIDE_INT", "val", "=", "UINTVAL", "(", "expand_normal", "(", "arg1", ")", ")", ";", "val", "=", "least_bit_hwi", "(", "val", ")", ";", "val", "*=", "BITS_PER_UNIT", ";", "if", "(", "val", "==", "0", "||", "mode_align", "<", "val", ")", "type_align", "=", "mode_align", ";", "else", "type_align", "=", "val", ";", "}", "else", "{", "tree", "ttype", "=", "TREE_TYPE", "(", "arg1", ")", ";", "if", "(", "CONVERT_EXPR_P", "(", "arg1", ")", "&&", "POINTER_TYPE_P", "(", "ttype", ")", "&&", "VOID_TYPE_P", "(", "TREE_TYPE", "(", "ttype", ")", ")", "&&", "POINTER_TYPE_P", "(", "TREE_TYPE", "(", "TREE_OPERAND", "(", "arg1", ",", "0", ")", ")", ")", ")", "arg1", "=", "TREE_OPERAND", "(", "arg1", ",", "0", ")", ";", "ttype", "=", "TREE_TYPE", "(", "arg1", ")", ";", "gcc_assert", "(", "POINTER_TYPE_P", "(", "ttype", ")", ")", ";", "ttype", "=", "TREE_TYPE", "(", "ttype", ")", ";", "type_align", "=", "TYPE_ALIGN", "(", "ttype", ")", ";", "}", "if", "(", "type_align", "<", "mode_align", ")", "return", "boolean_false_node", ";", "if", "(", "can_compare_and_swap_p", "(", "mode", ",", "true", ")", "&&", "can_atomic_load_p", "(", "mode", ")", ")", "return", "boolean_true_node", ";", "else", "return", "boolean_false_node", ";", "}" ]
Return true if (optional) argument ARG1 of size ARG0 is always lock free on this architecture.
[ "Return", "true", "if", "(", "optional", ")", "argument", "ARG1", "of", "size", "ARG0", "is", "always", "lock", "free", "on", "this", "architecture", "." ]
[ "/* We need a corresponding integer mode for the access to be lock-free. */", "/* Either this argument is null, or it's a fake pointer encoding\n the alignment of the object. */", "/* This function is usually invoked and folded immediately by the front\n\t end before anything else has a chance to look at it. The pointer\n\t parameter at this point is usually cast to a void *, so check for that\n\t and look past the cast. */", "/* Get the underlying type of the object. */", "/* If the object has smaller alignment, the lock free routines cannot\n be used. */", "/* Check if a compare_and_swap pattern exists for the mode which represents\n the required size. The pattern is not allowed to fail, so the existence\n of the pattern indicates support is present. Also require that an\n atomic load exists for the required size. */" ]
[ { "param": "arg0", "type": "tree" }, { "param": "arg1", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "arg0", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg1", "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_stack_restore
void
static void expand_stack_restore (tree var) { rtx_insn *prev; rtx sa = expand_normal (var); sa = convert_memory_address (Pmode, sa); prev = get_last_insn (); emit_stack_restore (SAVE_BLOCK, sa); record_new_stack_level (); fixup_args_size_notes (prev, get_last_insn (), 0); }
/* Emit code to restore the current value of stack. */
Emit code to restore the current value of stack.
[ "Emit", "code", "to", "restore", "the", "current", "value", "of", "stack", "." ]
static void expand_stack_restore (tree var) { rtx_insn *prev; rtx sa = expand_normal (var); sa = convert_memory_address (Pmode, sa); prev = get_last_insn (); emit_stack_restore (SAVE_BLOCK, sa); record_new_stack_level (); fixup_args_size_notes (prev, get_last_insn (), 0); }
[ "static", "void", "expand_stack_restore", "(", "tree", "var", ")", "{", "rtx_insn", "*", "prev", ";", "rtx", "sa", "=", "expand_normal", "(", "var", ")", ";", "sa", "=", "convert_memory_address", "(", "Pmode", ",", "sa", ")", ";", "prev", "=", "get_last_insn", "(", ")", ";", "emit_stack_restore", "(", "SAVE_BLOCK", ",", "sa", ")", ";", "record_new_stack_level", "(", ")", ";", "fixup_args_size_notes", "(", "prev", ",", "get_last_insn", "(", ")", ",", "0", ")", ";", "}" ]
Emit code to restore the current value of stack.
[ "Emit", "code", "to", "restore", "the", "current", "value", "of", "stack", "." ]
[]
[ { "param": "var", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "var", "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_stack_save
rtx
static rtx expand_stack_save (void) { rtx ret = NULL_RTX; emit_stack_save (SAVE_BLOCK, &ret); return ret; }
/* Emit code to save the current value of stack. */
Emit code to save the current value of stack.
[ "Emit", "code", "to", "save", "the", "current", "value", "of", "stack", "." ]
static rtx expand_stack_save (void) { rtx ret = NULL_RTX; emit_stack_save (SAVE_BLOCK, &ret); return ret; }
[ "static", "rtx", "expand_stack_save", "(", "void", ")", "{", "rtx", "ret", "=", "NULL_RTX", ";", "emit_stack_save", "(", "SAVE_BLOCK", ",", "&", "ret", ")", ";", "return", "ret", ";", "}" ]
Emit code to save the current value of stack.
[ "Emit", "code", "to", "save", "the", "current", "value", "of", "stack", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
builtin_mathfn_code
null
enum built_in_function builtin_mathfn_code (const_tree t) { const_tree fndecl, arg, parmlist; const_tree argtype, parmtype; const_call_expr_arg_iterator iter; if (TREE_CODE (t) != CALL_EXPR) return END_BUILTINS; fndecl = get_callee_fndecl (t); if (fndecl == NULL_TREE || TREE_CODE (fndecl) != FUNCTION_DECL || ! DECL_BUILT_IN (fndecl) || DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD) return END_BUILTINS; parmlist = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); init_const_call_expr_arg_iterator (t, &iter); for (; parmlist; parmlist = TREE_CHAIN (parmlist)) { /* If a function doesn't take a variable number of arguments, the last element in the list will have type `void'. */ parmtype = TREE_VALUE (parmlist); if (VOID_TYPE_P (parmtype)) { if (more_const_call_expr_args_p (&iter)) return END_BUILTINS; return DECL_FUNCTION_CODE (fndecl); } if (! more_const_call_expr_args_p (&iter)) return END_BUILTINS; arg = next_const_call_expr_arg (&iter); argtype = TREE_TYPE (arg); if (SCALAR_FLOAT_TYPE_P (parmtype)) { if (! SCALAR_FLOAT_TYPE_P (argtype)) return END_BUILTINS; } else if (COMPLEX_FLOAT_TYPE_P (parmtype)) { if (! COMPLEX_FLOAT_TYPE_P (argtype)) return END_BUILTINS; } else if (POINTER_TYPE_P (parmtype)) { if (! POINTER_TYPE_P (argtype)) return END_BUILTINS; } else if (INTEGRAL_TYPE_P (parmtype)) { if (! INTEGRAL_TYPE_P (argtype)) return END_BUILTINS; } else return END_BUILTINS; } /* Variable-length argument list. */ return DECL_FUNCTION_CODE (fndecl); }
/* Determine whether a tree node represents a call to a built-in function. If the tree T is a call to a built-in function with the right number of arguments of the appropriate types, return the DECL_FUNCTION_CODE of the call, e.g. BUILT_IN_SQRT. Otherwise the return value is END_BUILTINS. */
Determine whether a tree node represents a call to a built-in function. If the tree T is a call to a built-in function with the right number of arguments of the appropriate types, return the DECL_FUNCTION_CODE of the call, e.g.
[ "Determine", "whether", "a", "tree", "node", "represents", "a", "call", "to", "a", "built", "-", "in", "function", ".", "If", "the", "tree", "T", "is", "a", "call", "to", "a", "built", "-", "in", "function", "with", "the", "right", "number", "of", "arguments", "of", "the", "appropriate", "types", "return", "the", "DECL_FUNCTION_CODE", "of", "the", "call", "e", ".", "g", "." ]
enum built_in_function builtin_mathfn_code (const_tree t) { const_tree fndecl, arg, parmlist; const_tree argtype, parmtype; const_call_expr_arg_iterator iter; if (TREE_CODE (t) != CALL_EXPR) return END_BUILTINS; fndecl = get_callee_fndecl (t); if (fndecl == NULL_TREE || TREE_CODE (fndecl) != FUNCTION_DECL || ! DECL_BUILT_IN (fndecl) || DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD) return END_BUILTINS; parmlist = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); init_const_call_expr_arg_iterator (t, &iter); for (; parmlist; parmlist = TREE_CHAIN (parmlist)) { parmtype = TREE_VALUE (parmlist); if (VOID_TYPE_P (parmtype)) { if (more_const_call_expr_args_p (&iter)) return END_BUILTINS; return DECL_FUNCTION_CODE (fndecl); } if (! more_const_call_expr_args_p (&iter)) return END_BUILTINS; arg = next_const_call_expr_arg (&iter); argtype = TREE_TYPE (arg); if (SCALAR_FLOAT_TYPE_P (parmtype)) { if (! SCALAR_FLOAT_TYPE_P (argtype)) return END_BUILTINS; } else if (COMPLEX_FLOAT_TYPE_P (parmtype)) { if (! COMPLEX_FLOAT_TYPE_P (argtype)) return END_BUILTINS; } else if (POINTER_TYPE_P (parmtype)) { if (! POINTER_TYPE_P (argtype)) return END_BUILTINS; } else if (INTEGRAL_TYPE_P (parmtype)) { if (! INTEGRAL_TYPE_P (argtype)) return END_BUILTINS; } else return END_BUILTINS; } return DECL_FUNCTION_CODE (fndecl); }
[ "enum", "built_in_function", "builtin_mathfn_code", "(", "const_tree", "t", ")", "{", "const_tree", "fndecl", ",", "arg", ",", "parmlist", ";", "const_tree", "argtype", ",", "parmtype", ";", "const_call_expr_arg_iterator", "iter", ";", "if", "(", "TREE_CODE", "(", "t", ")", "!=", "CALL_EXPR", ")", "return", "END_BUILTINS", ";", "fndecl", "=", "get_callee_fndecl", "(", "t", ")", ";", "if", "(", "fndecl", "==", "NULL_TREE", "||", "TREE_CODE", "(", "fndecl", ")", "!=", "FUNCTION_DECL", "||", "!", "DECL_BUILT_IN", "(", "fndecl", ")", "||", "DECL_BUILT_IN_CLASS", "(", "fndecl", ")", "==", "BUILT_IN_MD", ")", "return", "END_BUILTINS", ";", "parmlist", "=", "TYPE_ARG_TYPES", "(", "TREE_TYPE", "(", "fndecl", ")", ")", ";", "init_const_call_expr_arg_iterator", "(", "t", ",", "&", "iter", ")", ";", "for", "(", ";", "parmlist", ";", "parmlist", "=", "TREE_CHAIN", "(", "parmlist", ")", ")", "{", "parmtype", "=", "TREE_VALUE", "(", "parmlist", ")", ";", "if", "(", "VOID_TYPE_P", "(", "parmtype", ")", ")", "{", "if", "(", "more_const_call_expr_args_p", "(", "&", "iter", ")", ")", "return", "END_BUILTINS", ";", "return", "DECL_FUNCTION_CODE", "(", "fndecl", ")", ";", "}", "if", "(", "!", "more_const_call_expr_args_p", "(", "&", "iter", ")", ")", "return", "END_BUILTINS", ";", "arg", "=", "next_const_call_expr_arg", "(", "&", "iter", ")", ";", "argtype", "=", "TREE_TYPE", "(", "arg", ")", ";", "if", "(", "SCALAR_FLOAT_TYPE_P", "(", "parmtype", ")", ")", "{", "if", "(", "!", "SCALAR_FLOAT_TYPE_P", "(", "argtype", ")", ")", "return", "END_BUILTINS", ";", "}", "else", "if", "(", "COMPLEX_FLOAT_TYPE_P", "(", "parmtype", ")", ")", "{", "if", "(", "!", "COMPLEX_FLOAT_TYPE_P", "(", "argtype", ")", ")", "return", "END_BUILTINS", ";", "}", "else", "if", "(", "POINTER_TYPE_P", "(", "parmtype", ")", ")", "{", "if", "(", "!", "POINTER_TYPE_P", "(", "argtype", ")", ")", "return", "END_BUILTINS", ";", "}", "else", "if", "(", "INTEGRAL_TYPE_P", "(", "parmtype", ")", ")", "{", "if", "(", "!", "INTEGRAL_TYPE_P", "(", "argtype", ")", ")", "return", "END_BUILTINS", ";", "}", "else", "return", "END_BUILTINS", ";", "}", "return", "DECL_FUNCTION_CODE", "(", "fndecl", ")", ";", "}" ]
Determine whether a tree node represents a call to a built-in function.
[ "Determine", "whether", "a", "tree", "node", "represents", "a", "call", "to", "a", "built", "-", "in", "function", "." ]
[ "/* If a function doesn't take a variable number of arguments,\n\t the last element in the list will have type `void'. */", "/* Variable-length argument list. */" ]
[ { "param": "t", "type": "const_tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "t", "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
fold_builtin_expect
tree
tree fold_builtin_expect (location_t loc, tree arg0, tree arg1, tree arg2) { tree inner, fndecl, inner_arg0; enum tree_code code; /* Distribute the expected value over short-circuiting operators. See through the cast from truthvalue_type_node to long. */ inner_arg0 = arg0; while (CONVERT_EXPR_P (inner_arg0) && INTEGRAL_TYPE_P (TREE_TYPE (inner_arg0)) && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (inner_arg0, 0)))) inner_arg0 = TREE_OPERAND (inner_arg0, 0); /* If this is a builtin_expect within a builtin_expect keep the inner one. See through a comparison against a constant. It might have been added to create a thruthvalue. */ inner = inner_arg0; if (COMPARISON_CLASS_P (inner) && TREE_CODE (TREE_OPERAND (inner, 1)) == INTEGER_CST) inner = TREE_OPERAND (inner, 0); if (TREE_CODE (inner) == CALL_EXPR && (fndecl = get_callee_fndecl (inner)) && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT) return arg0; inner = inner_arg0; code = TREE_CODE (inner); if (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR) { tree op0 = TREE_OPERAND (inner, 0); tree op1 = TREE_OPERAND (inner, 1); arg1 = save_expr (arg1); op0 = build_builtin_expect_predicate (loc, op0, arg1, arg2); op1 = build_builtin_expect_predicate (loc, op1, arg1, arg2); inner = build2 (code, TREE_TYPE (inner), op0, op1); return fold_convert_loc (loc, TREE_TYPE (arg0), inner); } /* If the argument isn't invariant then there's nothing else we can do. */ if (!TREE_CONSTANT (inner_arg0)) return NULL_TREE; /* If we expect that a comparison against the argument will fold to a constant return the constant. In practice, this means a true constant or the address of a non-weak symbol. */ inner = inner_arg0; STRIP_NOPS (inner); if (TREE_CODE (inner) == ADDR_EXPR) { do { inner = TREE_OPERAND (inner, 0); } while (TREE_CODE (inner) == COMPONENT_REF || TREE_CODE (inner) == ARRAY_REF); if (VAR_OR_FUNCTION_DECL_P (inner) && DECL_WEAK (inner)) return NULL_TREE; } /* Otherwise, ARG0 already has the proper type for the return value. */ return arg0; }
/* Fold a call to builtin_expect with arguments ARG0 and ARG1. Return NULL_TREE if no simplification is possible. */
Fold a call to builtin_expect with arguments ARG0 and ARG1. Return NULL_TREE if no simplification is possible.
[ "Fold", "a", "call", "to", "builtin_expect", "with", "arguments", "ARG0", "and", "ARG1", ".", "Return", "NULL_TREE", "if", "no", "simplification", "is", "possible", "." ]
tree fold_builtin_expect (location_t loc, tree arg0, tree arg1, tree arg2) { tree inner, fndecl, inner_arg0; enum tree_code code; inner_arg0 = arg0; while (CONVERT_EXPR_P (inner_arg0) && INTEGRAL_TYPE_P (TREE_TYPE (inner_arg0)) && INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (inner_arg0, 0)))) inner_arg0 = TREE_OPERAND (inner_arg0, 0); inner = inner_arg0; if (COMPARISON_CLASS_P (inner) && TREE_CODE (TREE_OPERAND (inner, 1)) == INTEGER_CST) inner = TREE_OPERAND (inner, 0); if (TREE_CODE (inner) == CALL_EXPR && (fndecl = get_callee_fndecl (inner)) && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT) return arg0; inner = inner_arg0; code = TREE_CODE (inner); if (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR) { tree op0 = TREE_OPERAND (inner, 0); tree op1 = TREE_OPERAND (inner, 1); arg1 = save_expr (arg1); op0 = build_builtin_expect_predicate (loc, op0, arg1, arg2); op1 = build_builtin_expect_predicate (loc, op1, arg1, arg2); inner = build2 (code, TREE_TYPE (inner), op0, op1); return fold_convert_loc (loc, TREE_TYPE (arg0), inner); } if (!TREE_CONSTANT (inner_arg0)) return NULL_TREE; inner = inner_arg0; STRIP_NOPS (inner); if (TREE_CODE (inner) == ADDR_EXPR) { do { inner = TREE_OPERAND (inner, 0); } while (TREE_CODE (inner) == COMPONENT_REF || TREE_CODE (inner) == ARRAY_REF); if (VAR_OR_FUNCTION_DECL_P (inner) && DECL_WEAK (inner)) return NULL_TREE; } return arg0; }
[ "tree", "fold_builtin_expect", "(", "location_t", "loc", ",", "tree", "arg0", ",", "tree", "arg1", ",", "tree", "arg2", ")", "{", "tree", "inner", ",", "fndecl", ",", "inner_arg0", ";", "enum", "tree_code", "code", ";", "inner_arg0", "=", "arg0", ";", "while", "(", "CONVERT_EXPR_P", "(", "inner_arg0", ")", "&&", "INTEGRAL_TYPE_P", "(", "TREE_TYPE", "(", "inner_arg0", ")", ")", "&&", "INTEGRAL_TYPE_P", "(", "TREE_TYPE", "(", "TREE_OPERAND", "(", "inner_arg0", ",", "0", ")", ")", ")", ")", "inner_arg0", "=", "TREE_OPERAND", "(", "inner_arg0", ",", "0", ")", ";", "inner", "=", "inner_arg0", ";", "if", "(", "COMPARISON_CLASS_P", "(", "inner", ")", "&&", "TREE_CODE", "(", "TREE_OPERAND", "(", "inner", ",", "1", ")", ")", "==", "INTEGER_CST", ")", "inner", "=", "TREE_OPERAND", "(", "inner", ",", "0", ")", ";", "if", "(", "TREE_CODE", "(", "inner", ")", "==", "CALL_EXPR", "&&", "(", "fndecl", "=", "get_callee_fndecl", "(", "inner", ")", ")", "&&", "DECL_BUILT_IN_CLASS", "(", "fndecl", ")", "==", "BUILT_IN_NORMAL", "&&", "DECL_FUNCTION_CODE", "(", "fndecl", ")", "==", "BUILT_IN_EXPECT", ")", "return", "arg0", ";", "inner", "=", "inner_arg0", ";", "code", "=", "TREE_CODE", "(", "inner", ")", ";", "if", "(", "code", "==", "TRUTH_ANDIF_EXPR", "||", "code", "==", "TRUTH_ORIF_EXPR", ")", "{", "tree", "op0", "=", "TREE_OPERAND", "(", "inner", ",", "0", ")", ";", "tree", "op1", "=", "TREE_OPERAND", "(", "inner", ",", "1", ")", ";", "arg1", "=", "save_expr", "(", "arg1", ")", ";", "op0", "=", "build_builtin_expect_predicate", "(", "loc", ",", "op0", ",", "arg1", ",", "arg2", ")", ";", "op1", "=", "build_builtin_expect_predicate", "(", "loc", ",", "op1", ",", "arg1", ",", "arg2", ")", ";", "inner", "=", "build2", "(", "code", ",", "TREE_TYPE", "(", "inner", ")", ",", "op0", ",", "op1", ")", ";", "return", "fold_convert_loc", "(", "loc", ",", "TREE_TYPE", "(", "arg0", ")", ",", "inner", ")", ";", "}", "if", "(", "!", "TREE_CONSTANT", "(", "inner_arg0", ")", ")", "return", "NULL_TREE", ";", "inner", "=", "inner_arg0", ";", "STRIP_NOPS", "(", "inner", ")", ";", "if", "(", "TREE_CODE", "(", "inner", ")", "==", "ADDR_EXPR", ")", "{", "do", "{", "inner", "=", "TREE_OPERAND", "(", "inner", ",", "0", ")", ";", "}", "while", "(", "TREE_CODE", "(", "inner", ")", "==", "COMPONENT_REF", "||", "TREE_CODE", "(", "inner", ")", "==", "ARRAY_REF", ")", ";", "if", "(", "VAR_OR_FUNCTION_DECL_P", "(", "inner", ")", "&&", "DECL_WEAK", "(", "inner", ")", ")", "return", "NULL_TREE", ";", "}", "return", "arg0", ";", "}" ]
Fold a call to builtin_expect with arguments ARG0 and ARG1.
[ "Fold", "a", "call", "to", "builtin_expect", "with", "arguments", "ARG0", "and", "ARG1", "." ]
[ "/* Distribute the expected value over short-circuiting operators.\n See through the cast from truthvalue_type_node to long. */", "/* If this is a builtin_expect within a builtin_expect keep the\n inner one. See through a comparison against a constant. It\n might have been added to create a thruthvalue. */", "/* If the argument isn't invariant then there's nothing else we can do. */", "/* If we expect that a comparison against the argument will fold to\n a constant return the constant. In practice, this means a true\n constant or the address of a non-weak symbol. */", "/* Otherwise, ARG0 already has the proper type for the return value. */" ]
[ { "param": "loc", "type": "location_t" }, { "param": "arg0", "type": "tree" }, { "param": "arg1", "type": "tree" }, { "param": "arg2", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "location_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg0", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg1", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg2", "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
fold_builtin_sincos
tree
static tree fold_builtin_sincos (location_t loc, tree arg0, tree arg1, tree arg2) { tree type; tree fndecl, call = NULL_TREE; if (!validate_arg (arg0, REAL_TYPE) || !validate_arg (arg1, POINTER_TYPE) || !validate_arg (arg2, POINTER_TYPE)) return NULL_TREE; type = TREE_TYPE (arg0); /* Calculate the result when the argument is a constant. */ built_in_function fn = mathfn_built_in_2 (type, CFN_BUILT_IN_CEXPI); if (fn == END_BUILTINS) return NULL_TREE; /* Canonicalize sincos to cexpi. */ if (TREE_CODE (arg0) == REAL_CST) { tree complex_type = build_complex_type (type); call = fold_const_call (as_combined_fn (fn), complex_type, arg0); } if (!call) { if (!targetm.libc_has_function (function_c99_math_complex) || !builtin_decl_implicit_p (fn)) return NULL_TREE; fndecl = builtin_decl_explicit (fn); call = build_call_expr_loc (loc, fndecl, 1, arg0); call = builtin_save_expr (call); } return build2 (COMPOUND_EXPR, void_type_node, build2 (MODIFY_EXPR, void_type_node, build_fold_indirect_ref_loc (loc, arg1), fold_build1_loc (loc, IMAGPART_EXPR, type, call)), build2 (MODIFY_EXPR, void_type_node, build_fold_indirect_ref_loc (loc, arg2), fold_build1_loc (loc, REALPART_EXPR, type, call))); }
/* Fold function call to builtin sincos, sincosf, or sincosl. Return NULL_TREE if no simplification can be made. */
Fold function call to builtin sincos, sincosf, or sincosl. Return NULL_TREE if no simplification can be made.
[ "Fold", "function", "call", "to", "builtin", "sincos", "sincosf", "or", "sincosl", ".", "Return", "NULL_TREE", "if", "no", "simplification", "can", "be", "made", "." ]
static tree fold_builtin_sincos (location_t loc, tree arg0, tree arg1, tree arg2) { tree type; tree fndecl, call = NULL_TREE; if (!validate_arg (arg0, REAL_TYPE) || !validate_arg (arg1, POINTER_TYPE) || !validate_arg (arg2, POINTER_TYPE)) return NULL_TREE; type = TREE_TYPE (arg0); built_in_function fn = mathfn_built_in_2 (type, CFN_BUILT_IN_CEXPI); if (fn == END_BUILTINS) return NULL_TREE; if (TREE_CODE (arg0) == REAL_CST) { tree complex_type = build_complex_type (type); call = fold_const_call (as_combined_fn (fn), complex_type, arg0); } if (!call) { if (!targetm.libc_has_function (function_c99_math_complex) || !builtin_decl_implicit_p (fn)) return NULL_TREE; fndecl = builtin_decl_explicit (fn); call = build_call_expr_loc (loc, fndecl, 1, arg0); call = builtin_save_expr (call); } return build2 (COMPOUND_EXPR, void_type_node, build2 (MODIFY_EXPR, void_type_node, build_fold_indirect_ref_loc (loc, arg1), fold_build1_loc (loc, IMAGPART_EXPR, type, call)), build2 (MODIFY_EXPR, void_type_node, build_fold_indirect_ref_loc (loc, arg2), fold_build1_loc (loc, REALPART_EXPR, type, call))); }
[ "static", "tree", "fold_builtin_sincos", "(", "location_t", "loc", ",", "tree", "arg0", ",", "tree", "arg1", ",", "tree", "arg2", ")", "{", "tree", "type", ";", "tree", "fndecl", ",", "call", "=", "NULL_TREE", ";", "if", "(", "!", "validate_arg", "(", "arg0", ",", "REAL_TYPE", ")", "||", "!", "validate_arg", "(", "arg1", ",", "POINTER_TYPE", ")", "||", "!", "validate_arg", "(", "arg2", ",", "POINTER_TYPE", ")", ")", "return", "NULL_TREE", ";", "type", "=", "TREE_TYPE", "(", "arg0", ")", ";", "built_in_function", "fn", "=", "mathfn_built_in_2", "(", "type", ",", "CFN_BUILT_IN_CEXPI", ")", ";", "if", "(", "fn", "==", "END_BUILTINS", ")", "return", "NULL_TREE", ";", "if", "(", "TREE_CODE", "(", "arg0", ")", "==", "REAL_CST", ")", "{", "tree", "complex_type", "=", "build_complex_type", "(", "type", ")", ";", "call", "=", "fold_const_call", "(", "as_combined_fn", "(", "fn", ")", ",", "complex_type", ",", "arg0", ")", ";", "}", "if", "(", "!", "call", ")", "{", "if", "(", "!", "targetm", ".", "libc_has_function", "(", "function_c99_math_complex", ")", "||", "!", "builtin_decl_implicit_p", "(", "fn", ")", ")", "return", "NULL_TREE", ";", "fndecl", "=", "builtin_decl_explicit", "(", "fn", ")", ";", "call", "=", "build_call_expr_loc", "(", "loc", ",", "fndecl", ",", "1", ",", "arg0", ")", ";", "call", "=", "builtin_save_expr", "(", "call", ")", ";", "}", "return", "build2", "(", "COMPOUND_EXPR", ",", "void_type_node", ",", "build2", "(", "MODIFY_EXPR", ",", "void_type_node", ",", "build_fold_indirect_ref_loc", "(", "loc", ",", "arg1", ")", ",", "fold_build1_loc", "(", "loc", ",", "IMAGPART_EXPR", ",", "type", ",", "call", ")", ")", ",", "build2", "(", "MODIFY_EXPR", ",", "void_type_node", ",", "build_fold_indirect_ref_loc", "(", "loc", ",", "arg2", ")", ",", "fold_build1_loc", "(", "loc", ",", "REALPART_EXPR", ",", "type", ",", "call", ")", ")", ")", ";", "}" ]
Fold function call to builtin sincos, sincosf, or sincosl.
[ "Fold", "function", "call", "to", "builtin", "sincos", "sincosf", "or", "sincosl", "." ]
[ "/* Calculate the result when the argument is a constant. */", "/* Canonicalize sincos to cexpi. */" ]
[ { "param": "loc", "type": "location_t" }, { "param": "arg0", "type": "tree" }, { "param": "arg1", "type": "tree" }, { "param": "arg2", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "location_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg0", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg1", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg2", "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
fold_builtin_memcmp
tree
static tree fold_builtin_memcmp (location_t loc, tree arg1, tree arg2, tree len) { if (!validate_arg (arg1, POINTER_TYPE) || !validate_arg (arg2, POINTER_TYPE) || !validate_arg (len, INTEGER_TYPE)) return NULL_TREE; /* If the LEN parameter is zero, return zero. */ if (integer_zerop (len)) return omit_two_operands_loc (loc, integer_type_node, integer_zero_node, arg1, arg2); /* If ARG1 and ARG2 are the same (and not volatile), return zero. */ if (operand_equal_p (arg1, arg2, 0)) return omit_one_operand_loc (loc, integer_type_node, integer_zero_node, len); /* If len parameter is one, return an expression corresponding to (*(const unsigned char*)arg1 - (const unsigned char*)arg2). */ if (tree_fits_uhwi_p (len) && tree_to_uhwi (len) == 1) { tree cst_uchar_node = build_type_variant (unsigned_char_type_node, 1, 0); tree cst_uchar_ptr_node = build_pointer_type_for_mode (cst_uchar_node, ptr_mode, true); tree ind1 = fold_convert_loc (loc, integer_type_node, build1 (INDIRECT_REF, cst_uchar_node, fold_convert_loc (loc, cst_uchar_ptr_node, arg1))); tree ind2 = fold_convert_loc (loc, integer_type_node, build1 (INDIRECT_REF, cst_uchar_node, fold_convert_loc (loc, cst_uchar_ptr_node, arg2))); return fold_build2_loc (loc, MINUS_EXPR, integer_type_node, ind1, ind2); } return NULL_TREE; }
/* Fold function call to builtin memcmp with arguments ARG1 and ARG2. Return NULL_TREE if no simplification can be made. */
Fold function call to builtin memcmp with arguments ARG1 and ARG2. Return NULL_TREE if no simplification can be made.
[ "Fold", "function", "call", "to", "builtin", "memcmp", "with", "arguments", "ARG1", "and", "ARG2", ".", "Return", "NULL_TREE", "if", "no", "simplification", "can", "be", "made", "." ]
static tree fold_builtin_memcmp (location_t loc, tree arg1, tree arg2, tree len) { if (!validate_arg (arg1, POINTER_TYPE) || !validate_arg (arg2, POINTER_TYPE) || !validate_arg (len, INTEGER_TYPE)) return NULL_TREE; if (integer_zerop (len)) return omit_two_operands_loc (loc, integer_type_node, integer_zero_node, arg1, arg2); if (operand_equal_p (arg1, arg2, 0)) return omit_one_operand_loc (loc, integer_type_node, integer_zero_node, len); if (tree_fits_uhwi_p (len) && tree_to_uhwi (len) == 1) { tree cst_uchar_node = build_type_variant (unsigned_char_type_node, 1, 0); tree cst_uchar_ptr_node = build_pointer_type_for_mode (cst_uchar_node, ptr_mode, true); tree ind1 = fold_convert_loc (loc, integer_type_node, build1 (INDIRECT_REF, cst_uchar_node, fold_convert_loc (loc, cst_uchar_ptr_node, arg1))); tree ind2 = fold_convert_loc (loc, integer_type_node, build1 (INDIRECT_REF, cst_uchar_node, fold_convert_loc (loc, cst_uchar_ptr_node, arg2))); return fold_build2_loc (loc, MINUS_EXPR, integer_type_node, ind1, ind2); } return NULL_TREE; }
[ "static", "tree", "fold_builtin_memcmp", "(", "location_t", "loc", ",", "tree", "arg1", ",", "tree", "arg2", ",", "tree", "len", ")", "{", "if", "(", "!", "validate_arg", "(", "arg1", ",", "POINTER_TYPE", ")", "||", "!", "validate_arg", "(", "arg2", ",", "POINTER_TYPE", ")", "||", "!", "validate_arg", "(", "len", ",", "INTEGER_TYPE", ")", ")", "return", "NULL_TREE", ";", "if", "(", "integer_zerop", "(", "len", ")", ")", "return", "omit_two_operands_loc", "(", "loc", ",", "integer_type_node", ",", "integer_zero_node", ",", "arg1", ",", "arg2", ")", ";", "if", "(", "operand_equal_p", "(", "arg1", ",", "arg2", ",", "0", ")", ")", "return", "omit_one_operand_loc", "(", "loc", ",", "integer_type_node", ",", "integer_zero_node", ",", "len", ")", ";", "if", "(", "tree_fits_uhwi_p", "(", "len", ")", "&&", "tree_to_uhwi", "(", "len", ")", "==", "1", ")", "{", "tree", "cst_uchar_node", "=", "build_type_variant", "(", "unsigned_char_type_node", ",", "1", ",", "0", ")", ";", "tree", "cst_uchar_ptr_node", "=", "build_pointer_type_for_mode", "(", "cst_uchar_node", ",", "ptr_mode", ",", "true", ")", ";", "tree", "ind1", "=", "fold_convert_loc", "(", "loc", ",", "integer_type_node", ",", "build1", "(", "INDIRECT_REF", ",", "cst_uchar_node", ",", "fold_convert_loc", "(", "loc", ",", "cst_uchar_ptr_node", ",", "arg1", ")", ")", ")", ";", "tree", "ind2", "=", "fold_convert_loc", "(", "loc", ",", "integer_type_node", ",", "build1", "(", "INDIRECT_REF", ",", "cst_uchar_node", ",", "fold_convert_loc", "(", "loc", ",", "cst_uchar_ptr_node", ",", "arg2", ")", ")", ")", ";", "return", "fold_build2_loc", "(", "loc", ",", "MINUS_EXPR", ",", "integer_type_node", ",", "ind1", ",", "ind2", ")", ";", "}", "return", "NULL_TREE", ";", "}" ]
Fold function call to builtin memcmp with arguments ARG1 and ARG2.
[ "Fold", "function", "call", "to", "builtin", "memcmp", "with", "arguments", "ARG1", "and", "ARG2", "." ]
[ "/* If the LEN parameter is zero, return zero. */", "/* If ARG1 and ARG2 are the same (and not volatile), return zero. */", "/* If len parameter is one, return an expression corresponding to\n (*(const unsigned char*)arg1 - (const unsigned char*)arg2). */" ]
[ { "param": "loc", "type": "location_t" }, { "param": "arg1", "type": "tree" }, { "param": "arg2", "type": "tree" }, { "param": "len", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "location_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg1", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg2", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "len", "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
fold_builtin_fabs
tree
static tree fold_builtin_fabs (location_t loc, tree arg, tree type) { if (!validate_arg (arg, REAL_TYPE)) return NULL_TREE; arg = fold_convert_loc (loc, type, arg); return fold_build1_loc (loc, ABS_EXPR, type, arg); }
/* Fold a call to fabs, fabsf or fabsl with argument ARG. */
Fold a call to fabs, fabsf or fabsl with argument ARG.
[ "Fold", "a", "call", "to", "fabs", "fabsf", "or", "fabsl", "with", "argument", "ARG", "." ]
static tree fold_builtin_fabs (location_t loc, tree arg, tree type) { if (!validate_arg (arg, REAL_TYPE)) return NULL_TREE; arg = fold_convert_loc (loc, type, arg); return fold_build1_loc (loc, ABS_EXPR, type, arg); }
[ "static", "tree", "fold_builtin_fabs", "(", "location_t", "loc", ",", "tree", "arg", ",", "tree", "type", ")", "{", "if", "(", "!", "validate_arg", "(", "arg", ",", "REAL_TYPE", ")", ")", "return", "NULL_TREE", ";", "arg", "=", "fold_convert_loc", "(", "loc", ",", "type", ",", "arg", ")", ";", "return", "fold_build1_loc", "(", "loc", ",", "ABS_EXPR", ",", "type", ",", "arg", ")", ";", "}" ]
Fold a call to fabs, fabsf or fabsl with argument ARG.
[ "Fold", "a", "call", "to", "fabs", "fabsf", "or", "fabsl", "with", "argument", "ARG", "." ]
[]
[ { "param": "loc", "type": "location_t" }, { "param": "arg", "type": "tree" }, { "param": "type", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "location_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "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
fold_builtin_abs
tree
static tree fold_builtin_abs (location_t loc, tree arg, tree type) { if (!validate_arg (arg, INTEGER_TYPE)) return NULL_TREE; arg = fold_convert_loc (loc, type, arg); return fold_build1_loc (loc, ABS_EXPR, type, arg); }
/* Fold a call to abs, labs, llabs or imaxabs with argument ARG. */
Fold a call to abs, labs, llabs or imaxabs with argument ARG.
[ "Fold", "a", "call", "to", "abs", "labs", "llabs", "or", "imaxabs", "with", "argument", "ARG", "." ]
static tree fold_builtin_abs (location_t loc, tree arg, tree type) { if (!validate_arg (arg, INTEGER_TYPE)) return NULL_TREE; arg = fold_convert_loc (loc, type, arg); return fold_build1_loc (loc, ABS_EXPR, type, arg); }
[ "static", "tree", "fold_builtin_abs", "(", "location_t", "loc", ",", "tree", "arg", ",", "tree", "type", ")", "{", "if", "(", "!", "validate_arg", "(", "arg", ",", "INTEGER_TYPE", ")", ")", "return", "NULL_TREE", ";", "arg", "=", "fold_convert_loc", "(", "loc", ",", "type", ",", "arg", ")", ";", "return", "fold_build1_loc", "(", "loc", ",", "ABS_EXPR", ",", "type", ",", "arg", ")", ";", "}" ]
Fold a call to abs, labs, llabs or imaxabs with argument ARG.
[ "Fold", "a", "call", "to", "abs", "labs", "llabs", "or", "imaxabs", "with", "argument", "ARG", "." ]
[]
[ { "param": "loc", "type": "location_t" }, { "param": "arg", "type": "tree" }, { "param": "type", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "location_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "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
fold_builtin_FUNCTION
tree
static inline tree fold_builtin_FUNCTION () { const char *name = ""; if (current_function_decl) name = lang_hooks.decl_printable_name (current_function_decl, 0); return build_string_literal (strlen (name) + 1, name); }
/* Fold a call to __builtin_FUNCTION to a constant string. */
Fold a call to __builtin_FUNCTION to a constant string.
[ "Fold", "a", "call", "to", "__builtin_FUNCTION", "to", "a", "constant", "string", "." ]
static inline tree fold_builtin_FUNCTION () { const char *name = ""; if (current_function_decl) name = lang_hooks.decl_printable_name (current_function_decl, 0); return build_string_literal (strlen (name) + 1, name); }
[ "static", "inline", "tree", "fold_builtin_FUNCTION", "(", ")", "{", "const", "char", "*", "name", "=", "\"", "\"", ";", "if", "(", "current_function_decl", ")", "name", "=", "lang_hooks", ".", "decl_printable_name", "(", "current_function_decl", ",", "0", ")", ";", "return", "build_string_literal", "(", "strlen", "(", "name", ")", "+", "1", ",", "name", ")", ";", "}" ]
Fold a call to __builtin_FUNCTION to a constant string.
[ "Fold", "a", "call", "to", "__builtin_FUNCTION", "to", "a", "constant", "string", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a71555e8198cc70e74616e9fcb83cb9e501afa6a
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/builtins.c
[ "BSD-3-Clause" ]
C
fold_builtin_LINE
tree
static inline tree fold_builtin_LINE (location_t loc, tree type) { return build_int_cst (type, LOCATION_LINE (loc)); }
/* Fold a call to __builtin_LINE to an integer constant. */
Fold a call to __builtin_LINE to an integer constant.
[ "Fold", "a", "call", "to", "__builtin_LINE", "to", "an", "integer", "constant", "." ]
static inline tree fold_builtin_LINE (location_t loc, tree type) { return build_int_cst (type, LOCATION_LINE (loc)); }
[ "static", "inline", "tree", "fold_builtin_LINE", "(", "location_t", "loc", ",", "tree", "type", ")", "{", "return", "build_int_cst", "(", "type", ",", "LOCATION_LINE", "(", "loc", ")", ")", ";", "}" ]
Fold a call to __builtin_LINE to an integer constant.
[ "Fold", "a", "call", "to", "__builtin_LINE", "to", "an", "integer", "constant", "." ]
[]
[ { "param": "loc", "type": "location_t" }, { "param": "type", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "location_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "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
readonly_data_expr
bool
bool readonly_data_expr (tree exp) { STRIP_NOPS (exp); if (TREE_CODE (exp) != ADDR_EXPR) return false; exp = get_base_address (TREE_OPERAND (exp, 0)); if (!exp) return false; /* Make sure we call decl_readonly_section only for trees it can handle (since it returns true for everything it doesn't understand). */ if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR || (VAR_P (exp) && TREE_STATIC (exp))) return decl_readonly_section (exp, 0); else return false; }
/* Returns true is EXP represents data that would potentially reside in a readonly section. */
Returns true is EXP represents data that would potentially reside in a readonly section.
[ "Returns", "true", "is", "EXP", "represents", "data", "that", "would", "potentially", "reside", "in", "a", "readonly", "section", "." ]
bool readonly_data_expr (tree exp) { STRIP_NOPS (exp); if (TREE_CODE (exp) != ADDR_EXPR) return false; exp = get_base_address (TREE_OPERAND (exp, 0)); if (!exp) return false; if (TREE_CODE (exp) == STRING_CST || TREE_CODE (exp) == CONSTRUCTOR || (VAR_P (exp) && TREE_STATIC (exp))) return decl_readonly_section (exp, 0); else return false; }
[ "bool", "readonly_data_expr", "(", "tree", "exp", ")", "{", "STRIP_NOPS", "(", "exp", ")", ";", "if", "(", "TREE_CODE", "(", "exp", ")", "!=", "ADDR_EXPR", ")", "return", "false", ";", "exp", "=", "get_base_address", "(", "TREE_OPERAND", "(", "exp", ",", "0", ")", ")", ";", "if", "(", "!", "exp", ")", "return", "false", ";", "if", "(", "TREE_CODE", "(", "exp", ")", "==", "STRING_CST", "||", "TREE_CODE", "(", "exp", ")", "==", "CONSTRUCTOR", "||", "(", "VAR_P", "(", "exp", ")", "&&", "TREE_STATIC", "(", "exp", ")", ")", ")", "return", "decl_readonly_section", "(", "exp", ",", "0", ")", ";", "else", "return", "false", ";", "}" ]
Returns true is EXP represents data that would potentially reside in a readonly section.
[ "Returns", "true", "is", "EXP", "represents", "data", "that", "would", "potentially", "reside", "in", "a", "readonly", "section", "." ]
[ "/* Make sure we call decl_readonly_section only for trees it\n can handle (since it returns true for everything it doesn't\n understand). */" ]
[ { "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
fold_builtin_strpbrk
tree
static tree fold_builtin_strpbrk (location_t loc, tree s1, tree s2, tree type) { if (!validate_arg (s1, POINTER_TYPE) || !validate_arg (s2, POINTER_TYPE)) return NULL_TREE; else { tree fn; const char *p1, *p2; p2 = c_getstr (s2); if (p2 == NULL) return NULL_TREE; p1 = c_getstr (s1); if (p1 != NULL) { const char *r = strpbrk (p1, p2); tree tem; if (r == NULL) return build_int_cst (TREE_TYPE (s1), 0); /* Return an offset into the constant string argument. */ tem = fold_build_pointer_plus_hwi_loc (loc, s1, r - p1); return fold_convert_loc (loc, type, tem); } if (p2[0] == '\0') /* strpbrk(x, "") == NULL. Evaluate and ignore s1 in case it had side-effects. */ return omit_one_operand_loc (loc, type, integer_zero_node, s1); if (p2[1] != '\0') return NULL_TREE; /* Really call strpbrk. */ fn = builtin_decl_implicit (BUILT_IN_STRCHR); if (!fn) return NULL_TREE; /* New argument list transforming strpbrk(s1, s2) to strchr(s1, s2[0]). */ return build_call_expr_loc (loc, fn, 2, s1, build_int_cst (integer_type_node, p2[0])); } }
/* Simplify a call to the strpbrk builtin. S1 and S2 are the arguments to the call, and TYPE is its return type. Return NULL_TREE if no simplification was possible, otherwise return the simplified form of the call as a tree. The simplified form may be a constant or other expression which computes the same value, but in a more efficient manner (including calls to other builtin functions). The call may contain arguments which need to be evaluated, but which are not useful to determine the result of the call. In this case we return a chain of COMPOUND_EXPRs. The LHS of each COMPOUND_EXPR will be an argument which must be evaluated. COMPOUND_EXPRs are chained through their RHS. The RHS of the last COMPOUND_EXPR in the chain will contain the tree for the simplified form of the builtin function call. */
Simplify a call to the strpbrk builtin. S1 and S2 are the arguments to the call, and TYPE is its return type. Return NULL_TREE if no simplification was possible, otherwise return the simplified form of the call as a tree. The simplified form may be a constant or other expression which computes the same value, but in a more efficient manner (including calls to other builtin functions). The call may contain arguments which need to be evaluated, but which are not useful to determine the result of the call. In this case we return a chain of COMPOUND_EXPRs. The LHS of each COMPOUND_EXPR will be an argument which must be evaluated. COMPOUND_EXPRs are chained through their RHS. The RHS of the last COMPOUND_EXPR in the chain will contain the tree for the simplified form of the builtin function call.
[ "Simplify", "a", "call", "to", "the", "strpbrk", "builtin", ".", "S1", "and", "S2", "are", "the", "arguments", "to", "the", "call", "and", "TYPE", "is", "its", "return", "type", ".", "Return", "NULL_TREE", "if", "no", "simplification", "was", "possible", "otherwise", "return", "the", "simplified", "form", "of", "the", "call", "as", "a", "tree", ".", "The", "simplified", "form", "may", "be", "a", "constant", "or", "other", "expression", "which", "computes", "the", "same", "value", "but", "in", "a", "more", "efficient", "manner", "(", "including", "calls", "to", "other", "builtin", "functions", ")", ".", "The", "call", "may", "contain", "arguments", "which", "need", "to", "be", "evaluated", "but", "which", "are", "not", "useful", "to", "determine", "the", "result", "of", "the", "call", ".", "In", "this", "case", "we", "return", "a", "chain", "of", "COMPOUND_EXPRs", ".", "The", "LHS", "of", "each", "COMPOUND_EXPR", "will", "be", "an", "argument", "which", "must", "be", "evaluated", ".", "COMPOUND_EXPRs", "are", "chained", "through", "their", "RHS", ".", "The", "RHS", "of", "the", "last", "COMPOUND_EXPR", "in", "the", "chain", "will", "contain", "the", "tree", "for", "the", "simplified", "form", "of", "the", "builtin", "function", "call", "." ]
static tree fold_builtin_strpbrk (location_t loc, tree s1, tree s2, tree type) { if (!validate_arg (s1, POINTER_TYPE) || !validate_arg (s2, POINTER_TYPE)) return NULL_TREE; else { tree fn; const char *p1, *p2; p2 = c_getstr (s2); if (p2 == NULL) return NULL_TREE; p1 = c_getstr (s1); if (p1 != NULL) { const char *r = strpbrk (p1, p2); tree tem; if (r == NULL) return build_int_cst (TREE_TYPE (s1), 0); tem = fold_build_pointer_plus_hwi_loc (loc, s1, r - p1); return fold_convert_loc (loc, type, tem); } if (p2[0] == '\0') return omit_one_operand_loc (loc, type, integer_zero_node, s1); if (p2[1] != '\0') return NULL_TREE; fn = builtin_decl_implicit (BUILT_IN_STRCHR); if (!fn) return NULL_TREE; return build_call_expr_loc (loc, fn, 2, s1, build_int_cst (integer_type_node, p2[0])); } }
[ "static", "tree", "fold_builtin_strpbrk", "(", "location_t", "loc", ",", "tree", "s1", ",", "tree", "s2", ",", "tree", "type", ")", "{", "if", "(", "!", "validate_arg", "(", "s1", ",", "POINTER_TYPE", ")", "||", "!", "validate_arg", "(", "s2", ",", "POINTER_TYPE", ")", ")", "return", "NULL_TREE", ";", "else", "{", "tree", "fn", ";", "const", "char", "*", "p1", ",", "*", "p2", ";", "p2", "=", "c_getstr", "(", "s2", ")", ";", "if", "(", "p2", "==", "NULL", ")", "return", "NULL_TREE", ";", "p1", "=", "c_getstr", "(", "s1", ")", ";", "if", "(", "p1", "!=", "NULL", ")", "{", "const", "char", "*", "r", "=", "strpbrk", "(", "p1", ",", "p2", ")", ";", "tree", "tem", ";", "if", "(", "r", "==", "NULL", ")", "return", "build_int_cst", "(", "TREE_TYPE", "(", "s1", ")", ",", "0", ")", ";", "tem", "=", "fold_build_pointer_plus_hwi_loc", "(", "loc", ",", "s1", ",", "r", "-", "p1", ")", ";", "return", "fold_convert_loc", "(", "loc", ",", "type", ",", "tem", ")", ";", "}", "if", "(", "p2", "[", "0", "]", "==", "'", "\\0", "'", ")", "return", "omit_one_operand_loc", "(", "loc", ",", "type", ",", "integer_zero_node", ",", "s1", ")", ";", "if", "(", "p2", "[", "1", "]", "!=", "'", "\\0", "'", ")", "return", "NULL_TREE", ";", "fn", "=", "builtin_decl_implicit", "(", "BUILT_IN_STRCHR", ")", ";", "if", "(", "!", "fn", ")", "return", "NULL_TREE", ";", "return", "build_call_expr_loc", "(", "loc", ",", "fn", ",", "2", ",", "s1", ",", "build_int_cst", "(", "integer_type_node", ",", "p2", "[", "0", "]", ")", ")", ";", "}", "}" ]
Simplify a call to the strpbrk builtin.
[ "Simplify", "a", "call", "to", "the", "strpbrk", "builtin", "." ]
[ "/* Return an offset into the constant string argument. */", "/* strpbrk(x, \"\") == NULL.\n\t Evaluate and ignore s1 in case it had side-effects. */", "/* Really call strpbrk. */", "/* New argument list transforming strpbrk(s1, s2) to\n\t strchr(s1, s2[0]). */" ]
[ { "param": "loc", "type": "location_t" }, { "param": "s1", "type": "tree" }, { "param": "s2", "type": "tree" }, { "param": "type", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "location_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "s1", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "s2", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "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
fold_builtin_strspn
tree
static tree fold_builtin_strspn (location_t loc, tree s1, tree s2) { if (!validate_arg (s1, POINTER_TYPE) || !validate_arg (s2, POINTER_TYPE)) return NULL_TREE; else { const char *p1 = c_getstr (s1), *p2 = c_getstr (s2); /* If either argument is "", return NULL_TREE. */ if ((p1 && *p1 == '\0') || (p2 && *p2 == '\0')) /* Evaluate and ignore both arguments in case either one has side-effects. */ return omit_two_operands_loc (loc, size_type_node, size_zero_node, s1, s2); return NULL_TREE; } }
/* Simplify a call to the strspn builtin. S1 and S2 are the arguments to the call. Return NULL_TREE if no simplification was possible, otherwise return the simplified form of the call as a tree. The simplified form may be a constant or other expression which computes the same value, but in a more efficient manner (including calls to other builtin functions). The call may contain arguments which need to be evaluated, but which are not useful to determine the result of the call. In this case we return a chain of COMPOUND_EXPRs. The LHS of each COMPOUND_EXPR will be an argument which must be evaluated. COMPOUND_EXPRs are chained through their RHS. The RHS of the last COMPOUND_EXPR in the chain will contain the tree for the simplified form of the builtin function call. */
Simplify a call to the strspn builtin. S1 and S2 are the arguments to the call. Return NULL_TREE if no simplification was possible, otherwise return the simplified form of the call as a tree. The simplified form may be a constant or other expression which computes the same value, but in a more efficient manner (including calls to other builtin functions). The call may contain arguments which need to be evaluated, but which are not useful to determine the result of the call. In this case we return a chain of COMPOUND_EXPRs. The LHS of each COMPOUND_EXPR will be an argument which must be evaluated. COMPOUND_EXPRs are chained through their RHS. The RHS of the last COMPOUND_EXPR in the chain will contain the tree for the simplified form of the builtin function call.
[ "Simplify", "a", "call", "to", "the", "strspn", "builtin", ".", "S1", "and", "S2", "are", "the", "arguments", "to", "the", "call", ".", "Return", "NULL_TREE", "if", "no", "simplification", "was", "possible", "otherwise", "return", "the", "simplified", "form", "of", "the", "call", "as", "a", "tree", ".", "The", "simplified", "form", "may", "be", "a", "constant", "or", "other", "expression", "which", "computes", "the", "same", "value", "but", "in", "a", "more", "efficient", "manner", "(", "including", "calls", "to", "other", "builtin", "functions", ")", ".", "The", "call", "may", "contain", "arguments", "which", "need", "to", "be", "evaluated", "but", "which", "are", "not", "useful", "to", "determine", "the", "result", "of", "the", "call", ".", "In", "this", "case", "we", "return", "a", "chain", "of", "COMPOUND_EXPRs", ".", "The", "LHS", "of", "each", "COMPOUND_EXPR", "will", "be", "an", "argument", "which", "must", "be", "evaluated", ".", "COMPOUND_EXPRs", "are", "chained", "through", "their", "RHS", ".", "The", "RHS", "of", "the", "last", "COMPOUND_EXPR", "in", "the", "chain", "will", "contain", "the", "tree", "for", "the", "simplified", "form", "of", "the", "builtin", "function", "call", "." ]
static tree fold_builtin_strspn (location_t loc, tree s1, tree s2) { if (!validate_arg (s1, POINTER_TYPE) || !validate_arg (s2, POINTER_TYPE)) return NULL_TREE; else { const char *p1 = c_getstr (s1), *p2 = c_getstr (s2); if ((p1 && *p1 == '\0') || (p2 && *p2 == '\0')) return omit_two_operands_loc (loc, size_type_node, size_zero_node, s1, s2); return NULL_TREE; } }
[ "static", "tree", "fold_builtin_strspn", "(", "location_t", "loc", ",", "tree", "s1", ",", "tree", "s2", ")", "{", "if", "(", "!", "validate_arg", "(", "s1", ",", "POINTER_TYPE", ")", "||", "!", "validate_arg", "(", "s2", ",", "POINTER_TYPE", ")", ")", "return", "NULL_TREE", ";", "else", "{", "const", "char", "*", "p1", "=", "c_getstr", "(", "s1", ")", ",", "*", "p2", "=", "c_getstr", "(", "s2", ")", ";", "if", "(", "(", "p1", "&&", "*", "p1", "==", "'", "\\0", "'", ")", "||", "(", "p2", "&&", "*", "p2", "==", "'", "\\0", "'", ")", ")", "return", "omit_two_operands_loc", "(", "loc", ",", "size_type_node", ",", "size_zero_node", ",", "s1", ",", "s2", ")", ";", "return", "NULL_TREE", ";", "}", "}" ]
Simplify a call to the strspn builtin.
[ "Simplify", "a", "call", "to", "the", "strspn", "builtin", "." ]
[ "/* If either argument is \"\", return NULL_TREE. */", "/* Evaluate and ignore both arguments in case either one has\n\t side-effects. */" ]
[ { "param": "loc", "type": "location_t" }, { "param": "s1", "type": "tree" }, { "param": "s2", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "location_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "s1", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "s2", "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
fold_builtin_strcspn
tree
static tree fold_builtin_strcspn (location_t loc, tree s1, tree s2) { if (!validate_arg (s1, POINTER_TYPE) || !validate_arg (s2, POINTER_TYPE)) return NULL_TREE; else { /* If the first argument is "", return NULL_TREE. */ const char *p1 = c_getstr (s1); if (p1 && *p1 == '\0') { /* Evaluate and ignore argument s2 in case it has side-effects. */ return omit_one_operand_loc (loc, size_type_node, size_zero_node, s2); } /* If the second argument is "", return __builtin_strlen(s1). */ const char *p2 = c_getstr (s2); if (p2 && *p2 == '\0') { tree fn = builtin_decl_implicit (BUILT_IN_STRLEN); /* If the replacement _DECL isn't initialized, don't do the transformation. */ if (!fn) return NULL_TREE; return build_call_expr_loc (loc, fn, 1, s1); } return NULL_TREE; } }
/* Simplify a call to the strcspn builtin. S1 and S2 are the arguments to the call. Return NULL_TREE if no simplification was possible, otherwise return the simplified form of the call as a tree. The simplified form may be a constant or other expression which computes the same value, but in a more efficient manner (including calls to other builtin functions). The call may contain arguments which need to be evaluated, but which are not useful to determine the result of the call. In this case we return a chain of COMPOUND_EXPRs. The LHS of each COMPOUND_EXPR will be an argument which must be evaluated. COMPOUND_EXPRs are chained through their RHS. The RHS of the last COMPOUND_EXPR in the chain will contain the tree for the simplified form of the builtin function call. */
Simplify a call to the strcspn builtin. S1 and S2 are the arguments to the call. Return NULL_TREE if no simplification was possible, otherwise return the simplified form of the call as a tree. The simplified form may be a constant or other expression which computes the same value, but in a more efficient manner (including calls to other builtin functions). The call may contain arguments which need to be evaluated, but which are not useful to determine the result of the call. In this case we return a chain of COMPOUND_EXPRs. The LHS of each COMPOUND_EXPR will be an argument which must be evaluated. COMPOUND_EXPRs are chained through their RHS. The RHS of the last COMPOUND_EXPR in the chain will contain the tree for the simplified form of the builtin function call.
[ "Simplify", "a", "call", "to", "the", "strcspn", "builtin", ".", "S1", "and", "S2", "are", "the", "arguments", "to", "the", "call", ".", "Return", "NULL_TREE", "if", "no", "simplification", "was", "possible", "otherwise", "return", "the", "simplified", "form", "of", "the", "call", "as", "a", "tree", ".", "The", "simplified", "form", "may", "be", "a", "constant", "or", "other", "expression", "which", "computes", "the", "same", "value", "but", "in", "a", "more", "efficient", "manner", "(", "including", "calls", "to", "other", "builtin", "functions", ")", ".", "The", "call", "may", "contain", "arguments", "which", "need", "to", "be", "evaluated", "but", "which", "are", "not", "useful", "to", "determine", "the", "result", "of", "the", "call", ".", "In", "this", "case", "we", "return", "a", "chain", "of", "COMPOUND_EXPRs", ".", "The", "LHS", "of", "each", "COMPOUND_EXPR", "will", "be", "an", "argument", "which", "must", "be", "evaluated", ".", "COMPOUND_EXPRs", "are", "chained", "through", "their", "RHS", ".", "The", "RHS", "of", "the", "last", "COMPOUND_EXPR", "in", "the", "chain", "will", "contain", "the", "tree", "for", "the", "simplified", "form", "of", "the", "builtin", "function", "call", "." ]
static tree fold_builtin_strcspn (location_t loc, tree s1, tree s2) { if (!validate_arg (s1, POINTER_TYPE) || !validate_arg (s2, POINTER_TYPE)) return NULL_TREE; else { const char *p1 = c_getstr (s1); if (p1 && *p1 == '\0') { return omit_one_operand_loc (loc, size_type_node, size_zero_node, s2); } const char *p2 = c_getstr (s2); if (p2 && *p2 == '\0') { tree fn = builtin_decl_implicit (BUILT_IN_STRLEN); if (!fn) return NULL_TREE; return build_call_expr_loc (loc, fn, 1, s1); } return NULL_TREE; } }
[ "static", "tree", "fold_builtin_strcspn", "(", "location_t", "loc", ",", "tree", "s1", ",", "tree", "s2", ")", "{", "if", "(", "!", "validate_arg", "(", "s1", ",", "POINTER_TYPE", ")", "||", "!", "validate_arg", "(", "s2", ",", "POINTER_TYPE", ")", ")", "return", "NULL_TREE", ";", "else", "{", "const", "char", "*", "p1", "=", "c_getstr", "(", "s1", ")", ";", "if", "(", "p1", "&&", "*", "p1", "==", "'", "\\0", "'", ")", "{", "return", "omit_one_operand_loc", "(", "loc", ",", "size_type_node", ",", "size_zero_node", ",", "s2", ")", ";", "}", "const", "char", "*", "p2", "=", "c_getstr", "(", "s2", ")", ";", "if", "(", "p2", "&&", "*", "p2", "==", "'", "\\0", "'", ")", "{", "tree", "fn", "=", "builtin_decl_implicit", "(", "BUILT_IN_STRLEN", ")", ";", "if", "(", "!", "fn", ")", "return", "NULL_TREE", ";", "return", "build_call_expr_loc", "(", "loc", ",", "fn", ",", "1", ",", "s1", ")", ";", "}", "return", "NULL_TREE", ";", "}", "}" ]
Simplify a call to the strcspn builtin.
[ "Simplify", "a", "call", "to", "the", "strcspn", "builtin", "." ]
[ "/* If the first argument is \"\", return NULL_TREE. */", "/* Evaluate and ignore argument s2 in case it has\n\t side-effects. */", "/* If the second argument is \"\", return __builtin_strlen(s1). */", "/* If the replacement _DECL isn't initialized, don't do the\n\t transformation. */" ]
[ { "param": "loc", "type": "location_t" }, { "param": "s1", "type": "tree" }, { "param": "s2", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "location_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "s1", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "s2", "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
fold_builtin_next_arg
bool
bool fold_builtin_next_arg (tree exp, bool va_start_p) { tree fntype = TREE_TYPE (current_function_decl); int nargs = call_expr_nargs (exp); tree arg; /* There is good chance the current input_location points inside the definition of the va_start macro (perhaps on the token for builtin) in a system header, so warnings will not be emitted. Use the location in real source code. */ source_location current_location = linemap_unwind_to_first_non_reserved_loc (line_table, input_location, NULL); if (!stdarg_p (fntype)) { error ("%<va_start%> used in function with fixed args"); return true; } if (va_start_p) { if (va_start_p && (nargs != 2)) { error ("wrong number of arguments to function %<va_start%>"); return true; } arg = CALL_EXPR_ARG (exp, 1); } /* We use __builtin_va_start (ap, 0, 0) or __builtin_next_arg (0, 0) when we checked the arguments and if needed issued a warning. */ else { if (nargs == 0) { /* Evidently an out of date version of <stdarg.h>; can't validate va_start's second argument, but can still work as intended. */ warning_at (current_location, OPT_Wvarargs, "%<__builtin_next_arg%> called without an argument"); return true; } else if (nargs > 1) { error ("wrong number of arguments to function %<__builtin_next_arg%>"); return true; } arg = CALL_EXPR_ARG (exp, 0); } if (TREE_CODE (arg) == SSA_NAME) arg = SSA_NAME_VAR (arg); /* We destructively modify the call to be __builtin_va_start (ap, 0) or __builtin_next_arg (0) the first time we see it, after checking the arguments and if needed issuing a warning. */ if (!integer_zerop (arg)) { tree last_parm = tree_last (DECL_ARGUMENTS (current_function_decl)); /* Strip off all nops for the sake of the comparison. This is not quite the same as STRIP_NOPS. It does more. We must also strip off INDIRECT_EXPR for C++ reference parameters. */ while (CONVERT_EXPR_P (arg) || TREE_CODE (arg) == INDIRECT_REF) arg = TREE_OPERAND (arg, 0); if (arg != last_parm) { /* FIXME: Sometimes with the tree optimizers we can get the not the last argument even though the user used the last argument. We just warn and set the arg to be the last argument so that we will get wrong-code because of it. */ warning_at (current_location, OPT_Wvarargs, "second parameter of %<va_start%> not last named argument"); } /* Undefined by C99 7.15.1.4p4 (va_start): "If the parameter parmN is declared with the register storage class, with a function or array type, or with a type that is not compatible with the type that results after application of the default argument promotions, the behavior is undefined." */ else if (DECL_REGISTER (arg)) { warning_at (current_location, OPT_Wvarargs, "undefined behavior when second parameter of " "%<va_start%> is declared with %<register%> storage"); } /* We want to verify the second parameter just once before the tree optimizers are run and then avoid keeping it in the tree, as otherwise we could warn even for correct code like: void foo (int i, ...) { va_list ap; i++; va_start (ap, i); va_end (ap); } */ if (va_start_p) CALL_EXPR_ARG (exp, 1) = integer_zero_node; else CALL_EXPR_ARG (exp, 0) = integer_zero_node; } return false; }
/* Fold the next_arg or va_start call EXP. Returns true if there was an error produced. False otherwise. This is done so that we don't output the error or warning twice or three times. */
Fold the next_arg or va_start call EXP. Returns true if there was an error produced. False otherwise. This is done so that we don't output the error or warning twice or three times.
[ "Fold", "the", "next_arg", "or", "va_start", "call", "EXP", ".", "Returns", "true", "if", "there", "was", "an", "error", "produced", ".", "False", "otherwise", ".", "This", "is", "done", "so", "that", "we", "don", "'", "t", "output", "the", "error", "or", "warning", "twice", "or", "three", "times", "." ]
bool fold_builtin_next_arg (tree exp, bool va_start_p) { tree fntype = TREE_TYPE (current_function_decl); int nargs = call_expr_nargs (exp); tree arg; source_location current_location = linemap_unwind_to_first_non_reserved_loc (line_table, input_location, NULL); if (!stdarg_p (fntype)) { error ("%<va_start%> used in function with fixed args"); return true; } if (va_start_p) { if (va_start_p && (nargs != 2)) { error ("wrong number of arguments to function %<va_start%>"); return true; } arg = CALL_EXPR_ARG (exp, 1); } else { if (nargs == 0) { warning_at (current_location, OPT_Wvarargs, "%<__builtin_next_arg%> called without an argument"); return true; } else if (nargs > 1) { error ("wrong number of arguments to function %<__builtin_next_arg%>"); return true; } arg = CALL_EXPR_ARG (exp, 0); } if (TREE_CODE (arg) == SSA_NAME) arg = SSA_NAME_VAR (arg); if (!integer_zerop (arg)) { tree last_parm = tree_last (DECL_ARGUMENTS (current_function_decl)); while (CONVERT_EXPR_P (arg) || TREE_CODE (arg) == INDIRECT_REF) arg = TREE_OPERAND (arg, 0); if (arg != last_parm) { warning_at (current_location, OPT_Wvarargs, "second parameter of %<va_start%> not last named argument"); } else if (DECL_REGISTER (arg)) { warning_at (current_location, OPT_Wvarargs, "undefined behavior when second parameter of " "%<va_start%> is declared with %<register%> storage"); } if (va_start_p) CALL_EXPR_ARG (exp, 1) = integer_zero_node; else CALL_EXPR_ARG (exp, 0) = integer_zero_node; } return false; }
[ "bool", "fold_builtin_next_arg", "(", "tree", "exp", ",", "bool", "va_start_p", ")", "{", "tree", "fntype", "=", "TREE_TYPE", "(", "current_function_decl", ")", ";", "int", "nargs", "=", "call_expr_nargs", "(", "exp", ")", ";", "tree", "arg", ";", "source_location", "current_location", "=", "linemap_unwind_to_first_non_reserved_loc", "(", "line_table", ",", "input_location", ",", "NULL", ")", ";", "if", "(", "!", "stdarg_p", "(", "fntype", ")", ")", "{", "error", "(", "\"", "\"", ")", ";", "return", "true", ";", "}", "if", "(", "va_start_p", ")", "{", "if", "(", "va_start_p", "&&", "(", "nargs", "!=", "2", ")", ")", "{", "error", "(", "\"", "\"", ")", ";", "return", "true", ";", "}", "arg", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "}", "else", "{", "if", "(", "nargs", "==", "0", ")", "{", "warning_at", "(", "current_location", ",", "OPT_Wvarargs", ",", "\"", "\"", ")", ";", "return", "true", ";", "}", "else", "if", "(", "nargs", ">", "1", ")", "{", "error", "(", "\"", "\"", ")", ";", "return", "true", ";", "}", "arg", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "}", "if", "(", "TREE_CODE", "(", "arg", ")", "==", "SSA_NAME", ")", "arg", "=", "SSA_NAME_VAR", "(", "arg", ")", ";", "if", "(", "!", "integer_zerop", "(", "arg", ")", ")", "{", "tree", "last_parm", "=", "tree_last", "(", "DECL_ARGUMENTS", "(", "current_function_decl", ")", ")", ";", "while", "(", "CONVERT_EXPR_P", "(", "arg", ")", "||", "TREE_CODE", "(", "arg", ")", "==", "INDIRECT_REF", ")", "arg", "=", "TREE_OPERAND", "(", "arg", ",", "0", ")", ";", "if", "(", "arg", "!=", "last_parm", ")", "{", "warning_at", "(", "current_location", ",", "OPT_Wvarargs", ",", "\"", "\"", ")", ";", "}", "else", "if", "(", "DECL_REGISTER", "(", "arg", ")", ")", "{", "warning_at", "(", "current_location", ",", "OPT_Wvarargs", ",", "\"", "\"", "\"", "\"", ")", ";", "}", "if", "(", "va_start_p", ")", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", "=", "integer_zero_node", ";", "else", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", "=", "integer_zero_node", ";", "}", "return", "false", ";", "}" ]
Fold the next_arg or va_start call EXP.
[ "Fold", "the", "next_arg", "or", "va_start", "call", "EXP", "." ]
[ "/* There is good chance the current input_location points inside the\n definition of the va_start macro (perhaps on the token for\n builtin) in a system header, so warnings will not be emitted.\n Use the location in real source code. */", "/* We use __builtin_va_start (ap, 0, 0) or __builtin_next_arg (0, 0)\n when we checked the arguments and if needed issued a warning. */", "/* Evidently an out of date version of <stdarg.h>; can't validate\n\t va_start's second argument, but can still work as intended. */", "/* We destructively modify the call to be __builtin_va_start (ap, 0)\n or __builtin_next_arg (0) the first time we see it, after checking\n the arguments and if needed issuing a warning. */", "/* Strip off all nops for the sake of the comparison. This\n\t is not quite the same as STRIP_NOPS. It does more.\n\t We must also strip off INDIRECT_EXPR for C++ reference\n\t parameters. */", "/* FIXME: Sometimes with the tree optimizers we can get the\n\t not the last argument even though the user used the last\n\t argument. We just warn and set the arg to be the last\n\t argument so that we will get wrong-code because of\n\t it. */", "/* Undefined by C99 7.15.1.4p4 (va_start):\n \"If the parameter parmN is declared with the register storage\n class, with a function or array type, or with a type that is\n not compatible with the type that results after application of\n the default argument promotions, the behavior is undefined.\"\n */", "/* We want to verify the second parameter just once before the tree\n\t optimizers are run and then avoid keeping it in the tree,\n\t as otherwise we could warn even for correct code like:\n\t void foo (int i, ...)\n\t { va_list ap; i++; va_start (ap, i); va_end (ap); } */" ]
[ { "param": "exp", "type": "tree" }, { "param": "va_start_p", "type": "bool" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "va_start_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
maybe_emit_chk_warning
void
static void maybe_emit_chk_warning (tree exp, enum built_in_function fcode) { /* The source string. */ tree srcstr = NULL_TREE; /* The size of the destination object. */ tree objsize = NULL_TREE; /* The string that is being concatenated with (as in __strcat_chk) or null if it isn't. */ tree catstr = NULL_TREE; /* The maximum length of the source sequence in a bounded operation (such as __strncat_chk) or null if the operation isn't bounded (such as __strcat_chk). */ tree maxread = NULL_TREE; /* The exact size of the access (such as in __strncpy_chk). */ tree size = NULL_TREE; switch (fcode) { case BUILT_IN_STRCPY_CHK: case BUILT_IN_STPCPY_CHK: srcstr = CALL_EXPR_ARG (exp, 1); objsize = CALL_EXPR_ARG (exp, 2); break; case BUILT_IN_STRCAT_CHK: /* For __strcat_chk the warning will be emitted only if overflowing by at least strlen (dest) + 1 bytes. */ catstr = CALL_EXPR_ARG (exp, 0); srcstr = CALL_EXPR_ARG (exp, 1); objsize = CALL_EXPR_ARG (exp, 2); break; case BUILT_IN_STRNCAT_CHK: catstr = CALL_EXPR_ARG (exp, 0); srcstr = CALL_EXPR_ARG (exp, 1); maxread = CALL_EXPR_ARG (exp, 2); objsize = CALL_EXPR_ARG (exp, 3); break; case BUILT_IN_STRNCPY_CHK: case BUILT_IN_STPNCPY_CHK: srcstr = CALL_EXPR_ARG (exp, 1); size = CALL_EXPR_ARG (exp, 2); objsize = CALL_EXPR_ARG (exp, 3); break; case BUILT_IN_SNPRINTF_CHK: case BUILT_IN_VSNPRINTF_CHK: maxread = CALL_EXPR_ARG (exp, 1); objsize = CALL_EXPR_ARG (exp, 3); break; default: gcc_unreachable (); } if (catstr && maxread) { /* Check __strncat_chk. There is no way to determine the length of the string to which the source string is being appended so just warn when the length of the source string is not known. */ check_strncat_sizes (exp, objsize); return; } /* The destination argument is the first one for all built-ins above. */ tree dst = CALL_EXPR_ARG (exp, 0); check_access (exp, dst, srcstr, size, maxread, srcstr, objsize); }
/* Emit warning if a buffer overflow is detected at compile time. */
Emit warning if a buffer overflow is detected at compile time.
[ "Emit", "warning", "if", "a", "buffer", "overflow", "is", "detected", "at", "compile", "time", "." ]
static void maybe_emit_chk_warning (tree exp, enum built_in_function fcode) { tree srcstr = NULL_TREE; tree objsize = NULL_TREE; tree catstr = NULL_TREE; tree maxread = NULL_TREE; tree size = NULL_TREE; switch (fcode) { case BUILT_IN_STRCPY_CHK: case BUILT_IN_STPCPY_CHK: srcstr = CALL_EXPR_ARG (exp, 1); objsize = CALL_EXPR_ARG (exp, 2); break; case BUILT_IN_STRCAT_CHK: catstr = CALL_EXPR_ARG (exp, 0); srcstr = CALL_EXPR_ARG (exp, 1); objsize = CALL_EXPR_ARG (exp, 2); break; case BUILT_IN_STRNCAT_CHK: catstr = CALL_EXPR_ARG (exp, 0); srcstr = CALL_EXPR_ARG (exp, 1); maxread = CALL_EXPR_ARG (exp, 2); objsize = CALL_EXPR_ARG (exp, 3); break; case BUILT_IN_STRNCPY_CHK: case BUILT_IN_STPNCPY_CHK: srcstr = CALL_EXPR_ARG (exp, 1); size = CALL_EXPR_ARG (exp, 2); objsize = CALL_EXPR_ARG (exp, 3); break; case BUILT_IN_SNPRINTF_CHK: case BUILT_IN_VSNPRINTF_CHK: maxread = CALL_EXPR_ARG (exp, 1); objsize = CALL_EXPR_ARG (exp, 3); break; default: gcc_unreachable (); } if (catstr && maxread) { check_strncat_sizes (exp, objsize); return; } tree dst = CALL_EXPR_ARG (exp, 0); check_access (exp, dst, srcstr, size, maxread, srcstr, objsize); }
[ "static", "void", "maybe_emit_chk_warning", "(", "tree", "exp", ",", "enum", "built_in_function", "fcode", ")", "{", "tree", "srcstr", "=", "NULL_TREE", ";", "tree", "objsize", "=", "NULL_TREE", ";", "tree", "catstr", "=", "NULL_TREE", ";", "tree", "maxread", "=", "NULL_TREE", ";", "tree", "size", "=", "NULL_TREE", ";", "switch", "(", "fcode", ")", "{", "case", "BUILT_IN_STRCPY_CHK", ":", "case", "BUILT_IN_STPCPY_CHK", ":", "srcstr", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "objsize", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "break", ";", "case", "BUILT_IN_STRCAT_CHK", ":", "catstr", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "srcstr", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "objsize", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "break", ";", "case", "BUILT_IN_STRNCAT_CHK", ":", "catstr", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "srcstr", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "maxread", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "objsize", "=", "CALL_EXPR_ARG", "(", "exp", ",", "3", ")", ";", "break", ";", "case", "BUILT_IN_STRNCPY_CHK", ":", "case", "BUILT_IN_STPNCPY_CHK", ":", "srcstr", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "size", "=", "CALL_EXPR_ARG", "(", "exp", ",", "2", ")", ";", "objsize", "=", "CALL_EXPR_ARG", "(", "exp", ",", "3", ")", ";", "break", ";", "case", "BUILT_IN_SNPRINTF_CHK", ":", "case", "BUILT_IN_VSNPRINTF_CHK", ":", "maxread", "=", "CALL_EXPR_ARG", "(", "exp", ",", "1", ")", ";", "objsize", "=", "CALL_EXPR_ARG", "(", "exp", ",", "3", ")", ";", "break", ";", "default", ":", "gcc_unreachable", "(", ")", ";", "}", "if", "(", "catstr", "&&", "maxread", ")", "{", "check_strncat_sizes", "(", "exp", ",", "objsize", ")", ";", "return", ";", "}", "tree", "dst", "=", "CALL_EXPR_ARG", "(", "exp", ",", "0", ")", ";", "check_access", "(", "exp", ",", "dst", ",", "srcstr", ",", "size", ",", "maxread", ",", "srcstr", ",", "objsize", ")", ";", "}" ]
Emit warning if a buffer overflow is detected at compile time.
[ "Emit", "warning", "if", "a", "buffer", "overflow", "is", "detected", "at", "compile", "time", "." ]
[ "/* The source string. */", "/* The size of the destination object. */", "/* The string that is being concatenated with (as in __strcat_chk)\n or null if it isn't. */", "/* The maximum length of the source sequence in a bounded operation\n (such as __strncat_chk) or null if the operation isn't bounded\n (such as __strcat_chk). */", "/* The exact size of the access (such as in __strncpy_chk). */", "/* For __strcat_chk the warning will be emitted only if overflowing\n\t by at least strlen (dest) + 1 bytes. */", "/* Check __strncat_chk. There is no way to determine the length\n\t of the string to which the source string is being appended so\n\t just warn when the length of the source string is not known. */", "/* The destination argument is the first one for all built-ins above. */" ]
[ { "param": "exp", "type": "tree" }, { "param": "fcode", "type": "enum built_in_function" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fcode", "type": "enum built_in_function", "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
is_inexpensive_builtin
bool
bool is_inexpensive_builtin (tree decl) { if (!decl) return false; else if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_MD) return true; else if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL) switch (DECL_FUNCTION_CODE (decl)) { case BUILT_IN_ABS: CASE_BUILT_IN_ALLOCA: case BUILT_IN_BSWAP16: case BUILT_IN_BSWAP32: case BUILT_IN_BSWAP64: case BUILT_IN_CLZ: case BUILT_IN_CLZIMAX: case BUILT_IN_CLZL: case BUILT_IN_CLZLL: case BUILT_IN_CTZ: case BUILT_IN_CTZIMAX: case BUILT_IN_CTZL: case BUILT_IN_CTZLL: case BUILT_IN_FFS: case BUILT_IN_FFSIMAX: case BUILT_IN_FFSL: case BUILT_IN_FFSLL: case BUILT_IN_IMAXABS: case BUILT_IN_FINITE: case BUILT_IN_FINITEF: case BUILT_IN_FINITEL: case BUILT_IN_FINITED32: case BUILT_IN_FINITED64: case BUILT_IN_FINITED128: case BUILT_IN_FPCLASSIFY: case BUILT_IN_ISFINITE: case BUILT_IN_ISINF_SIGN: case BUILT_IN_ISINF: case BUILT_IN_ISINFF: case BUILT_IN_ISINFL: case BUILT_IN_ISINFD32: case BUILT_IN_ISINFD64: case BUILT_IN_ISINFD128: case BUILT_IN_ISNAN: case BUILT_IN_ISNANF: case BUILT_IN_ISNANL: case BUILT_IN_ISNAND32: case BUILT_IN_ISNAND64: case BUILT_IN_ISNAND128: case BUILT_IN_ISNORMAL: case BUILT_IN_ISGREATER: case BUILT_IN_ISGREATEREQUAL: case BUILT_IN_ISLESS: case BUILT_IN_ISLESSEQUAL: case BUILT_IN_ISLESSGREATER: case BUILT_IN_ISUNORDERED: case BUILT_IN_VA_ARG_PACK: case BUILT_IN_VA_ARG_PACK_LEN: case BUILT_IN_VA_COPY: case BUILT_IN_TRAP: case BUILT_IN_SAVEREGS: case BUILT_IN_POPCOUNTL: case BUILT_IN_POPCOUNTLL: case BUILT_IN_POPCOUNTIMAX: case BUILT_IN_POPCOUNT: case BUILT_IN_PARITYL: case BUILT_IN_PARITYLL: case BUILT_IN_PARITYIMAX: case BUILT_IN_PARITY: case BUILT_IN_LABS: case BUILT_IN_LLABS: case BUILT_IN_PREFETCH: case BUILT_IN_ACC_ON_DEVICE: return true; default: return is_simple_builtin (decl); } return false; }
/* Return true if DECL is a builtin that is not expensive, i.e., they are most probably expanded inline into reasonably simple code. This is a superset of is_simple_builtin. */
Return true if DECL is a builtin that is not expensive, i.e., they are most probably expanded inline into reasonably simple code. This is a superset of is_simple_builtin.
[ "Return", "true", "if", "DECL", "is", "a", "builtin", "that", "is", "not", "expensive", "i", ".", "e", ".", "they", "are", "most", "probably", "expanded", "inline", "into", "reasonably", "simple", "code", ".", "This", "is", "a", "superset", "of", "is_simple_builtin", "." ]
bool is_inexpensive_builtin (tree decl) { if (!decl) return false; else if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_MD) return true; else if (DECL_BUILT_IN_CLASS (decl) == BUILT_IN_NORMAL) switch (DECL_FUNCTION_CODE (decl)) { case BUILT_IN_ABS: CASE_BUILT_IN_ALLOCA: case BUILT_IN_BSWAP16: case BUILT_IN_BSWAP32: case BUILT_IN_BSWAP64: case BUILT_IN_CLZ: case BUILT_IN_CLZIMAX: case BUILT_IN_CLZL: case BUILT_IN_CLZLL: case BUILT_IN_CTZ: case BUILT_IN_CTZIMAX: case BUILT_IN_CTZL: case BUILT_IN_CTZLL: case BUILT_IN_FFS: case BUILT_IN_FFSIMAX: case BUILT_IN_FFSL: case BUILT_IN_FFSLL: case BUILT_IN_IMAXABS: case BUILT_IN_FINITE: case BUILT_IN_FINITEF: case BUILT_IN_FINITEL: case BUILT_IN_FINITED32: case BUILT_IN_FINITED64: case BUILT_IN_FINITED128: case BUILT_IN_FPCLASSIFY: case BUILT_IN_ISFINITE: case BUILT_IN_ISINF_SIGN: case BUILT_IN_ISINF: case BUILT_IN_ISINFF: case BUILT_IN_ISINFL: case BUILT_IN_ISINFD32: case BUILT_IN_ISINFD64: case BUILT_IN_ISINFD128: case BUILT_IN_ISNAN: case BUILT_IN_ISNANF: case BUILT_IN_ISNANL: case BUILT_IN_ISNAND32: case BUILT_IN_ISNAND64: case BUILT_IN_ISNAND128: case BUILT_IN_ISNORMAL: case BUILT_IN_ISGREATER: case BUILT_IN_ISGREATEREQUAL: case BUILT_IN_ISLESS: case BUILT_IN_ISLESSEQUAL: case BUILT_IN_ISLESSGREATER: case BUILT_IN_ISUNORDERED: case BUILT_IN_VA_ARG_PACK: case BUILT_IN_VA_ARG_PACK_LEN: case BUILT_IN_VA_COPY: case BUILT_IN_TRAP: case BUILT_IN_SAVEREGS: case BUILT_IN_POPCOUNTL: case BUILT_IN_POPCOUNTLL: case BUILT_IN_POPCOUNTIMAX: case BUILT_IN_POPCOUNT: case BUILT_IN_PARITYL: case BUILT_IN_PARITYLL: case BUILT_IN_PARITYIMAX: case BUILT_IN_PARITY: case BUILT_IN_LABS: case BUILT_IN_LLABS: case BUILT_IN_PREFETCH: case BUILT_IN_ACC_ON_DEVICE: return true; default: return is_simple_builtin (decl); } return false; }
[ "bool", "is_inexpensive_builtin", "(", "tree", "decl", ")", "{", "if", "(", "!", "decl", ")", "return", "false", ";", "else", "if", "(", "DECL_BUILT_IN_CLASS", "(", "decl", ")", "==", "BUILT_IN_MD", ")", "return", "true", ";", "else", "if", "(", "DECL_BUILT_IN_CLASS", "(", "decl", ")", "==", "BUILT_IN_NORMAL", ")", "switch", "(", "DECL_FUNCTION_CODE", "(", "decl", ")", ")", "{", "case", "BUILT_IN_ABS", ":", "CASE_BUILT_IN_ALLOCA", ":", "case", "BUILT_IN_BSWAP16", ":", "case", "BUILT_IN_BSWAP32", ":", "case", "BUILT_IN_BSWAP64", ":", "case", "BUILT_IN_CLZ", ":", "case", "BUILT_IN_CLZIMAX", ":", "case", "BUILT_IN_CLZL", ":", "case", "BUILT_IN_CLZLL", ":", "case", "BUILT_IN_CTZ", ":", "case", "BUILT_IN_CTZIMAX", ":", "case", "BUILT_IN_CTZL", ":", "case", "BUILT_IN_CTZLL", ":", "case", "BUILT_IN_FFS", ":", "case", "BUILT_IN_FFSIMAX", ":", "case", "BUILT_IN_FFSL", ":", "case", "BUILT_IN_FFSLL", ":", "case", "BUILT_IN_IMAXABS", ":", "case", "BUILT_IN_FINITE", ":", "case", "BUILT_IN_FINITEF", ":", "case", "BUILT_IN_FINITEL", ":", "case", "BUILT_IN_FINITED32", ":", "case", "BUILT_IN_FINITED64", ":", "case", "BUILT_IN_FINITED128", ":", "case", "BUILT_IN_FPCLASSIFY", ":", "case", "BUILT_IN_ISFINITE", ":", "case", "BUILT_IN_ISINF_SIGN", ":", "case", "BUILT_IN_ISINF", ":", "case", "BUILT_IN_ISINFF", ":", "case", "BUILT_IN_ISINFL", ":", "case", "BUILT_IN_ISINFD32", ":", "case", "BUILT_IN_ISINFD64", ":", "case", "BUILT_IN_ISINFD128", ":", "case", "BUILT_IN_ISNAN", ":", "case", "BUILT_IN_ISNANF", ":", "case", "BUILT_IN_ISNANL", ":", "case", "BUILT_IN_ISNAND32", ":", "case", "BUILT_IN_ISNAND64", ":", "case", "BUILT_IN_ISNAND128", ":", "case", "BUILT_IN_ISNORMAL", ":", "case", "BUILT_IN_ISGREATER", ":", "case", "BUILT_IN_ISGREATEREQUAL", ":", "case", "BUILT_IN_ISLESS", ":", "case", "BUILT_IN_ISLESSEQUAL", ":", "case", "BUILT_IN_ISLESSGREATER", ":", "case", "BUILT_IN_ISUNORDERED", ":", "case", "BUILT_IN_VA_ARG_PACK", ":", "case", "BUILT_IN_VA_ARG_PACK_LEN", ":", "case", "BUILT_IN_VA_COPY", ":", "case", "BUILT_IN_TRAP", ":", "case", "BUILT_IN_SAVEREGS", ":", "case", "BUILT_IN_POPCOUNTL", ":", "case", "BUILT_IN_POPCOUNTLL", ":", "case", "BUILT_IN_POPCOUNTIMAX", ":", "case", "BUILT_IN_POPCOUNT", ":", "case", "BUILT_IN_PARITYL", ":", "case", "BUILT_IN_PARITYLL", ":", "case", "BUILT_IN_PARITYIMAX", ":", "case", "BUILT_IN_PARITY", ":", "case", "BUILT_IN_LABS", ":", "case", "BUILT_IN_LLABS", ":", "case", "BUILT_IN_PREFETCH", ":", "case", "BUILT_IN_ACC_ON_DEVICE", ":", "return", "true", ";", "default", ":", "return", "is_simple_builtin", "(", "decl", ")", ";", "}", "return", "false", ";", "}" ]
Return true if DECL is a builtin that is not expensive, i.e., they are most probably expanded inline into reasonably simple code.
[ "Return", "true", "if", "DECL", "is", "a", "builtin", "that", "is", "not", "expensive", "i", ".", "e", ".", "they", "are", "most", "probably", "expanded", "inline", "into", "reasonably", "simple", "code", "." ]
[]
[ { "param": "decl", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "decl", "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
target_char_cst_p
bool
bool target_char_cst_p (tree t, char *p) { if (!tree_fits_uhwi_p (t) || CHAR_TYPE_SIZE != HOST_BITS_PER_CHAR) return false; *p = (char)tree_to_uhwi (t); return true; }
/* Return true if T is a constant and the value cast to a target char can be represented by a host char. Store the casted char constant in *P if so. */
Return true if T is a constant and the value cast to a target char can be represented by a host char. Store the casted char constant in *P if so.
[ "Return", "true", "if", "T", "is", "a", "constant", "and", "the", "value", "cast", "to", "a", "target", "char", "can", "be", "represented", "by", "a", "host", "char", ".", "Store", "the", "casted", "char", "constant", "in", "*", "P", "if", "so", "." ]
bool target_char_cst_p (tree t, char *p) { if (!tree_fits_uhwi_p (t) || CHAR_TYPE_SIZE != HOST_BITS_PER_CHAR) return false; *p = (char)tree_to_uhwi (t); return true; }
[ "bool", "target_char_cst_p", "(", "tree", "t", ",", "char", "*", "p", ")", "{", "if", "(", "!", "tree_fits_uhwi_p", "(", "t", ")", "||", "CHAR_TYPE_SIZE", "!=", "HOST_BITS_PER_CHAR", ")", "return", "false", ";", "*", "p", "=", "(", "char", ")", "tree_to_uhwi", "(", "t", ")", ";", "return", "true", ";", "}" ]
Return true if T is a constant and the value cast to a target char can be represented by a host char.
[ "Return", "true", "if", "T", "is", "a", "constant", "and", "the", "value", "cast", "to", "a", "target", "char", "can", "be", "represented", "by", "a", "host", "char", "." ]
[]
[ { "param": "t", "type": "tree" }, { "param": "p", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "t", "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
max_object_size
tree
tree max_object_size (void) { /* To do: Make this a configurable parameter. */ return TYPE_MAX_VALUE (ptrdiff_type_node); }
/* Return the maximum object size. */
Return the maximum object size.
[ "Return", "the", "maximum", "object", "size", "." ]
tree max_object_size (void) { return TYPE_MAX_VALUE (ptrdiff_type_node); }
[ "tree", "max_object_size", "(", "void", ")", "{", "return", "TYPE_MAX_VALUE", "(", "ptrdiff_type_node", ")", ";", "}" ]
Return the maximum object size.
[ "Return", "the", "maximum", "object", "size", "." ]
[ "/* To do: Make this a configurable parameter. */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
validate_exp
bool
static bool validate_exp (rtx exp, const char *name, file_location loc) { if (exp == 0) { message_at (loc, "%s: must give a predicate expression", name); return true; } switch (GET_CODE (exp)) { /* Ternary, binary, unary expressions: recurse into subexpressions. */ case IF_THEN_ELSE: if (validate_exp (XEXP (exp, 2), name, loc)) return true; /* fall through */ case AND: case IOR: if (validate_exp (XEXP (exp, 1), name, loc)) return true; /* fall through */ case NOT: return validate_exp (XEXP (exp, 0), name, loc); /* MATCH_CODE might have a syntax error in its path expression. */ case MATCH_CODE: { const char *p; for (p = XSTR (exp, 1); *p; p++) { if (!ISDIGIT (*p) && !ISLOWER (*p)) { error_at (loc, "%s: invalid character in path " "string '%s'", name, XSTR (exp, 1)); return true; } } } gcc_fallthrough (); /* These need no special checking. */ case MATCH_OPERAND: case MATCH_TEST: return false; default: error_at (loc, "%s: cannot use '%s' in a predicate expression", name, GET_RTX_NAME (GET_CODE (exp))); return true; } }
/* Given a predicate expression EXP, from form NAME at location LOC, verify that it does not contain any RTL constructs which are not valid in predicate definitions. Returns true if EXP is INvalid; issues error messages, caller need not. */
Given a predicate expression EXP, from form NAME at location LOC, verify that it does not contain any RTL constructs which are not valid in predicate definitions. Returns true if EXP is INvalid; issues error messages, caller need not.
[ "Given", "a", "predicate", "expression", "EXP", "from", "form", "NAME", "at", "location", "LOC", "verify", "that", "it", "does", "not", "contain", "any", "RTL", "constructs", "which", "are", "not", "valid", "in", "predicate", "definitions", ".", "Returns", "true", "if", "EXP", "is", "INvalid", ";", "issues", "error", "messages", "caller", "need", "not", "." ]
static bool validate_exp (rtx exp, const char *name, file_location loc) { if (exp == 0) { message_at (loc, "%s: must give a predicate expression", name); return true; } switch (GET_CODE (exp)) { case IF_THEN_ELSE: if (validate_exp (XEXP (exp, 2), name, loc)) return true; case AND: case IOR: if (validate_exp (XEXP (exp, 1), name, loc)) return true; case NOT: return validate_exp (XEXP (exp, 0), name, loc); case MATCH_CODE: { const char *p; for (p = XSTR (exp, 1); *p; p++) { if (!ISDIGIT (*p) && !ISLOWER (*p)) { error_at (loc, "%s: invalid character in path " "string '%s'", name, XSTR (exp, 1)); return true; } } } gcc_fallthrough (); case MATCH_OPERAND: case MATCH_TEST: return false; default: error_at (loc, "%s: cannot use '%s' in a predicate expression", name, GET_RTX_NAME (GET_CODE (exp))); return true; } }
[ "static", "bool", "validate_exp", "(", "rtx", "exp", ",", "const", "char", "*", "name", ",", "file_location", "loc", ")", "{", "if", "(", "exp", "==", "0", ")", "{", "message_at", "(", "loc", ",", "\"", "\"", ",", "name", ")", ";", "return", "true", ";", "}", "switch", "(", "GET_CODE", "(", "exp", ")", ")", "{", "case", "IF_THEN_ELSE", ":", "if", "(", "validate_exp", "(", "XEXP", "(", "exp", ",", "2", ")", ",", "name", ",", "loc", ")", ")", "return", "true", ";", "case", "AND", ":", "case", "IOR", ":", "if", "(", "validate_exp", "(", "XEXP", "(", "exp", ",", "1", ")", ",", "name", ",", "loc", ")", ")", "return", "true", ";", "case", "NOT", ":", "return", "validate_exp", "(", "XEXP", "(", "exp", ",", "0", ")", ",", "name", ",", "loc", ")", ";", "case", "MATCH_CODE", ":", "{", "const", "char", "*", "p", ";", "for", "(", "p", "=", "XSTR", "(", "exp", ",", "1", ")", ";", "*", "p", ";", "p", "++", ")", "{", "if", "(", "!", "ISDIGIT", "(", "*", "p", ")", "&&", "!", "ISLOWER", "(", "*", "p", ")", ")", "{", "error_at", "(", "loc", ",", "\"", "\"", "\"", "\"", ",", "name", ",", "XSTR", "(", "exp", ",", "1", ")", ")", ";", "return", "true", ";", "}", "}", "}", "gcc_fallthrough", "(", ")", ";", "case", "MATCH_OPERAND", ":", "case", "MATCH_TEST", ":", "return", "false", ";", "default", ":", "error_at", "(", "loc", ",", "\"", "\"", ",", "name", ",", "GET_RTX_NAME", "(", "GET_CODE", "(", "exp", ")", ")", ")", ";", "return", "true", ";", "}", "}" ]
Given a predicate expression EXP, from form NAME at location LOC, verify that it does not contain any RTL constructs which are not valid in predicate definitions.
[ "Given", "a", "predicate", "expression", "EXP", "from", "form", "NAME", "at", "location", "LOC", "verify", "that", "it", "does", "not", "contain", "any", "RTL", "constructs", "which", "are", "not", "valid", "in", "predicate", "definitions", "." ]
[ "/* Ternary, binary, unary expressions: recurse into subexpressions. */", "/* fall through */", "/* fall through */", "/* MATCH_CODE might have a syntax error in its path expression. */", "/* These need no special checking. */" ]
[ { "param": "exp", "type": "rtx" }, { "param": "name", "type": "char" }, { "param": "loc", "type": "file_location" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "loc", "type": "file_location", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
process_define_predicate
void
static void process_define_predicate (md_rtx_info *info) { validate_exp (XEXP (info->def, 1), XSTR (info->def, 0), info->loc); }
/* Predicates are defined with (define_predicate) or (define_special_predicate) expressions in the machine description. */
Predicates are defined with (define_predicate) or (define_special_predicate) expressions in the machine description.
[ "Predicates", "are", "defined", "with", "(", "define_predicate", ")", "or", "(", "define_special_predicate", ")", "expressions", "in", "the", "machine", "description", "." ]
static void process_define_predicate (md_rtx_info *info) { validate_exp (XEXP (info->def, 1), XSTR (info->def, 0), info->loc); }
[ "static", "void", "process_define_predicate", "(", "md_rtx_info", "*", "info", ")", "{", "validate_exp", "(", "XEXP", "(", "info", "->", "def", ",", "1", ")", ",", "XSTR", "(", "info", "->", "def", ",", "0", ")", ",", "info", "->", "loc", ")", ";", "}" ]
Predicates are defined with (define_predicate) or (define_special_predicate) expressions in the machine description.
[ "Predicates", "are", "defined", "with", "(", "define_predicate", ")", "or", "(", "define_special_predicate", ")", "expressions", "in", "the", "machine", "description", "." ]
[]
[ { "param": "info", "type": "md_rtx_info" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "info", "type": "md_rtx_info", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
needs_variable
bool
static bool needs_variable (rtx exp, const char *var) { switch (GET_CODE (exp)) { /* Ternary, binary, unary expressions need a variable if any of their subexpressions do. */ case IF_THEN_ELSE: if (needs_variable (XEXP (exp, 2), var)) return true; /* fall through */ case AND: case IOR: if (needs_variable (XEXP (exp, 1), var)) return true; /* fall through */ case NOT: return needs_variable (XEXP (exp, 0), var); /* MATCH_CODE uses "op", but nothing else. */ case MATCH_CODE: return !strcmp (var, "op"); /* MATCH_OPERAND uses "op" and may use "mode". */ case MATCH_OPERAND: if (!strcmp (var, "op")) return true; if (!strcmp (var, "mode") && GET_MODE (exp) == VOIDmode) return true; return false; /* MATCH_TEST uses var if XSTR (exp, 0) =~ /\b${var}\b/o; */ case MATCH_TEST: { const char *p = XSTR (exp, 0); const char *q = strstr (p, var); if (!q) return false; if (q != p && (ISALNUM (q[-1]) || q[-1] == '_')) return false; q += strlen (var); if (ISALNUM (q[0]) || q[0] == '_') return false; } return true; default: gcc_unreachable (); } }
/* Given a predicate expression EXP, from form NAME, determine whether it refers to the variable given as VAR. */
Given a predicate expression EXP, from form NAME, determine whether it refers to the variable given as VAR.
[ "Given", "a", "predicate", "expression", "EXP", "from", "form", "NAME", "determine", "whether", "it", "refers", "to", "the", "variable", "given", "as", "VAR", "." ]
static bool needs_variable (rtx exp, const char *var) { switch (GET_CODE (exp)) { case IF_THEN_ELSE: if (needs_variable (XEXP (exp, 2), var)) return true; case AND: case IOR: if (needs_variable (XEXP (exp, 1), var)) return true; case NOT: return needs_variable (XEXP (exp, 0), var); case MATCH_CODE: return !strcmp (var, "op"); case MATCH_OPERAND: if (!strcmp (var, "op")) return true; if (!strcmp (var, "mode") && GET_MODE (exp) == VOIDmode) return true; return false; case MATCH_TEST: { const char *p = XSTR (exp, 0); const char *q = strstr (p, var); if (!q) return false; if (q != p && (ISALNUM (q[-1]) || q[-1] == '_')) return false; q += strlen (var); if (ISALNUM (q[0]) || q[0] == '_') return false; } return true; default: gcc_unreachable (); } }
[ "static", "bool", "needs_variable", "(", "rtx", "exp", ",", "const", "char", "*", "var", ")", "{", "switch", "(", "GET_CODE", "(", "exp", ")", ")", "{", "case", "IF_THEN_ELSE", ":", "if", "(", "needs_variable", "(", "XEXP", "(", "exp", ",", "2", ")", ",", "var", ")", ")", "return", "true", ";", "case", "AND", ":", "case", "IOR", ":", "if", "(", "needs_variable", "(", "XEXP", "(", "exp", ",", "1", ")", ",", "var", ")", ")", "return", "true", ";", "case", "NOT", ":", "return", "needs_variable", "(", "XEXP", "(", "exp", ",", "0", ")", ",", "var", ")", ";", "case", "MATCH_CODE", ":", "return", "!", "strcmp", "(", "var", ",", "\"", "\"", ")", ";", "case", "MATCH_OPERAND", ":", "if", "(", "!", "strcmp", "(", "var", ",", "\"", "\"", ")", ")", "return", "true", ";", "if", "(", "!", "strcmp", "(", "var", ",", "\"", "\"", ")", "&&", "GET_MODE", "(", "exp", ")", "==", "VOIDmode", ")", "return", "true", ";", "return", "false", ";", "case", "MATCH_TEST", ":", "{", "const", "char", "*", "p", "=", "XSTR", "(", "exp", ",", "0", ")", ";", "const", "char", "*", "q", "=", "strstr", "(", "p", ",", "var", ")", ";", "if", "(", "!", "q", ")", "return", "false", ";", "if", "(", "q", "!=", "p", "&&", "(", "ISALNUM", "(", "q", "[", "-1", "]", ")", "||", "q", "[", "-1", "]", "==", "'", "'", ")", ")", "return", "false", ";", "q", "+=", "strlen", "(", "var", ")", ";", "if", "(", "ISALNUM", "(", "q", "[", "0", "]", ")", "||", "q", "[", "0", "]", "==", "'", "'", ")", "return", "false", ";", "}", "return", "true", ";", "default", ":", "gcc_unreachable", "(", ")", ";", "}", "}" ]
Given a predicate expression EXP, from form NAME, determine whether it refers to the variable given as VAR.
[ "Given", "a", "predicate", "expression", "EXP", "from", "form", "NAME", "determine", "whether", "it", "refers", "to", "the", "variable", "given", "as", "VAR", "." ]
[ "/* Ternary, binary, unary expressions need a variable if\n\t any of their subexpressions do. */", "/* fall through */", "/* fall through */", "/* MATCH_CODE uses \"op\", but nothing else. */", "/* MATCH_OPERAND uses \"op\" and may use \"mode\". */", "/* MATCH_TEST uses var if XSTR (exp, 0) =~ /\\b${var}\\b/o; */" ]
[ { "param": "exp", "type": "rtx" }, { "param": "var", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "var", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
generate_switch_p
bool
static bool generate_switch_p (rtx exp) { return GET_CODE (exp) == MATCH_CODE && strchr (XSTR (exp, 0), ','); }
/* Determine whether the expression EXP is a MATCH_CODE that should be written as a switch statement. */
Determine whether the expression EXP is a MATCH_CODE that should be written as a switch statement.
[ "Determine", "whether", "the", "expression", "EXP", "is", "a", "MATCH_CODE", "that", "should", "be", "written", "as", "a", "switch", "statement", "." ]
static bool generate_switch_p (rtx exp) { return GET_CODE (exp) == MATCH_CODE && strchr (XSTR (exp, 0), ','); }
[ "static", "bool", "generate_switch_p", "(", "rtx", "exp", ")", "{", "return", "GET_CODE", "(", "exp", ")", "==", "MATCH_CODE", "&&", "strchr", "(", "XSTR", "(", "exp", ",", "0", ")", ",", "'", "'", ")", ";", "}" ]
Determine whether the expression EXP is a MATCH_CODE that should be written as a switch statement.
[ "Determine", "whether", "the", "expression", "EXP", "is", "a", "MATCH_CODE", "that", "should", "be", "written", "as", "a", "switch", "statement", "." ]
[]
[ { "param": "exp", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_extract_subexp
void
static void write_extract_subexp (const char *path) { int len = strlen (path); int i; /* We first write out the operations (XEXP or XVECEXP) in reverse order, then write "op", then the indices in forward order. */ for (i = len - 1; i >= 0; i--) { if (ISLOWER (path[i])) fputs ("XVECEXP (", stdout); else if (ISDIGIT (path[i])) fputs ("XEXP (", stdout); else gcc_unreachable (); } fputs ("op", stdout); for (i = 0; i < len; i++) { if (ISLOWER (path[i])) printf (", 0, %d)", path[i] - 'a'); else if (ISDIGIT (path[i])) printf (", %d)", path[i] - '0'); else gcc_unreachable (); } }
/* PATH is a string describing a path from the root of an RTL expression to an inner subexpression to be tested. Output code which computes the subexpression from the variable holding the root of the expression. */
PATH is a string describing a path from the root of an RTL expression to an inner subexpression to be tested. Output code which computes the subexpression from the variable holding the root of the expression.
[ "PATH", "is", "a", "string", "describing", "a", "path", "from", "the", "root", "of", "an", "RTL", "expression", "to", "an", "inner", "subexpression", "to", "be", "tested", ".", "Output", "code", "which", "computes", "the", "subexpression", "from", "the", "variable", "holding", "the", "root", "of", "the", "expression", "." ]
static void write_extract_subexp (const char *path) { int len = strlen (path); int i; for (i = len - 1; i >= 0; i--) { if (ISLOWER (path[i])) fputs ("XVECEXP (", stdout); else if (ISDIGIT (path[i])) fputs ("XEXP (", stdout); else gcc_unreachable (); } fputs ("op", stdout); for (i = 0; i < len; i++) { if (ISLOWER (path[i])) printf (", 0, %d)", path[i] - 'a'); else if (ISDIGIT (path[i])) printf (", %d)", path[i] - '0'); else gcc_unreachable (); } }
[ "static", "void", "write_extract_subexp", "(", "const", "char", "*", "path", ")", "{", "int", "len", "=", "strlen", "(", "path", ")", ";", "int", "i", ";", "for", "(", "i", "=", "len", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "ISLOWER", "(", "path", "[", "i", "]", ")", ")", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "else", "if", "(", "ISDIGIT", "(", "path", "[", "i", "]", ")", ")", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "else", "gcc_unreachable", "(", ")", ";", "}", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "if", "(", "ISLOWER", "(", "path", "[", "i", "]", ")", ")", "printf", "(", "\"", "\"", ",", "path", "[", "i", "]", "-", "'", "'", ")", ";", "else", "if", "(", "ISDIGIT", "(", "path", "[", "i", "]", ")", ")", "printf", "(", "\"", "\"", ",", "path", "[", "i", "]", "-", "'", "'", ")", ";", "else", "gcc_unreachable", "(", ")", ";", "}", "}" ]
PATH is a string describing a path from the root of an RTL expression to an inner subexpression to be tested.
[ "PATH", "is", "a", "string", "describing", "a", "path", "from", "the", "root", "of", "an", "RTL", "expression", "to", "an", "inner", "subexpression", "to", "be", "tested", "." ]
[ "/* We first write out the operations (XEXP or XVECEXP) in reverse\n order, then write \"op\", then the indices in forward order. */" ]
[ { "param": "path", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_match_code
void
static void write_match_code (const char *path, const char *codes) { const char *code; while ((code = scan_comma_elt (&codes)) != 0) { fputs ("GET_CODE (", stdout); write_extract_subexp (path); fputs (") == ", stdout); while (code < codes) { putchar (TOUPPER (*code)); code++; } if (*codes == ',') fputs (" || ", stdout); } }
/* CODES is a list of RTX codes. Write out an expression which determines whether the operand has one of those codes. */
CODES is a list of RTX codes. Write out an expression which determines whether the operand has one of those codes.
[ "CODES", "is", "a", "list", "of", "RTX", "codes", ".", "Write", "out", "an", "expression", "which", "determines", "whether", "the", "operand", "has", "one", "of", "those", "codes", "." ]
static void write_match_code (const char *path, const char *codes) { const char *code; while ((code = scan_comma_elt (&codes)) != 0) { fputs ("GET_CODE (", stdout); write_extract_subexp (path); fputs (") == ", stdout); while (code < codes) { putchar (TOUPPER (*code)); code++; } if (*codes == ',') fputs (" || ", stdout); } }
[ "static", "void", "write_match_code", "(", "const", "char", "*", "path", ",", "const", "char", "*", "codes", ")", "{", "const", "char", "*", "code", ";", "while", "(", "(", "code", "=", "scan_comma_elt", "(", "&", "codes", ")", ")", "!=", "0", ")", "{", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "write_extract_subexp", "(", "path", ")", ";", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "while", "(", "code", "<", "codes", ")", "{", "putchar", "(", "TOUPPER", "(", "*", "code", ")", ")", ";", "code", "++", ";", "}", "if", "(", "*", "codes", "==", "'", "'", ")", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "}", "}" ]
CODES is a list of RTX codes.
[ "CODES", "is", "a", "list", "of", "RTX", "codes", "." ]
[]
[ { "param": "path", "type": "char" }, { "param": "codes", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "path", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "codes", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_predicate_expr
void
static void write_predicate_expr (rtx exp) { switch (GET_CODE (exp)) { case AND: putchar ('('); write_predicate_expr (XEXP (exp, 0)); fputs (") && (", stdout); write_predicate_expr (XEXP (exp, 1)); putchar (')'); break; case IOR: putchar ('('); write_predicate_expr (XEXP (exp, 0)); fputs (") || (", stdout); write_predicate_expr (XEXP (exp, 1)); putchar (')'); break; case NOT: fputs ("!(", stdout); write_predicate_expr (XEXP (exp, 0)); putchar (')'); break; case IF_THEN_ELSE: putchar ('('); write_predicate_expr (XEXP (exp, 0)); fputs (") ? (", stdout); write_predicate_expr (XEXP (exp, 1)); fputs (") : (", stdout); write_predicate_expr (XEXP (exp, 2)); putchar (')'); break; case MATCH_OPERAND: if (GET_MODE (exp) == VOIDmode) printf ("%s (op, mode)", XSTR (exp, 1)); else printf ("%s (op, %smode)", XSTR (exp, 1), mode_name[GET_MODE (exp)]); break; case MATCH_CODE: write_match_code (XSTR (exp, 1), XSTR (exp, 0)); break; case MATCH_TEST: rtx_reader_ptr->print_c_condition (XSTR (exp, 0)); break; default: gcc_unreachable (); } }
/* EXP is an RTL (sub)expression for a predicate. Recursively descend the expression and write out an equivalent C expression. */
EXP is an RTL (sub)expression for a predicate. Recursively descend the expression and write out an equivalent C expression.
[ "EXP", "is", "an", "RTL", "(", "sub", ")", "expression", "for", "a", "predicate", ".", "Recursively", "descend", "the", "expression", "and", "write", "out", "an", "equivalent", "C", "expression", "." ]
static void write_predicate_expr (rtx exp) { switch (GET_CODE (exp)) { case AND: putchar ('('); write_predicate_expr (XEXP (exp, 0)); fputs (") && (", stdout); write_predicate_expr (XEXP (exp, 1)); putchar (')'); break; case IOR: putchar ('('); write_predicate_expr (XEXP (exp, 0)); fputs (") || (", stdout); write_predicate_expr (XEXP (exp, 1)); putchar (')'); break; case NOT: fputs ("!(", stdout); write_predicate_expr (XEXP (exp, 0)); putchar (')'); break; case IF_THEN_ELSE: putchar ('('); write_predicate_expr (XEXP (exp, 0)); fputs (") ? (", stdout); write_predicate_expr (XEXP (exp, 1)); fputs (") : (", stdout); write_predicate_expr (XEXP (exp, 2)); putchar (')'); break; case MATCH_OPERAND: if (GET_MODE (exp) == VOIDmode) printf ("%s (op, mode)", XSTR (exp, 1)); else printf ("%s (op, %smode)", XSTR (exp, 1), mode_name[GET_MODE (exp)]); break; case MATCH_CODE: write_match_code (XSTR (exp, 1), XSTR (exp, 0)); break; case MATCH_TEST: rtx_reader_ptr->print_c_condition (XSTR (exp, 0)); break; default: gcc_unreachable (); } }
[ "static", "void", "write_predicate_expr", "(", "rtx", "exp", ")", "{", "switch", "(", "GET_CODE", "(", "exp", ")", ")", "{", "case", "AND", ":", "putchar", "(", "'", "'", ")", ";", "write_predicate_expr", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ";", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "write_predicate_expr", "(", "XEXP", "(", "exp", ",", "1", ")", ")", ";", "putchar", "(", "'", "'", ")", ";", "break", ";", "case", "IOR", ":", "putchar", "(", "'", "'", ")", ";", "write_predicate_expr", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ";", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "write_predicate_expr", "(", "XEXP", "(", "exp", ",", "1", ")", ")", ";", "putchar", "(", "'", "'", ")", ";", "break", ";", "case", "NOT", ":", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "write_predicate_expr", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ";", "putchar", "(", "'", "'", ")", ";", "break", ";", "case", "IF_THEN_ELSE", ":", "putchar", "(", "'", "'", ")", ";", "write_predicate_expr", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ";", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "write_predicate_expr", "(", "XEXP", "(", "exp", ",", "1", ")", ")", ";", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "write_predicate_expr", "(", "XEXP", "(", "exp", ",", "2", ")", ")", ";", "putchar", "(", "'", "'", ")", ";", "break", ";", "case", "MATCH_OPERAND", ":", "if", "(", "GET_MODE", "(", "exp", ")", "==", "VOIDmode", ")", "printf", "(", "\"", "\"", ",", "XSTR", "(", "exp", ",", "1", ")", ")", ";", "else", "printf", "(", "\"", "\"", ",", "XSTR", "(", "exp", ",", "1", ")", ",", "mode_name", "[", "GET_MODE", "(", "exp", ")", "]", ")", ";", "break", ";", "case", "MATCH_CODE", ":", "write_match_code", "(", "XSTR", "(", "exp", ",", "1", ")", ",", "XSTR", "(", "exp", ",", "0", ")", ")", ";", "break", ";", "case", "MATCH_TEST", ":", "rtx_reader_ptr", "->", "print_c_condition", "(", "XSTR", "(", "exp", ",", "0", ")", ")", ";", "break", ";", "default", ":", "gcc_unreachable", "(", ")", ";", "}", "}" ]
EXP is an RTL (sub)expression for a predicate.
[ "EXP", "is", "an", "RTL", "(", "sub", ")", "expression", "for", "a", "predicate", "." ]
[]
[ { "param": "exp", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_match_code_switch
void
static void write_match_code_switch (rtx exp) { const char *codes = XSTR (exp, 0); const char *path = XSTR (exp, 1); const char *code; fputs (" switch (GET_CODE (", stdout); write_extract_subexp (path); fputs ("))\n {\n", stdout); while ((code = scan_comma_elt (&codes)) != 0) { fputs (" case ", stdout); while (code < codes) { putchar (TOUPPER (*code)); code++; } fputs (":\n", stdout); } }
/* Write the MATCH_CODE expression EXP as a switch statement. */
Write the MATCH_CODE expression EXP as a switch statement.
[ "Write", "the", "MATCH_CODE", "expression", "EXP", "as", "a", "switch", "statement", "." ]
static void write_match_code_switch (rtx exp) { const char *codes = XSTR (exp, 0); const char *path = XSTR (exp, 1); const char *code; fputs (" switch (GET_CODE (", stdout); write_extract_subexp (path); fputs ("))\n {\n", stdout); while ((code = scan_comma_elt (&codes)) != 0) { fputs (" case ", stdout); while (code < codes) { putchar (TOUPPER (*code)); code++; } fputs (":\n", stdout); } }
[ "static", "void", "write_match_code_switch", "(", "rtx", "exp", ")", "{", "const", "char", "*", "codes", "=", "XSTR", "(", "exp", ",", "0", ")", ";", "const", "char", "*", "path", "=", "XSTR", "(", "exp", ",", "1", ")", ";", "const", "char", "*", "code", ";", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "write_extract_subexp", "(", "path", ")", ";", "fputs", "(", "\"", "\\n", "\\n", "\"", ",", "stdout", ")", ";", "while", "(", "(", "code", "=", "scan_comma_elt", "(", "&", "codes", ")", ")", "!=", "0", ")", "{", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "while", "(", "code", "<", "codes", ")", "{", "putchar", "(", "TOUPPER", "(", "*", "code", ")", ")", ";", "code", "++", ";", "}", "fputs", "(", "\"", "\\n", "\"", ",", "stdout", ")", ";", "}", "}" ]
Write the MATCH_CODE expression EXP as a switch statement.
[ "Write", "the", "MATCH_CODE", "expression", "EXP", "as", "a", "switch", "statement", "." ]
[]
[ { "param": "exp", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_predicate_stmts
void
static void write_predicate_stmts (rtx exp) { switch (GET_CODE (exp)) { case MATCH_CODE: if (generate_switch_p (exp)) { write_match_code_switch (exp); puts (" return true;\n" " default:\n" " break;\n" " }\n" " return false;"); return; } break; case AND: if (generate_switch_p (XEXP (exp, 0))) { write_match_code_switch (XEXP (exp, 0)); puts (" break;\n" " default:\n" " return false;\n" " }"); exp = XEXP (exp, 1); } break; case IOR: if (generate_switch_p (XEXP (exp, 0))) { write_match_code_switch (XEXP (exp, 0)); puts (" return true;\n" " default:\n" " break;\n" " }"); exp = XEXP (exp, 1); } break; case NOT: if (generate_switch_p (XEXP (exp, 0))) { write_match_code_switch (XEXP (exp, 0)); puts (" return false;\n" " default:\n" " break;\n" " }\n" " return true;"); return; } break; default: break; } fputs (" return ",stdout); write_predicate_expr (exp); fputs (";\n", stdout); }
/* Given a predicate expression EXP, write out a sequence of stmts to evaluate it. This is similar to write_predicate_expr but can generate efficient switch statements. */
Given a predicate expression EXP, write out a sequence of stmts to evaluate it. This is similar to write_predicate_expr but can generate efficient switch statements.
[ "Given", "a", "predicate", "expression", "EXP", "write", "out", "a", "sequence", "of", "stmts", "to", "evaluate", "it", ".", "This", "is", "similar", "to", "write_predicate_expr", "but", "can", "generate", "efficient", "switch", "statements", "." ]
static void write_predicate_stmts (rtx exp) { switch (GET_CODE (exp)) { case MATCH_CODE: if (generate_switch_p (exp)) { write_match_code_switch (exp); puts (" return true;\n" " default:\n" " break;\n" " }\n" " return false;"); return; } break; case AND: if (generate_switch_p (XEXP (exp, 0))) { write_match_code_switch (XEXP (exp, 0)); puts (" break;\n" " default:\n" " return false;\n" " }"); exp = XEXP (exp, 1); } break; case IOR: if (generate_switch_p (XEXP (exp, 0))) { write_match_code_switch (XEXP (exp, 0)); puts (" return true;\n" " default:\n" " break;\n" " }"); exp = XEXP (exp, 1); } break; case NOT: if (generate_switch_p (XEXP (exp, 0))) { write_match_code_switch (XEXP (exp, 0)); puts (" return false;\n" " default:\n" " break;\n" " }\n" " return true;"); return; } break; default: break; } fputs (" return ",stdout); write_predicate_expr (exp); fputs (";\n", stdout); }
[ "static", "void", "write_predicate_stmts", "(", "rtx", "exp", ")", "{", "switch", "(", "GET_CODE", "(", "exp", ")", ")", "{", "case", "MATCH_CODE", ":", "if", "(", "generate_switch_p", "(", "exp", ")", ")", "{", "write_match_code_switch", "(", "exp", ")", ";", "puts", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\"", ")", ";", "return", ";", "}", "break", ";", "case", "AND", ":", "if", "(", "generate_switch_p", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ")", "{", "write_match_code_switch", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ";", "puts", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\"", ")", ";", "exp", "=", "XEXP", "(", "exp", ",", "1", ")", ";", "}", "break", ";", "case", "IOR", ":", "if", "(", "generate_switch_p", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ")", "{", "write_match_code_switch", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ";", "puts", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\"", ")", ";", "exp", "=", "XEXP", "(", "exp", ",", "1", ")", ";", "}", "break", ";", "case", "NOT", ":", "if", "(", "generate_switch_p", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ")", "{", "write_match_code_switch", "(", "XEXP", "(", "exp", ",", "0", ")", ")", ";", "puts", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\"", ")", ";", "return", ";", "}", "break", ";", "default", ":", "break", ";", "}", "fputs", "(", "\"", "\"", ",", "stdout", ")", ";", "write_predicate_expr", "(", "exp", ")", ";", "fputs", "(", "\"", "\\n", "\"", ",", "stdout", ")", ";", "}" ]
Given a predicate expression EXP, write out a sequence of stmts to evaluate it.
[ "Given", "a", "predicate", "expression", "EXP", "write", "out", "a", "sequence", "of", "stmts", "to", "evaluate", "it", "." ]
[]
[ { "param": "exp", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "exp", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_one_predicate_function
void
static void write_one_predicate_function (struct pred_data *p) { if (!p->exp) return; write_predicate_subfunction (p); add_mode_tests (p); /* A normal predicate can legitimately not look at machine_mode if it accepts only CONST_INTs and/or CONST_WIDE_INT and/or CONST_DOUBLEs. */ printf ("int\n%s (rtx op, machine_mode mode ATTRIBUTE_UNUSED)\n{\n", p->name); write_predicate_stmts (p->exp); fputs ("}\n\n", stdout); }
/* Given a predicate, write out a complete C function to compute it. */
Given a predicate, write out a complete C function to compute it.
[ "Given", "a", "predicate", "write", "out", "a", "complete", "C", "function", "to", "compute", "it", "." ]
static void write_one_predicate_function (struct pred_data *p) { if (!p->exp) return; write_predicate_subfunction (p); add_mode_tests (p); printf ("int\n%s (rtx op, machine_mode mode ATTRIBUTE_UNUSED)\n{\n", p->name); write_predicate_stmts (p->exp); fputs ("}\n\n", stdout); }
[ "static", "void", "write_one_predicate_function", "(", "struct", "pred_data", "*", "p", ")", "{", "if", "(", "!", "p", "->", "exp", ")", "return", ";", "write_predicate_subfunction", "(", "p", ")", ";", "add_mode_tests", "(", "p", ")", ";", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "p", "->", "name", ")", ";", "write_predicate_stmts", "(", "p", "->", "exp", ")", ";", "fputs", "(", "\"", "\\n", "\\n", "\"", ",", "stdout", ")", ";", "}" ]
Given a predicate, write out a complete C function to compute it.
[ "Given", "a", "predicate", "write", "out", "a", "complete", "C", "function", "to", "compute", "it", "." ]
[ "/* A normal predicate can legitimately not look at machine_mode\n if it accepts only CONST_INTs and/or CONST_WIDE_INT and/or CONST_DOUBLEs. */" ]
[ { "param": "p", "type": "struct pred_data" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p", "type": "struct pred_data", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
process_define_register_constraint
void
static void process_define_register_constraint (md_rtx_info *info) { add_constraint (XSTR (info->def, 0), XSTR (info->def, 1), 0, false, false, false, info->loc); }
/* Process a DEFINE_REGISTER_CONSTRAINT expression, C. */
Process a DEFINE_REGISTER_CONSTRAINT expression, C.
[ "Process", "a", "DEFINE_REGISTER_CONSTRAINT", "expression", "C", "." ]
static void process_define_register_constraint (md_rtx_info *info) { add_constraint (XSTR (info->def, 0), XSTR (info->def, 1), 0, false, false, false, info->loc); }
[ "static", "void", "process_define_register_constraint", "(", "md_rtx_info", "*", "info", ")", "{", "add_constraint", "(", "XSTR", "(", "info", "->", "def", ",", "0", ")", ",", "XSTR", "(", "info", "->", "def", ",", "1", ")", ",", "0", ",", "false", ",", "false", ",", "false", ",", "info", "->", "loc", ")", ";", "}" ]
Process a DEFINE_REGISTER_CONSTRAINT expression, C.
[ "Process", "a", "DEFINE_REGISTER_CONSTRAINT", "expression", "C", "." ]
[]
[ { "param": "info", "type": "md_rtx_info" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "info", "type": "md_rtx_info", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_enum_constraint_num
void
static void write_enum_constraint_num (void) { fputs ("#define CONSTRAINT_NUM_DEFINED_P 1\n", stdout); fputs ("enum constraint_num\n" "{\n" " CONSTRAINT__UNKNOWN = 0", stdout); for (unsigned int i = 0; i < num_constraints; ++i) printf (",\n CONSTRAINT_%s", enum_order[i]->c_name); puts (",\n CONSTRAINT__LIMIT\n};\n"); }
/* Write out an enumeration with one entry per machine-specific constraint. */
Write out an enumeration with one entry per machine-specific constraint.
[ "Write", "out", "an", "enumeration", "with", "one", "entry", "per", "machine", "-", "specific", "constraint", "." ]
static void write_enum_constraint_num (void) { fputs ("#define CONSTRAINT_NUM_DEFINED_P 1\n", stdout); fputs ("enum constraint_num\n" "{\n" " CONSTRAINT__UNKNOWN = 0", stdout); for (unsigned int i = 0; i < num_constraints; ++i) printf (",\n CONSTRAINT_%s", enum_order[i]->c_name); puts (",\n CONSTRAINT__LIMIT\n};\n"); }
[ "static", "void", "write_enum_constraint_num", "(", "void", ")", "{", "fputs", "(", "\"", "\\n", "\"", ",", "stdout", ")", ";", "fputs", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\"", ",", "stdout", ")", ";", "for", "(", "unsigned", "int", "i", "=", "0", ";", "i", "<", "num_constraints", ";", "++", "i", ")", "printf", "(", "\"", "\\n", "\"", ",", "enum_order", "[", "i", "]", "->", "c_name", ")", ";", "puts", "(", "\"", "\\n", "\\n", "\\n", "\"", ")", ";", "}" ]
Write out an enumeration with one entry per machine-specific constraint.
[ "Write", "out", "an", "enumeration", "with", "one", "entry", "per", "machine", "-", "specific", "constraint", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_lookup_constraint_1
void
static void write_lookup_constraint_1 (void) { unsigned int i; puts ("enum constraint_num\n" "lookup_constraint_1 (const char *str)\n" "{\n" " switch (str[0])\n" " {"); for (i = 0; i < ARRAY_SIZE (constraints_by_letter_table); i++) { struct constraint_data *c = constraints_by_letter_table[i]; if (!c) continue; printf (" case '%c':\n", i); if (c->namelen == 1) printf (" return CONSTRAINT_%s;\n", c->c_name); else { do { printf (" if (!strncmp (str + 1, \"%s\", %lu))\n" " return CONSTRAINT_%s;\n", c->name + 1, (unsigned long int) c->namelen - 1, c->c_name); c = c->next_this_letter; } while (c); puts (" break;"); } } puts (" default: break;\n" " }\n" " return CONSTRAINT__UNKNOWN;\n" "}\n"); }
/* Write out a function which looks at a string and determines what constraint name, if any, it begins with. */
Write out a function which looks at a string and determines what constraint name, if any, it begins with.
[ "Write", "out", "a", "function", "which", "looks", "at", "a", "string", "and", "determines", "what", "constraint", "name", "if", "any", "it", "begins", "with", "." ]
static void write_lookup_constraint_1 (void) { unsigned int i; puts ("enum constraint_num\n" "lookup_constraint_1 (const char *str)\n" "{\n" " switch (str[0])\n" " {"); for (i = 0; i < ARRAY_SIZE (constraints_by_letter_table); i++) { struct constraint_data *c = constraints_by_letter_table[i]; if (!c) continue; printf (" case '%c':\n", i); if (c->namelen == 1) printf (" return CONSTRAINT_%s;\n", c->c_name); else { do { printf (" if (!strncmp (str + 1, \"%s\", %lu))\n" " return CONSTRAINT_%s;\n", c->name + 1, (unsigned long int) c->namelen - 1, c->c_name); c = c->next_this_letter; } while (c); puts (" break;"); } } puts (" default: break;\n" " }\n" " return CONSTRAINT__UNKNOWN;\n" "}\n"); }
[ "static", "void", "write_lookup_constraint_1", "(", "void", ")", "{", "unsigned", "int", "i", ";", "puts", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "ARRAY_SIZE", "(", "constraints_by_letter_table", ")", ";", "i", "++", ")", "{", "struct", "constraint_data", "*", "c", "=", "constraints_by_letter_table", "[", "i", "]", ";", "if", "(", "!", "c", ")", "continue", ";", "printf", "(", "\"", "\\n", "\"", ",", "i", ")", ";", "if", "(", "c", "->", "namelen", "==", "1", ")", "printf", "(", "\"", "\\n", "\"", ",", "c", "->", "c_name", ")", ";", "else", "{", "do", "{", "printf", "(", "\"", "\\\"", "\\\"", "\\n", "\"", "\"", "\\n", "\"", ",", "c", "->", "name", "+", "1", ",", "(", "unsigned", "long", "int", ")", "c", "->", "namelen", "-", "1", ",", "c", "->", "c_name", ")", ";", "c", "=", "c", "->", "next_this_letter", ";", "}", "while", "(", "c", ")", ";", "puts", "(", "\"", "\"", ")", ";", "}", "}", "puts", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", ")", ";", "}" ]
Write out a function which looks at a string and determines what constraint name, if any, it begins with.
[ "Write", "out", "a", "function", "which", "looks", "at", "a", "string", "and", "determines", "what", "constraint", "name", "if", "any", "it", "begins", "with", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_lookup_constraint_array
void
static void write_lookup_constraint_array (void) { unsigned int i; printf ("const unsigned char lookup_constraint_array[] = {\n "); for (i = 0; i < ARRAY_SIZE (constraints_by_letter_table); i++) { if (i != 0) printf (",\n "); struct constraint_data *c = constraints_by_letter_table[i]; if (!c) printf ("CONSTRAINT__UNKNOWN"); else if (c->namelen == 1) printf ("MIN ((int) CONSTRAINT_%s, (int) UCHAR_MAX)", c->c_name); else printf ("UCHAR_MAX"); } printf ("\n};\n\n"); }
/* Write out an array that maps single-letter characters to their constraints (if that fits in a character) or 255 if lookup_constraint_1 must be called. */
Write out an array that maps single-letter characters to their constraints (if that fits in a character) or 255 if lookup_constraint_1 must be called.
[ "Write", "out", "an", "array", "that", "maps", "single", "-", "letter", "characters", "to", "their", "constraints", "(", "if", "that", "fits", "in", "a", "character", ")", "or", "255", "if", "lookup_constraint_1", "must", "be", "called", "." ]
static void write_lookup_constraint_array (void) { unsigned int i; printf ("const unsigned char lookup_constraint_array[] = {\n "); for (i = 0; i < ARRAY_SIZE (constraints_by_letter_table); i++) { if (i != 0) printf (",\n "); struct constraint_data *c = constraints_by_letter_table[i]; if (!c) printf ("CONSTRAINT__UNKNOWN"); else if (c->namelen == 1) printf ("MIN ((int) CONSTRAINT_%s, (int) UCHAR_MAX)", c->c_name); else printf ("UCHAR_MAX"); } printf ("\n};\n\n"); }
[ "static", "void", "write_lookup_constraint_array", "(", "void", ")", "{", "unsigned", "int", "i", ";", "printf", "(", "\"", "\\n", "\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "ARRAY_SIZE", "(", "constraints_by_letter_table", ")", ";", "i", "++", ")", "{", "if", "(", "i", "!=", "0", ")", "printf", "(", "\"", "\\n", "\"", ")", ";", "struct", "constraint_data", "*", "c", "=", "constraints_by_letter_table", "[", "i", "]", ";", "if", "(", "!", "c", ")", "printf", "(", "\"", "\"", ")", ";", "else", "if", "(", "c", "->", "namelen", "==", "1", ")", "printf", "(", "\"", "\"", ",", "c", "->", "c_name", ")", ";", "else", "printf", "(", "\"", "\"", ")", ";", "}", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ")", ";", "}" ]
Write out an array that maps single-letter characters to their constraints (if that fits in a character) or 255 if lookup_constraint_1 must be called.
[ "Write", "out", "an", "array", "that", "maps", "single", "-", "letter", "characters", "to", "their", "constraints", "(", "if", "that", "fits", "in", "a", "character", ")", "or", "255", "if", "lookup_constraint_1", "must", "be", "called", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_insn_constraint_len
void
static void write_insn_constraint_len (void) { unsigned int i; puts ("static inline size_t\n" "insn_constraint_len (char fc, const char *str ATTRIBUTE_UNUSED)\n" "{\n" " switch (fc)\n" " {"); for (i = 0; i < ARRAY_SIZE (constraints_by_letter_table); i++) { struct constraint_data *c = constraints_by_letter_table[i]; if (!c || c->namelen == 1) continue; /* Constraints with multiple characters should have the same length. */ { struct constraint_data *c2 = c->next_this_letter; size_t len = c->namelen; while (c2) { if (c2->namelen != len) error ("Multi-letter constraints with first letter '%c' " "should have same length", i); c2 = c2->next_this_letter; } } printf (" case '%c': return %lu;\n", i, (unsigned long int) c->namelen); } puts (" default: break;\n" " }\n" " return 1;\n" "}\n"); }
/* Write out a function which looks at a string and determines what the constraint name length is. */
Write out a function which looks at a string and determines what the constraint name length is.
[ "Write", "out", "a", "function", "which", "looks", "at", "a", "string", "and", "determines", "what", "the", "constraint", "name", "length", "is", "." ]
static void write_insn_constraint_len (void) { unsigned int i; puts ("static inline size_t\n" "insn_constraint_len (char fc, const char *str ATTRIBUTE_UNUSED)\n" "{\n" " switch (fc)\n" " {"); for (i = 0; i < ARRAY_SIZE (constraints_by_letter_table); i++) { struct constraint_data *c = constraints_by_letter_table[i]; if (!c || c->namelen == 1) continue; { struct constraint_data *c2 = c->next_this_letter; size_t len = c->namelen; while (c2) { if (c2->namelen != len) error ("Multi-letter constraints with first letter '%c' " "should have same length", i); c2 = c2->next_this_letter; } } printf (" case '%c': return %lu;\n", i, (unsigned long int) c->namelen); } puts (" default: break;\n" " }\n" " return 1;\n" "}\n"); }
[ "static", "void", "write_insn_constraint_len", "(", "void", ")", "{", "unsigned", "int", "i", ";", "puts", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "ARRAY_SIZE", "(", "constraints_by_letter_table", ")", ";", "i", "++", ")", "{", "struct", "constraint_data", "*", "c", "=", "constraints_by_letter_table", "[", "i", "]", ";", "if", "(", "!", "c", "||", "c", "->", "namelen", "==", "1", ")", "continue", ";", "{", "struct", "constraint_data", "*", "c2", "=", "c", "->", "next_this_letter", ";", "size_t", "len", "=", "c", "->", "namelen", ";", "while", "(", "c2", ")", "{", "if", "(", "c2", "->", "namelen", "!=", "len", ")", "error", "(", "\"", "\"", "\"", "\"", ",", "i", ")", ";", "c2", "=", "c2", "->", "next_this_letter", ";", "}", "}", "printf", "(", "\"", "\\n", "\"", ",", "i", ",", "(", "unsigned", "long", "int", ")", "c", "->", "namelen", ")", ";", "}", "puts", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", ")", ";", "}" ]
Write out a function which looks at a string and determines what the constraint name length is.
[ "Write", "out", "a", "function", "which", "looks", "at", "a", "string", "and", "determines", "what", "the", "constraint", "name", "length", "is", "." ]
[ "/* Constraints with multiple characters should have the same\n\t length. */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_constraint_satisfied_p_array
void
static void write_constraint_satisfied_p_array (void) { if (satisfied_start == num_constraints) return; printf ("bool (*constraint_satisfied_p_array[]) (rtx) = {\n "); for (unsigned int i = satisfied_start; i < num_constraints; ++i) { if (i != satisfied_start) printf (",\n "); printf ("satisfies_constraint_%s", enum_order[i]->c_name); } printf ("\n};\n\n"); }
/* Write out the wrapper function, constraint_satisfied_p, that maps a CONSTRAINT_xxx constant to one of the predicate functions generated above. */
Write out the wrapper function, constraint_satisfied_p, that maps a CONSTRAINT_xxx constant to one of the predicate functions generated above.
[ "Write", "out", "the", "wrapper", "function", "constraint_satisfied_p", "that", "maps", "a", "CONSTRAINT_xxx", "constant", "to", "one", "of", "the", "predicate", "functions", "generated", "above", "." ]
static void write_constraint_satisfied_p_array (void) { if (satisfied_start == num_constraints) return; printf ("bool (*constraint_satisfied_p_array[]) (rtx) = {\n "); for (unsigned int i = satisfied_start; i < num_constraints; ++i) { if (i != satisfied_start) printf (",\n "); printf ("satisfies_constraint_%s", enum_order[i]->c_name); } printf ("\n};\n\n"); }
[ "static", "void", "write_constraint_satisfied_p_array", "(", "void", ")", "{", "if", "(", "satisfied_start", "==", "num_constraints", ")", "return", ";", "printf", "(", "\"", "\\n", "\"", ")", ";", "for", "(", "unsigned", "int", "i", "=", "satisfied_start", ";", "i", "<", "num_constraints", ";", "++", "i", ")", "{", "if", "(", "i", "!=", "satisfied_start", ")", "printf", "(", "\"", "\\n", "\"", ")", ";", "printf", "(", "\"", "\"", ",", "enum_order", "[", "i", "]", "->", "c_name", ")", ";", "}", "printf", "(", "\"", "\\n", "\\n", "\\n", "\"", ")", ";", "}" ]
Write out the wrapper function, constraint_satisfied_p, that maps a CONSTRAINT_xxx constant to one of the predicate functions generated above.
[ "Write", "out", "the", "wrapper", "function", "constraint_satisfied_p", "that", "maps", "a", "CONSTRAINT_xxx", "constant", "to", "one", "of", "the", "predicate", "functions", "generated", "above", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_range_function
void
static void write_range_function (const char *name, unsigned int start, unsigned int end) { printf ("static inline bool\n"); if (start != end) printf ("%s (enum constraint_num c)\n" "{\n" " return c >= CONSTRAINT_%s && c <= CONSTRAINT_%s;\n" "}\n\n", name, enum_order[start]->c_name, enum_order[end - 1]->c_name); else printf ("%s (enum constraint_num)\n" "{\n" " return false;\n" "}\n\n", name); }
/* Write a definition for a function NAME that returns true if a given constraint_num is in the range [START, END). */
Write a definition for a function NAME that returns true if a given constraint_num is in the range [START, END).
[ "Write", "a", "definition", "for", "a", "function", "NAME", "that", "returns", "true", "if", "a", "given", "constraint_num", "is", "in", "the", "range", "[", "START", "END", ")", "." ]
static void write_range_function (const char *name, unsigned int start, unsigned int end) { printf ("static inline bool\n"); if (start != end) printf ("%s (enum constraint_num c)\n" "{\n" " return c >= CONSTRAINT_%s && c <= CONSTRAINT_%s;\n" "}\n\n", name, enum_order[start]->c_name, enum_order[end - 1]->c_name); else printf ("%s (enum constraint_num)\n" "{\n" " return false;\n" "}\n\n", name); }
[ "static", "void", "write_range_function", "(", "const", "char", "*", "name", ",", "unsigned", "int", "start", ",", "unsigned", "int", "end", ")", "{", "printf", "(", "\"", "\\n", "\"", ")", ";", "if", "(", "start", "!=", "end", ")", "printf", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\\n", "\"", ",", "name", ",", "enum_order", "[", "start", "]", "->", "c_name", ",", "enum_order", "[", "end", "-", "1", "]", "->", "c_name", ")", ";", "else", "printf", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\\n", "\"", ",", "name", ")", ";", "}" ]
Write a definition for a function NAME that returns true if a given constraint_num is in the range [START, END).
[ "Write", "a", "definition", "for", "a", "function", "NAME", "that", "returns", "true", "if", "a", "given", "constraint_num", "is", "in", "the", "range", "[", "START", "END", ")", "." ]
[]
[ { "param": "name", "type": "char" }, { "param": "start", "type": "unsigned int" }, { "param": "end", "type": "unsigned int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "start", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "end", "type": "unsigned int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_allows_reg_mem_function
void
static void write_allows_reg_mem_function (void) { printf ("static inline void\n" "insn_extra_constraint_allows_reg_mem (enum constraint_num c,\n" "\t\t\t\t bool *allows_reg, bool *allows_mem)\n" "{\n"); if (maybe_allows_none_start != maybe_allows_none_end) printf (" if (c >= CONSTRAINT_%s && c <= CONSTRAINT_%s)\n" " return;\n", enum_order[maybe_allows_none_start]->c_name, enum_order[maybe_allows_none_end - 1]->c_name); if (maybe_allows_reg_start != maybe_allows_reg_end) printf (" if (c >= CONSTRAINT_%s && c <= CONSTRAINT_%s)\n" " {\n" " *allows_reg = true;\n" " return;\n" " }\n", enum_order[maybe_allows_reg_start]->c_name, enum_order[maybe_allows_reg_end - 1]->c_name); if (maybe_allows_mem_start != maybe_allows_mem_end) printf (" if (c >= CONSTRAINT_%s && c <= CONSTRAINT_%s)\n" " {\n" " *allows_mem = true;\n" " return;\n" " }\n", enum_order[maybe_allows_mem_start]->c_name, enum_order[maybe_allows_mem_end - 1]->c_name); printf (" (void) c;\n" " *allows_reg = true;\n" " *allows_mem = true;\n" "}\n\n"); }
/* Write a definition for insn_extra_constraint_allows_reg_mem function. */
Write a definition for insn_extra_constraint_allows_reg_mem function.
[ "Write", "a", "definition", "for", "insn_extra_constraint_allows_reg_mem", "function", "." ]
static void write_allows_reg_mem_function (void) { printf ("static inline void\n" "insn_extra_constraint_allows_reg_mem (enum constraint_num c,\n" "\t\t\t\t bool *allows_reg, bool *allows_mem)\n" "{\n"); if (maybe_allows_none_start != maybe_allows_none_end) printf (" if (c >= CONSTRAINT_%s && c <= CONSTRAINT_%s)\n" " return;\n", enum_order[maybe_allows_none_start]->c_name, enum_order[maybe_allows_none_end - 1]->c_name); if (maybe_allows_reg_start != maybe_allows_reg_end) printf (" if (c >= CONSTRAINT_%s && c <= CONSTRAINT_%s)\n" " {\n" " *allows_reg = true;\n" " return;\n" " }\n", enum_order[maybe_allows_reg_start]->c_name, enum_order[maybe_allows_reg_end - 1]->c_name); if (maybe_allows_mem_start != maybe_allows_mem_end) printf (" if (c >= CONSTRAINT_%s && c <= CONSTRAINT_%s)\n" " {\n" " *allows_mem = true;\n" " return;\n" " }\n", enum_order[maybe_allows_mem_start]->c_name, enum_order[maybe_allows_mem_end - 1]->c_name); printf (" (void) c;\n" " *allows_reg = true;\n" " *allows_mem = true;\n" "}\n\n"); }
[ "static", "void", "write_allows_reg_mem_function", "(", "void", ")", "{", "printf", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\t", "\\t", "\\t", "\\t", "\\n", "\"", "\"", "\\n", "\"", ")", ";", "if", "(", "maybe_allows_none_start", "!=", "maybe_allows_none_end", ")", "printf", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", ",", "enum_order", "[", "maybe_allows_none_start", "]", "->", "c_name", ",", "enum_order", "[", "maybe_allows_none_end", "-", "1", "]", "->", "c_name", ")", ";", "if", "(", "maybe_allows_reg_start", "!=", "maybe_allows_reg_end", ")", "printf", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", ",", "enum_order", "[", "maybe_allows_reg_start", "]", "->", "c_name", ",", "enum_order", "[", "maybe_allows_reg_end", "-", "1", "]", "->", "c_name", ")", ";", "if", "(", "maybe_allows_mem_start", "!=", "maybe_allows_mem_end", ")", "printf", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", ",", "enum_order", "[", "maybe_allows_mem_start", "]", "->", "c_name", ",", "enum_order", "[", "maybe_allows_mem_end", "-", "1", "]", "->", "c_name", ")", ";", "printf", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\\n", "\"", ")", ";", "}" ]
Write a definition for insn_extra_constraint_allows_reg_mem function.
[ "Write", "a", "definition", "for", "insn_extra_constraint_allows_reg_mem", "function", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
e0892ffa5724ac120d3c4c6242ff093ac1a42d1f
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/genpreds.c
[ "BSD-3-Clause" ]
C
write_insn_preds_c
void
static void write_insn_preds_c (void) { struct pred_data *p; printf ("\ /* Generated automatically by the program '%s'\n\ from the machine description file '%s'. */\n\n", progname, md_reader_ptr->get_top_level_filename ()); puts ("\ #define IN_TARGET_CODE 1\n\ #include \"config.h\"\n\ #include \"system.h\"\n\ #include \"coretypes.h\"\n\ #include \"backend.h\"\n\ #include \"predict.h\"\n\ #include \"tree.h\"\n\ #include \"rtl.h\"\n\ #include \"alias.h\"\n\ #include \"varasm.h\"\n\ #include \"stor-layout.h\"\n\ #include \"calls.h\"\n\ #include \"memmodel.h\"\n\ #include \"tm_p.h\"\n\ #include \"insn-config.h\"\n\ #include \"recog.h\"\n\ #include \"output.h\"\n\ #include \"flags.h\"\n\ #include \"df.h\"\n\ #include \"resource.h\"\n\ #include \"diagnostic-core.h\"\n\ #include \"reload.h\"\n\ #include \"regs.h\"\n\ #include \"emit-rtl.h\"\n\ #include \"tm-constrs.h\"\n\ #include \"target.h\"\n"); FOR_ALL_PREDICATES (p) write_one_predicate_function (p); if (constraint_max_namelen > 0) { write_lookup_constraint_1 (); write_lookup_constraint_array (); if (have_register_constraints) write_reg_class_for_constraint_1 (); write_constraint_satisfied_p_array (); if (have_const_int_constraints) write_insn_const_int_ok_for_constraint (); } }
/* Write insn-preds.c. N.B. the list of headers to include was copied from genrecog; it may not be ideal. FUTURE: Write #line markers referring back to the machine description. (Can't practically do this now since we don't know the line number of the C block - just the line number of the enclosing expression.) */
Write #line markers referring back to the machine description. (Can't practically do this now since we don't know the line number of the C block - just the line number of the enclosing expression.)
[ "Write", "#line", "markers", "referring", "back", "to", "the", "machine", "description", ".", "(", "Can", "'", "t", "practically", "do", "this", "now", "since", "we", "don", "'", "t", "know", "the", "line", "number", "of", "the", "C", "block", "-", "just", "the", "line", "number", "of", "the", "enclosing", "expression", ".", ")" ]
static void write_insn_preds_c (void) { struct pred_data *p; printf ("\ /* Generated automatically by the program '%s'\n\ from the machine description file '%s'. */\n\n", progname, md_reader_ptr->get_top_level_filename ()); puts ("\ #define IN_TARGET_CODE 1\n\ #include \"config.h\"\n\ #include \"system.h\"\n\ #include \"coretypes.h\"\n\ #include \"backend.h\"\n\ #include \"predict.h\"\n\ #include \"tree.h\"\n\ #include \"rtl.h\"\n\ #include \"alias.h\"\n\ #include \"varasm.h\"\n\ #include \"stor-layout.h\"\n\ #include \"calls.h\"\n\ #include \"memmodel.h\"\n\ #include \"tm_p.h\"\n\ #include \"insn-config.h\"\n\ #include \"recog.h\"\n\ #include \"output.h\"\n\ #include \"flags.h\"\n\ #include \"df.h\"\n\ #include \"resource.h\"\n\ #include \"diagnostic-core.h\"\n\ #include \"reload.h\"\n\ #include \"regs.h\"\n\ #include \"emit-rtl.h\"\n\ #include \"tm-constrs.h\"\n\ #include \"target.h\"\n"); FOR_ALL_PREDICATES (p) write_one_predicate_function (p); if (constraint_max_namelen > 0) { write_lookup_constraint_1 (); write_lookup_constraint_array (); if (have_register_constraints) write_reg_class_for_constraint_1 (); write_constraint_satisfied_p_array (); if (have_const_int_constraints) write_insn_const_int_ok_for_constraint (); } }
[ "static", "void", "write_insn_preds_c", "(", "void", ")", "{", "struct", "pred_data", "*", "p", ";", "printf", "(", "\"", "\\\n", "\\n", "\\\n", "\\n", "\\n", "\"", ",", "progname", ",", "md_reader_ptr", "->", "get_top_level_filename", "(", ")", ")", ";", "puts", "(", "\"", "\\\n", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\\\n", "\\\"", "\\\"", "\\n", "\"", ")", ";", "FOR_ALL_PREDICATES", "(", "p", ")", "write_one_predicate_function", "(", "p", ")", ";", "if", "(", "constraint_max_namelen", ">", "0", ")", "{", "write_lookup_constraint_1", "(", ")", ";", "write_lookup_constraint_array", "(", ")", ";", "if", "(", "have_register_constraints", ")", "write_reg_class_for_constraint_1", "(", ")", ";", "write_constraint_satisfied_p_array", "(", ")", ";", "if", "(", "have_const_int_constraints", ")", "write_insn_const_int_ok_for_constraint", "(", ")", ";", "}", "}" ]
Write insn-preds.c.
[ "Write", "insn", "-", "preds", ".", "c", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
uiomove
int
int uiomove(caddr_t cp, size_t n, struct uio *uio) { thread_t td = curthread; struct iovec *iov; size_t cnt; size_t tot; int error = 0; int save = 0; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, ("uiomove: mode")); KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == td, ("uiomove proc")); crit_enter(); save = td->td_flags & TDF_DEADLKTREAT; td->td_flags |= TDF_DEADLKTREAT; crit_exit(); tot = 0; while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; cnt = iov->iov_len; if (cnt == 0) { uio->uio_iov++; uio->uio_iovcnt--; continue; } if (cnt > n) cnt = n; tot += cnt; switch (uio->uio_segflg) { case UIO_USERSPACE: if (tot > 1024*1024) lwkt_user_yield(); if (uio->uio_rw == UIO_READ) error = copyout(cp, iov->iov_base, cnt); else error = copyin(iov->iov_base, cp, cnt); break; case UIO_SYSSPACE: if (uio->uio_rw == UIO_READ) bcopy(cp, iov->iov_base, cnt); else bcopy(iov->iov_base, cp, cnt); break; case UIO_NOCOPY: break; } if (error) break; iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt; uio->uio_offset += cnt; cp += cnt; n -= cnt; } crit_enter(); td->td_flags = (td->td_flags & ~TDF_DEADLKTREAT) | save; crit_exit(); return (error); }
/* * UIO_READ: copy the kernelspace cp to the user or kernelspace UIO * UIO_WRITE: copy the user or kernelspace UIO to the kernelspace cp * * For userspace UIO's, uio_td must be the current thread. * * The syscall interface is responsible for limiting the length to * ssize_t for things like read() or write() which return the bytes * read or written as ssize_t. These functions work with unsigned * lengths. */
copy the kernelspace cp to the user or kernelspace UIO UIO_WRITE: copy the user or kernelspace UIO to the kernelspace cp For userspace UIO's, uio_td must be the current thread. The syscall interface is responsible for limiting the length to ssize_t for things like read() or write() which return the bytes read or written as ssize_t. These functions work with unsigned lengths.
[ "copy", "the", "kernelspace", "cp", "to", "the", "user", "or", "kernelspace", "UIO", "UIO_WRITE", ":", "copy", "the", "user", "or", "kernelspace", "UIO", "to", "the", "kernelspace", "cp", "For", "userspace", "UIO", "'", "s", "uio_td", "must", "be", "the", "current", "thread", ".", "The", "syscall", "interface", "is", "responsible", "for", "limiting", "the", "length", "to", "ssize_t", "for", "things", "like", "read", "()", "or", "write", "()", "which", "return", "the", "bytes", "read", "or", "written", "as", "ssize_t", ".", "These", "functions", "work", "with", "unsigned", "lengths", "." ]
int uiomove(caddr_t cp, size_t n, struct uio *uio) { thread_t td = curthread; struct iovec *iov; size_t cnt; size_t tot; int error = 0; int save = 0; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, ("uiomove: mode")); KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == td, ("uiomove proc")); crit_enter(); save = td->td_flags & TDF_DEADLKTREAT; td->td_flags |= TDF_DEADLKTREAT; crit_exit(); tot = 0; while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; cnt = iov->iov_len; if (cnt == 0) { uio->uio_iov++; uio->uio_iovcnt--; continue; } if (cnt > n) cnt = n; tot += cnt; switch (uio->uio_segflg) { case UIO_USERSPACE: if (tot > 1024*1024) lwkt_user_yield(); if (uio->uio_rw == UIO_READ) error = copyout(cp, iov->iov_base, cnt); else error = copyin(iov->iov_base, cp, cnt); break; case UIO_SYSSPACE: if (uio->uio_rw == UIO_READ) bcopy(cp, iov->iov_base, cnt); else bcopy(iov->iov_base, cp, cnt); break; case UIO_NOCOPY: break; } if (error) break; iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt; uio->uio_offset += cnt; cp += cnt; n -= cnt; } crit_enter(); td->td_flags = (td->td_flags & ~TDF_DEADLKTREAT) | save; crit_exit(); return (error); }
[ "int", "uiomove", "(", "caddr_t", "cp", ",", "size_t", "n", ",", "struct", "uio", "*", "uio", ")", "{", "thread_t", "td", "=", "curthread", ";", "struct", "iovec", "*", "iov", ";", "size_t", "cnt", ";", "size_t", "tot", ";", "int", "error", "=", "0", ";", "int", "save", "=", "0", ";", "KASSERT", "(", "uio", "->", "uio_rw", "==", "UIO_READ", "||", "uio", "->", "uio_rw", "==", "UIO_WRITE", ",", "(", "\"", "\"", ")", ")", ";", "KASSERT", "(", "uio", "->", "uio_segflg", "!=", "UIO_USERSPACE", "||", "uio", "->", "uio_td", "==", "td", ",", "(", "\"", "\"", ")", ")", ";", "crit_enter", "(", ")", ";", "save", "=", "td", "->", "td_flags", "&", "TDF_DEADLKTREAT", ";", "td", "->", "td_flags", "|=", "TDF_DEADLKTREAT", ";", "crit_exit", "(", ")", ";", "tot", "=", "0", ";", "while", "(", "n", ">", "0", "&&", "uio", "->", "uio_resid", ")", "{", "iov", "=", "uio", "->", "uio_iov", ";", "cnt", "=", "iov", "->", "iov_len", ";", "if", "(", "cnt", "==", "0", ")", "{", "uio", "->", "uio_iov", "++", ";", "uio", "->", "uio_iovcnt", "--", ";", "continue", ";", "}", "if", "(", "cnt", ">", "n", ")", "cnt", "=", "n", ";", "tot", "+=", "cnt", ";", "switch", "(", "uio", "->", "uio_segflg", ")", "{", "case", "UIO_USERSPACE", ":", "if", "(", "tot", ">", "1024", "*", "1024", ")", "lwkt_user_yield", "(", ")", ";", "if", "(", "uio", "->", "uio_rw", "==", "UIO_READ", ")", "error", "=", "copyout", "(", "cp", ",", "iov", "->", "iov_base", ",", "cnt", ")", ";", "else", "error", "=", "copyin", "(", "iov", "->", "iov_base", ",", "cp", ",", "cnt", ")", ";", "break", ";", "case", "UIO_SYSSPACE", ":", "if", "(", "uio", "->", "uio_rw", "==", "UIO_READ", ")", "bcopy", "(", "cp", ",", "iov", "->", "iov_base", ",", "cnt", ")", ";", "else", "bcopy", "(", "iov", "->", "iov_base", ",", "cp", ",", "cnt", ")", ";", "break", ";", "case", "UIO_NOCOPY", ":", "break", ";", "}", "if", "(", "error", ")", "break", ";", "iov", "->", "iov_base", "=", "(", "char", "*", ")", "iov", "->", "iov_base", "+", "cnt", ";", "iov", "->", "iov_len", "-=", "cnt", ";", "uio", "->", "uio_resid", "-=", "cnt", ";", "uio", "->", "uio_offset", "+=", "cnt", ";", "cp", "+=", "cnt", ";", "n", "-=", "cnt", ";", "}", "crit_enter", "(", ")", ";", "td", "->", "td_flags", "=", "(", "td", "->", "td_flags", "&", "~", "TDF_DEADLKTREAT", ")", "|", "save", ";", "crit_exit", "(", ")", ";", "return", "(", "error", ")", ";", "}" ]
UIO_READ: copy the kernelspace cp to the user or kernelspace UIO UIO_WRITE: copy the user or kernelspace UIO to the kernelspace cp
[ "UIO_READ", ":", "copy", "the", "kernelspace", "cp", "to", "the", "user", "or", "kernelspace", "UIO", "UIO_WRITE", ":", "copy", "the", "user", "or", "kernelspace", "UIO", "to", "the", "kernelspace", "cp" ]
[]
[ { "param": "cp", "type": "caddr_t" }, { "param": "n", "type": "size_t" }, { "param": "uio", "type": "struct uio" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cp", "type": "caddr_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "uio", "type": "struct uio", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
uiomovebp
int
int uiomovebp(struct buf *bp, caddr_t cp, size_t n, struct uio *uio) { int count; vm_page_t m; if (bp->b_vp && bp->b_vp->v_type == VREG && (bp->b_flags & B_CACHE) && (count = bp->b_xio.xio_npages) != 0 && (m = bp->b_xio.xio_pages[count-1])->valid != VM_PAGE_BITS_ALL) { vm_page_zero_invalid(m, TRUE); } return (uiomove(cp, n, uio)); }
/* * This is the same as uiomove() except (cp, n) is within the bounds of * the passed, locked buffer. Under certain circumstances a VM fault * occuring with a locked buffer held can result in a deadlock or an * attempt to recursively lock the buffer. * * This procedure deals with these cases. * * If the buffer represents a regular file, is B_CACHE, but the last VM page * is not fully valid we fix-up the last VM page. This should handle the * recursive lock issue. * * Deadlocks are another issue. We are holding the vp and the bp locked * and could deadlock against a different vp and/or bp if another thread is * trying to access us while we accessing it. The only solution here is * to release the bp and vnode lock and do the uio to/from a system buffer, * then regain the locks and copyback (if applicable). XXX TODO. */
This is the same as uiomove() except (cp, n) is within the bounds of the passed, locked buffer. Under certain circumstances a VM fault occuring with a locked buffer held can result in a deadlock or an attempt to recursively lock the buffer. This procedure deals with these cases. If the buffer represents a regular file, is B_CACHE, but the last VM page is not fully valid we fix-up the last VM page. This should handle the recursive lock issue. Deadlocks are another issue. We are holding the vp and the bp locked and could deadlock against a different vp and/or bp if another thread is trying to access us while we accessing it. The only solution here is to release the bp and vnode lock and do the uio to/from a system buffer, then regain the locks and copyback (if applicable). XXX TODO.
[ "This", "is", "the", "same", "as", "uiomove", "()", "except", "(", "cp", "n", ")", "is", "within", "the", "bounds", "of", "the", "passed", "locked", "buffer", ".", "Under", "certain", "circumstances", "a", "VM", "fault", "occuring", "with", "a", "locked", "buffer", "held", "can", "result", "in", "a", "deadlock", "or", "an", "attempt", "to", "recursively", "lock", "the", "buffer", ".", "This", "procedure", "deals", "with", "these", "cases", ".", "If", "the", "buffer", "represents", "a", "regular", "file", "is", "B_CACHE", "but", "the", "last", "VM", "page", "is", "not", "fully", "valid", "we", "fix", "-", "up", "the", "last", "VM", "page", ".", "This", "should", "handle", "the", "recursive", "lock", "issue", ".", "Deadlocks", "are", "another", "issue", ".", "We", "are", "holding", "the", "vp", "and", "the", "bp", "locked", "and", "could", "deadlock", "against", "a", "different", "vp", "and", "/", "or", "bp", "if", "another", "thread", "is", "trying", "to", "access", "us", "while", "we", "accessing", "it", ".", "The", "only", "solution", "here", "is", "to", "release", "the", "bp", "and", "vnode", "lock", "and", "do", "the", "uio", "to", "/", "from", "a", "system", "buffer", "then", "regain", "the", "locks", "and", "copyback", "(", "if", "applicable", ")", ".", "XXX", "TODO", "." ]
int uiomovebp(struct buf *bp, caddr_t cp, size_t n, struct uio *uio) { int count; vm_page_t m; if (bp->b_vp && bp->b_vp->v_type == VREG && (bp->b_flags & B_CACHE) && (count = bp->b_xio.xio_npages) != 0 && (m = bp->b_xio.xio_pages[count-1])->valid != VM_PAGE_BITS_ALL) { vm_page_zero_invalid(m, TRUE); } return (uiomove(cp, n, uio)); }
[ "int", "uiomovebp", "(", "struct", "buf", "*", "bp", ",", "caddr_t", "cp", ",", "size_t", "n", ",", "struct", "uio", "*", "uio", ")", "{", "int", "count", ";", "vm_page_t", "m", ";", "if", "(", "bp", "->", "b_vp", "&&", "bp", "->", "b_vp", "->", "v_type", "==", "VREG", "&&", "(", "bp", "->", "b_flags", "&", "B_CACHE", ")", "&&", "(", "count", "=", "bp", "->", "b_xio", ".", "xio_npages", ")", "!=", "0", "&&", "(", "m", "=", "bp", "->", "b_xio", ".", "xio_pages", "[", "count", "-", "1", "]", ")", "->", "valid", "!=", "VM_PAGE_BITS_ALL", ")", "{", "vm_page_zero_invalid", "(", "m", ",", "TRUE", ")", ";", "}", "return", "(", "uiomove", "(", "cp", ",", "n", ",", "uio", ")", ")", ";", "}" ]
This is the same as uiomove() except (cp, n) is within the bounds of the passed, locked buffer.
[ "This", "is", "the", "same", "as", "uiomove", "()", "except", "(", "cp", "n", ")", "is", "within", "the", "bounds", "of", "the", "passed", "locked", "buffer", "." ]
[]
[ { "param": "bp", "type": "struct buf" }, { "param": "cp", "type": "caddr_t" }, { "param": "n", "type": "size_t" }, { "param": "uio", "type": "struct uio" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bp", "type": "struct buf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cp", "type": "caddr_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "uio", "type": "struct uio", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
uiomove_nofault
int
int uiomove_nofault(caddr_t cp, size_t n, struct uio *uio) { thread_t td = curthread; int error; atomic_set_int(&td->td_flags, TDF_NOFAULT); error = uiomove(cp, n, uio); atomic_clear_int(&td->td_flags, TDF_NOFAULT); return error; }
/* * uiomove() but fail for non-trivial VM faults, even if the VM fault is * valid. Returns EFAULT if a VM fault occurred via the copyin/copyout * onfault code. * * This allows callers to hold e.g. a busy VM page, or a busy VM object, * or a locked vnode through the call and then fall-back to safer code * if we fail. */
uiomove() but fail for non-trivial VM faults, even if the VM fault is valid. Returns EFAULT if a VM fault occurred via the copyin/copyout onfault code. This allows callers to hold e.g. a busy VM page, or a busy VM object, or a locked vnode through the call and then fall-back to safer code if we fail.
[ "uiomove", "()", "but", "fail", "for", "non", "-", "trivial", "VM", "faults", "even", "if", "the", "VM", "fault", "is", "valid", ".", "Returns", "EFAULT", "if", "a", "VM", "fault", "occurred", "via", "the", "copyin", "/", "copyout", "onfault", "code", ".", "This", "allows", "callers", "to", "hold", "e", ".", "g", ".", "a", "busy", "VM", "page", "or", "a", "busy", "VM", "object", "or", "a", "locked", "vnode", "through", "the", "call", "and", "then", "fall", "-", "back", "to", "safer", "code", "if", "we", "fail", "." ]
int uiomove_nofault(caddr_t cp, size_t n, struct uio *uio) { thread_t td = curthread; int error; atomic_set_int(&td->td_flags, TDF_NOFAULT); error = uiomove(cp, n, uio); atomic_clear_int(&td->td_flags, TDF_NOFAULT); return error; }
[ "int", "uiomove_nofault", "(", "caddr_t", "cp", ",", "size_t", "n", ",", "struct", "uio", "*", "uio", ")", "{", "thread_t", "td", "=", "curthread", ";", "int", "error", ";", "atomic_set_int", "(", "&", "td", "->", "td_flags", ",", "TDF_NOFAULT", ")", ";", "error", "=", "uiomove", "(", "cp", ",", "n", ",", "uio", ")", ";", "atomic_clear_int", "(", "&", "td", "->", "td_flags", ",", "TDF_NOFAULT", ")", ";", "return", "error", ";", "}" ]
uiomove() but fail for non-trivial VM faults, even if the VM fault is valid.
[ "uiomove", "()", "but", "fail", "for", "non", "-", "trivial", "VM", "faults", "even", "if", "the", "VM", "fault", "is", "valid", "." ]
[]
[ { "param": "cp", "type": "caddr_t" }, { "param": "n", "type": "size_t" }, { "param": "uio", "type": "struct uio" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cp", "type": "caddr_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "uio", "type": "struct uio", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
uiomove_frombuf
int
int uiomove_frombuf(void *buf, size_t buflen, struct uio *uio) { size_t offset; offset = (size_t)uio->uio_offset; if ((off_t)offset != uio->uio_offset) return (EINVAL); if (buflen == 0 || offset >= buflen) return (0); return (uiomove((char *)buf + offset, buflen - offset, uio)); }
/* * Wrapper for uiomove() that validates the arguments against a known-good * kernel buffer. This function automatically indexes the buffer by * uio_offset and handles all range checking. */
Wrapper for uiomove() that validates the arguments against a known-good kernel buffer. This function automatically indexes the buffer by uio_offset and handles all range checking.
[ "Wrapper", "for", "uiomove", "()", "that", "validates", "the", "arguments", "against", "a", "known", "-", "good", "kernel", "buffer", ".", "This", "function", "automatically", "indexes", "the", "buffer", "by", "uio_offset", "and", "handles", "all", "range", "checking", "." ]
int uiomove_frombuf(void *buf, size_t buflen, struct uio *uio) { size_t offset; offset = (size_t)uio->uio_offset; if ((off_t)offset != uio->uio_offset) return (EINVAL); if (buflen == 0 || offset >= buflen) return (0); return (uiomove((char *)buf + offset, buflen - offset, uio)); }
[ "int", "uiomove_frombuf", "(", "void", "*", "buf", ",", "size_t", "buflen", ",", "struct", "uio", "*", "uio", ")", "{", "size_t", "offset", ";", "offset", "=", "(", "size_t", ")", "uio", "->", "uio_offset", ";", "if", "(", "(", "off_t", ")", "offset", "!=", "uio", "->", "uio_offset", ")", "return", "(", "EINVAL", ")", ";", "if", "(", "buflen", "==", "0", "||", "offset", ">=", "buflen", ")", "return", "(", "0", ")", ";", "return", "(", "uiomove", "(", "(", "char", "*", ")", "buf", "+", "offset", ",", "buflen", "-", "offset", ",", "uio", ")", ")", ";", "}" ]
Wrapper for uiomove() that validates the arguments against a known-good kernel buffer.
[ "Wrapper", "for", "uiomove", "()", "that", "validates", "the", "arguments", "against", "a", "known", "-", "good", "kernel", "buffer", "." ]
[]
[ { "param": "buf", "type": "void" }, { "param": "buflen", "type": "size_t" }, { "param": "uio", "type": "struct uio" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buf", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "buflen", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "uio", "type": "struct uio", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
ureadc
int
int ureadc(int c, struct uio *uio) { struct iovec *iov; char *iov_base; again: if (uio->uio_iovcnt == 0 || uio->uio_resid == 0) panic("ureadc"); iov = uio->uio_iov; if (iov->iov_len == 0) { uio->uio_iovcnt--; uio->uio_iov++; goto again; } switch (uio->uio_segflg) { case UIO_USERSPACE: if (subyte(iov->iov_base, c) < 0) return (EFAULT); break; case UIO_SYSSPACE: iov_base = iov->iov_base; *iov_base = c; iov->iov_base = iov_base; break; case UIO_NOCOPY: break; } iov->iov_base = (char *)iov->iov_base + 1; iov->iov_len--; uio->uio_resid--; uio->uio_offset++; return (0); }
/* * Give next character to user as result of read. */
Give next character to user as result of read.
[ "Give", "next", "character", "to", "user", "as", "result", "of", "read", "." ]
int ureadc(int c, struct uio *uio) { struct iovec *iov; char *iov_base; again: if (uio->uio_iovcnt == 0 || uio->uio_resid == 0) panic("ureadc"); iov = uio->uio_iov; if (iov->iov_len == 0) { uio->uio_iovcnt--; uio->uio_iov++; goto again; } switch (uio->uio_segflg) { case UIO_USERSPACE: if (subyte(iov->iov_base, c) < 0) return (EFAULT); break; case UIO_SYSSPACE: iov_base = iov->iov_base; *iov_base = c; iov->iov_base = iov_base; break; case UIO_NOCOPY: break; } iov->iov_base = (char *)iov->iov_base + 1; iov->iov_len--; uio->uio_resid--; uio->uio_offset++; return (0); }
[ "int", "ureadc", "(", "int", "c", ",", "struct", "uio", "*", "uio", ")", "{", "struct", "iovec", "*", "iov", ";", "char", "*", "iov_base", ";", "again", ":", "if", "(", "uio", "->", "uio_iovcnt", "==", "0", "||", "uio", "->", "uio_resid", "==", "0", ")", "panic", "(", "\"", "\"", ")", ";", "iov", "=", "uio", "->", "uio_iov", ";", "if", "(", "iov", "->", "iov_len", "==", "0", ")", "{", "uio", "->", "uio_iovcnt", "--", ";", "uio", "->", "uio_iov", "++", ";", "goto", "again", ";", "}", "switch", "(", "uio", "->", "uio_segflg", ")", "{", "case", "UIO_USERSPACE", ":", "if", "(", "subyte", "(", "iov", "->", "iov_base", ",", "c", ")", "<", "0", ")", "return", "(", "EFAULT", ")", ";", "break", ";", "case", "UIO_SYSSPACE", ":", "iov_base", "=", "iov", "->", "iov_base", ";", "*", "iov_base", "=", "c", ";", "iov", "->", "iov_base", "=", "iov_base", ";", "break", ";", "case", "UIO_NOCOPY", ":", "break", ";", "}", "iov", "->", "iov_base", "=", "(", "char", "*", ")", "iov", "->", "iov_base", "+", "1", ";", "iov", "->", "iov_len", "--", ";", "uio", "->", "uio_resid", "--", ";", "uio", "->", "uio_offset", "++", ";", "return", "(", "0", ")", ";", "}" ]
Give next character to user as result of read.
[ "Give", "next", "character", "to", "user", "as", "result", "of", "read", "." ]
[]
[ { "param": "c", "type": "int" }, { "param": "uio", "type": "struct uio" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "c", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "uio", "type": "struct uio", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
hashinit
void
void * hashinit(int elements, struct malloc_type *type, u_long *hashmask) { long hashsize; LIST_HEAD(generic, generic) *hashtbl; int i; if (elements <= 0) panic("hashinit: bad elements"); for (hashsize = 2; hashsize < elements; hashsize <<= 1) continue; hashtbl = kmalloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); for (i = 0; i < hashsize; i++) LIST_INIT(&hashtbl[i]); *hashmask = hashsize - 1; return (hashtbl); }
/* * General routine to allocate a hash table. Make the hash table size a * power of 2 greater or equal to the number of elements requested, and * store the masking value in *hashmask. */
General routine to allocate a hash table. Make the hash table size a power of 2 greater or equal to the number of elements requested, and store the masking value in *hashmask.
[ "General", "routine", "to", "allocate", "a", "hash", "table", ".", "Make", "the", "hash", "table", "size", "a", "power", "of", "2", "greater", "or", "equal", "to", "the", "number", "of", "elements", "requested", "and", "store", "the", "masking", "value", "in", "*", "hashmask", "." ]
void * hashinit(int elements, struct malloc_type *type, u_long *hashmask) { long hashsize; LIST_HEAD(generic, generic) *hashtbl; int i; if (elements <= 0) panic("hashinit: bad elements"); for (hashsize = 2; hashsize < elements; hashsize <<= 1) continue; hashtbl = kmalloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); for (i = 0; i < hashsize; i++) LIST_INIT(&hashtbl[i]); *hashmask = hashsize - 1; return (hashtbl); }
[ "void", "*", "hashinit", "(", "int", "elements", ",", "struct", "malloc_type", "*", "type", ",", "u_long", "*", "hashmask", ")", "{", "long", "hashsize", ";", "LIST_HEAD", "(", "generic", ",", "generic", ")", "*", "hashtbl", ";", "int", "i", ";", "if", "(", "elements", "<=", "0", ")", "panic", "(", "\"", "\"", ")", ";", "for", "(", "hashsize", "=", "2", ";", "hashsize", "<", "elements", ";", "hashsize", "<<=", "1", ")", "continue", ";", "hashtbl", "=", "kmalloc", "(", "(", "u_long", ")", "hashsize", "*", "sizeof", "(", "*", "hashtbl", ")", ",", "type", ",", "M_WAITOK", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "hashsize", ";", "i", "++", ")", "LIST_INIT", "(", "&", "hashtbl", "[", "i", "]", ")", ";", "*", "hashmask", "=", "hashsize", "-", "1", ";", "return", "(", "hashtbl", ")", ";", "}" ]
General routine to allocate a hash table.
[ "General", "routine", "to", "allocate", "a", "hash", "table", "." ]
[]
[ { "param": "elements", "type": "int" }, { "param": "type", "type": "struct malloc_type" }, { "param": "hashmask", "type": "u_long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elements", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "struct malloc_type", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "hashmask", "type": "u_long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
hashinit_ext
void
void * hashinit_ext(int elements, size_t size, struct malloc_type *type, u_long *hashmask) { long hashsize; void *hashtbl; if (elements <= 0) panic("hashinit: bad elements"); for (hashsize = 2; hashsize < elements; hashsize <<= 1) continue; hashtbl = kmalloc((size_t)hashsize * size, type, M_WAITOK | M_ZERO); *hashmask = hashsize - 1; return (hashtbl); }
/* * This is a newer version which allocates a hash table of structures. * * The returned array will be zero'd. The caller is responsible for * initializing the structures. */
This is a newer version which allocates a hash table of structures. The returned array will be zero'd. The caller is responsible for initializing the structures.
[ "This", "is", "a", "newer", "version", "which", "allocates", "a", "hash", "table", "of", "structures", ".", "The", "returned", "array", "will", "be", "zero", "'", "d", ".", "The", "caller", "is", "responsible", "for", "initializing", "the", "structures", "." ]
void * hashinit_ext(int elements, size_t size, struct malloc_type *type, u_long *hashmask) { long hashsize; void *hashtbl; if (elements <= 0) panic("hashinit: bad elements"); for (hashsize = 2; hashsize < elements; hashsize <<= 1) continue; hashtbl = kmalloc((size_t)hashsize * size, type, M_WAITOK | M_ZERO); *hashmask = hashsize - 1; return (hashtbl); }
[ "void", "*", "hashinit_ext", "(", "int", "elements", ",", "size_t", "size", ",", "struct", "malloc_type", "*", "type", ",", "u_long", "*", "hashmask", ")", "{", "long", "hashsize", ";", "void", "*", "hashtbl", ";", "if", "(", "elements", "<=", "0", ")", "panic", "(", "\"", "\"", ")", ";", "for", "(", "hashsize", "=", "2", ";", "hashsize", "<", "elements", ";", "hashsize", "<<=", "1", ")", "continue", ";", "hashtbl", "=", "kmalloc", "(", "(", "size_t", ")", "hashsize", "*", "size", ",", "type", ",", "M_WAITOK", "|", "M_ZERO", ")", ";", "*", "hashmask", "=", "hashsize", "-", "1", ";", "return", "(", "hashtbl", ")", ";", "}" ]
This is a newer version which allocates a hash table of structures.
[ "This", "is", "a", "newer", "version", "which", "allocates", "a", "hash", "table", "of", "structures", "." ]
[]
[ { "param": "elements", "type": "int" }, { "param": "size", "type": "size_t" }, { "param": "type", "type": "struct malloc_type" }, { "param": "hashmask", "type": "u_long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elements", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "struct malloc_type", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "hashmask", "type": "u_long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
phashinit
void
void * phashinit(int elements, struct malloc_type *type, u_long *nentries) { long hashsize; LIST_HEAD(generic, generic) *hashtbl; int i; if (elements <= 0) panic("phashinit: bad elements"); for (i = 1, hashsize = primes[1]; hashsize <= elements;) { i++; if (i == NPRIMES) break; hashsize = primes[i]; } hashsize = primes[i - 1]; hashtbl = kmalloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); for (i = 0; i < hashsize; i++) LIST_INIT(&hashtbl[i]); *nentries = hashsize; return (hashtbl); }
/* * General routine to allocate a prime number sized hash table. */
General routine to allocate a prime number sized hash table.
[ "General", "routine", "to", "allocate", "a", "prime", "number", "sized", "hash", "table", "." ]
void * phashinit(int elements, struct malloc_type *type, u_long *nentries) { long hashsize; LIST_HEAD(generic, generic) *hashtbl; int i; if (elements <= 0) panic("phashinit: bad elements"); for (i = 1, hashsize = primes[1]; hashsize <= elements;) { i++; if (i == NPRIMES) break; hashsize = primes[i]; } hashsize = primes[i - 1]; hashtbl = kmalloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); for (i = 0; i < hashsize; i++) LIST_INIT(&hashtbl[i]); *nentries = hashsize; return (hashtbl); }
[ "void", "*", "phashinit", "(", "int", "elements", ",", "struct", "malloc_type", "*", "type", ",", "u_long", "*", "nentries", ")", "{", "long", "hashsize", ";", "LIST_HEAD", "(", "generic", ",", "generic", ")", "*", "hashtbl", ";", "int", "i", ";", "if", "(", "elements", "<=", "0", ")", "panic", "(", "\"", "\"", ")", ";", "for", "(", "i", "=", "1", ",", "hashsize", "=", "primes", "[", "1", "]", ";", "hashsize", "<=", "elements", ";", ")", "{", "i", "++", ";", "if", "(", "i", "==", "NPRIMES", ")", "break", ";", "hashsize", "=", "primes", "[", "i", "]", ";", "}", "hashsize", "=", "primes", "[", "i", "-", "1", "]", ";", "hashtbl", "=", "kmalloc", "(", "(", "u_long", ")", "hashsize", "*", "sizeof", "(", "*", "hashtbl", ")", ",", "type", ",", "M_WAITOK", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "hashsize", ";", "i", "++", ")", "LIST_INIT", "(", "&", "hashtbl", "[", "i", "]", ")", ";", "*", "nentries", "=", "hashsize", ";", "return", "(", "hashtbl", ")", ";", "}" ]
General routine to allocate a prime number sized hash table.
[ "General", "routine", "to", "allocate", "a", "prime", "number", "sized", "hash", "table", "." ]
[]
[ { "param": "elements", "type": "int" }, { "param": "type", "type": "struct malloc_type" }, { "param": "nentries", "type": "u_long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elements", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "struct malloc_type", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nentries", "type": "u_long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
phashinit_ext
void
void * phashinit_ext(int elements, size_t size, struct malloc_type *type, u_long *nentries) { long hashsize; void *hashtbl; int i; if (elements <= 0) panic("phashinit: bad elements"); for (i = 1, hashsize = primes[1]; hashsize <= elements;) { i++; if (i == NPRIMES) break; hashsize = primes[i]; } hashsize = primes[i - 1]; hashtbl = kmalloc((size_t)hashsize * size, type, M_WAITOK | M_ZERO); *nentries = hashsize; return (hashtbl); }
/* * This is a newer version which allocates a hash table of structures * in a prime-number size. * * The returned array will be zero'd. The caller is responsible for * initializing the structures. */
This is a newer version which allocates a hash table of structures in a prime-number size. The returned array will be zero'd. The caller is responsible for initializing the structures.
[ "This", "is", "a", "newer", "version", "which", "allocates", "a", "hash", "table", "of", "structures", "in", "a", "prime", "-", "number", "size", ".", "The", "returned", "array", "will", "be", "zero", "'", "d", ".", "The", "caller", "is", "responsible", "for", "initializing", "the", "structures", "." ]
void * phashinit_ext(int elements, size_t size, struct malloc_type *type, u_long *nentries) { long hashsize; void *hashtbl; int i; if (elements <= 0) panic("phashinit: bad elements"); for (i = 1, hashsize = primes[1]; hashsize <= elements;) { i++; if (i == NPRIMES) break; hashsize = primes[i]; } hashsize = primes[i - 1]; hashtbl = kmalloc((size_t)hashsize * size, type, M_WAITOK | M_ZERO); *nentries = hashsize; return (hashtbl); }
[ "void", "*", "phashinit_ext", "(", "int", "elements", ",", "size_t", "size", ",", "struct", "malloc_type", "*", "type", ",", "u_long", "*", "nentries", ")", "{", "long", "hashsize", ";", "void", "*", "hashtbl", ";", "int", "i", ";", "if", "(", "elements", "<=", "0", ")", "panic", "(", "\"", "\"", ")", ";", "for", "(", "i", "=", "1", ",", "hashsize", "=", "primes", "[", "1", "]", ";", "hashsize", "<=", "elements", ";", ")", "{", "i", "++", ";", "if", "(", "i", "==", "NPRIMES", ")", "break", ";", "hashsize", "=", "primes", "[", "i", "]", ";", "}", "hashsize", "=", "primes", "[", "i", "-", "1", "]", ";", "hashtbl", "=", "kmalloc", "(", "(", "size_t", ")", "hashsize", "*", "size", ",", "type", ",", "M_WAITOK", "|", "M_ZERO", ")", ";", "*", "nentries", "=", "hashsize", ";", "return", "(", "hashtbl", ")", ";", "}" ]
This is a newer version which allocates a hash table of structures in a prime-number size.
[ "This", "is", "a", "newer", "version", "which", "allocates", "a", "hash", "table", "of", "structures", "in", "a", "prime", "-", "number", "size", "." ]
[]
[ { "param": "elements", "type": "int" }, { "param": "size", "type": "size_t" }, { "param": "type", "type": "struct malloc_type" }, { "param": "nentries", "type": "u_long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elements", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "struct malloc_type", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "nentries", "type": "u_long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
iovec_copyin
int
int iovec_copyin(const struct iovec *uiov, struct iovec **kiov, struct iovec *siov, int iov_cnt, size_t *iov_len) { struct iovec *iovp; int error, i; size_t len; if ((u_int)iov_cnt > UIO_MAXIOV) return EMSGSIZE; if (iov_cnt > UIO_SMALLIOV) { *kiov = kmalloc(sizeof(struct iovec) * iov_cnt, M_IOV, M_WAITOK); } else { *kiov = siov; } error = copyin(uiov, *kiov, iov_cnt * sizeof(struct iovec)); if (error == 0) { *iov_len = 0; for (i = 0, iovp = *kiov; i < iov_cnt; i++, iovp++) { /* * Check for both *iov_len overflows and out of * range iovp->iov_len's. We limit to the * capabilities of signed integers. * * GCC4 - overflow check opt requires assign/test. */ len = *iov_len + iovp->iov_len; if (len < *iov_len) error = EINVAL; *iov_len = len; } } /* * From userland disallow iovec's which exceed the sized size * limit as the system calls return ssize_t. * * NOTE: Internal kernel interfaces can handle the unsigned * limit. */ if (error == 0 && (ssize_t)*iov_len < 0) error = EINVAL; if (error) iovec_free(kiov, siov); return (error); }
/* * Copyin an iovec. If the iovec array fits, use the preallocated small * iovec structure. If it is too big, dynamically allocate an iovec array * of sufficient size. * * MPSAFE */
Copyin an iovec. If the iovec array fits, use the preallocated small iovec structure. If it is too big, dynamically allocate an iovec array of sufficient size. MPSAFE
[ "Copyin", "an", "iovec", ".", "If", "the", "iovec", "array", "fits", "use", "the", "preallocated", "small", "iovec", "structure", ".", "If", "it", "is", "too", "big", "dynamically", "allocate", "an", "iovec", "array", "of", "sufficient", "size", ".", "MPSAFE" ]
int iovec_copyin(const struct iovec *uiov, struct iovec **kiov, struct iovec *siov, int iov_cnt, size_t *iov_len) { struct iovec *iovp; int error, i; size_t len; if ((u_int)iov_cnt > UIO_MAXIOV) return EMSGSIZE; if (iov_cnt > UIO_SMALLIOV) { *kiov = kmalloc(sizeof(struct iovec) * iov_cnt, M_IOV, M_WAITOK); } else { *kiov = siov; } error = copyin(uiov, *kiov, iov_cnt * sizeof(struct iovec)); if (error == 0) { *iov_len = 0; for (i = 0, iovp = *kiov; i < iov_cnt; i++, iovp++) { len = *iov_len + iovp->iov_len; if (len < *iov_len) error = EINVAL; *iov_len = len; } } if (error == 0 && (ssize_t)*iov_len < 0) error = EINVAL; if (error) iovec_free(kiov, siov); return (error); }
[ "int", "iovec_copyin", "(", "const", "struct", "iovec", "*", "uiov", ",", "struct", "iovec", "*", "*", "kiov", ",", "struct", "iovec", "*", "siov", ",", "int", "iov_cnt", ",", "size_t", "*", "iov_len", ")", "{", "struct", "iovec", "*", "iovp", ";", "int", "error", ",", "i", ";", "size_t", "len", ";", "if", "(", "(", "u_int", ")", "iov_cnt", ">", "UIO_MAXIOV", ")", "return", "EMSGSIZE", ";", "if", "(", "iov_cnt", ">", "UIO_SMALLIOV", ")", "{", "*", "kiov", "=", "kmalloc", "(", "sizeof", "(", "struct", "iovec", ")", "*", "iov_cnt", ",", "M_IOV", ",", "M_WAITOK", ")", ";", "}", "else", "{", "*", "kiov", "=", "siov", ";", "}", "error", "=", "copyin", "(", "uiov", ",", "*", "kiov", ",", "iov_cnt", "*", "sizeof", "(", "struct", "iovec", ")", ")", ";", "if", "(", "error", "==", "0", ")", "{", "*", "iov_len", "=", "0", ";", "for", "(", "i", "=", "0", ",", "iovp", "=", "*", "kiov", ";", "i", "<", "iov_cnt", ";", "i", "++", ",", "iovp", "++", ")", "{", "len", "=", "*", "iov_len", "+", "iovp", "->", "iov_len", ";", "if", "(", "len", "<", "*", "iov_len", ")", "error", "=", "EINVAL", ";", "*", "iov_len", "=", "len", ";", "}", "}", "if", "(", "error", "==", "0", "&&", "(", "ssize_t", ")", "*", "iov_len", "<", "0", ")", "error", "=", "EINVAL", ";", "if", "(", "error", ")", "iovec_free", "(", "kiov", ",", "siov", ")", ";", "return", "(", "error", ")", ";", "}" ]
Copyin an iovec.
[ "Copyin", "an", "iovec", "." ]
[ "/*\n\t\t\t * Check for both *iov_len overflows and out of\n\t\t\t * range iovp->iov_len's. We limit to the\n\t\t\t * capabilities of signed integers.\n\t\t\t *\n\t\t\t * GCC4 - overflow check opt requires assign/test.\n\t\t\t */", "/*\n\t * From userland disallow iovec's which exceed the sized size\n\t * limit as the system calls return ssize_t.\n\t *\n\t * NOTE: Internal kernel interfaces can handle the unsigned\n\t *\t limit.\n\t */" ]
[ { "param": "uiov", "type": "struct iovec" }, { "param": "kiov", "type": "struct iovec" }, { "param": "siov", "type": "struct iovec" }, { "param": "iov_cnt", "type": "int" }, { "param": "iov_len", "type": "size_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "uiov", "type": "struct iovec", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kiov", "type": "struct iovec", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "siov", "type": "struct iovec", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "iov_cnt", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "iov_len", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f3e1f5c497f46a61d8eed8e0f52eeecab7a3394
atrens/DragonFlyBSD-src
sys/kern/kern_subr.c
[ "BSD-3-Clause" ]
C
uiomove_fromphys
int
int uiomove_fromphys(vm_page_t *ma, vm_offset_t offset, size_t n, struct uio *uio) { struct lwbuf lwb_cache; struct lwbuf *lwb; struct thread *td = curthread; struct iovec *iov; void *cp; vm_offset_t page_offset; vm_page_t m; size_t cnt; int error = 0; int save = 0; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, ("uiomove_fromphys: mode")); KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread, ("uiomove_fromphys proc")); crit_enter(); save = td->td_flags & TDF_DEADLKTREAT; td->td_flags |= TDF_DEADLKTREAT; crit_exit(); while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; cnt = iov->iov_len; if (cnt == 0) { uio->uio_iov++; uio->uio_iovcnt--; continue; } if (cnt > n) cnt = n; page_offset = offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - page_offset); m = ma[offset >> PAGE_SHIFT]; lwb = lwbuf_alloc(m, &lwb_cache); cp = (char *)lwbuf_kva(lwb) + page_offset; switch (uio->uio_segflg) { case UIO_USERSPACE: /* * note: removed uioyield (it was the wrong place to * put it). */ if (uio->uio_rw == UIO_READ) error = copyout(cp, iov->iov_base, cnt); else error = copyin(iov->iov_base, cp, cnt); if (error) { lwbuf_free(lwb); goto out; } break; case UIO_SYSSPACE: if (uio->uio_rw == UIO_READ) bcopy(cp, iov->iov_base, cnt); else bcopy(iov->iov_base, cp, cnt); break; case UIO_NOCOPY: break; } lwbuf_free(lwb); iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt; uio->uio_offset += cnt; offset += cnt; n -= cnt; } out: if (save == 0) { crit_enter(); td->td_flags &= ~TDF_DEADLKTREAT; crit_exit(); } return (error); }
/* * Implement uiomove(9) from physical memory using lwbuf's to reduce * the creation and destruction of ephemeral mappings. */
Implement uiomove(9) from physical memory using lwbuf's to reduce the creation and destruction of ephemeral mappings.
[ "Implement", "uiomove", "(", "9", ")", "from", "physical", "memory", "using", "lwbuf", "'", "s", "to", "reduce", "the", "creation", "and", "destruction", "of", "ephemeral", "mappings", "." ]
int uiomove_fromphys(vm_page_t *ma, vm_offset_t offset, size_t n, struct uio *uio) { struct lwbuf lwb_cache; struct lwbuf *lwb; struct thread *td = curthread; struct iovec *iov; void *cp; vm_offset_t page_offset; vm_page_t m; size_t cnt; int error = 0; int save = 0; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, ("uiomove_fromphys: mode")); KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread, ("uiomove_fromphys proc")); crit_enter(); save = td->td_flags & TDF_DEADLKTREAT; td->td_flags |= TDF_DEADLKTREAT; crit_exit(); while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; cnt = iov->iov_len; if (cnt == 0) { uio->uio_iov++; uio->uio_iovcnt--; continue; } if (cnt > n) cnt = n; page_offset = offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - page_offset); m = ma[offset >> PAGE_SHIFT]; lwb = lwbuf_alloc(m, &lwb_cache); cp = (char *)lwbuf_kva(lwb) + page_offset; switch (uio->uio_segflg) { case UIO_USERSPACE: if (uio->uio_rw == UIO_READ) error = copyout(cp, iov->iov_base, cnt); else error = copyin(iov->iov_base, cp, cnt); if (error) { lwbuf_free(lwb); goto out; } break; case UIO_SYSSPACE: if (uio->uio_rw == UIO_READ) bcopy(cp, iov->iov_base, cnt); else bcopy(iov->iov_base, cp, cnt); break; case UIO_NOCOPY: break; } lwbuf_free(lwb); iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt; uio->uio_offset += cnt; offset += cnt; n -= cnt; } out: if (save == 0) { crit_enter(); td->td_flags &= ~TDF_DEADLKTREAT; crit_exit(); } return (error); }
[ "int", "uiomove_fromphys", "(", "vm_page_t", "*", "ma", ",", "vm_offset_t", "offset", ",", "size_t", "n", ",", "struct", "uio", "*", "uio", ")", "{", "struct", "lwbuf", "lwb_cache", ";", "struct", "lwbuf", "*", "lwb", ";", "struct", "thread", "*", "td", "=", "curthread", ";", "struct", "iovec", "*", "iov", ";", "void", "*", "cp", ";", "vm_offset_t", "page_offset", ";", "vm_page_t", "m", ";", "size_t", "cnt", ";", "int", "error", "=", "0", ";", "int", "save", "=", "0", ";", "KASSERT", "(", "uio", "->", "uio_rw", "==", "UIO_READ", "||", "uio", "->", "uio_rw", "==", "UIO_WRITE", ",", "(", "\"", "\"", ")", ")", ";", "KASSERT", "(", "uio", "->", "uio_segflg", "!=", "UIO_USERSPACE", "||", "uio", "->", "uio_td", "==", "curthread", ",", "(", "\"", "\"", ")", ")", ";", "crit_enter", "(", ")", ";", "save", "=", "td", "->", "td_flags", "&", "TDF_DEADLKTREAT", ";", "td", "->", "td_flags", "|=", "TDF_DEADLKTREAT", ";", "crit_exit", "(", ")", ";", "while", "(", "n", ">", "0", "&&", "uio", "->", "uio_resid", ")", "{", "iov", "=", "uio", "->", "uio_iov", ";", "cnt", "=", "iov", "->", "iov_len", ";", "if", "(", "cnt", "==", "0", ")", "{", "uio", "->", "uio_iov", "++", ";", "uio", "->", "uio_iovcnt", "--", ";", "continue", ";", "}", "if", "(", "cnt", ">", "n", ")", "cnt", "=", "n", ";", "page_offset", "=", "offset", "&", "PAGE_MASK", ";", "cnt", "=", "min", "(", "cnt", ",", "PAGE_SIZE", "-", "page_offset", ")", ";", "m", "=", "ma", "[", "offset", ">>", "PAGE_SHIFT", "]", ";", "lwb", "=", "lwbuf_alloc", "(", "m", ",", "&", "lwb_cache", ")", ";", "cp", "=", "(", "char", "*", ")", "lwbuf_kva", "(", "lwb", ")", "+", "page_offset", ";", "switch", "(", "uio", "->", "uio_segflg", ")", "{", "case", "UIO_USERSPACE", ":", "if", "(", "uio", "->", "uio_rw", "==", "UIO_READ", ")", "error", "=", "copyout", "(", "cp", ",", "iov", "->", "iov_base", ",", "cnt", ")", ";", "else", "error", "=", "copyin", "(", "iov", "->", "iov_base", ",", "cp", ",", "cnt", ")", ";", "if", "(", "error", ")", "{", "lwbuf_free", "(", "lwb", ")", ";", "goto", "out", ";", "}", "break", ";", "case", "UIO_SYSSPACE", ":", "if", "(", "uio", "->", "uio_rw", "==", "UIO_READ", ")", "bcopy", "(", "cp", ",", "iov", "->", "iov_base", ",", "cnt", ")", ";", "else", "bcopy", "(", "iov", "->", "iov_base", ",", "cp", ",", "cnt", ")", ";", "break", ";", "case", "UIO_NOCOPY", ":", "break", ";", "}", "lwbuf_free", "(", "lwb", ")", ";", "iov", "->", "iov_base", "=", "(", "char", "*", ")", "iov", "->", "iov_base", "+", "cnt", ";", "iov", "->", "iov_len", "-=", "cnt", ";", "uio", "->", "uio_resid", "-=", "cnt", ";", "uio", "->", "uio_offset", "+=", "cnt", ";", "offset", "+=", "cnt", ";", "n", "-=", "cnt", ";", "}", "out", ":", "if", "(", "save", "==", "0", ")", "{", "crit_enter", "(", ")", ";", "td", "->", "td_flags", "&=", "~", "TDF_DEADLKTREAT", ";", "crit_exit", "(", ")", ";", "}", "return", "(", "error", ")", ";", "}" ]
Implement uiomove(9) from physical memory using lwbuf's to reduce the creation and destruction of ephemeral mappings.
[ "Implement", "uiomove", "(", "9", ")", "from", "physical", "memory", "using", "lwbuf", "'", "s", "to", "reduce", "the", "creation", "and", "destruction", "of", "ephemeral", "mappings", "." ]
[ "/*\n\t\t\t * note: removed uioyield (it was the wrong place to\n\t\t\t * put it).\n\t\t\t */" ]
[ { "param": "ma", "type": "vm_page_t" }, { "param": "offset", "type": "vm_offset_t" }, { "param": "n", "type": "size_t" }, { "param": "uio", "type": "struct uio" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ma", "type": "vm_page_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "offset", "type": "vm_offset_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "n", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "uio", "type": "struct uio", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a40bf2a883b05a27c8511b21d6718eed19ac928f
atrens/DragonFlyBSD-src
sys/kern/kern_kinfo.c
[ "BSD-3-Clause" ]
C
timevalfix
void
static void timevalfix(struct timeval *t1) { if (t1->tv_usec < 0) { t1->tv_sec--; t1->tv_usec += 1000000; } if (t1->tv_usec >= 1000000) { t1->tv_sec++; t1->tv_usec -= 1000000; } }
/* * This is a temporary hack for when libkvm compiles in this file * from userland. These functions don't belong here. */
This is a temporary hack for when libkvm compiles in this file from userland. These functions don't belong here.
[ "This", "is", "a", "temporary", "hack", "for", "when", "libkvm", "compiles", "in", "this", "file", "from", "userland", ".", "These", "functions", "don", "'", "t", "belong", "here", "." ]
static void timevalfix(struct timeval *t1) { if (t1->tv_usec < 0) { t1->tv_sec--; t1->tv_usec += 1000000; } if (t1->tv_usec >= 1000000) { t1->tv_sec++; t1->tv_usec -= 1000000; } }
[ "static", "void", "timevalfix", "(", "struct", "timeval", "*", "t1", ")", "{", "if", "(", "t1", "->", "tv_usec", "<", "0", ")", "{", "t1", "->", "tv_sec", "--", ";", "t1", "->", "tv_usec", "+=", "1000000", ";", "}", "if", "(", "t1", "->", "tv_usec", ">=", "1000000", ")", "{", "t1", "->", "tv_sec", "++", ";", "t1", "->", "tv_usec", "-=", "1000000", ";", "}", "}" ]
This is a temporary hack for when libkvm compiles in this file from userland.
[ "This", "is", "a", "temporary", "hack", "for", "when", "libkvm", "compiles", "in", "this", "file", "from", "userland", "." ]
[]
[ { "param": "t1", "type": "struct timeval" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "t1", "type": "struct timeval", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a40bf2a883b05a27c8511b21d6718eed19ac928f
atrens/DragonFlyBSD-src
sys/kern/kern_kinfo.c
[ "BSD-3-Clause" ]
C
fill_kinfo_proc
void
void fill_kinfo_proc(struct proc *p, struct kinfo_proc *kp) { struct session *sess; struct pgrp *pgrp; struct vmspace *vm; pgrp = p->p_pgrp; sess = pgrp ? pgrp->pg_session : NULL; bzero(kp, sizeof(*kp)); kp->kp_paddr = (uintptr_t)p; kp->kp_fd = (uintptr_t)p->p_fd; kp->kp_flags = p->p_flags; kp->kp_stat = p->p_stat; kp->kp_lock = p->p_lock; kp->kp_acflag = p->p_acflag; kp->kp_traceflag = p->p_traceflag; kp->kp_siglist = p->p_siglist; if (p->p_sigacts) { kp->kp_sigignore = p->p_sigignore; /* p_sigacts-> */ kp->kp_sigcatch = p->p_sigcatch; /* p_sigacts-> */ kp->kp_sigflag = p->p_sigacts->ps_flag; } kp->kp_start = p->p_start; strncpy(kp->kp_comm, p->p_comm, sizeof(kp->kp_comm) - 1); kp->kp_comm[sizeof(kp->kp_comm) - 1] = 0; if (p->p_ucred) { kp->kp_uid = p->p_ucred->cr_uid; kp->kp_ngroups = p->p_ucred->cr_ngroups; if (p->p_ucred->cr_groups) { bcopy(p->p_ucred->cr_groups, kp->kp_groups, NGROUPS * sizeof(kp->kp_groups[0])); } kp->kp_ruid = p->p_ucred->cr_ruid; kp->kp_svuid = p->p_ucred->cr_svuid; kp->kp_rgid = p->p_ucred->cr_rgid; kp->kp_svgid = p->p_ucred->cr_svgid; } kp->kp_pid = p->p_pid; if (p->p_oppid != 0) kp->kp_ppid = p->p_oppid; else kp->kp_ppid = p->p_pptr != NULL ? p->p_pptr->p_pid : -1; if (pgrp) { kp->kp_pgid = pgrp->pg_id; kp->kp_jobc = pgrp->pg_jobc; } if (sess) { kp->kp_sid = sess->s_sid; bcopy(sess->s_login, kp->kp_login, MAXLOGNAME); if (sess->s_ttyvp != NULL) kp->kp_auxflags |= KI_CTTY; if ((p->p_session != NULL) && SESS_LEADER(p)) kp->kp_auxflags |= KI_SLEADER; } if (sess && (p->p_flags & P_CONTROLT) != 0 && sess->s_ttyp != NULL) { kp->kp_tdev = devid_from_dev(sess->s_ttyp->t_dev); if (sess->s_ttyp->t_pgrp != NULL) kp->kp_tpgid = sess->s_ttyp->t_pgrp->pg_id; else kp->kp_tpgid = -1; if (sess->s_ttyp->t_session != NULL) kp->kp_tsid = sess->s_ttyp->t_session->s_sid; else kp->kp_tsid = -1; } else { kp->kp_tdev = NOUDEV; } kp->kp_exitstat = p->p_xstat; kp->kp_nthreads = p->p_nthreads; kp->kp_nice = p->p_nice; kp->kp_swtime = p->p_swtime; if ((vm = p->p_vmspace) != NULL) { kp->kp_vm_map_size = vm->vm_map.size; kp->kp_vm_rssize = vmspace_resident_count(vm); kp->kp_vm_swrss = vm->vm_swrss; kp->kp_vm_tsize = btoc(vm->vm_tsize); kp->kp_vm_dsize = btoc(vm->vm_dsize); kp->kp_vm_ssize = btoc(vm->vm_ssize); } if (p->p_ucred && jailed(p->p_ucred)) kp->kp_jailid = p->p_ucred->cr_prison->pr_id; kp->kp_ru = p->p_ru; kp->kp_cru = p->p_cru; }
/* * Fill in a struct kinfo_proc, and zero the lwp fields for a possible * fill_kinfo_lwp() aggregation. * * NOTE! We may be asked to fill in kinfo_proc for a zombied process, and * the process may be in the middle of being deallocated. Check all pointers * for NULL. * * Caller must hold p->p_token */
Fill in a struct kinfo_proc, and zero the lwp fields for a possible fill_kinfo_lwp() aggregation. NOTE. We may be asked to fill in kinfo_proc for a zombied process, and the process may be in the middle of being deallocated. Check all pointers for NULL. Caller must hold p->p_token
[ "Fill", "in", "a", "struct", "kinfo_proc", "and", "zero", "the", "lwp", "fields", "for", "a", "possible", "fill_kinfo_lwp", "()", "aggregation", ".", "NOTE", ".", "We", "may", "be", "asked", "to", "fill", "in", "kinfo_proc", "for", "a", "zombied", "process", "and", "the", "process", "may", "be", "in", "the", "middle", "of", "being", "deallocated", ".", "Check", "all", "pointers", "for", "NULL", ".", "Caller", "must", "hold", "p", "-", ">", "p_token" ]
void fill_kinfo_proc(struct proc *p, struct kinfo_proc *kp) { struct session *sess; struct pgrp *pgrp; struct vmspace *vm; pgrp = p->p_pgrp; sess = pgrp ? pgrp->pg_session : NULL; bzero(kp, sizeof(*kp)); kp->kp_paddr = (uintptr_t)p; kp->kp_fd = (uintptr_t)p->p_fd; kp->kp_flags = p->p_flags; kp->kp_stat = p->p_stat; kp->kp_lock = p->p_lock; kp->kp_acflag = p->p_acflag; kp->kp_traceflag = p->p_traceflag; kp->kp_siglist = p->p_siglist; if (p->p_sigacts) { kp->kp_sigignore = p->p_sigignore; kp->kp_sigcatch = p->p_sigcatch; kp->kp_sigflag = p->p_sigacts->ps_flag; } kp->kp_start = p->p_start; strncpy(kp->kp_comm, p->p_comm, sizeof(kp->kp_comm) - 1); kp->kp_comm[sizeof(kp->kp_comm) - 1] = 0; if (p->p_ucred) { kp->kp_uid = p->p_ucred->cr_uid; kp->kp_ngroups = p->p_ucred->cr_ngroups; if (p->p_ucred->cr_groups) { bcopy(p->p_ucred->cr_groups, kp->kp_groups, NGROUPS * sizeof(kp->kp_groups[0])); } kp->kp_ruid = p->p_ucred->cr_ruid; kp->kp_svuid = p->p_ucred->cr_svuid; kp->kp_rgid = p->p_ucred->cr_rgid; kp->kp_svgid = p->p_ucred->cr_svgid; } kp->kp_pid = p->p_pid; if (p->p_oppid != 0) kp->kp_ppid = p->p_oppid; else kp->kp_ppid = p->p_pptr != NULL ? p->p_pptr->p_pid : -1; if (pgrp) { kp->kp_pgid = pgrp->pg_id; kp->kp_jobc = pgrp->pg_jobc; } if (sess) { kp->kp_sid = sess->s_sid; bcopy(sess->s_login, kp->kp_login, MAXLOGNAME); if (sess->s_ttyvp != NULL) kp->kp_auxflags |= KI_CTTY; if ((p->p_session != NULL) && SESS_LEADER(p)) kp->kp_auxflags |= KI_SLEADER; } if (sess && (p->p_flags & P_CONTROLT) != 0 && sess->s_ttyp != NULL) { kp->kp_tdev = devid_from_dev(sess->s_ttyp->t_dev); if (sess->s_ttyp->t_pgrp != NULL) kp->kp_tpgid = sess->s_ttyp->t_pgrp->pg_id; else kp->kp_tpgid = -1; if (sess->s_ttyp->t_session != NULL) kp->kp_tsid = sess->s_ttyp->t_session->s_sid; else kp->kp_tsid = -1; } else { kp->kp_tdev = NOUDEV; } kp->kp_exitstat = p->p_xstat; kp->kp_nthreads = p->p_nthreads; kp->kp_nice = p->p_nice; kp->kp_swtime = p->p_swtime; if ((vm = p->p_vmspace) != NULL) { kp->kp_vm_map_size = vm->vm_map.size; kp->kp_vm_rssize = vmspace_resident_count(vm); kp->kp_vm_swrss = vm->vm_swrss; kp->kp_vm_tsize = btoc(vm->vm_tsize); kp->kp_vm_dsize = btoc(vm->vm_dsize); kp->kp_vm_ssize = btoc(vm->vm_ssize); } if (p->p_ucred && jailed(p->p_ucred)) kp->kp_jailid = p->p_ucred->cr_prison->pr_id; kp->kp_ru = p->p_ru; kp->kp_cru = p->p_cru; }
[ "void", "fill_kinfo_proc", "(", "struct", "proc", "*", "p", ",", "struct", "kinfo_proc", "*", "kp", ")", "{", "struct", "session", "*", "sess", ";", "struct", "pgrp", "*", "pgrp", ";", "struct", "vmspace", "*", "vm", ";", "pgrp", "=", "p", "->", "p_pgrp", ";", "sess", "=", "pgrp", "?", "pgrp", "->", "pg_session", ":", "NULL", ";", "bzero", "(", "kp", ",", "sizeof", "(", "*", "kp", ")", ")", ";", "kp", "->", "kp_paddr", "=", "(", "uintptr_t", ")", "p", ";", "kp", "->", "kp_fd", "=", "(", "uintptr_t", ")", "p", "->", "p_fd", ";", "kp", "->", "kp_flags", "=", "p", "->", "p_flags", ";", "kp", "->", "kp_stat", "=", "p", "->", "p_stat", ";", "kp", "->", "kp_lock", "=", "p", "->", "p_lock", ";", "kp", "->", "kp_acflag", "=", "p", "->", "p_acflag", ";", "kp", "->", "kp_traceflag", "=", "p", "->", "p_traceflag", ";", "kp", "->", "kp_siglist", "=", "p", "->", "p_siglist", ";", "if", "(", "p", "->", "p_sigacts", ")", "{", "kp", "->", "kp_sigignore", "=", "p", "->", "p_sigignore", ";", "kp", "->", "kp_sigcatch", "=", "p", "->", "p_sigcatch", ";", "kp", "->", "kp_sigflag", "=", "p", "->", "p_sigacts", "->", "ps_flag", ";", "}", "kp", "->", "kp_start", "=", "p", "->", "p_start", ";", "strncpy", "(", "kp", "->", "kp_comm", ",", "p", "->", "p_comm", ",", "sizeof", "(", "kp", "->", "kp_comm", ")", "-", "1", ")", ";", "kp", "->", "kp_comm", "[", "sizeof", "(", "kp", "->", "kp_comm", ")", "-", "1", "]", "=", "0", ";", "if", "(", "p", "->", "p_ucred", ")", "{", "kp", "->", "kp_uid", "=", "p", "->", "p_ucred", "->", "cr_uid", ";", "kp", "->", "kp_ngroups", "=", "p", "->", "p_ucred", "->", "cr_ngroups", ";", "if", "(", "p", "->", "p_ucred", "->", "cr_groups", ")", "{", "bcopy", "(", "p", "->", "p_ucred", "->", "cr_groups", ",", "kp", "->", "kp_groups", ",", "NGROUPS", "*", "sizeof", "(", "kp", "->", "kp_groups", "[", "0", "]", ")", ")", ";", "}", "kp", "->", "kp_ruid", "=", "p", "->", "p_ucred", "->", "cr_ruid", ";", "kp", "->", "kp_svuid", "=", "p", "->", "p_ucred", "->", "cr_svuid", ";", "kp", "->", "kp_rgid", "=", "p", "->", "p_ucred", "->", "cr_rgid", ";", "kp", "->", "kp_svgid", "=", "p", "->", "p_ucred", "->", "cr_svgid", ";", "}", "kp", "->", "kp_pid", "=", "p", "->", "p_pid", ";", "if", "(", "p", "->", "p_oppid", "!=", "0", ")", "kp", "->", "kp_ppid", "=", "p", "->", "p_oppid", ";", "else", "kp", "->", "kp_ppid", "=", "p", "->", "p_pptr", "!=", "NULL", "?", "p", "->", "p_pptr", "->", "p_pid", ":", "-1", ";", "if", "(", "pgrp", ")", "{", "kp", "->", "kp_pgid", "=", "pgrp", "->", "pg_id", ";", "kp", "->", "kp_jobc", "=", "pgrp", "->", "pg_jobc", ";", "}", "if", "(", "sess", ")", "{", "kp", "->", "kp_sid", "=", "sess", "->", "s_sid", ";", "bcopy", "(", "sess", "->", "s_login", ",", "kp", "->", "kp_login", ",", "MAXLOGNAME", ")", ";", "if", "(", "sess", "->", "s_ttyvp", "!=", "NULL", ")", "kp", "->", "kp_auxflags", "|=", "KI_CTTY", ";", "if", "(", "(", "p", "->", "p_session", "!=", "NULL", ")", "&&", "SESS_LEADER", "(", "p", ")", ")", "kp", "->", "kp_auxflags", "|=", "KI_SLEADER", ";", "}", "if", "(", "sess", "&&", "(", "p", "->", "p_flags", "&", "P_CONTROLT", ")", "!=", "0", "&&", "sess", "->", "s_ttyp", "!=", "NULL", ")", "{", "kp", "->", "kp_tdev", "=", "devid_from_dev", "(", "sess", "->", "s_ttyp", "->", "t_dev", ")", ";", "if", "(", "sess", "->", "s_ttyp", "->", "t_pgrp", "!=", "NULL", ")", "kp", "->", "kp_tpgid", "=", "sess", "->", "s_ttyp", "->", "t_pgrp", "->", "pg_id", ";", "else", "kp", "->", "kp_tpgid", "=", "-1", ";", "if", "(", "sess", "->", "s_ttyp", "->", "t_session", "!=", "NULL", ")", "kp", "->", "kp_tsid", "=", "sess", "->", "s_ttyp", "->", "t_session", "->", "s_sid", ";", "else", "kp", "->", "kp_tsid", "=", "-1", ";", "}", "else", "{", "kp", "->", "kp_tdev", "=", "NOUDEV", ";", "}", "kp", "->", "kp_exitstat", "=", "p", "->", "p_xstat", ";", "kp", "->", "kp_nthreads", "=", "p", "->", "p_nthreads", ";", "kp", "->", "kp_nice", "=", "p", "->", "p_nice", ";", "kp", "->", "kp_swtime", "=", "p", "->", "p_swtime", ";", "if", "(", "(", "vm", "=", "p", "->", "p_vmspace", ")", "!=", "NULL", ")", "{", "kp", "->", "kp_vm_map_size", "=", "vm", "->", "vm_map", ".", "size", ";", "kp", "->", "kp_vm_rssize", "=", "vmspace_resident_count", "(", "vm", ")", ";", "kp", "->", "kp_vm_swrss", "=", "vm", "->", "vm_swrss", ";", "kp", "->", "kp_vm_tsize", "=", "btoc", "(", "vm", "->", "vm_tsize", ")", ";", "kp", "->", "kp_vm_dsize", "=", "btoc", "(", "vm", "->", "vm_dsize", ")", ";", "kp", "->", "kp_vm_ssize", "=", "btoc", "(", "vm", "->", "vm_ssize", ")", ";", "}", "if", "(", "p", "->", "p_ucred", "&&", "jailed", "(", "p", "->", "p_ucred", ")", ")", "kp", "->", "kp_jailid", "=", "p", "->", "p_ucred", "->", "cr_prison", "->", "pr_id", ";", "kp", "->", "kp_ru", "=", "p", "->", "p_ru", ";", "kp", "->", "kp_cru", "=", "p", "->", "p_cru", ";", "}" ]
Fill in a struct kinfo_proc, and zero the lwp fields for a possible fill_kinfo_lwp() aggregation.
[ "Fill", "in", "a", "struct", "kinfo_proc", "and", "zero", "the", "lwp", "fields", "for", "a", "possible", "fill_kinfo_lwp", "()", "aggregation", "." ]
[ "/* p_sigacts-> */", "/* p_sigacts-> */" ]
[ { "param": "p", "type": "struct proc" }, { "param": "kp", "type": "struct kinfo_proc" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p", "type": "struct proc", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kp", "type": "struct kinfo_proc", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a40bf2a883b05a27c8511b21d6718eed19ac928f
atrens/DragonFlyBSD-src
sys/kern/kern_kinfo.c
[ "BSD-3-Clause" ]
C
fill_kinfo_lwp
void
void fill_kinfo_lwp(struct lwp *lwp, struct kinfo_lwp *kl) { kl->kl_pid = lwp->lwp_proc->p_pid; kl->kl_tid = lwp->lwp_tid; kl->kl_flags = lwp->lwp_flags; kl->kl_stat = lwp->lwp_stat; kl->kl_lock = lwp->lwp_lock; kl->kl_tdflags = lwp->lwp_thread->td_flags; /* * The process/lwp stat may not reflect whether the process is * actually sleeping or not if the related thread was directly * descheduled by LWKT. Adjust the stat if the thread is not * runnable and not waiting to be scheduled on a cpu by the * user process scheduler. */ if (kl->kl_stat == LSRUN) { if ((kl->kl_tdflags & TDF_RUNQ) == 0 && (lwp->lwp_mpflags & LWP_MP_ONRUNQ) == 0) { kl->kl_stat = LSSLEEP; } } #ifdef _KERNEL kl->kl_mpcount = get_mplock_count(lwp->lwp_thread); #else kl->kl_mpcount = 0; #endif kl->kl_prio = lwp->lwp_usdata.bsd4.priority; /* XXX TGEN dangerous assumption */ kl->kl_tdprio = lwp->lwp_thread->td_pri; kl->kl_rtprio = lwp->lwp_rtprio; kl->kl_uticks += lwp->lwp_thread->td_uticks; kl->kl_sticks += lwp->lwp_thread->td_sticks; kl->kl_iticks += lwp->lwp_thread->td_iticks; kl->kl_cpticks += lwp->lwp_cpticks; kl->kl_pctcpu += lwp->lwp_proc->p_stat == SZOMB ? 0 : lwp->lwp_pctcpu; kl->kl_slptime += lwp->lwp_slptime; kl->kl_origcpu = lwp->lwp_usdata.bsd4.batch; kl->kl_estcpu = lwp->lwp_usdata.bsd4.estcpu; kl->kl_cpuid = lwp->lwp_thread->td_gd->gd_cpuid; ruadd(&kl->kl_ru, &lwp->lwp_ru); kl->kl_siglist = lwp->lwp_siglist; kl->kl_sigmask = lwp->lwp_sigmask; kl->kl_wchan = (uintptr_t)lwp->lwp_thread->td_wchan; if (lwp->lwp_thread->td_wmesg) { strncpy(kl->kl_wmesg, lwp->lwp_thread->td_wmesg, WMESGLEN); kl->kl_wmesg[WMESGLEN] = 0; } strlcpy(kl->kl_comm, lwp->lwp_thread->td_comm, sizeof(kl->kl_comm)); }
/* * Fill in a struct kinfo_lwp. This routine also doubles as an aggregator * of lwps for the proc. * * The kl structure must be initially zerod by the caller. Note that * fill_kinfo_proc() will do this for us. */
Fill in a struct kinfo_lwp. This routine also doubles as an aggregator of lwps for the proc. The kl structure must be initially zerod by the caller. Note that fill_kinfo_proc() will do this for us.
[ "Fill", "in", "a", "struct", "kinfo_lwp", ".", "This", "routine", "also", "doubles", "as", "an", "aggregator", "of", "lwps", "for", "the", "proc", ".", "The", "kl", "structure", "must", "be", "initially", "zerod", "by", "the", "caller", ".", "Note", "that", "fill_kinfo_proc", "()", "will", "do", "this", "for", "us", "." ]
void fill_kinfo_lwp(struct lwp *lwp, struct kinfo_lwp *kl) { kl->kl_pid = lwp->lwp_proc->p_pid; kl->kl_tid = lwp->lwp_tid; kl->kl_flags = lwp->lwp_flags; kl->kl_stat = lwp->lwp_stat; kl->kl_lock = lwp->lwp_lock; kl->kl_tdflags = lwp->lwp_thread->td_flags; if (kl->kl_stat == LSRUN) { if ((kl->kl_tdflags & TDF_RUNQ) == 0 && (lwp->lwp_mpflags & LWP_MP_ONRUNQ) == 0) { kl->kl_stat = LSSLEEP; } } #ifdef _KERNEL kl->kl_mpcount = get_mplock_count(lwp->lwp_thread); #else kl->kl_mpcount = 0; #endif kl->kl_prio = lwp->lwp_usdata.bsd4.priority; kl->kl_tdprio = lwp->lwp_thread->td_pri; kl->kl_rtprio = lwp->lwp_rtprio; kl->kl_uticks += lwp->lwp_thread->td_uticks; kl->kl_sticks += lwp->lwp_thread->td_sticks; kl->kl_iticks += lwp->lwp_thread->td_iticks; kl->kl_cpticks += lwp->lwp_cpticks; kl->kl_pctcpu += lwp->lwp_proc->p_stat == SZOMB ? 0 : lwp->lwp_pctcpu; kl->kl_slptime += lwp->lwp_slptime; kl->kl_origcpu = lwp->lwp_usdata.bsd4.batch; kl->kl_estcpu = lwp->lwp_usdata.bsd4.estcpu; kl->kl_cpuid = lwp->lwp_thread->td_gd->gd_cpuid; ruadd(&kl->kl_ru, &lwp->lwp_ru); kl->kl_siglist = lwp->lwp_siglist; kl->kl_sigmask = lwp->lwp_sigmask; kl->kl_wchan = (uintptr_t)lwp->lwp_thread->td_wchan; if (lwp->lwp_thread->td_wmesg) { strncpy(kl->kl_wmesg, lwp->lwp_thread->td_wmesg, WMESGLEN); kl->kl_wmesg[WMESGLEN] = 0; } strlcpy(kl->kl_comm, lwp->lwp_thread->td_comm, sizeof(kl->kl_comm)); }
[ "void", "fill_kinfo_lwp", "(", "struct", "lwp", "*", "lwp", ",", "struct", "kinfo_lwp", "*", "kl", ")", "{", "kl", "->", "kl_pid", "=", "lwp", "->", "lwp_proc", "->", "p_pid", ";", "kl", "->", "kl_tid", "=", "lwp", "->", "lwp_tid", ";", "kl", "->", "kl_flags", "=", "lwp", "->", "lwp_flags", ";", "kl", "->", "kl_stat", "=", "lwp", "->", "lwp_stat", ";", "kl", "->", "kl_lock", "=", "lwp", "->", "lwp_lock", ";", "kl", "->", "kl_tdflags", "=", "lwp", "->", "lwp_thread", "->", "td_flags", ";", "if", "(", "kl", "->", "kl_stat", "==", "LSRUN", ")", "{", "if", "(", "(", "kl", "->", "kl_tdflags", "&", "TDF_RUNQ", ")", "==", "0", "&&", "(", "lwp", "->", "lwp_mpflags", "&", "LWP_MP_ONRUNQ", ")", "==", "0", ")", "{", "kl", "->", "kl_stat", "=", "LSSLEEP", ";", "}", "}", "#ifdef", "_KERNEL", "kl", "->", "kl_mpcount", "=", "get_mplock_count", "(", "lwp", "->", "lwp_thread", ")", ";", "#else", "kl", "->", "kl_mpcount", "=", "0", ";", "#endif", "kl", "->", "kl_prio", "=", "lwp", "->", "lwp_usdata", ".", "bsd4", ".", "priority", ";", "kl", "->", "kl_tdprio", "=", "lwp", "->", "lwp_thread", "->", "td_pri", ";", "kl", "->", "kl_rtprio", "=", "lwp", "->", "lwp_rtprio", ";", "kl", "->", "kl_uticks", "+=", "lwp", "->", "lwp_thread", "->", "td_uticks", ";", "kl", "->", "kl_sticks", "+=", "lwp", "->", "lwp_thread", "->", "td_sticks", ";", "kl", "->", "kl_iticks", "+=", "lwp", "->", "lwp_thread", "->", "td_iticks", ";", "kl", "->", "kl_cpticks", "+=", "lwp", "->", "lwp_cpticks", ";", "kl", "->", "kl_pctcpu", "+=", "lwp", "->", "lwp_proc", "->", "p_stat", "==", "SZOMB", "?", "0", ":", "lwp", "->", "lwp_pctcpu", ";", "kl", "->", "kl_slptime", "+=", "lwp", "->", "lwp_slptime", ";", "kl", "->", "kl_origcpu", "=", "lwp", "->", "lwp_usdata", ".", "bsd4", ".", "batch", ";", "kl", "->", "kl_estcpu", "=", "lwp", "->", "lwp_usdata", ".", "bsd4", ".", "estcpu", ";", "kl", "->", "kl_cpuid", "=", "lwp", "->", "lwp_thread", "->", "td_gd", "->", "gd_cpuid", ";", "ruadd", "(", "&", "kl", "->", "kl_ru", ",", "&", "lwp", "->", "lwp_ru", ")", ";", "kl", "->", "kl_siglist", "=", "lwp", "->", "lwp_siglist", ";", "kl", "->", "kl_sigmask", "=", "lwp", "->", "lwp_sigmask", ";", "kl", "->", "kl_wchan", "=", "(", "uintptr_t", ")", "lwp", "->", "lwp_thread", "->", "td_wchan", ";", "if", "(", "lwp", "->", "lwp_thread", "->", "td_wmesg", ")", "{", "strncpy", "(", "kl", "->", "kl_wmesg", ",", "lwp", "->", "lwp_thread", "->", "td_wmesg", ",", "WMESGLEN", ")", ";", "kl", "->", "kl_wmesg", "[", "WMESGLEN", "]", "=", "0", ";", "}", "strlcpy", "(", "kl", "->", "kl_comm", ",", "lwp", "->", "lwp_thread", "->", "td_comm", ",", "sizeof", "(", "kl", "->", "kl_comm", ")", ")", ";", "}" ]
Fill in a struct kinfo_lwp.
[ "Fill", "in", "a", "struct", "kinfo_lwp", "." ]
[ "/*\n\t * The process/lwp stat may not reflect whether the process is\n\t * actually sleeping or not if the related thread was directly\n\t * descheduled by LWKT. Adjust the stat if the thread is not\n\t * runnable and not waiting to be scheduled on a cpu by the\n\t * user process scheduler.\n\t */", "/* XXX TGEN dangerous assumption */" ]
[ { "param": "lwp", "type": "struct lwp" }, { "param": "kl", "type": "struct kinfo_lwp" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lwp", "type": "struct lwp", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kl", "type": "struct kinfo_lwp", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a40bf2a883b05a27c8511b21d6718eed19ac928f
atrens/DragonFlyBSD-src
sys/kern/kern_kinfo.c
[ "BSD-3-Clause" ]
C
fill_kinfo_proc_kthread
void
void fill_kinfo_proc_kthread(struct thread *td, struct kinfo_proc *kp) { bzero(kp, sizeof(*kp)); /* * Fill in fake proc information and semi-fake lwp info. */ kp->kp_pid = -1; kp->kp_tdev = NOUDEV; strncpy(kp->kp_comm, td->td_comm, sizeof(kp->kp_comm) - 1); kp->kp_comm[sizeof(kp->kp_comm) - 1] = 0; kp->kp_flags = P_SYSTEM; if (td != &td->td_gd->gd_idlethread) kp->kp_stat = SACTIVE; else kp->kp_stat = SIDL; kp->kp_nthreads = 1; kp->kp_ktaddr = (uintptr_t)td; kp->kp_lwp.kl_pid = -1; kp->kp_lwp.kl_tid = -1; kp->kp_lwp.kl_tdflags = td->td_flags; #ifdef _KERNEL kp->kp_lwp.kl_mpcount = get_mplock_count(td); #else kp->kp_lwp.kl_mpcount = 0; #endif kp->kp_lwp.kl_tdprio = td->td_pri; kp->kp_lwp.kl_rtprio.type = RTP_PRIO_THREAD; kp->kp_lwp.kl_rtprio.prio = td->td_pri; kp->kp_lwp.kl_uticks = td->td_uticks; kp->kp_lwp.kl_sticks = td->td_sticks; kp->kp_lwp.kl_iticks = td->td_iticks; kp->kp_lwp.kl_cpuid = td->td_gd->gd_cpuid; kp->kp_lwp.kl_wchan = (uintptr_t)td->td_wchan; if (td->td_flags & TDF_RUNQ) kp->kp_lwp.kl_stat = LSRUN; else kp->kp_lwp.kl_stat = LSSLEEP; if (td->td_wmesg) { strncpy(kp->kp_lwp.kl_wmesg, td->td_wmesg, WMESGLEN); kp->kp_lwp.kl_wmesg[WMESGLEN] = 0; } strlcpy(kp->kp_lwp.kl_comm, td->td_comm, sizeof(kp->kp_lwp.kl_comm)); }
/* * Fill in a struct kinfo_proc for kernel threads (i.e. those without proc). */
Fill in a struct kinfo_proc for kernel threads .
[ "Fill", "in", "a", "struct", "kinfo_proc", "for", "kernel", "threads", "." ]
void fill_kinfo_proc_kthread(struct thread *td, struct kinfo_proc *kp) { bzero(kp, sizeof(*kp)); kp->kp_pid = -1; kp->kp_tdev = NOUDEV; strncpy(kp->kp_comm, td->td_comm, sizeof(kp->kp_comm) - 1); kp->kp_comm[sizeof(kp->kp_comm) - 1] = 0; kp->kp_flags = P_SYSTEM; if (td != &td->td_gd->gd_idlethread) kp->kp_stat = SACTIVE; else kp->kp_stat = SIDL; kp->kp_nthreads = 1; kp->kp_ktaddr = (uintptr_t)td; kp->kp_lwp.kl_pid = -1; kp->kp_lwp.kl_tid = -1; kp->kp_lwp.kl_tdflags = td->td_flags; #ifdef _KERNEL kp->kp_lwp.kl_mpcount = get_mplock_count(td); #else kp->kp_lwp.kl_mpcount = 0; #endif kp->kp_lwp.kl_tdprio = td->td_pri; kp->kp_lwp.kl_rtprio.type = RTP_PRIO_THREAD; kp->kp_lwp.kl_rtprio.prio = td->td_pri; kp->kp_lwp.kl_uticks = td->td_uticks; kp->kp_lwp.kl_sticks = td->td_sticks; kp->kp_lwp.kl_iticks = td->td_iticks; kp->kp_lwp.kl_cpuid = td->td_gd->gd_cpuid; kp->kp_lwp.kl_wchan = (uintptr_t)td->td_wchan; if (td->td_flags & TDF_RUNQ) kp->kp_lwp.kl_stat = LSRUN; else kp->kp_lwp.kl_stat = LSSLEEP; if (td->td_wmesg) { strncpy(kp->kp_lwp.kl_wmesg, td->td_wmesg, WMESGLEN); kp->kp_lwp.kl_wmesg[WMESGLEN] = 0; } strlcpy(kp->kp_lwp.kl_comm, td->td_comm, sizeof(kp->kp_lwp.kl_comm)); }
[ "void", "fill_kinfo_proc_kthread", "(", "struct", "thread", "*", "td", ",", "struct", "kinfo_proc", "*", "kp", ")", "{", "bzero", "(", "kp", ",", "sizeof", "(", "*", "kp", ")", ")", ";", "kp", "->", "kp_pid", "=", "-1", ";", "kp", "->", "kp_tdev", "=", "NOUDEV", ";", "strncpy", "(", "kp", "->", "kp_comm", ",", "td", "->", "td_comm", ",", "sizeof", "(", "kp", "->", "kp_comm", ")", "-", "1", ")", ";", "kp", "->", "kp_comm", "[", "sizeof", "(", "kp", "->", "kp_comm", ")", "-", "1", "]", "=", "0", ";", "kp", "->", "kp_flags", "=", "P_SYSTEM", ";", "if", "(", "td", "!=", "&", "td", "->", "td_gd", "->", "gd_idlethread", ")", "kp", "->", "kp_stat", "=", "SACTIVE", ";", "else", "kp", "->", "kp_stat", "=", "SIDL", ";", "kp", "->", "kp_nthreads", "=", "1", ";", "kp", "->", "kp_ktaddr", "=", "(", "uintptr_t", ")", "td", ";", "kp", "->", "kp_lwp", ".", "kl_pid", "=", "-1", ";", "kp", "->", "kp_lwp", ".", "kl_tid", "=", "-1", ";", "kp", "->", "kp_lwp", ".", "kl_tdflags", "=", "td", "->", "td_flags", ";", "#ifdef", "_KERNEL", "kp", "->", "kp_lwp", ".", "kl_mpcount", "=", "get_mplock_count", "(", "td", ")", ";", "#else", "kp", "->", "kp_lwp", ".", "kl_mpcount", "=", "0", ";", "#endif", "kp", "->", "kp_lwp", ".", "kl_tdprio", "=", "td", "->", "td_pri", ";", "kp", "->", "kp_lwp", ".", "kl_rtprio", ".", "type", "=", "RTP_PRIO_THREAD", ";", "kp", "->", "kp_lwp", ".", "kl_rtprio", ".", "prio", "=", "td", "->", "td_pri", ";", "kp", "->", "kp_lwp", ".", "kl_uticks", "=", "td", "->", "td_uticks", ";", "kp", "->", "kp_lwp", ".", "kl_sticks", "=", "td", "->", "td_sticks", ";", "kp", "->", "kp_lwp", ".", "kl_iticks", "=", "td", "->", "td_iticks", ";", "kp", "->", "kp_lwp", ".", "kl_cpuid", "=", "td", "->", "td_gd", "->", "gd_cpuid", ";", "kp", "->", "kp_lwp", ".", "kl_wchan", "=", "(", "uintptr_t", ")", "td", "->", "td_wchan", ";", "if", "(", "td", "->", "td_flags", "&", "TDF_RUNQ", ")", "kp", "->", "kp_lwp", ".", "kl_stat", "=", "LSRUN", ";", "else", "kp", "->", "kp_lwp", ".", "kl_stat", "=", "LSSLEEP", ";", "if", "(", "td", "->", "td_wmesg", ")", "{", "strncpy", "(", "kp", "->", "kp_lwp", ".", "kl_wmesg", ",", "td", "->", "td_wmesg", ",", "WMESGLEN", ")", ";", "kp", "->", "kp_lwp", ".", "kl_wmesg", "[", "WMESGLEN", "]", "=", "0", ";", "}", "strlcpy", "(", "kp", "->", "kp_lwp", ".", "kl_comm", ",", "td", "->", "td_comm", ",", "sizeof", "(", "kp", "->", "kp_lwp", ".", "kl_comm", ")", ")", ";", "}" ]
Fill in a struct kinfo_proc for kernel threads (i.e.
[ "Fill", "in", "a", "struct", "kinfo_proc", "for", "kernel", "threads", "(", "i", ".", "e", "." ]
[ "/*\n\t * Fill in fake proc information and semi-fake lwp info.\n\t */" ]
[ { "param": "td", "type": "struct thread" }, { "param": "kp", "type": "struct kinfo_proc" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "td", "type": "struct thread", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kp", "type": "struct kinfo_proc", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
reg_save_code
int
static int reg_save_code (int reg, machine_mode mode) { bool ok; if (cached_reg_save_code[reg][mode]) return cached_reg_save_code[reg][mode]; if (!targetm.hard_regno_mode_ok (reg, mode)) { /* Depending on how targetm.hard_regno_mode_ok is defined, range propagation might deduce here that reg >= FIRST_PSEUDO_REGISTER. So the assert below silences a warning. */ gcc_assert (reg < FIRST_PSEUDO_REGISTER); cached_reg_save_code[reg][mode] = -1; cached_reg_restore_code[reg][mode] = -1; return -1; } /* Update the register number and modes of the register and memory operand. */ set_mode_and_regno (test_reg, mode, reg); PUT_MODE (test_mem, mode); /* Force re-recognition of the modified insns. */ INSN_CODE (saveinsn) = -1; INSN_CODE (restinsn) = -1; cached_reg_save_code[reg][mode] = recog_memoized (saveinsn); cached_reg_restore_code[reg][mode] = recog_memoized (restinsn); /* Now extract both insns and see if we can meet their constraints. We don't know here whether the save and restore will be in size- or speed-tuned code, so just use the set of enabled alternatives. */ ok = (cached_reg_save_code[reg][mode] != -1 && cached_reg_restore_code[reg][mode] != -1); if (ok) { extract_insn (saveinsn); ok = constrain_operands (1, get_enabled_alternatives (saveinsn)); extract_insn (restinsn); ok &= constrain_operands (1, get_enabled_alternatives (restinsn)); } if (! ok) { cached_reg_save_code[reg][mode] = -1; cached_reg_restore_code[reg][mode] = -1; } gcc_assert (cached_reg_save_code[reg][mode]); return cached_reg_save_code[reg][mode]; }
/* Return the INSN_CODE used to save register REG in mode MODE. */
Return the INSN_CODE used to save register REG in mode MODE.
[ "Return", "the", "INSN_CODE", "used", "to", "save", "register", "REG", "in", "mode", "MODE", "." ]
static int reg_save_code (int reg, machine_mode mode) { bool ok; if (cached_reg_save_code[reg][mode]) return cached_reg_save_code[reg][mode]; if (!targetm.hard_regno_mode_ok (reg, mode)) { gcc_assert (reg < FIRST_PSEUDO_REGISTER); cached_reg_save_code[reg][mode] = -1; cached_reg_restore_code[reg][mode] = -1; return -1; } set_mode_and_regno (test_reg, mode, reg); PUT_MODE (test_mem, mode); INSN_CODE (saveinsn) = -1; INSN_CODE (restinsn) = -1; cached_reg_save_code[reg][mode] = recog_memoized (saveinsn); cached_reg_restore_code[reg][mode] = recog_memoized (restinsn); ok = (cached_reg_save_code[reg][mode] != -1 && cached_reg_restore_code[reg][mode] != -1); if (ok) { extract_insn (saveinsn); ok = constrain_operands (1, get_enabled_alternatives (saveinsn)); extract_insn (restinsn); ok &= constrain_operands (1, get_enabled_alternatives (restinsn)); } if (! ok) { cached_reg_save_code[reg][mode] = -1; cached_reg_restore_code[reg][mode] = -1; } gcc_assert (cached_reg_save_code[reg][mode]); return cached_reg_save_code[reg][mode]; }
[ "static", "int", "reg_save_code", "(", "int", "reg", ",", "machine_mode", "mode", ")", "{", "bool", "ok", ";", "if", "(", "cached_reg_save_code", "[", "reg", "]", "[", "mode", "]", ")", "return", "cached_reg_save_code", "[", "reg", "]", "[", "mode", "]", ";", "if", "(", "!", "targetm", ".", "hard_regno_mode_ok", "(", "reg", ",", "mode", ")", ")", "{", "gcc_assert", "(", "reg", "<", "FIRST_PSEUDO_REGISTER", ")", ";", "cached_reg_save_code", "[", "reg", "]", "[", "mode", "]", "=", "-1", ";", "cached_reg_restore_code", "[", "reg", "]", "[", "mode", "]", "=", "-1", ";", "return", "-1", ";", "}", "set_mode_and_regno", "(", "test_reg", ",", "mode", ",", "reg", ")", ";", "PUT_MODE", "(", "test_mem", ",", "mode", ")", ";", "INSN_CODE", "(", "saveinsn", ")", "=", "-1", ";", "INSN_CODE", "(", "restinsn", ")", "=", "-1", ";", "cached_reg_save_code", "[", "reg", "]", "[", "mode", "]", "=", "recog_memoized", "(", "saveinsn", ")", ";", "cached_reg_restore_code", "[", "reg", "]", "[", "mode", "]", "=", "recog_memoized", "(", "restinsn", ")", ";", "ok", "=", "(", "cached_reg_save_code", "[", "reg", "]", "[", "mode", "]", "!=", "-1", "&&", "cached_reg_restore_code", "[", "reg", "]", "[", "mode", "]", "!=", "-1", ")", ";", "if", "(", "ok", ")", "{", "extract_insn", "(", "saveinsn", ")", ";", "ok", "=", "constrain_operands", "(", "1", ",", "get_enabled_alternatives", "(", "saveinsn", ")", ")", ";", "extract_insn", "(", "restinsn", ")", ";", "ok", "&=", "constrain_operands", "(", "1", ",", "get_enabled_alternatives", "(", "restinsn", ")", ")", ";", "}", "if", "(", "!", "ok", ")", "{", "cached_reg_save_code", "[", "reg", "]", "[", "mode", "]", "=", "-1", ";", "cached_reg_restore_code", "[", "reg", "]", "[", "mode", "]", "=", "-1", ";", "}", "gcc_assert", "(", "cached_reg_save_code", "[", "reg", "]", "[", "mode", "]", ")", ";", "return", "cached_reg_save_code", "[", "reg", "]", "[", "mode", "]", ";", "}" ]
Return the INSN_CODE used to save register REG in mode MODE.
[ "Return", "the", "INSN_CODE", "used", "to", "save", "register", "REG", "in", "mode", "MODE", "." ]
[ "/* Depending on how targetm.hard_regno_mode_ok is defined, range\n\t propagation might deduce here that reg >= FIRST_PSEUDO_REGISTER.\n\t So the assert below silences a warning. */", "/* Update the register number and modes of the register\n and memory operand. */", "/* Force re-recognition of the modified insns. */", "/* Now extract both insns and see if we can meet their\n constraints. We don't know here whether the save and restore will\n be in size- or speed-tuned code, so just use the set of enabled\n alternatives. */" ]
[ { "param": "reg", "type": "int" }, { "param": "mode", "type": "machine_mode" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "reg", "type": "int", "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": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
reg_restore_code
int
static int reg_restore_code (int reg, machine_mode mode) { if (cached_reg_restore_code[reg][mode]) return cached_reg_restore_code[reg][mode]; /* Populate our cache. */ reg_save_code (reg, mode); return cached_reg_restore_code[reg][mode]; }
/* Return the INSN_CODE used to restore register REG in mode MODE. */
Return the INSN_CODE used to restore register REG in mode MODE.
[ "Return", "the", "INSN_CODE", "used", "to", "restore", "register", "REG", "in", "mode", "MODE", "." ]
static int reg_restore_code (int reg, machine_mode mode) { if (cached_reg_restore_code[reg][mode]) return cached_reg_restore_code[reg][mode]; reg_save_code (reg, mode); return cached_reg_restore_code[reg][mode]; }
[ "static", "int", "reg_restore_code", "(", "int", "reg", ",", "machine_mode", "mode", ")", "{", "if", "(", "cached_reg_restore_code", "[", "reg", "]", "[", "mode", "]", ")", "return", "cached_reg_restore_code", "[", "reg", "]", "[", "mode", "]", ";", "reg_save_code", "(", "reg", ",", "mode", ")", ";", "return", "cached_reg_restore_code", "[", "reg", "]", "[", "mode", "]", ";", "}" ]
Return the INSN_CODE used to restore register REG in mode MODE.
[ "Return", "the", "INSN_CODE", "used", "to", "restore", "register", "REG", "in", "mode", "MODE", "." ]
[ "/* Populate our cache. */" ]
[ { "param": "reg", "type": "int" }, { "param": "mode", "type": "machine_mode" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "reg", "type": "int", "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": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
init_caller_save
void
void init_caller_save (void) { rtx addr_reg; int offset; rtx address; int i, j; if (caller_save_initialized_p) return; caller_save_initialized_p = true; CLEAR_HARD_REG_SET (no_caller_save_reg_set); /* First find all the registers that we need to deal with and all the modes that they can have. If we can't find a mode to use, we can't have the register live over calls. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { if (call_used_regs[i] && !TEST_HARD_REG_BIT (call_fixed_reg_set, i)) { for (j = 1; j <= MOVE_MAX_WORDS; j++) { regno_save_mode[i][j] = HARD_REGNO_CALLER_SAVE_MODE (i, j, VOIDmode); if (regno_save_mode[i][j] == VOIDmode && j == 1) { SET_HARD_REG_BIT (call_fixed_reg_set, i); } } } else regno_save_mode[i][1] = VOIDmode; } /* The following code tries to approximate the conditions under which we can easily save and restore a register without scratch registers or other complexities. It will usually work, except under conditions where the validity of an insn operand is dependent on the address offset. No such cases are currently known. We first find a typical offset from some BASE_REG_CLASS register. This address is chosen by finding the first register in the class and by finding the smallest power of two that is a valid offset from that register in every mode we will use to save registers. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (TEST_HARD_REG_BIT (reg_class_contents [(int) base_reg_class (regno_save_mode[i][1], ADDR_SPACE_GENERIC, PLUS, CONST_INT)], i)) break; gcc_assert (i < FIRST_PSEUDO_REGISTER); addr_reg = gen_rtx_REG (Pmode, i); for (offset = 1 << (HOST_BITS_PER_INT / 2); offset; offset >>= 1) { address = gen_rtx_PLUS (Pmode, addr_reg, gen_int_mode (offset, Pmode)); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (regno_save_mode[i][1] != VOIDmode && ! strict_memory_address_p (regno_save_mode[i][1], address)) break; if (i == FIRST_PSEUDO_REGISTER) break; } /* If we didn't find a valid address, we must use register indirect. */ if (offset == 0) address = addr_reg; /* Next we try to form an insn to save and restore the register. We see if such an insn is recognized and meets its constraints. To avoid lots of unnecessary RTL allocation, we construct all the RTL once, then modify the memory and register operands in-place. */ test_reg = gen_rtx_REG (word_mode, LAST_VIRTUAL_REGISTER + 1); test_mem = gen_rtx_MEM (word_mode, address); savepat = gen_rtx_SET (test_mem, test_reg); restpat = gen_rtx_SET (test_reg, test_mem); saveinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, savepat, 0, -1, 0); restinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, restpat, 0, -1, 0); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (j = 1; j <= MOVE_MAX_WORDS; j++) if (reg_save_code (i,regno_save_mode[i][j]) == -1) { regno_save_mode[i][j] = VOIDmode; if (j == 1) { SET_HARD_REG_BIT (call_fixed_reg_set, i); if (call_used_regs[i]) SET_HARD_REG_BIT (no_caller_save_reg_set, i); } } }
/* Initialize for caller-save. Look at all the hard registers that are used by a call and for which reginfo.c has not already excluded from being used across a call. Ensure that we can find a mode to save the register and that there is a simple insn to save and restore the register. This latter check avoids problems that would occur if we tried to save the MQ register of some machines directly into memory. */
Initialize for caller-save. Look at all the hard registers that are used by a call and for which reginfo.c has not already excluded from being used across a call. Ensure that we can find a mode to save the register and that there is a simple insn to save and restore the register. This latter check avoids problems that would occur if we tried to save the MQ register of some machines directly into memory.
[ "Initialize", "for", "caller", "-", "save", ".", "Look", "at", "all", "the", "hard", "registers", "that", "are", "used", "by", "a", "call", "and", "for", "which", "reginfo", ".", "c", "has", "not", "already", "excluded", "from", "being", "used", "across", "a", "call", ".", "Ensure", "that", "we", "can", "find", "a", "mode", "to", "save", "the", "register", "and", "that", "there", "is", "a", "simple", "insn", "to", "save", "and", "restore", "the", "register", ".", "This", "latter", "check", "avoids", "problems", "that", "would", "occur", "if", "we", "tried", "to", "save", "the", "MQ", "register", "of", "some", "machines", "directly", "into", "memory", "." ]
void init_caller_save (void) { rtx addr_reg; int offset; rtx address; int i, j; if (caller_save_initialized_p) return; caller_save_initialized_p = true; CLEAR_HARD_REG_SET (no_caller_save_reg_set); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { if (call_used_regs[i] && !TEST_HARD_REG_BIT (call_fixed_reg_set, i)) { for (j = 1; j <= MOVE_MAX_WORDS; j++) { regno_save_mode[i][j] = HARD_REGNO_CALLER_SAVE_MODE (i, j, VOIDmode); if (regno_save_mode[i][j] == VOIDmode && j == 1) { SET_HARD_REG_BIT (call_fixed_reg_set, i); } } } else regno_save_mode[i][1] = VOIDmode; } for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (TEST_HARD_REG_BIT (reg_class_contents [(int) base_reg_class (regno_save_mode[i][1], ADDR_SPACE_GENERIC, PLUS, CONST_INT)], i)) break; gcc_assert (i < FIRST_PSEUDO_REGISTER); addr_reg = gen_rtx_REG (Pmode, i); for (offset = 1 << (HOST_BITS_PER_INT / 2); offset; offset >>= 1) { address = gen_rtx_PLUS (Pmode, addr_reg, gen_int_mode (offset, Pmode)); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (regno_save_mode[i][1] != VOIDmode && ! strict_memory_address_p (regno_save_mode[i][1], address)) break; if (i == FIRST_PSEUDO_REGISTER) break; } if (offset == 0) address = addr_reg; test_reg = gen_rtx_REG (word_mode, LAST_VIRTUAL_REGISTER + 1); test_mem = gen_rtx_MEM (word_mode, address); savepat = gen_rtx_SET (test_mem, test_reg); restpat = gen_rtx_SET (test_reg, test_mem); saveinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, savepat, 0, -1, 0); restinsn = gen_rtx_INSN (VOIDmode, 0, 0, 0, restpat, 0, -1, 0); for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (j = 1; j <= MOVE_MAX_WORDS; j++) if (reg_save_code (i,regno_save_mode[i][j]) == -1) { regno_save_mode[i][j] = VOIDmode; if (j == 1) { SET_HARD_REG_BIT (call_fixed_reg_set, i); if (call_used_regs[i]) SET_HARD_REG_BIT (no_caller_save_reg_set, i); } } }
[ "void", "init_caller_save", "(", "void", ")", "{", "rtx", "addr_reg", ";", "int", "offset", ";", "rtx", "address", ";", "int", "i", ",", "j", ";", "if", "(", "caller_save_initialized_p", ")", "return", ";", "caller_save_initialized_p", "=", "true", ";", "CLEAR_HARD_REG_SET", "(", "no_caller_save_reg_set", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "FIRST_PSEUDO_REGISTER", ";", "i", "++", ")", "{", "if", "(", "call_used_regs", "[", "i", "]", "&&", "!", "TEST_HARD_REG_BIT", "(", "call_fixed_reg_set", ",", "i", ")", ")", "{", "for", "(", "j", "=", "1", ";", "j", "<=", "MOVE_MAX_WORDS", ";", "j", "++", ")", "{", "regno_save_mode", "[", "i", "]", "[", "j", "]", "=", "HARD_REGNO_CALLER_SAVE_MODE", "(", "i", ",", "j", ",", "VOIDmode", ")", ";", "if", "(", "regno_save_mode", "[", "i", "]", "[", "j", "]", "==", "VOIDmode", "&&", "j", "==", "1", ")", "{", "SET_HARD_REG_BIT", "(", "call_fixed_reg_set", ",", "i", ")", ";", "}", "}", "}", "else", "regno_save_mode", "[", "i", "]", "[", "1", "]", "=", "VOIDmode", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "FIRST_PSEUDO_REGISTER", ";", "i", "++", ")", "if", "(", "TEST_HARD_REG_BIT", "(", "reg_class_contents", "[", "(", "int", ")", "base_reg_class", "(", "regno_save_mode", "[", "i", "]", "[", "1", "]", ",", "ADDR_SPACE_GENERIC", ",", "PLUS", ",", "CONST_INT", ")", "]", ",", "i", ")", ")", "break", ";", "gcc_assert", "(", "i", "<", "FIRST_PSEUDO_REGISTER", ")", ";", "addr_reg", "=", "gen_rtx_REG", "(", "Pmode", ",", "i", ")", ";", "for", "(", "offset", "=", "1", "<<", "(", "HOST_BITS_PER_INT", "/", "2", ")", ";", "offset", ";", "offset", ">>=", "1", ")", "{", "address", "=", "gen_rtx_PLUS", "(", "Pmode", ",", "addr_reg", ",", "gen_int_mode", "(", "offset", ",", "Pmode", ")", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "FIRST_PSEUDO_REGISTER", ";", "i", "++", ")", "if", "(", "regno_save_mode", "[", "i", "]", "[", "1", "]", "!=", "VOIDmode", "&&", "!", "strict_memory_address_p", "(", "regno_save_mode", "[", "i", "]", "[", "1", "]", ",", "address", ")", ")", "break", ";", "if", "(", "i", "==", "FIRST_PSEUDO_REGISTER", ")", "break", ";", "}", "if", "(", "offset", "==", "0", ")", "address", "=", "addr_reg", ";", "test_reg", "=", "gen_rtx_REG", "(", "word_mode", ",", "LAST_VIRTUAL_REGISTER", "+", "1", ")", ";", "test_mem", "=", "gen_rtx_MEM", "(", "word_mode", ",", "address", ")", ";", "savepat", "=", "gen_rtx_SET", "(", "test_mem", ",", "test_reg", ")", ";", "restpat", "=", "gen_rtx_SET", "(", "test_reg", ",", "test_mem", ")", ";", "saveinsn", "=", "gen_rtx_INSN", "(", "VOIDmode", ",", "0", ",", "0", ",", "0", ",", "savepat", ",", "0", ",", "-1", ",", "0", ")", ";", "restinsn", "=", "gen_rtx_INSN", "(", "VOIDmode", ",", "0", ",", "0", ",", "0", ",", "restpat", ",", "0", ",", "-1", ",", "0", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "FIRST_PSEUDO_REGISTER", ";", "i", "++", ")", "for", "(", "j", "=", "1", ";", "j", "<=", "MOVE_MAX_WORDS", ";", "j", "++", ")", "if", "(", "reg_save_code", "(", "i", ",", "regno_save_mode", "[", "i", "]", "[", "j", "]", ")", "==", "-1", ")", "{", "regno_save_mode", "[", "i", "]", "[", "j", "]", "=", "VOIDmode", ";", "if", "(", "j", "==", "1", ")", "{", "SET_HARD_REG_BIT", "(", "call_fixed_reg_set", ",", "i", ")", ";", "if", "(", "call_used_regs", "[", "i", "]", ")", "SET_HARD_REG_BIT", "(", "no_caller_save_reg_set", ",", "i", ")", ";", "}", "}", "}" ]
Initialize for caller-save.
[ "Initialize", "for", "caller", "-", "save", "." ]
[ "/* First find all the registers that we need to deal with and all\n the modes that they can have. If we can't find a mode to use,\n we can't have the register live over calls. */", "/* The following code tries to approximate the conditions under which\n we can easily save and restore a register without scratch registers or\n other complexities. It will usually work, except under conditions where\n the validity of an insn operand is dependent on the address offset.\n No such cases are currently known.\n\n We first find a typical offset from some BASE_REG_CLASS register.\n This address is chosen by finding the first register in the class\n and by finding the smallest power of two that is a valid offset from\n that register in every mode we will use to save registers. */", "/* If we didn't find a valid address, we must use register indirect. */", "/* Next we try to form an insn to save and restore the register. We\n see if such an insn is recognized and meets its constraints.\n\n To avoid lots of unnecessary RTL allocation, we construct all the RTL\n once, then modify the memory and register operands in-place. */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
init_save_areas
void
void init_save_areas (void) { int i, j; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (j = 1; j <= MOVE_MAX_WORDS; j++) regno_save_mem[i][j] = 0; save_slots_num = 0; }
/* Initialize save areas by showing that we haven't allocated any yet. */
Initialize save areas by showing that we haven't allocated any yet.
[ "Initialize", "save", "areas", "by", "showing", "that", "we", "haven", "'", "t", "allocated", "any", "yet", "." ]
void init_save_areas (void) { int i, j; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (j = 1; j <= MOVE_MAX_WORDS; j++) regno_save_mem[i][j] = 0; save_slots_num = 0; }
[ "void", "init_save_areas", "(", "void", ")", "{", "int", "i", ",", "j", ";", "for", "(", "i", "=", "0", ";", "i", "<", "FIRST_PSEUDO_REGISTER", ";", "i", "++", ")", "for", "(", "j", "=", "1", ";", "j", "<=", "MOVE_MAX_WORDS", ";", "j", "++", ")", "regno_save_mem", "[", "i", "]", "[", "j", "]", "=", "0", ";", "save_slots_num", "=", "0", ";", "}" ]
Initialize save areas by showing that we haven't allocated any yet.
[ "Initialize", "save", "areas", "by", "showing", "that", "we", "haven", "'", "t", "allocated", "any", "yet", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
initiate_saved_hard_regs
void
static void initiate_saved_hard_regs (void) { int i; saved_regs_num = 0; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) hard_reg_map[i] = NULL; }
/* First called function for work with saved hard registers. */
First called function for work with saved hard registers.
[ "First", "called", "function", "for", "work", "with", "saved", "hard", "registers", "." ]
static void initiate_saved_hard_regs (void) { int i; saved_regs_num = 0; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) hard_reg_map[i] = NULL; }
[ "static", "void", "initiate_saved_hard_regs", "(", "void", ")", "{", "int", "i", ";", "saved_regs_num", "=", "0", ";", "for", "(", "i", "=", "0", ";", "i", "<", "FIRST_PSEUDO_REGISTER", ";", "i", "++", ")", "hard_reg_map", "[", "i", "]", "=", "NULL", ";", "}" ]
First called function for work with saved hard registers.
[ "First", "called", "function", "for", "work", "with", "saved", "hard", "registers", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
new_saved_hard_reg
void
static void new_saved_hard_reg (int regno, int call_freq) { struct saved_hard_reg *saved_reg; saved_reg = (struct saved_hard_reg *) xmalloc (sizeof (struct saved_hard_reg)); hard_reg_map[regno] = all_saved_regs[saved_regs_num] = saved_reg; saved_reg->num = saved_regs_num++; saved_reg->hard_regno = regno; saved_reg->call_freq = call_freq; saved_reg->first_p = FALSE; saved_reg->next = -1; }
/* Allocate and return new saved hard register with given REGNO and CALL_FREQ. */
Allocate and return new saved hard register with given REGNO and CALL_FREQ.
[ "Allocate", "and", "return", "new", "saved", "hard", "register", "with", "given", "REGNO", "and", "CALL_FREQ", "." ]
static void new_saved_hard_reg (int regno, int call_freq) { struct saved_hard_reg *saved_reg; saved_reg = (struct saved_hard_reg *) xmalloc (sizeof (struct saved_hard_reg)); hard_reg_map[regno] = all_saved_regs[saved_regs_num] = saved_reg; saved_reg->num = saved_regs_num++; saved_reg->hard_regno = regno; saved_reg->call_freq = call_freq; saved_reg->first_p = FALSE; saved_reg->next = -1; }
[ "static", "void", "new_saved_hard_reg", "(", "int", "regno", ",", "int", "call_freq", ")", "{", "struct", "saved_hard_reg", "*", "saved_reg", ";", "saved_reg", "=", "(", "struct", "saved_hard_reg", "*", ")", "xmalloc", "(", "sizeof", "(", "struct", "saved_hard_reg", ")", ")", ";", "hard_reg_map", "[", "regno", "]", "=", "all_saved_regs", "[", "saved_regs_num", "]", "=", "saved_reg", ";", "saved_reg", "->", "num", "=", "saved_regs_num", "++", ";", "saved_reg", "->", "hard_regno", "=", "regno", ";", "saved_reg", "->", "call_freq", "=", "call_freq", ";", "saved_reg", "->", "first_p", "=", "FALSE", ";", "saved_reg", "->", "next", "=", "-1", ";", "}" ]
Allocate and return new saved hard register with given REGNO and CALL_FREQ.
[ "Allocate", "and", "return", "new", "saved", "hard", "register", "with", "given", "REGNO", "and", "CALL_FREQ", "." ]
[]
[ { "param": "regno", "type": "int" }, { "param": "call_freq", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "regno", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "call_freq", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
finish_saved_hard_regs
void
static void finish_saved_hard_regs (void) { int i; for (i = 0; i < saved_regs_num; i++) free (all_saved_regs[i]); }
/* Free memory allocated for the saved hard registers. */
Free memory allocated for the saved hard registers.
[ "Free", "memory", "allocated", "for", "the", "saved", "hard", "registers", "." ]
static void finish_saved_hard_regs (void) { int i; for (i = 0; i < saved_regs_num; i++) free (all_saved_regs[i]); }
[ "static", "void", "finish_saved_hard_regs", "(", "void", ")", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "saved_regs_num", ";", "i", "++", ")", "free", "(", "all_saved_regs", "[", "i", "]", ")", ";", "}" ]
Free memory allocated for the saved hard registers.
[ "Free", "memory", "allocated", "for", "the", "saved", "hard", "registers", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
saved_hard_reg_compare_func
int
static int saved_hard_reg_compare_func (const void *v1p, const void *v2p) { const struct saved_hard_reg *p1 = *(struct saved_hard_reg * const *) v1p; const struct saved_hard_reg *p2 = *(struct saved_hard_reg * const *) v2p; if (flag_omit_frame_pointer) { if (p1->call_freq - p2->call_freq != 0) return p1->call_freq - p2->call_freq; } else if (p2->call_freq - p1->call_freq != 0) return p2->call_freq - p1->call_freq; return p1->num - p2->num; }
/* The function is used to sort the saved hard register structures according their frequency. */
The function is used to sort the saved hard register structures according their frequency.
[ "The", "function", "is", "used", "to", "sort", "the", "saved", "hard", "register", "structures", "according", "their", "frequency", "." ]
static int saved_hard_reg_compare_func (const void *v1p, const void *v2p) { const struct saved_hard_reg *p1 = *(struct saved_hard_reg * const *) v1p; const struct saved_hard_reg *p2 = *(struct saved_hard_reg * const *) v2p; if (flag_omit_frame_pointer) { if (p1->call_freq - p2->call_freq != 0) return p1->call_freq - p2->call_freq; } else if (p2->call_freq - p1->call_freq != 0) return p2->call_freq - p1->call_freq; return p1->num - p2->num; }
[ "static", "int", "saved_hard_reg_compare_func", "(", "const", "void", "*", "v1p", ",", "const", "void", "*", "v2p", ")", "{", "const", "struct", "saved_hard_reg", "*", "p1", "=", "*", "(", "struct", "saved_hard_reg", "*", "const", "*", ")", "v1p", ";", "const", "struct", "saved_hard_reg", "*", "p2", "=", "*", "(", "struct", "saved_hard_reg", "*", "const", "*", ")", "v2p", ";", "if", "(", "flag_omit_frame_pointer", ")", "{", "if", "(", "p1", "->", "call_freq", "-", "p2", "->", "call_freq", "!=", "0", ")", "return", "p1", "->", "call_freq", "-", "p2", "->", "call_freq", ";", "}", "else", "if", "(", "p2", "->", "call_freq", "-", "p1", "->", "call_freq", "!=", "0", ")", "return", "p2", "->", "call_freq", "-", "p1", "->", "call_freq", ";", "return", "p1", "->", "num", "-", "p2", "->", "num", ";", "}" ]
The function is used to sort the saved hard register structures according their frequency.
[ "The", "function", "is", "used", "to", "sort", "the", "saved", "hard", "register", "structures", "according", "their", "frequency", "." ]
[]
[ { "param": "v1p", "type": "void" }, { "param": "v2p", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v1p", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "v2p", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
save_call_clobbered_regs
void
void save_call_clobbered_regs (void) { struct insn_chain *chain, *next, *last = NULL; machine_mode save_mode [FIRST_PSEUDO_REGISTER]; /* Computed in mark_set_regs, holds all registers set by the current instruction. */ HARD_REG_SET this_insn_sets; CLEAR_HARD_REG_SET (hard_regs_saved); n_regs_saved = 0; for (chain = reload_insn_chain; chain != 0; chain = next) { rtx_insn *insn = chain->insn; enum rtx_code code = GET_CODE (insn); next = chain->next; gcc_assert (!chain->is_caller_save_insn); if (NONDEBUG_INSN_P (insn)) { /* If some registers have been saved, see if INSN references any of them. We must restore them before the insn if so. */ if (n_regs_saved) { int regno; HARD_REG_SET this_insn_sets; if (code == JUMP_INSN) /* Restore all registers if this is a JUMP_INSN. */ COPY_HARD_REG_SET (referenced_regs, hard_regs_saved); else { CLEAR_HARD_REG_SET (referenced_regs); mark_referenced_regs (&PATTERN (insn), mark_reg_as_referenced, NULL); AND_HARD_REG_SET (referenced_regs, hard_regs_saved); } for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (referenced_regs, regno)) regno += insert_restore (chain, 1, regno, MOVE_MAX_WORDS, save_mode); /* If a saved register is set after the call, this means we no longer should restore it. This can happen when parts of a multi-word pseudo do not conflict with other pseudos, so IRA may allocate the same hard register for both. One may be live across the call, while the other is set afterwards. */ CLEAR_HARD_REG_SET (this_insn_sets); note_stores (PATTERN (insn), mark_set_regs, &this_insn_sets); AND_COMPL_HARD_REG_SET (hard_regs_saved, this_insn_sets); } if (code == CALL_INSN && ! SIBLING_CALL_P (insn) && ! find_reg_note (insn, REG_NORETURN, NULL)) { unsigned regno; HARD_REG_SET hard_regs_to_save; HARD_REG_SET call_def_reg_set; reg_set_iterator rsi; rtx cheap; cheap = find_reg_note (insn, REG_RETURNED, NULL); if (cheap) cheap = XEXP (cheap, 0); /* Use the register life information in CHAIN to compute which regs are live during the call. */ REG_SET_TO_HARD_REG_SET (hard_regs_to_save, &chain->live_throughout); /* Save hard registers always in the widest mode available. */ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (hard_regs_to_save, regno)) save_mode [regno] = regno_save_mode [regno][1]; else save_mode [regno] = VOIDmode; /* Look through all live pseudos, mark their hard registers and choose proper mode for saving. */ EXECUTE_IF_SET_IN_REG_SET (&chain->live_throughout, FIRST_PSEUDO_REGISTER, regno, rsi) { int r = reg_renumber[regno]; int nregs; machine_mode mode; if (r < 0 || regno_reg_rtx[regno] == cheap) continue; nregs = hard_regno_nregs (r, PSEUDO_REGNO_MODE (regno)); mode = HARD_REGNO_CALLER_SAVE_MODE (r, nregs, PSEUDO_REGNO_MODE (regno)); if (partial_subreg_p (save_mode[r], mode)) save_mode[r] = mode; while (nregs-- > 0) SET_HARD_REG_BIT (hard_regs_to_save, r + nregs); } /* Record all registers set in this call insn. These don't need to be saved. N.B. the call insn might set a subreg of a multi-hard-reg pseudo; then the pseudo is considered live during the call, but the subreg that is set isn't. */ CLEAR_HARD_REG_SET (this_insn_sets); note_stores (PATTERN (insn), mark_set_regs, &this_insn_sets); /* Compute which hard regs must be saved before this call. */ AND_COMPL_HARD_REG_SET (hard_regs_to_save, call_fixed_reg_set); AND_COMPL_HARD_REG_SET (hard_regs_to_save, this_insn_sets); AND_COMPL_HARD_REG_SET (hard_regs_to_save, hard_regs_saved); get_call_reg_set_usage (insn, &call_def_reg_set, call_used_reg_set); AND_HARD_REG_SET (hard_regs_to_save, call_def_reg_set); for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (hard_regs_to_save, regno)) regno += insert_save (chain, regno, &hard_regs_to_save, save_mode); /* Must recompute n_regs_saved. */ n_regs_saved = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (hard_regs_saved, regno)) n_regs_saved++; if (cheap && HARD_REGISTER_P (cheap) && TEST_HARD_REG_BIT (call_used_reg_set, REGNO (cheap))) { rtx dest, newpat; rtx pat = PATTERN (insn); if (GET_CODE (pat) == PARALLEL) pat = XVECEXP (pat, 0, 0); dest = SET_DEST (pat); /* For multiple return values dest is PARALLEL. Currently we handle only single return value case. */ if (REG_P (dest)) { newpat = gen_rtx_SET (cheap, copy_rtx (dest)); chain = insert_one_insn (chain, 0, -1, newpat); } } } last = chain; } else if (DEBUG_INSN_P (insn) && n_regs_saved) mark_referenced_regs (&PATTERN (insn), replace_reg_with_saved_mem, save_mode); if (chain->next == 0 || chain->next->block != chain->block) { int regno; /* At the end of the basic block, we must restore any registers that remain saved. If the last insn in the block is a JUMP_INSN, put the restore before the insn, otherwise, put it after the insn. */ if (n_regs_saved && DEBUG_INSN_P (insn) && last && last->block == chain->block) { rtx_insn *ins, *prev; basic_block bb = BLOCK_FOR_INSN (insn); /* When adding hard reg restores after a DEBUG_INSN, move all notes between last real insn and this DEBUG_INSN after the DEBUG_INSN, otherwise we could get code -g/-g0 differences. */ for (ins = PREV_INSN (insn); ins != last->insn; ins = prev) { prev = PREV_INSN (ins); if (NOTE_P (ins)) { SET_NEXT_INSN (prev) = NEXT_INSN (ins); SET_PREV_INSN (NEXT_INSN (ins)) = prev; SET_PREV_INSN (ins) = insn; SET_NEXT_INSN (ins) = NEXT_INSN (insn); SET_NEXT_INSN (insn) = ins; if (NEXT_INSN (ins)) SET_PREV_INSN (NEXT_INSN (ins)) = ins; if (BB_END (bb) == insn) BB_END (bb) = ins; } else gcc_assert (DEBUG_INSN_P (ins)); } } last = NULL; if (n_regs_saved) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (hard_regs_saved, regno)) regno += insert_restore (chain, JUMP_P (insn), regno, MOVE_MAX_WORDS, save_mode); } } }
/* Find the places where hard regs are live across calls and save them. */
Find the places where hard regs are live across calls and save them.
[ "Find", "the", "places", "where", "hard", "regs", "are", "live", "across", "calls", "and", "save", "them", "." ]
void save_call_clobbered_regs (void) { struct insn_chain *chain, *next, *last = NULL; machine_mode save_mode [FIRST_PSEUDO_REGISTER]; HARD_REG_SET this_insn_sets; CLEAR_HARD_REG_SET (hard_regs_saved); n_regs_saved = 0; for (chain = reload_insn_chain; chain != 0; chain = next) { rtx_insn *insn = chain->insn; enum rtx_code code = GET_CODE (insn); next = chain->next; gcc_assert (!chain->is_caller_save_insn); if (NONDEBUG_INSN_P (insn)) { if (n_regs_saved) { int regno; HARD_REG_SET this_insn_sets; if (code == JUMP_INSN) COPY_HARD_REG_SET (referenced_regs, hard_regs_saved); else { CLEAR_HARD_REG_SET (referenced_regs); mark_referenced_regs (&PATTERN (insn), mark_reg_as_referenced, NULL); AND_HARD_REG_SET (referenced_regs, hard_regs_saved); } for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (referenced_regs, regno)) regno += insert_restore (chain, 1, regno, MOVE_MAX_WORDS, save_mode); CLEAR_HARD_REG_SET (this_insn_sets); note_stores (PATTERN (insn), mark_set_regs, &this_insn_sets); AND_COMPL_HARD_REG_SET (hard_regs_saved, this_insn_sets); } if (code == CALL_INSN && ! SIBLING_CALL_P (insn) && ! find_reg_note (insn, REG_NORETURN, NULL)) { unsigned regno; HARD_REG_SET hard_regs_to_save; HARD_REG_SET call_def_reg_set; reg_set_iterator rsi; rtx cheap; cheap = find_reg_note (insn, REG_RETURNED, NULL); if (cheap) cheap = XEXP (cheap, 0); REG_SET_TO_HARD_REG_SET (hard_regs_to_save, &chain->live_throughout); for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (hard_regs_to_save, regno)) save_mode [regno] = regno_save_mode [regno][1]; else save_mode [regno] = VOIDmode; EXECUTE_IF_SET_IN_REG_SET (&chain->live_throughout, FIRST_PSEUDO_REGISTER, regno, rsi) { int r = reg_renumber[regno]; int nregs; machine_mode mode; if (r < 0 || regno_reg_rtx[regno] == cheap) continue; nregs = hard_regno_nregs (r, PSEUDO_REGNO_MODE (regno)); mode = HARD_REGNO_CALLER_SAVE_MODE (r, nregs, PSEUDO_REGNO_MODE (regno)); if (partial_subreg_p (save_mode[r], mode)) save_mode[r] = mode; while (nregs-- > 0) SET_HARD_REG_BIT (hard_regs_to_save, r + nregs); } CLEAR_HARD_REG_SET (this_insn_sets); note_stores (PATTERN (insn), mark_set_regs, &this_insn_sets); AND_COMPL_HARD_REG_SET (hard_regs_to_save, call_fixed_reg_set); AND_COMPL_HARD_REG_SET (hard_regs_to_save, this_insn_sets); AND_COMPL_HARD_REG_SET (hard_regs_to_save, hard_regs_saved); get_call_reg_set_usage (insn, &call_def_reg_set, call_used_reg_set); AND_HARD_REG_SET (hard_regs_to_save, call_def_reg_set); for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (hard_regs_to_save, regno)) regno += insert_save (chain, regno, &hard_regs_to_save, save_mode); n_regs_saved = 0; for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (hard_regs_saved, regno)) n_regs_saved++; if (cheap && HARD_REGISTER_P (cheap) && TEST_HARD_REG_BIT (call_used_reg_set, REGNO (cheap))) { rtx dest, newpat; rtx pat = PATTERN (insn); if (GET_CODE (pat) == PARALLEL) pat = XVECEXP (pat, 0, 0); dest = SET_DEST (pat); if (REG_P (dest)) { newpat = gen_rtx_SET (cheap, copy_rtx (dest)); chain = insert_one_insn (chain, 0, -1, newpat); } } } last = chain; } else if (DEBUG_INSN_P (insn) && n_regs_saved) mark_referenced_regs (&PATTERN (insn), replace_reg_with_saved_mem, save_mode); if (chain->next == 0 || chain->next->block != chain->block) { int regno; if (n_regs_saved && DEBUG_INSN_P (insn) && last && last->block == chain->block) { rtx_insn *ins, *prev; basic_block bb = BLOCK_FOR_INSN (insn); for (ins = PREV_INSN (insn); ins != last->insn; ins = prev) { prev = PREV_INSN (ins); if (NOTE_P (ins)) { SET_NEXT_INSN (prev) = NEXT_INSN (ins); SET_PREV_INSN (NEXT_INSN (ins)) = prev; SET_PREV_INSN (ins) = insn; SET_NEXT_INSN (ins) = NEXT_INSN (insn); SET_NEXT_INSN (insn) = ins; if (NEXT_INSN (ins)) SET_PREV_INSN (NEXT_INSN (ins)) = ins; if (BB_END (bb) == insn) BB_END (bb) = ins; } else gcc_assert (DEBUG_INSN_P (ins)); } } last = NULL; if (n_regs_saved) for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) if (TEST_HARD_REG_BIT (hard_regs_saved, regno)) regno += insert_restore (chain, JUMP_P (insn), regno, MOVE_MAX_WORDS, save_mode); } } }
[ "void", "save_call_clobbered_regs", "(", "void", ")", "{", "struct", "insn_chain", "*", "chain", ",", "*", "next", ",", "*", "last", "=", "NULL", ";", "machine_mode", "save_mode", "[", "FIRST_PSEUDO_REGISTER", "]", ";", "HARD_REG_SET", "this_insn_sets", ";", "CLEAR_HARD_REG_SET", "(", "hard_regs_saved", ")", ";", "n_regs_saved", "=", "0", ";", "for", "(", "chain", "=", "reload_insn_chain", ";", "chain", "!=", "0", ";", "chain", "=", "next", ")", "{", "rtx_insn", "*", "insn", "=", "chain", "->", "insn", ";", "enum", "rtx_code", "code", "=", "GET_CODE", "(", "insn", ")", ";", "next", "=", "chain", "->", "next", ";", "gcc_assert", "(", "!", "chain", "->", "is_caller_save_insn", ")", ";", "if", "(", "NONDEBUG_INSN_P", "(", "insn", ")", ")", "{", "if", "(", "n_regs_saved", ")", "{", "int", "regno", ";", "HARD_REG_SET", "this_insn_sets", ";", "if", "(", "code", "==", "JUMP_INSN", ")", "COPY_HARD_REG_SET", "(", "referenced_regs", ",", "hard_regs_saved", ")", ";", "else", "{", "CLEAR_HARD_REG_SET", "(", "referenced_regs", ")", ";", "mark_referenced_regs", "(", "&", "PATTERN", "(", "insn", ")", ",", "mark_reg_as_referenced", ",", "NULL", ")", ";", "AND_HARD_REG_SET", "(", "referenced_regs", ",", "hard_regs_saved", ")", ";", "}", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "TEST_HARD_REG_BIT", "(", "referenced_regs", ",", "regno", ")", ")", "regno", "+=", "insert_restore", "(", "chain", ",", "1", ",", "regno", ",", "MOVE_MAX_WORDS", ",", "save_mode", ")", ";", "CLEAR_HARD_REG_SET", "(", "this_insn_sets", ")", ";", "note_stores", "(", "PATTERN", "(", "insn", ")", ",", "mark_set_regs", ",", "&", "this_insn_sets", ")", ";", "AND_COMPL_HARD_REG_SET", "(", "hard_regs_saved", ",", "this_insn_sets", ")", ";", "}", "if", "(", "code", "==", "CALL_INSN", "&&", "!", "SIBLING_CALL_P", "(", "insn", ")", "&&", "!", "find_reg_note", "(", "insn", ",", "REG_NORETURN", ",", "NULL", ")", ")", "{", "unsigned", "regno", ";", "HARD_REG_SET", "hard_regs_to_save", ";", "HARD_REG_SET", "call_def_reg_set", ";", "reg_set_iterator", "rsi", ";", "rtx", "cheap", ";", "cheap", "=", "find_reg_note", "(", "insn", ",", "REG_RETURNED", ",", "NULL", ")", ";", "if", "(", "cheap", ")", "cheap", "=", "XEXP", "(", "cheap", ",", "0", ")", ";", "REG_SET_TO_HARD_REG_SET", "(", "hard_regs_to_save", ",", "&", "chain", "->", "live_throughout", ")", ";", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "TEST_HARD_REG_BIT", "(", "hard_regs_to_save", ",", "regno", ")", ")", "save_mode", "[", "regno", "]", "=", "regno_save_mode", "[", "regno", "]", "[", "1", "]", ";", "else", "save_mode", "[", "regno", "]", "=", "VOIDmode", ";", "EXECUTE_IF_SET_IN_REG_SET", "(", "&", "chain", "->", "live_throughout", ",", "FIRST_PSEUDO_REGISTER", ",", "regno", ",", "rsi", ")", "", "{", "int", "r", "=", "reg_renumber", "[", "regno", "]", ";", "int", "nregs", ";", "machine_mode", "mode", ";", "if", "(", "r", "<", "0", "||", "regno_reg_rtx", "[", "regno", "]", "==", "cheap", ")", "continue", ";", "nregs", "=", "hard_regno_nregs", "(", "r", ",", "PSEUDO_REGNO_MODE", "(", "regno", ")", ")", ";", "mode", "=", "HARD_REGNO_CALLER_SAVE_MODE", "(", "r", ",", "nregs", ",", "PSEUDO_REGNO_MODE", "(", "regno", ")", ")", ";", "if", "(", "partial_subreg_p", "(", "save_mode", "[", "r", "]", ",", "mode", ")", ")", "save_mode", "[", "r", "]", "=", "mode", ";", "while", "(", "nregs", "--", ">", "0", ")", "SET_HARD_REG_BIT", "(", "hard_regs_to_save", ",", "r", "+", "nregs", ")", ";", "}", "CLEAR_HARD_REG_SET", "(", "this_insn_sets", ")", ";", "note_stores", "(", "PATTERN", "(", "insn", ")", ",", "mark_set_regs", ",", "&", "this_insn_sets", ")", ";", "AND_COMPL_HARD_REG_SET", "(", "hard_regs_to_save", ",", "call_fixed_reg_set", ")", ";", "AND_COMPL_HARD_REG_SET", "(", "hard_regs_to_save", ",", "this_insn_sets", ")", ";", "AND_COMPL_HARD_REG_SET", "(", "hard_regs_to_save", ",", "hard_regs_saved", ")", ";", "get_call_reg_set_usage", "(", "insn", ",", "&", "call_def_reg_set", ",", "call_used_reg_set", ")", ";", "AND_HARD_REG_SET", "(", "hard_regs_to_save", ",", "call_def_reg_set", ")", ";", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "TEST_HARD_REG_BIT", "(", "hard_regs_to_save", ",", "regno", ")", ")", "regno", "+=", "insert_save", "(", "chain", ",", "regno", ",", "&", "hard_regs_to_save", ",", "save_mode", ")", ";", "n_regs_saved", "=", "0", ";", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "TEST_HARD_REG_BIT", "(", "hard_regs_saved", ",", "regno", ")", ")", "n_regs_saved", "++", ";", "if", "(", "cheap", "&&", "HARD_REGISTER_P", "(", "cheap", ")", "&&", "TEST_HARD_REG_BIT", "(", "call_used_reg_set", ",", "REGNO", "(", "cheap", ")", ")", ")", "{", "rtx", "dest", ",", "newpat", ";", "rtx", "pat", "=", "PATTERN", "(", "insn", ")", ";", "if", "(", "GET_CODE", "(", "pat", ")", "==", "PARALLEL", ")", "pat", "=", "XVECEXP", "(", "pat", ",", "0", ",", "0", ")", ";", "dest", "=", "SET_DEST", "(", "pat", ")", ";", "if", "(", "REG_P", "(", "dest", ")", ")", "{", "newpat", "=", "gen_rtx_SET", "(", "cheap", ",", "copy_rtx", "(", "dest", ")", ")", ";", "chain", "=", "insert_one_insn", "(", "chain", ",", "0", ",", "-1", ",", "newpat", ")", ";", "}", "}", "}", "last", "=", "chain", ";", "}", "else", "if", "(", "DEBUG_INSN_P", "(", "insn", ")", "&&", "n_regs_saved", ")", "mark_referenced_regs", "(", "&", "PATTERN", "(", "insn", ")", ",", "replace_reg_with_saved_mem", ",", "save_mode", ")", ";", "if", "(", "chain", "->", "next", "==", "0", "||", "chain", "->", "next", "->", "block", "!=", "chain", "->", "block", ")", "{", "int", "regno", ";", "if", "(", "n_regs_saved", "&&", "DEBUG_INSN_P", "(", "insn", ")", "&&", "last", "&&", "last", "->", "block", "==", "chain", "->", "block", ")", "{", "rtx_insn", "*", "ins", ",", "*", "prev", ";", "basic_block", "bb", "=", "BLOCK_FOR_INSN", "(", "insn", ")", ";", "for", "(", "ins", "=", "PREV_INSN", "(", "insn", ")", ";", "ins", "!=", "last", "->", "insn", ";", "ins", "=", "prev", ")", "{", "prev", "=", "PREV_INSN", "(", "ins", ")", ";", "if", "(", "NOTE_P", "(", "ins", ")", ")", "{", "SET_NEXT_INSN", "(", "prev", ")", "=", "NEXT_INSN", "(", "ins", ")", ";", "SET_PREV_INSN", "(", "NEXT_INSN", "(", "ins", ")", ")", "=", "prev", ";", "SET_PREV_INSN", "(", "ins", ")", "=", "insn", ";", "SET_NEXT_INSN", "(", "ins", ")", "=", "NEXT_INSN", "(", "insn", ")", ";", "SET_NEXT_INSN", "(", "insn", ")", "=", "ins", ";", "if", "(", "NEXT_INSN", "(", "ins", ")", ")", "SET_PREV_INSN", "(", "NEXT_INSN", "(", "ins", ")", ")", "=", "ins", ";", "if", "(", "BB_END", "(", "bb", ")", "==", "insn", ")", "BB_END", "(", "bb", ")", "=", "ins", ";", "}", "else", "gcc_assert", "(", "DEBUG_INSN_P", "(", "ins", ")", ")", ";", "}", "}", "last", "=", "NULL", ";", "if", "(", "n_regs_saved", ")", "for", "(", "regno", "=", "0", ";", "regno", "<", "FIRST_PSEUDO_REGISTER", ";", "regno", "++", ")", "if", "(", "TEST_HARD_REG_BIT", "(", "hard_regs_saved", ",", "regno", ")", ")", "regno", "+=", "insert_restore", "(", "chain", ",", "JUMP_P", "(", "insn", ")", ",", "regno", ",", "MOVE_MAX_WORDS", ",", "save_mode", ")", ";", "}", "}", "}" ]
Find the places where hard regs are live across calls and save them.
[ "Find", "the", "places", "where", "hard", "regs", "are", "live", "across", "calls", "and", "save", "them", "." ]
[ "/* Computed in mark_set_regs, holds all registers set by the current\n instruction. */", "/* If some registers have been saved, see if INSN references\n\t any of them. We must restore them before the insn if so. */", "/* Restore all registers if this is a JUMP_INSN. */", "/* If a saved register is set after the call, this means we no\n\t\t longer should restore it. This can happen when parts of a\n\t\t multi-word pseudo do not conflict with other pseudos, so\n\t\t IRA may allocate the same hard register for both. One may\n\t\t be live across the call, while the other is set\n\t\t afterwards. */", "/* Use the register life information in CHAIN to compute which\n\t\t regs are live during the call. */", "/* Save hard registers always in the widest mode available. */", "/* Look through all live pseudos, mark their hard registers\n\t\t and choose proper mode for saving. */", "/* Record all registers set in this call insn. These don't need\n\t\t to be saved. N.B. the call insn might set a subreg of a\n\t\t multi-hard-reg pseudo; then the pseudo is considered live\n\t\t during the call, but the subreg that is set isn't. */", "/* Compute which hard regs must be saved before this call. */", "/* Must recompute n_regs_saved. */", "/* For multiple return values dest is PARALLEL.\n\t\t Currently we handle only single return value case. */", "/* At the end of the basic block, we must restore any registers that\n\t remain saved. If the last insn in the block is a JUMP_INSN, put\n\t the restore before the insn, otherwise, put it after the insn. */", "/* When adding hard reg restores after a DEBUG_INSN, move\n\t\t all notes between last real insn and this DEBUG_INSN after\n\t\t the DEBUG_INSN, otherwise we could get code\n\t\t -g/-g0 differences. */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
add_stored_regs
void
static void add_stored_regs (rtx reg, const_rtx setter, void *data) { int regno, endregno, i; machine_mode mode = GET_MODE (reg); int offset = 0; if (GET_CODE (setter) == CLOBBER) return; if (GET_CODE (reg) == SUBREG && REG_P (SUBREG_REG (reg)) && REGNO (SUBREG_REG (reg)) < FIRST_PSEUDO_REGISTER) { offset = subreg_regno_offset (REGNO (SUBREG_REG (reg)), GET_MODE (SUBREG_REG (reg)), SUBREG_BYTE (reg), GET_MODE (reg)); regno = REGNO (SUBREG_REG (reg)) + offset; endregno = regno + subreg_nregs (reg); } else { if (!REG_P (reg) || REGNO (reg) >= FIRST_PSEUDO_REGISTER) return; regno = REGNO (reg) + offset; endregno = end_hard_regno (mode, regno); } for (i = regno; i < endregno; i++) SET_REGNO_REG_SET ((regset) data, i); }
/* Here from note_stores when an insn stores a value in a register. Set the proper bit or bits in the passed regset. All pseudos that have been assigned hard regs have had their register number changed already, so we can ignore pseudos. */
Here from note_stores when an insn stores a value in a register. Set the proper bit or bits in the passed regset. All pseudos that have been assigned hard regs have had their register number changed already, so we can ignore pseudos.
[ "Here", "from", "note_stores", "when", "an", "insn", "stores", "a", "value", "in", "a", "register", ".", "Set", "the", "proper", "bit", "or", "bits", "in", "the", "passed", "regset", ".", "All", "pseudos", "that", "have", "been", "assigned", "hard", "regs", "have", "had", "their", "register", "number", "changed", "already", "so", "we", "can", "ignore", "pseudos", "." ]
static void add_stored_regs (rtx reg, const_rtx setter, void *data) { int regno, endregno, i; machine_mode mode = GET_MODE (reg); int offset = 0; if (GET_CODE (setter) == CLOBBER) return; if (GET_CODE (reg) == SUBREG && REG_P (SUBREG_REG (reg)) && REGNO (SUBREG_REG (reg)) < FIRST_PSEUDO_REGISTER) { offset = subreg_regno_offset (REGNO (SUBREG_REG (reg)), GET_MODE (SUBREG_REG (reg)), SUBREG_BYTE (reg), GET_MODE (reg)); regno = REGNO (SUBREG_REG (reg)) + offset; endregno = regno + subreg_nregs (reg); } else { if (!REG_P (reg) || REGNO (reg) >= FIRST_PSEUDO_REGISTER) return; regno = REGNO (reg) + offset; endregno = end_hard_regno (mode, regno); } for (i = regno; i < endregno; i++) SET_REGNO_REG_SET ((regset) data, i); }
[ "static", "void", "add_stored_regs", "(", "rtx", "reg", ",", "const_rtx", "setter", ",", "void", "*", "data", ")", "{", "int", "regno", ",", "endregno", ",", "i", ";", "machine_mode", "mode", "=", "GET_MODE", "(", "reg", ")", ";", "int", "offset", "=", "0", ";", "if", "(", "GET_CODE", "(", "setter", ")", "==", "CLOBBER", ")", "return", ";", "if", "(", "GET_CODE", "(", "reg", ")", "==", "SUBREG", "&&", "REG_P", "(", "SUBREG_REG", "(", "reg", ")", ")", "&&", "REGNO", "(", "SUBREG_REG", "(", "reg", ")", ")", "<", "FIRST_PSEUDO_REGISTER", ")", "{", "offset", "=", "subreg_regno_offset", "(", "REGNO", "(", "SUBREG_REG", "(", "reg", ")", ")", ",", "GET_MODE", "(", "SUBREG_REG", "(", "reg", ")", ")", ",", "SUBREG_BYTE", "(", "reg", ")", ",", "GET_MODE", "(", "reg", ")", ")", ";", "regno", "=", "REGNO", "(", "SUBREG_REG", "(", "reg", ")", ")", "+", "offset", ";", "endregno", "=", "regno", "+", "subreg_nregs", "(", "reg", ")", ";", "}", "else", "{", "if", "(", "!", "REG_P", "(", "reg", ")", "||", "REGNO", "(", "reg", ")", ">=", "FIRST_PSEUDO_REGISTER", ")", "return", ";", "regno", "=", "REGNO", "(", "reg", ")", "+", "offset", ";", "endregno", "=", "end_hard_regno", "(", "mode", ",", "regno", ")", ";", "}", "for", "(", "i", "=", "regno", ";", "i", "<", "endregno", ";", "i", "++", ")", "SET_REGNO_REG_SET", "(", "(", "regset", ")", "data", ",", "i", ")", ";", "}" ]
Here from note_stores when an insn stores a value in a register.
[ "Here", "from", "note_stores", "when", "an", "insn", "stores", "a", "value", "in", "a", "register", "." ]
[]
[ { "param": "reg", "type": "rtx" }, { "param": "setter", "type": "const_rtx" }, { "param": "data", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "reg", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "setter", "type": "const_rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
mark_referenced_regs
void
static void mark_referenced_regs (rtx *loc, refmarker_fn *mark, void *arg) { enum rtx_code code = GET_CODE (*loc); const char *fmt; int i, j; if (code == SET) mark_referenced_regs (&SET_SRC (*loc), mark, arg); if (code == SET || code == CLOBBER) { loc = &SET_DEST (*loc); code = GET_CODE (*loc); if ((code == REG && REGNO (*loc) < FIRST_PSEUDO_REGISTER) || code == PC || code == CC0 || (code == SUBREG && REG_P (SUBREG_REG (*loc)) && REGNO (SUBREG_REG (*loc)) < FIRST_PSEUDO_REGISTER /* If we're setting only part of a multi-word register, we shall mark it as referenced, because the words that are not being set should be restored. */ && !read_modify_subreg_p (*loc))) return; } if (code == MEM || code == SUBREG) { loc = &XEXP (*loc, 0); code = GET_CODE (*loc); } if (code == REG) { int regno = REGNO (*loc); int hardregno = (regno < FIRST_PSEUDO_REGISTER ? regno : reg_renumber[regno]); if (hardregno >= 0) mark (loc, GET_MODE (*loc), hardregno, arg); else if (arg) /* ??? Will we ever end up with an equiv expression in a debug insn, that would have required restoring a reg, or will reload take care of it for us? */ return; /* If this is a pseudo that did not get a hard register, scan its memory location, since it might involve the use of another register, which might be saved. */ else if (reg_equiv_mem (regno) != 0) mark_referenced_regs (&XEXP (reg_equiv_mem (regno), 0), mark, arg); else if (reg_equiv_address (regno) != 0) mark_referenced_regs (&reg_equiv_address (regno), mark, arg); return; } fmt = GET_RTX_FORMAT (code); for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) { if (fmt[i] == 'e') mark_referenced_regs (&XEXP (*loc, i), mark, arg); else if (fmt[i] == 'E') for (j = XVECLEN (*loc, i) - 1; j >= 0; j--) mark_referenced_regs (&XVECEXP (*loc, i, j), mark, arg); } }
/* Walk X and record all referenced registers in REFERENCED_REGS. */
Walk X and record all referenced registers in REFERENCED_REGS.
[ "Walk", "X", "and", "record", "all", "referenced", "registers", "in", "REFERENCED_REGS", "." ]
static void mark_referenced_regs (rtx *loc, refmarker_fn *mark, void *arg) { enum rtx_code code = GET_CODE (*loc); const char *fmt; int i, j; if (code == SET) mark_referenced_regs (&SET_SRC (*loc), mark, arg); if (code == SET || code == CLOBBER) { loc = &SET_DEST (*loc); code = GET_CODE (*loc); if ((code == REG && REGNO (*loc) < FIRST_PSEUDO_REGISTER) || code == PC || code == CC0 || (code == SUBREG && REG_P (SUBREG_REG (*loc)) && REGNO (SUBREG_REG (*loc)) < FIRST_PSEUDO_REGISTER && !read_modify_subreg_p (*loc))) return; } if (code == MEM || code == SUBREG) { loc = &XEXP (*loc, 0); code = GET_CODE (*loc); } if (code == REG) { int regno = REGNO (*loc); int hardregno = (regno < FIRST_PSEUDO_REGISTER ? regno : reg_renumber[regno]); if (hardregno >= 0) mark (loc, GET_MODE (*loc), hardregno, arg); else if (arg) return; else if (reg_equiv_mem (regno) != 0) mark_referenced_regs (&XEXP (reg_equiv_mem (regno), 0), mark, arg); else if (reg_equiv_address (regno) != 0) mark_referenced_regs (&reg_equiv_address (regno), mark, arg); return; } fmt = GET_RTX_FORMAT (code); for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) { if (fmt[i] == 'e') mark_referenced_regs (&XEXP (*loc, i), mark, arg); else if (fmt[i] == 'E') for (j = XVECLEN (*loc, i) - 1; j >= 0; j--) mark_referenced_regs (&XVECEXP (*loc, i, j), mark, arg); } }
[ "static", "void", "mark_referenced_regs", "(", "rtx", "*", "loc", ",", "refmarker_fn", "*", "mark", ",", "void", "*", "arg", ")", "{", "enum", "rtx_code", "code", "=", "GET_CODE", "(", "*", "loc", ")", ";", "const", "char", "*", "fmt", ";", "int", "i", ",", "j", ";", "if", "(", "code", "==", "SET", ")", "mark_referenced_regs", "(", "&", "SET_SRC", "(", "*", "loc", ")", ",", "mark", ",", "arg", ")", ";", "if", "(", "code", "==", "SET", "||", "code", "==", "CLOBBER", ")", "{", "loc", "=", "&", "SET_DEST", "(", "*", "loc", ")", ";", "code", "=", "GET_CODE", "(", "*", "loc", ")", ";", "if", "(", "(", "code", "==", "REG", "&&", "REGNO", "(", "*", "loc", ")", "<", "FIRST_PSEUDO_REGISTER", ")", "||", "code", "==", "PC", "||", "code", "==", "CC0", "||", "(", "code", "==", "SUBREG", "&&", "REG_P", "(", "SUBREG_REG", "(", "*", "loc", ")", ")", "&&", "REGNO", "(", "SUBREG_REG", "(", "*", "loc", ")", ")", "<", "FIRST_PSEUDO_REGISTER", "&&", "!", "read_modify_subreg_p", "(", "*", "loc", ")", ")", ")", "return", ";", "}", "if", "(", "code", "==", "MEM", "||", "code", "==", "SUBREG", ")", "{", "loc", "=", "&", "XEXP", "(", "*", "loc", ",", "0", ")", ";", "code", "=", "GET_CODE", "(", "*", "loc", ")", ";", "}", "if", "(", "code", "==", "REG", ")", "{", "int", "regno", "=", "REGNO", "(", "*", "loc", ")", ";", "int", "hardregno", "=", "(", "regno", "<", "FIRST_PSEUDO_REGISTER", "?", "regno", ":", "reg_renumber", "[", "regno", "]", ")", ";", "if", "(", "hardregno", ">=", "0", ")", "mark", "(", "loc", ",", "GET_MODE", "(", "*", "loc", ")", ",", "hardregno", ",", "arg", ")", ";", "else", "if", "(", "arg", ")", "return", ";", "else", "if", "(", "reg_equiv_mem", "(", "regno", ")", "!=", "0", ")", "mark_referenced_regs", "(", "&", "XEXP", "(", "reg_equiv_mem", "(", "regno", ")", ",", "0", ")", ",", "mark", ",", "arg", ")", ";", "else", "if", "(", "reg_equiv_address", "(", "regno", ")", "!=", "0", ")", "mark_referenced_regs", "(", "&", "reg_equiv_address", "(", "regno", ")", ",", "mark", ",", "arg", ")", ";", "return", ";", "}", "fmt", "=", "GET_RTX_FORMAT", "(", "code", ")", ";", "for", "(", "i", "=", "GET_RTX_LENGTH", "(", "code", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "fmt", "[", "i", "]", "==", "'", "'", ")", "mark_referenced_regs", "(", "&", "XEXP", "(", "*", "loc", ",", "i", ")", ",", "mark", ",", "arg", ")", ";", "else", "if", "(", "fmt", "[", "i", "]", "==", "'", "'", ")", "for", "(", "j", "=", "XVECLEN", "(", "*", "loc", ",", "i", ")", "-", "1", ";", "j", ">=", "0", ";", "j", "--", ")", "mark_referenced_regs", "(", "&", "XVECEXP", "(", "*", "loc", ",", "i", ",", "j", ")", ",", "mark", ",", "arg", ")", ";", "}", "}" ]
Walk X and record all referenced registers in REFERENCED_REGS.
[ "Walk", "X", "and", "record", "all", "referenced", "registers", "in", "REFERENCED_REGS", "." ]
[ "/* If we're setting only part of a multi-word register,\n\t\t we shall mark it as referenced, because the words\n\t\t that are not being set should be restored. */", "/* ??? Will we ever end up with an equiv expression in a debug\n\t insn, that would have required restoring a reg, or will\n\t reload take care of it for us? */", "/* If this is a pseudo that did not get a hard register, scan its\n\t memory location, since it might involve the use of another\n\t register, which might be saved. */" ]
[ { "param": "loc", "type": "rtx" }, { "param": "mark", "type": "refmarker_fn" }, { "param": "arg", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mark", "type": "refmarker_fn", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
replace_reg_with_saved_mem
void
static void replace_reg_with_saved_mem (rtx *loc, machine_mode mode, int regno, void *arg) { unsigned int i, nregs = hard_regno_nregs (regno, mode); rtx mem; machine_mode *save_mode = (machine_mode *)arg; for (i = 0; i < nregs; i++) if (TEST_HARD_REG_BIT (hard_regs_saved, regno + i)) break; /* If none of the registers in the range would need restoring, we're all set. */ if (i == nregs) return; while (++i < nregs) if (!TEST_HARD_REG_BIT (hard_regs_saved, regno + i)) break; if (i == nregs && regno_save_mem[regno][nregs]) { mem = copy_rtx (regno_save_mem[regno][nregs]); if (nregs == hard_regno_nregs (regno, save_mode[regno])) mem = adjust_address_nv (mem, save_mode[regno], 0); if (GET_MODE (mem) != mode) { /* This is gen_lowpart_if_possible(), but without validating the newly-formed address. */ poly_int64 offset = byte_lowpart_offset (mode, GET_MODE (mem)); mem = adjust_address_nv (mem, mode, offset); } } else { mem = gen_rtx_CONCATN (mode, rtvec_alloc (nregs)); for (i = 0; i < nregs; i++) if (TEST_HARD_REG_BIT (hard_regs_saved, regno + i)) { gcc_assert (regno_save_mem[regno + i][1]); XVECEXP (mem, 0, i) = copy_rtx (regno_save_mem[regno + i][1]); } else { machine_mode smode = save_mode[regno]; gcc_assert (smode != VOIDmode); if (hard_regno_nregs (regno, smode) > 1) smode = mode_for_size (exact_div (GET_MODE_BITSIZE (mode), nregs), GET_MODE_CLASS (mode), 0).require (); XVECEXP (mem, 0, i) = gen_rtx_REG (smode, regno + i); } } gcc_assert (GET_MODE (mem) == mode); *loc = mem; }
/* Parameter function for mark_referenced_regs() that replaces registers referenced in a debug_insn that would have been restored, should it be a non-debug_insn, with their save locations. */
Parameter function for mark_referenced_regs() that replaces registers referenced in a debug_insn that would have been restored, should it be a non-debug_insn, with their save locations.
[ "Parameter", "function", "for", "mark_referenced_regs", "()", "that", "replaces", "registers", "referenced", "in", "a", "debug_insn", "that", "would", "have", "been", "restored", "should", "it", "be", "a", "non", "-", "debug_insn", "with", "their", "save", "locations", "." ]
static void replace_reg_with_saved_mem (rtx *loc, machine_mode mode, int regno, void *arg) { unsigned int i, nregs = hard_regno_nregs (regno, mode); rtx mem; machine_mode *save_mode = (machine_mode *)arg; for (i = 0; i < nregs; i++) if (TEST_HARD_REG_BIT (hard_regs_saved, regno + i)) break; if (i == nregs) return; while (++i < nregs) if (!TEST_HARD_REG_BIT (hard_regs_saved, regno + i)) break; if (i == nregs && regno_save_mem[regno][nregs]) { mem = copy_rtx (regno_save_mem[regno][nregs]); if (nregs == hard_regno_nregs (regno, save_mode[regno])) mem = adjust_address_nv (mem, save_mode[regno], 0); if (GET_MODE (mem) != mode) { poly_int64 offset = byte_lowpart_offset (mode, GET_MODE (mem)); mem = adjust_address_nv (mem, mode, offset); } } else { mem = gen_rtx_CONCATN (mode, rtvec_alloc (nregs)); for (i = 0; i < nregs; i++) if (TEST_HARD_REG_BIT (hard_regs_saved, regno + i)) { gcc_assert (regno_save_mem[regno + i][1]); XVECEXP (mem, 0, i) = copy_rtx (regno_save_mem[regno + i][1]); } else { machine_mode smode = save_mode[regno]; gcc_assert (smode != VOIDmode); if (hard_regno_nregs (regno, smode) > 1) smode = mode_for_size (exact_div (GET_MODE_BITSIZE (mode), nregs), GET_MODE_CLASS (mode), 0).require (); XVECEXP (mem, 0, i) = gen_rtx_REG (smode, regno + i); } } gcc_assert (GET_MODE (mem) == mode); *loc = mem; }
[ "static", "void", "replace_reg_with_saved_mem", "(", "rtx", "*", "loc", ",", "machine_mode", "mode", ",", "int", "regno", ",", "void", "*", "arg", ")", "{", "unsigned", "int", "i", ",", "nregs", "=", "hard_regno_nregs", "(", "regno", ",", "mode", ")", ";", "rtx", "mem", ";", "machine_mode", "*", "save_mode", "=", "(", "machine_mode", "*", ")", "arg", ";", "for", "(", "i", "=", "0", ";", "i", "<", "nregs", ";", "i", "++", ")", "if", "(", "TEST_HARD_REG_BIT", "(", "hard_regs_saved", ",", "regno", "+", "i", ")", ")", "break", ";", "if", "(", "i", "==", "nregs", ")", "return", ";", "while", "(", "++", "i", "<", "nregs", ")", "if", "(", "!", "TEST_HARD_REG_BIT", "(", "hard_regs_saved", ",", "regno", "+", "i", ")", ")", "break", ";", "if", "(", "i", "==", "nregs", "&&", "regno_save_mem", "[", "regno", "]", "[", "nregs", "]", ")", "{", "mem", "=", "copy_rtx", "(", "regno_save_mem", "[", "regno", "]", "[", "nregs", "]", ")", ";", "if", "(", "nregs", "==", "hard_regno_nregs", "(", "regno", ",", "save_mode", "[", "regno", "]", ")", ")", "mem", "=", "adjust_address_nv", "(", "mem", ",", "save_mode", "[", "regno", "]", ",", "0", ")", ";", "if", "(", "GET_MODE", "(", "mem", ")", "!=", "mode", ")", "{", "poly_int64", "offset", "=", "byte_lowpart_offset", "(", "mode", ",", "GET_MODE", "(", "mem", ")", ")", ";", "mem", "=", "adjust_address_nv", "(", "mem", ",", "mode", ",", "offset", ")", ";", "}", "}", "else", "{", "mem", "=", "gen_rtx_CONCATN", "(", "mode", ",", "rtvec_alloc", "(", "nregs", ")", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "nregs", ";", "i", "++", ")", "if", "(", "TEST_HARD_REG_BIT", "(", "hard_regs_saved", ",", "regno", "+", "i", ")", ")", "{", "gcc_assert", "(", "regno_save_mem", "[", "regno", "+", "i", "]", "[", "1", "]", ")", ";", "XVECEXP", "(", "mem", ",", "0", ",", "i", ")", "=", "copy_rtx", "(", "regno_save_mem", "[", "regno", "+", "i", "]", "[", "1", "]", ")", ";", "}", "else", "{", "machine_mode", "smode", "=", "save_mode", "[", "regno", "]", ";", "gcc_assert", "(", "smode", "!=", "VOIDmode", ")", ";", "if", "(", "hard_regno_nregs", "(", "regno", ",", "smode", ")", ">", "1", ")", "smode", "=", "mode_for_size", "(", "exact_div", "(", "GET_MODE_BITSIZE", "(", "mode", ")", ",", "nregs", ")", ",", "GET_MODE_CLASS", "(", "mode", ")", ",", "0", ")", ".", "require", "(", ")", ";", "XVECEXP", "(", "mem", ",", "0", ",", "i", ")", "=", "gen_rtx_REG", "(", "smode", ",", "regno", "+", "i", ")", ";", "}", "}", "gcc_assert", "(", "GET_MODE", "(", "mem", ")", "==", "mode", ")", ";", "*", "loc", "=", "mem", ";", "}" ]
Parameter function for mark_referenced_regs() that replaces registers referenced in a debug_insn that would have been restored, should it be a non-debug_insn, with their save locations.
[ "Parameter", "function", "for", "mark_referenced_regs", "()", "that", "replaces", "registers", "referenced", "in", "a", "debug_insn", "that", "would", "have", "been", "restored", "should", "it", "be", "a", "non", "-", "debug_insn", "with", "their", "save", "locations", "." ]
[ "/* If none of the registers in the range would need restoring, we're\n all set. */", "/* This is gen_lowpart_if_possible(), but without validating\n\t the newly-formed address. */" ]
[ { "param": "loc", "type": "rtx" }, { "param": "mode", "type": "machine_mode" }, { "param": "regno", "type": "int" }, { "param": "arg", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "loc", "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 }, { "identifier": "regno", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "arg", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
insert_restore
int
static int insert_restore (struct insn_chain *chain, int before_p, int regno, int maxrestore, machine_mode *save_mode) { int i, k; rtx pat = NULL_RTX; int code; unsigned int numregs = 0; struct insn_chain *new_chain; rtx mem; /* A common failure mode if register status is not correct in the RTL is for this routine to be called with a REGNO we didn't expect to save. That will cause us to write an insn with a (nil) SET_DEST or SET_SRC. Instead of doing so and causing a crash later, check for this common case here instead. This will remove one step in debugging such problems. */ gcc_assert (regno_save_mem[regno][1]); /* Get the pattern to emit and update our status. See if we can restore `maxrestore' registers at once. Work backwards to the single register case. */ for (i = maxrestore; i > 0; i--) { int j; int ok = 1; if (regno_save_mem[regno][i] == 0) continue; for (j = 0; j < i; j++) if (! TEST_HARD_REG_BIT (hard_regs_saved, regno + j)) { ok = 0; break; } /* Must do this one restore at a time. */ if (! ok) continue; numregs = i; break; } mem = regno_save_mem [regno][numregs]; if (save_mode [regno] != VOIDmode && save_mode [regno] != GET_MODE (mem) && numregs == hard_regno_nregs (regno, save_mode [regno]) /* Check that insn to restore REGNO in save_mode[regno] is correct. */ && reg_save_code (regno, save_mode[regno]) >= 0) mem = adjust_address_nv (mem, save_mode[regno], 0); else mem = copy_rtx (mem); /* Verify that the alignment of spill space is equal to or greater than required. */ gcc_assert (MIN (MAX_SUPPORTED_STACK_ALIGNMENT, GET_MODE_ALIGNMENT (GET_MODE (mem))) <= MEM_ALIGN (mem)); pat = gen_rtx_SET (gen_rtx_REG (GET_MODE (mem), regno), mem); code = reg_restore_code (regno, GET_MODE (mem)); new_chain = insert_one_insn (chain, before_p, code, pat); /* Clear status for all registers we restored. */ for (k = 0; k < i; k++) { CLEAR_HARD_REG_BIT (hard_regs_saved, regno + k); SET_REGNO_REG_SET (&new_chain->dead_or_set, regno + k); n_regs_saved--; } /* Tell our callers how many extra registers we saved/restored. */ return numregs - 1; }
/* Insert a sequence of insns to restore. Place these insns in front of CHAIN if BEFORE_P is nonzero, behind the insn otherwise. MAXRESTORE is the maximum number of registers which should be restored during this call. It should never be less than 1 since we only work with entire registers. Note that we have verified in init_caller_save that we can do this with a simple SET, so use it. Set INSN_CODE to what we save there since the address might not be valid so the insn might not be recognized. These insns will be reloaded and have register elimination done by find_reload, so we need not worry about that here. Return the extra number of registers saved. */
Insert a sequence of insns to restore. Place these insns in front of CHAIN if BEFORE_P is nonzero, behind the insn otherwise. MAXRESTORE is the maximum number of registers which should be restored during this call. It should never be less than 1 since we only work with entire registers. Note that we have verified in init_caller_save that we can do this with a simple SET, so use it. Set INSN_CODE to what we save there since the address might not be valid so the insn might not be recognized. These insns will be reloaded and have register elimination done by find_reload, so we need not worry about that here. Return the extra number of registers saved.
[ "Insert", "a", "sequence", "of", "insns", "to", "restore", ".", "Place", "these", "insns", "in", "front", "of", "CHAIN", "if", "BEFORE_P", "is", "nonzero", "behind", "the", "insn", "otherwise", ".", "MAXRESTORE", "is", "the", "maximum", "number", "of", "registers", "which", "should", "be", "restored", "during", "this", "call", ".", "It", "should", "never", "be", "less", "than", "1", "since", "we", "only", "work", "with", "entire", "registers", ".", "Note", "that", "we", "have", "verified", "in", "init_caller_save", "that", "we", "can", "do", "this", "with", "a", "simple", "SET", "so", "use", "it", ".", "Set", "INSN_CODE", "to", "what", "we", "save", "there", "since", "the", "address", "might", "not", "be", "valid", "so", "the", "insn", "might", "not", "be", "recognized", ".", "These", "insns", "will", "be", "reloaded", "and", "have", "register", "elimination", "done", "by", "find_reload", "so", "we", "need", "not", "worry", "about", "that", "here", ".", "Return", "the", "extra", "number", "of", "registers", "saved", "." ]
static int insert_restore (struct insn_chain *chain, int before_p, int regno, int maxrestore, machine_mode *save_mode) { int i, k; rtx pat = NULL_RTX; int code; unsigned int numregs = 0; struct insn_chain *new_chain; rtx mem; gcc_assert (regno_save_mem[regno][1]); for (i = maxrestore; i > 0; i--) { int j; int ok = 1; if (regno_save_mem[regno][i] == 0) continue; for (j = 0; j < i; j++) if (! TEST_HARD_REG_BIT (hard_regs_saved, regno + j)) { ok = 0; break; } if (! ok) continue; numregs = i; break; } mem = regno_save_mem [regno][numregs]; if (save_mode [regno] != VOIDmode && save_mode [regno] != GET_MODE (mem) && numregs == hard_regno_nregs (regno, save_mode [regno]) && reg_save_code (regno, save_mode[regno]) >= 0) mem = adjust_address_nv (mem, save_mode[regno], 0); else mem = copy_rtx (mem); gcc_assert (MIN (MAX_SUPPORTED_STACK_ALIGNMENT, GET_MODE_ALIGNMENT (GET_MODE (mem))) <= MEM_ALIGN (mem)); pat = gen_rtx_SET (gen_rtx_REG (GET_MODE (mem), regno), mem); code = reg_restore_code (regno, GET_MODE (mem)); new_chain = insert_one_insn (chain, before_p, code, pat); for (k = 0; k < i; k++) { CLEAR_HARD_REG_BIT (hard_regs_saved, regno + k); SET_REGNO_REG_SET (&new_chain->dead_or_set, regno + k); n_regs_saved--; } return numregs - 1; }
[ "static", "int", "insert_restore", "(", "struct", "insn_chain", "*", "chain", ",", "int", "before_p", ",", "int", "regno", ",", "int", "maxrestore", ",", "machine_mode", "*", "save_mode", ")", "{", "int", "i", ",", "k", ";", "rtx", "pat", "=", "NULL_RTX", ";", "int", "code", ";", "unsigned", "int", "numregs", "=", "0", ";", "struct", "insn_chain", "*", "new_chain", ";", "rtx", "mem", ";", "gcc_assert", "(", "regno_save_mem", "[", "regno", "]", "[", "1", "]", ")", ";", "for", "(", "i", "=", "maxrestore", ";", "i", ">", "0", ";", "i", "--", ")", "{", "int", "j", ";", "int", "ok", "=", "1", ";", "if", "(", "regno_save_mem", "[", "regno", "]", "[", "i", "]", "==", "0", ")", "continue", ";", "for", "(", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "if", "(", "!", "TEST_HARD_REG_BIT", "(", "hard_regs_saved", ",", "regno", "+", "j", ")", ")", "{", "ok", "=", "0", ";", "break", ";", "}", "if", "(", "!", "ok", ")", "continue", ";", "numregs", "=", "i", ";", "break", ";", "}", "mem", "=", "regno_save_mem", "[", "regno", "]", "[", "numregs", "]", ";", "if", "(", "save_mode", "[", "regno", "]", "!=", "VOIDmode", "&&", "save_mode", "[", "regno", "]", "!=", "GET_MODE", "(", "mem", ")", "&&", "numregs", "==", "hard_regno_nregs", "(", "regno", ",", "save_mode", "[", "regno", "]", ")", "&&", "reg_save_code", "(", "regno", ",", "save_mode", "[", "regno", "]", ")", ">=", "0", ")", "mem", "=", "adjust_address_nv", "(", "mem", ",", "save_mode", "[", "regno", "]", ",", "0", ")", ";", "else", "mem", "=", "copy_rtx", "(", "mem", ")", ";", "gcc_assert", "(", "MIN", "(", "MAX_SUPPORTED_STACK_ALIGNMENT", ",", "GET_MODE_ALIGNMENT", "(", "GET_MODE", "(", "mem", ")", ")", ")", "<=", "MEM_ALIGN", "(", "mem", ")", ")", ";", "pat", "=", "gen_rtx_SET", "(", "gen_rtx_REG", "(", "GET_MODE", "(", "mem", ")", ",", "regno", ")", ",", "mem", ")", ";", "code", "=", "reg_restore_code", "(", "regno", ",", "GET_MODE", "(", "mem", ")", ")", ";", "new_chain", "=", "insert_one_insn", "(", "chain", ",", "before_p", ",", "code", ",", "pat", ")", ";", "for", "(", "k", "=", "0", ";", "k", "<", "i", ";", "k", "++", ")", "{", "CLEAR_HARD_REG_BIT", "(", "hard_regs_saved", ",", "regno", "+", "k", ")", ";", "SET_REGNO_REG_SET", "(", "&", "new_chain", "->", "dead_or_set", ",", "regno", "+", "k", ")", ";", "n_regs_saved", "--", ";", "}", "return", "numregs", "-", "1", ";", "}" ]
Insert a sequence of insns to restore.
[ "Insert", "a", "sequence", "of", "insns", "to", "restore", "." ]
[ "/* A common failure mode if register status is not correct in the\n RTL is for this routine to be called with a REGNO we didn't\n expect to save. That will cause us to write an insn with a (nil)\n SET_DEST or SET_SRC. Instead of doing so and causing a crash\n later, check for this common case here instead. This will remove\n one step in debugging such problems. */", "/* Get the pattern to emit and update our status.\n\n See if we can restore `maxrestore' registers at once. Work\n backwards to the single register case. */", "/* Must do this one restore at a time. */", "/* Check that insn to restore REGNO in save_mode[regno] is\n\t correct. */", "/* Verify that the alignment of spill space is equal to or greater\n than required. */", "/* Clear status for all registers we restored. */", "/* Tell our callers how many extra registers we saved/restored. */" ]
[ { "param": "chain", "type": "struct insn_chain" }, { "param": "before_p", "type": "int" }, { "param": "regno", "type": "int" }, { "param": "maxrestore", "type": "int" }, { "param": "save_mode", "type": "machine_mode" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "chain", "type": "struct insn_chain", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "before_p", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "regno", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "maxrestore", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "save_mode", "type": "machine_mode", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
insert_save
int
static int insert_save (struct insn_chain *chain, int regno, HARD_REG_SET *to_save, machine_mode *save_mode) { int i; unsigned int k; rtx pat = NULL_RTX; int code; unsigned int numregs = 0; struct insn_chain *new_chain; rtx mem; /* A common failure mode if register status is not correct in the RTL is for this routine to be called with a REGNO we didn't expect to save. That will cause us to write an insn with a (nil) SET_DEST or SET_SRC. Instead of doing so and causing a crash later, check for this common case here. This will remove one step in debugging such problems. */ gcc_assert (regno_save_mem[regno][1]); /* Get the pattern to emit and update our status. See if we can save several registers with a single instruction. Work backwards to the single register case. */ for (i = MOVE_MAX_WORDS; i > 0; i--) { int j; int ok = 1; if (regno_save_mem[regno][i] == 0) continue; for (j = 0; j < i; j++) if (! TEST_HARD_REG_BIT (*to_save, regno + j)) { ok = 0; break; } /* Must do this one save at a time. */ if (! ok) continue; numregs = i; break; } mem = regno_save_mem [regno][numregs]; if (save_mode [regno] != VOIDmode && save_mode [regno] != GET_MODE (mem) && numregs == hard_regno_nregs (regno, save_mode [regno]) /* Check that insn to save REGNO in save_mode[regno] is correct. */ && reg_save_code (regno, save_mode[regno]) >= 0) mem = adjust_address_nv (mem, save_mode[regno], 0); else mem = copy_rtx (mem); /* Verify that the alignment of spill space is equal to or greater than required. */ gcc_assert (MIN (MAX_SUPPORTED_STACK_ALIGNMENT, GET_MODE_ALIGNMENT (GET_MODE (mem))) <= MEM_ALIGN (mem)); pat = gen_rtx_SET (mem, gen_rtx_REG (GET_MODE (mem), regno)); code = reg_save_code (regno, GET_MODE (mem)); new_chain = insert_one_insn (chain, 1, code, pat); /* Set hard_regs_saved and dead_or_set for all the registers we saved. */ for (k = 0; k < numregs; k++) { SET_HARD_REG_BIT (hard_regs_saved, regno + k); SET_REGNO_REG_SET (&new_chain->dead_or_set, regno + k); n_regs_saved++; } /* Tell our callers how many extra registers we saved/restored. */ return numregs - 1; }
/* Like insert_restore above, but save registers instead. */
Like insert_restore above, but save registers instead.
[ "Like", "insert_restore", "above", "but", "save", "registers", "instead", "." ]
static int insert_save (struct insn_chain *chain, int regno, HARD_REG_SET *to_save, machine_mode *save_mode) { int i; unsigned int k; rtx pat = NULL_RTX; int code; unsigned int numregs = 0; struct insn_chain *new_chain; rtx mem; gcc_assert (regno_save_mem[regno][1]); for (i = MOVE_MAX_WORDS; i > 0; i--) { int j; int ok = 1; if (regno_save_mem[regno][i] == 0) continue; for (j = 0; j < i; j++) if (! TEST_HARD_REG_BIT (*to_save, regno + j)) { ok = 0; break; } if (! ok) continue; numregs = i; break; } mem = regno_save_mem [regno][numregs]; if (save_mode [regno] != VOIDmode && save_mode [regno] != GET_MODE (mem) && numregs == hard_regno_nregs (regno, save_mode [regno]) && reg_save_code (regno, save_mode[regno]) >= 0) mem = adjust_address_nv (mem, save_mode[regno], 0); else mem = copy_rtx (mem); gcc_assert (MIN (MAX_SUPPORTED_STACK_ALIGNMENT, GET_MODE_ALIGNMENT (GET_MODE (mem))) <= MEM_ALIGN (mem)); pat = gen_rtx_SET (mem, gen_rtx_REG (GET_MODE (mem), regno)); code = reg_save_code (regno, GET_MODE (mem)); new_chain = insert_one_insn (chain, 1, code, pat); for (k = 0; k < numregs; k++) { SET_HARD_REG_BIT (hard_regs_saved, regno + k); SET_REGNO_REG_SET (&new_chain->dead_or_set, regno + k); n_regs_saved++; } return numregs - 1; }
[ "static", "int", "insert_save", "(", "struct", "insn_chain", "*", "chain", ",", "int", "regno", ",", "HARD_REG_SET", "*", "to_save", ",", "machine_mode", "*", "save_mode", ")", "{", "int", "i", ";", "unsigned", "int", "k", ";", "rtx", "pat", "=", "NULL_RTX", ";", "int", "code", ";", "unsigned", "int", "numregs", "=", "0", ";", "struct", "insn_chain", "*", "new_chain", ";", "rtx", "mem", ";", "gcc_assert", "(", "regno_save_mem", "[", "regno", "]", "[", "1", "]", ")", ";", "for", "(", "i", "=", "MOVE_MAX_WORDS", ";", "i", ">", "0", ";", "i", "--", ")", "{", "int", "j", ";", "int", "ok", "=", "1", ";", "if", "(", "regno_save_mem", "[", "regno", "]", "[", "i", "]", "==", "0", ")", "continue", ";", "for", "(", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "if", "(", "!", "TEST_HARD_REG_BIT", "(", "*", "to_save", ",", "regno", "+", "j", ")", ")", "{", "ok", "=", "0", ";", "break", ";", "}", "if", "(", "!", "ok", ")", "continue", ";", "numregs", "=", "i", ";", "break", ";", "}", "mem", "=", "regno_save_mem", "[", "regno", "]", "[", "numregs", "]", ";", "if", "(", "save_mode", "[", "regno", "]", "!=", "VOIDmode", "&&", "save_mode", "[", "regno", "]", "!=", "GET_MODE", "(", "mem", ")", "&&", "numregs", "==", "hard_regno_nregs", "(", "regno", ",", "save_mode", "[", "regno", "]", ")", "&&", "reg_save_code", "(", "regno", ",", "save_mode", "[", "regno", "]", ")", ">=", "0", ")", "mem", "=", "adjust_address_nv", "(", "mem", ",", "save_mode", "[", "regno", "]", ",", "0", ")", ";", "else", "mem", "=", "copy_rtx", "(", "mem", ")", ";", "gcc_assert", "(", "MIN", "(", "MAX_SUPPORTED_STACK_ALIGNMENT", ",", "GET_MODE_ALIGNMENT", "(", "GET_MODE", "(", "mem", ")", ")", ")", "<=", "MEM_ALIGN", "(", "mem", ")", ")", ";", "pat", "=", "gen_rtx_SET", "(", "mem", ",", "gen_rtx_REG", "(", "GET_MODE", "(", "mem", ")", ",", "regno", ")", ")", ";", "code", "=", "reg_save_code", "(", "regno", ",", "GET_MODE", "(", "mem", ")", ")", ";", "new_chain", "=", "insert_one_insn", "(", "chain", ",", "1", ",", "code", ",", "pat", ")", ";", "for", "(", "k", "=", "0", ";", "k", "<", "numregs", ";", "k", "++", ")", "{", "SET_HARD_REG_BIT", "(", "hard_regs_saved", ",", "regno", "+", "k", ")", ";", "SET_REGNO_REG_SET", "(", "&", "new_chain", "->", "dead_or_set", ",", "regno", "+", "k", ")", ";", "n_regs_saved", "++", ";", "}", "return", "numregs", "-", "1", ";", "}" ]
Like insert_restore above, but save registers instead.
[ "Like", "insert_restore", "above", "but", "save", "registers", "instead", "." ]
[ "/* A common failure mode if register status is not correct in the\n RTL is for this routine to be called with a REGNO we didn't\n expect to save. That will cause us to write an insn with a (nil)\n SET_DEST or SET_SRC. Instead of doing so and causing a crash\n later, check for this common case here. This will remove one\n step in debugging such problems. */", "/* Get the pattern to emit and update our status.\n\n See if we can save several registers with a single instruction.\n Work backwards to the single register case. */", "/* Must do this one save at a time. */", "/* Check that insn to save REGNO in save_mode[regno] is\n\t correct. */", "/* Verify that the alignment of spill space is equal to or greater\n than required. */", "/* Set hard_regs_saved and dead_or_set for all the registers we saved. */", "/* Tell our callers how many extra registers we saved/restored. */" ]
[ { "param": "chain", "type": "struct insn_chain" }, { "param": "regno", "type": "int" }, { "param": "to_save", "type": "HARD_REG_SET" }, { "param": "save_mode", "type": "machine_mode" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "chain", "type": "struct insn_chain", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "regno", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "to_save", "type": "HARD_REG_SET", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "save_mode", "type": "machine_mode", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a7edbadd2534317bc3a71d4fd8c502df0de6c5cc
atrens/DragonFlyBSD-src
contrib/gcc-8.0/gcc/caller-save.c
[ "BSD-3-Clause" ]
C
insert_one_insn
null
static struct insn_chain * insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat) { rtx_insn *insn = chain->insn; struct insn_chain *new_chain; /* If INSN references CC0, put our insns in front of the insn that sets CC0. This is always safe, since the only way we could be passed an insn that references CC0 is for a restore, and doing a restore earlier isn't a problem. We do, however, assume here that CALL_INSNs don't reference CC0. Guard against non-INSN's like CODE_LABEL. */ if (HAVE_cc0 && (NONJUMP_INSN_P (insn) || JUMP_P (insn)) && before_p && reg_referenced_p (cc0_rtx, PATTERN (insn))) chain = chain->prev, insn = chain->insn; new_chain = new_insn_chain (); if (before_p) { rtx link; new_chain->prev = chain->prev; if (new_chain->prev != 0) new_chain->prev->next = new_chain; else reload_insn_chain = new_chain; chain->prev = new_chain; new_chain->next = chain; new_chain->insn = emit_insn_before (pat, insn); /* ??? It would be nice if we could exclude the already / still saved registers from the live sets. */ COPY_REG_SET (&new_chain->live_throughout, &chain->live_throughout); note_uses (&PATTERN (chain->insn), add_used_regs, &new_chain->live_throughout); /* If CHAIN->INSN is a call, then the registers which contain the arguments to the function are live in the new insn. */ if (CALL_P (chain->insn)) for (link = CALL_INSN_FUNCTION_USAGE (chain->insn); link != NULL_RTX; link = XEXP (link, 1)) note_uses (&XEXP (link, 0), add_used_regs, &new_chain->live_throughout); CLEAR_REG_SET (&new_chain->dead_or_set); if (chain->insn == BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block))) BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn; } else { new_chain->next = chain->next; if (new_chain->next != 0) new_chain->next->prev = new_chain; chain->next = new_chain; new_chain->prev = chain; new_chain->insn = emit_insn_after (pat, insn); /* ??? It would be nice if we could exclude the already / still saved registers from the live sets, and observe REG_UNUSED notes. */ COPY_REG_SET (&new_chain->live_throughout, &chain->live_throughout); /* Registers that are set in CHAIN->INSN live in the new insn. (Unless there is a REG_UNUSED note for them, but we don't look for them here.) */ note_stores (PATTERN (chain->insn), add_stored_regs, &new_chain->live_throughout); CLEAR_REG_SET (&new_chain->dead_or_set); if (chain->insn == BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block))) BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn; } new_chain->block = chain->block; new_chain->is_caller_save_insn = 1; INSN_CODE (new_chain->insn) = code; return new_chain; }
/* Emit a new caller-save insn and set the code. */
Emit a new caller-save insn and set the code.
[ "Emit", "a", "new", "caller", "-", "save", "insn", "and", "set", "the", "code", "." ]
static struct insn_chain * insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat) { rtx_insn *insn = chain->insn; struct insn_chain *new_chain; if (HAVE_cc0 && (NONJUMP_INSN_P (insn) || JUMP_P (insn)) && before_p && reg_referenced_p (cc0_rtx, PATTERN (insn))) chain = chain->prev, insn = chain->insn; new_chain = new_insn_chain (); if (before_p) { rtx link; new_chain->prev = chain->prev; if (new_chain->prev != 0) new_chain->prev->next = new_chain; else reload_insn_chain = new_chain; chain->prev = new_chain; new_chain->next = chain; new_chain->insn = emit_insn_before (pat, insn); COPY_REG_SET (&new_chain->live_throughout, &chain->live_throughout); note_uses (&PATTERN (chain->insn), add_used_regs, &new_chain->live_throughout); if (CALL_P (chain->insn)) for (link = CALL_INSN_FUNCTION_USAGE (chain->insn); link != NULL_RTX; link = XEXP (link, 1)) note_uses (&XEXP (link, 0), add_used_regs, &new_chain->live_throughout); CLEAR_REG_SET (&new_chain->dead_or_set); if (chain->insn == BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block))) BB_HEAD (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn; } else { new_chain->next = chain->next; if (new_chain->next != 0) new_chain->next->prev = new_chain; chain->next = new_chain; new_chain->prev = chain; new_chain->insn = emit_insn_after (pat, insn); COPY_REG_SET (&new_chain->live_throughout, &chain->live_throughout); note_stores (PATTERN (chain->insn), add_stored_regs, &new_chain->live_throughout); CLEAR_REG_SET (&new_chain->dead_or_set); if (chain->insn == BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block))) BB_END (BASIC_BLOCK_FOR_FN (cfun, chain->block)) = new_chain->insn; } new_chain->block = chain->block; new_chain->is_caller_save_insn = 1; INSN_CODE (new_chain->insn) = code; return new_chain; }
[ "static", "struct", "insn_chain", "*", "insert_one_insn", "(", "struct", "insn_chain", "*", "chain", ",", "int", "before_p", ",", "int", "code", ",", "rtx", "pat", ")", "{", "rtx_insn", "*", "insn", "=", "chain", "->", "insn", ";", "struct", "insn_chain", "*", "new_chain", ";", "if", "(", "HAVE_cc0", "&&", "(", "NONJUMP_INSN_P", "(", "insn", ")", "||", "JUMP_P", "(", "insn", ")", ")", "&&", "before_p", "&&", "reg_referenced_p", "(", "cc0_rtx", ",", "PATTERN", "(", "insn", ")", ")", ")", "chain", "=", "chain", "->", "prev", ",", "insn", "=", "chain", "->", "insn", ";", "new_chain", "=", "new_insn_chain", "(", ")", ";", "if", "(", "before_p", ")", "{", "rtx", "link", ";", "new_chain", "->", "prev", "=", "chain", "->", "prev", ";", "if", "(", "new_chain", "->", "prev", "!=", "0", ")", "new_chain", "->", "prev", "->", "next", "=", "new_chain", ";", "else", "reload_insn_chain", "=", "new_chain", ";", "chain", "->", "prev", "=", "new_chain", ";", "new_chain", "->", "next", "=", "chain", ";", "new_chain", "->", "insn", "=", "emit_insn_before", "(", "pat", ",", "insn", ")", ";", "COPY_REG_SET", "(", "&", "new_chain", "->", "live_throughout", ",", "&", "chain", "->", "live_throughout", ")", ";", "note_uses", "(", "&", "PATTERN", "(", "chain", "->", "insn", ")", ",", "add_used_regs", ",", "&", "new_chain", "->", "live_throughout", ")", ";", "if", "(", "CALL_P", "(", "chain", "->", "insn", ")", ")", "for", "(", "link", "=", "CALL_INSN_FUNCTION_USAGE", "(", "chain", "->", "insn", ")", ";", "link", "!=", "NULL_RTX", ";", "link", "=", "XEXP", "(", "link", ",", "1", ")", ")", "note_uses", "(", "&", "XEXP", "(", "link", ",", "0", ")", ",", "add_used_regs", ",", "&", "new_chain", "->", "live_throughout", ")", ";", "CLEAR_REG_SET", "(", "&", "new_chain", "->", "dead_or_set", ")", ";", "if", "(", "chain", "->", "insn", "==", "BB_HEAD", "(", "BASIC_BLOCK_FOR_FN", "(", "cfun", ",", "chain", "->", "block", ")", ")", ")", "BB_HEAD", "(", "BASIC_BLOCK_FOR_FN", "(", "cfun", ",", "chain", "->", "block", ")", ")", "=", "new_chain", "->", "insn", ";", "}", "else", "{", "new_chain", "->", "next", "=", "chain", "->", "next", ";", "if", "(", "new_chain", "->", "next", "!=", "0", ")", "new_chain", "->", "next", "->", "prev", "=", "new_chain", ";", "chain", "->", "next", "=", "new_chain", ";", "new_chain", "->", "prev", "=", "chain", ";", "new_chain", "->", "insn", "=", "emit_insn_after", "(", "pat", ",", "insn", ")", ";", "COPY_REG_SET", "(", "&", "new_chain", "->", "live_throughout", ",", "&", "chain", "->", "live_throughout", ")", ";", "note_stores", "(", "PATTERN", "(", "chain", "->", "insn", ")", ",", "add_stored_regs", ",", "&", "new_chain", "->", "live_throughout", ")", ";", "CLEAR_REG_SET", "(", "&", "new_chain", "->", "dead_or_set", ")", ";", "if", "(", "chain", "->", "insn", "==", "BB_END", "(", "BASIC_BLOCK_FOR_FN", "(", "cfun", ",", "chain", "->", "block", ")", ")", ")", "BB_END", "(", "BASIC_BLOCK_FOR_FN", "(", "cfun", ",", "chain", "->", "block", ")", ")", "=", "new_chain", "->", "insn", ";", "}", "new_chain", "->", "block", "=", "chain", "->", "block", ";", "new_chain", "->", "is_caller_save_insn", "=", "1", ";", "INSN_CODE", "(", "new_chain", "->", "insn", ")", "=", "code", ";", "return", "new_chain", ";", "}" ]
Emit a new caller-save insn and set the code.
[ "Emit", "a", "new", "caller", "-", "save", "insn", "and", "set", "the", "code", "." ]
[ "/* If INSN references CC0, put our insns in front of the insn that sets\n CC0. This is always safe, since the only way we could be passed an\n insn that references CC0 is for a restore, and doing a restore earlier\n isn't a problem. We do, however, assume here that CALL_INSNs don't\n reference CC0. Guard against non-INSN's like CODE_LABEL. */", "/* ??? It would be nice if we could exclude the already / still saved\n\t registers from the live sets. */", "/* If CHAIN->INSN is a call, then the registers which contain\n\t the arguments to the function are live in the new insn. */", "/* ??? It would be nice if we could exclude the already / still saved\n\t registers from the live sets, and observe REG_UNUSED notes. */", "/* Registers that are set in CHAIN->INSN live in the new insn.\n\t (Unless there is a REG_UNUSED note for them, but we don't\n\t look for them here.) */" ]
[ { "param": "chain", "type": "struct insn_chain" }, { "param": "before_p", "type": "int" }, { "param": "code", "type": "int" }, { "param": "pat", "type": "rtx" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "chain", "type": "struct insn_chain", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "before_p", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "code", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pat", "type": "rtx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e02fe228cc802e09d884b6a58bd350aee7501260
atrens/DragonFlyBSD-src
usr.bin/evtranalyze/svg.c
[ "BSD-3-Clause" ]
C
svg_rect_new
null
struct svg_rect * svg_rect_new(const char *cl) { struct svg_rect *r; if (!(r = malloc(sizeof(*r)))) return r; svg_rect_init(r, cl); return r; }
/* * In the future, we might want to stick the rectangle in the * <defs> element at this point and then <use> it in the rest * of the document. */
In the future, we might want to stick the rectangle in the element at this point and then it in the rest of the document.
[ "In", "the", "future", "we", "might", "want", "to", "stick", "the", "rectangle", "in", "the", "element", "at", "this", "point", "and", "then", "it", "in", "the", "rest", "of", "the", "document", "." ]
struct svg_rect * svg_rect_new(const char *cl) { struct svg_rect *r; if (!(r = malloc(sizeof(*r)))) return r; svg_rect_init(r, cl); return r; }
[ "struct", "svg_rect", "*", "svg_rect_new", "(", "const", "char", "*", "cl", ")", "{", "struct", "svg_rect", "*", "r", ";", "if", "(", "!", "(", "r", "=", "malloc", "(", "sizeof", "(", "*", "r", ")", ")", ")", ")", "return", "r", ";", "svg_rect_init", "(", "r", ",", "cl", ")", ";", "return", "r", ";", "}" ]
In the future, we might want to stick the rectangle in the <defs> element at this point and then <use> it in the rest of the document.
[ "In", "the", "future", "we", "might", "want", "to", "stick", "the", "rectangle", "in", "the", "<defs", ">", "element", "at", "this", "point", "and", "then", "<use", ">", "it", "in", "the", "rest", "of", "the", "document", "." ]
[]
[ { "param": "cl", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cl", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e0da0d35f9b2b3458d6971f5ee33fd74230b6056
atrens/DragonFlyBSD-src
contrib/gdb-7/gdb/inf-loop.c
[ "BSD-3-Clause" ]
C
inferior_event_handler
void
void inferior_event_handler (enum inferior_event_type event_type, gdb_client_data client_data) { struct cleanup *cleanup_if_error = make_bpstat_clear_actions_cleanup (); switch (event_type) { case INF_REG_EVENT: /* Use catch errors for now, until the inner layers of fetch_inferior_event (i.e. readchar) can return meaningful error status. If an error occurs while getting an event from the target, just cancel the current command. */ if (!catch_errors (fetch_inferior_event_wrapper, client_data, "", RETURN_MASK_ALL)) { bpstat_clear_actions (); do_all_intermediate_continuations (1); do_all_continuations (1); async_enable_stdin (); display_gdb_prompt (0); } break; case INF_EXEC_COMPLETE: if (!non_stop) { /* Unregister the inferior from the event loop. This is done so that when the inferior is not running we don't get distracted by spurious inferior output. */ if (target_has_execution) target_async (NULL, 0); } /* Do all continuations associated with the whole inferior (not a particular thread). */ if (!ptid_equal (inferior_ptid, null_ptid)) do_all_inferior_continuations (0); /* If we were doing a multi-step (eg: step n, next n), but it got interrupted by a breakpoint, still do the pending continuations. The continuation itself is responsible for distinguishing the cases. The continuations are allowed to touch the inferior memory, e.g. to remove breakpoints, so run them before running breakpoint commands, which may resume the target. */ if (non_stop && target_has_execution && !ptid_equal (inferior_ptid, null_ptid)) do_all_intermediate_continuations_thread (inferior_thread (), 0); else do_all_intermediate_continuations (0); /* Always finish the previous command before running any breakpoint commands. Any stop cancels the previous command. E.g. a "finish" or "step-n" command interrupted by an unrelated breakpoint is canceled. */ if (non_stop && target_has_execution && !ptid_equal (inferior_ptid, null_ptid)) do_all_continuations_thread (inferior_thread (), 0); else do_all_continuations (0); /* When running a command list (from a user command, say), these are only run when the command list is all done. */ if (interpreter_async) { volatile struct gdb_exception e; check_frame_language_change (); /* Don't propagate breakpoint commands errors. Either we're stopping or some command resumes the inferior. The user will be informed. */ TRY_CATCH (e, RETURN_MASK_ALL) { bpstat_do_actions (); } exception_print (gdb_stderr, e); } break; case INF_EXEC_CONTINUE: /* Is there anything left to do for the command issued to complete? */ if (non_stop) do_all_intermediate_continuations_thread (inferior_thread (), 0); else do_all_intermediate_continuations (0); break; case INF_TIMER: default: printf_unfiltered (_("Event type not recognized.\n")); break; } discard_cleanups (cleanup_if_error); }
/* General function to handle events in the inferior. So far it just takes care of detecting errors reported by select() or poll(), otherwise it assumes that all is OK, and goes on reading data from the fd. This however may not always be what we want to do. */
General function to handle events in the inferior. So far it just takes care of detecting errors reported by select() or poll(), otherwise it assumes that all is OK, and goes on reading data from the fd. This however may not always be what we want to do.
[ "General", "function", "to", "handle", "events", "in", "the", "inferior", ".", "So", "far", "it", "just", "takes", "care", "of", "detecting", "errors", "reported", "by", "select", "()", "or", "poll", "()", "otherwise", "it", "assumes", "that", "all", "is", "OK", "and", "goes", "on", "reading", "data", "from", "the", "fd", ".", "This", "however", "may", "not", "always", "be", "what", "we", "want", "to", "do", "." ]
void inferior_event_handler (enum inferior_event_type event_type, gdb_client_data client_data) { struct cleanup *cleanup_if_error = make_bpstat_clear_actions_cleanup (); switch (event_type) { case INF_REG_EVENT: if (!catch_errors (fetch_inferior_event_wrapper, client_data, "", RETURN_MASK_ALL)) { bpstat_clear_actions (); do_all_intermediate_continuations (1); do_all_continuations (1); async_enable_stdin (); display_gdb_prompt (0); } break; case INF_EXEC_COMPLETE: if (!non_stop) { if (target_has_execution) target_async (NULL, 0); } if (!ptid_equal (inferior_ptid, null_ptid)) do_all_inferior_continuations (0); if (non_stop && target_has_execution && !ptid_equal (inferior_ptid, null_ptid)) do_all_intermediate_continuations_thread (inferior_thread (), 0); else do_all_intermediate_continuations (0); if (non_stop && target_has_execution && !ptid_equal (inferior_ptid, null_ptid)) do_all_continuations_thread (inferior_thread (), 0); else do_all_continuations (0); if (interpreter_async) { volatile struct gdb_exception e; check_frame_language_change (); TRY_CATCH (e, RETURN_MASK_ALL) { bpstat_do_actions (); } exception_print (gdb_stderr, e); } break; case INF_EXEC_CONTINUE: if (non_stop) do_all_intermediate_continuations_thread (inferior_thread (), 0); else do_all_intermediate_continuations (0); break; case INF_TIMER: default: printf_unfiltered (_("Event type not recognized.\n")); break; } discard_cleanups (cleanup_if_error); }
[ "void", "inferior_event_handler", "(", "enum", "inferior_event_type", "event_type", ",", "gdb_client_data", "client_data", ")", "{", "struct", "cleanup", "*", "cleanup_if_error", "=", "make_bpstat_clear_actions_cleanup", "(", ")", ";", "switch", "(", "event_type", ")", "{", "case", "INF_REG_EVENT", ":", "if", "(", "!", "catch_errors", "(", "fetch_inferior_event_wrapper", ",", "client_data", ",", "\"", "\"", ",", "RETURN_MASK_ALL", ")", ")", "{", "bpstat_clear_actions", "(", ")", ";", "do_all_intermediate_continuations", "(", "1", ")", ";", "do_all_continuations", "(", "1", ")", ";", "async_enable_stdin", "(", ")", ";", "display_gdb_prompt", "(", "0", ")", ";", "}", "break", ";", "case", "INF_EXEC_COMPLETE", ":", "if", "(", "!", "non_stop", ")", "{", "if", "(", "target_has_execution", ")", "target_async", "(", "NULL", ",", "0", ")", ";", "}", "if", "(", "!", "ptid_equal", "(", "inferior_ptid", ",", "null_ptid", ")", ")", "do_all_inferior_continuations", "(", "0", ")", ";", "if", "(", "non_stop", "&&", "target_has_execution", "&&", "!", "ptid_equal", "(", "inferior_ptid", ",", "null_ptid", ")", ")", "do_all_intermediate_continuations_thread", "(", "inferior_thread", "(", ")", ",", "0", ")", ";", "else", "do_all_intermediate_continuations", "(", "0", ")", ";", "if", "(", "non_stop", "&&", "target_has_execution", "&&", "!", "ptid_equal", "(", "inferior_ptid", ",", "null_ptid", ")", ")", "do_all_continuations_thread", "(", "inferior_thread", "(", ")", ",", "0", ")", ";", "else", "do_all_continuations", "(", "0", ")", ";", "if", "(", "interpreter_async", ")", "{", "volatile", "struct", "gdb_exception", "e", ";", "check_frame_language_change", "(", ")", ";", "TRY_CATCH", "(", "e", ",", "RETURN_MASK_ALL", ")", "", "{", "bpstat_do_actions", "(", ")", ";", "}", "exception_print", "(", "gdb_stderr", ",", "e", ")", ";", "}", "break", ";", "case", "INF_EXEC_CONTINUE", ":", "if", "(", "non_stop", ")", "do_all_intermediate_continuations_thread", "(", "inferior_thread", "(", ")", ",", "0", ")", ";", "else", "do_all_intermediate_continuations", "(", "0", ")", ";", "break", ";", "case", "INF_TIMER", ":", "default", ":", "printf_unfiltered", "(", "_", "(", "\"", "\\n", "\"", ")", ")", ";", "break", ";", "}", "discard_cleanups", "(", "cleanup_if_error", ")", ";", "}" ]
General function to handle events in the inferior.
[ "General", "function", "to", "handle", "events", "in", "the", "inferior", "." ]
[ "/* Use catch errors for now, until the inner layers of\n\t fetch_inferior_event (i.e. readchar) can return meaningful\n\t error status. If an error occurs while getting an event from\n\t the target, just cancel the current command. */", "/* Unregister the inferior from the event loop. This is done\n\t so that when the inferior is not running we don't get\n\t distracted by spurious inferior output. */", "/* Do all continuations associated with the whole inferior (not\n\t a particular thread). */", "/* If we were doing a multi-step (eg: step n, next n), but it\n\t got interrupted by a breakpoint, still do the pending\n\t continuations. The continuation itself is responsible for\n\t distinguishing the cases. The continuations are allowed to\n\t touch the inferior memory, e.g. to remove breakpoints, so run\n\t them before running breakpoint commands, which may resume the\n\t target. */", "/* Always finish the previous command before running any\n\t breakpoint commands. Any stop cancels the previous command.\n\t E.g. a \"finish\" or \"step-n\" command interrupted by an\n\t unrelated breakpoint is canceled. */", "/* When running a command list (from a user command, say), these\n\t are only run when the command list is all done. */", "/* Don't propagate breakpoint commands errors. Either we're\n\t stopping or some command resumes the inferior. The user will\n\t be informed. */", "/* Is there anything left to do for the command issued to\n complete? */" ]
[ { "param": "event_type", "type": "enum inferior_event_type" }, { "param": "client_data", "type": "gdb_client_data" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "event_type", "type": "enum inferior_event_type", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "client_data", "type": "gdb_client_data", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e8caa023b37c3ed686bd6a4d28453c564007198
atrens/DragonFlyBSD-src
contrib/gcc-4.7/libstdc++-v3/include/bits/random.h
[ "BSD-3-Clause" ]
C
discard
void
void discard(unsigned long long __z) { for (; __z != 0ULL; --__z) (*this)(); }
/** * @brief Discard a sequence of random numbers. */
@brief Discard a sequence of random numbers.
[ "@brief", "Discard", "a", "sequence", "of", "random", "numbers", "." ]
void discard(unsigned long long __z) { for (; __z != 0ULL; --__z) (*this)(); }
[ "void", "discard", "(", "unsigned", "long", "long", "__z", ")", "{", "for", "(", ";", "__z", "!=", "0ULL", ";", "--", "__z", ")", "(", "*", "this", ")", "(", ")", ";", "}" ]
@brief Discard a sequence of random numbers.
[ "@brief", "Discard", "a", "sequence", "of", "random", "numbers", "." ]
[]
[ { "param": "__z", "type": "unsigned long long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "__z", "type": "unsigned long long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e8caa023b37c3ed686bd6a4d28453c564007198
atrens/DragonFlyBSD-src
contrib/gcc-4.7/libstdc++-v3/include/bits/random.h
[ "BSD-3-Clause" ]
C
seed
void
void seed() { _M_b.seed(); _M_n = 0; }
/** * @brief Reseeds the %discard_block_engine object with the default * seed for the underlying base class generator engine. */
@brief Reseeds the %discard_block_engine object with the default seed for the underlying base class generator engine.
[ "@brief", "Reseeds", "the", "%discard_block_engine", "object", "with", "the", "default", "seed", "for", "the", "underlying", "base", "class", "generator", "engine", "." ]
void seed() { _M_b.seed(); _M_n = 0; }
[ "void", "seed", "(", ")", "{", "_M_b", ".", "seed", "(", ")", ";", "_M_n", "=", "0", ";", "}" ]
@brief Reseeds the %discard_block_engine object with the default seed for the underlying base class generator engine.
[ "@brief", "Reseeds", "the", "%discard_block_engine", "object", "with", "the", "default", "seed", "for", "the", "underlying", "base", "class", "generator", "engine", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1e8caa023b37c3ed686bd6a4d28453c564007198
atrens/DragonFlyBSD-src
contrib/gcc-4.7/libstdc++-v3/include/bits/random.h
[ "BSD-3-Clause" ]
C
seed
void
void seed(result_type __s) { _M_b.seed(__s); _M_n = 0; }
/** * @brief Reseeds the %discard_block_engine object with the default * seed for the underlying base class generator engine. */
@brief Reseeds the %discard_block_engine object with the default seed for the underlying base class generator engine.
[ "@brief", "Reseeds", "the", "%discard_block_engine", "object", "with", "the", "default", "seed", "for", "the", "underlying", "base", "class", "generator", "engine", "." ]
void seed(result_type __s) { _M_b.seed(__s); _M_n = 0; }
[ "void", "seed", "(", "result_type", "__s", ")", "{", "_M_b", ".", "seed", "(", "__s", ")", ";", "_M_n", "=", "0", ";", "}" ]
@brief Reseeds the %discard_block_engine object with the default seed for the underlying base class generator engine.
[ "@brief", "Reseeds", "the", "%discard_block_engine", "object", "with", "the", "default", "seed", "for", "the", "underlying", "base", "class", "generator", "engine", "." ]
[]
[ { "param": "__s", "type": "result_type" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "__s", "type": "result_type", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e8caa023b37c3ed686bd6a4d28453c564007198
atrens/DragonFlyBSD-src
contrib/gcc-4.7/libstdc++-v3/include/bits/random.h
[ "BSD-3-Clause" ]
C
seed
void
void seed() { _M_b.seed(); _M_initialize(); }
/** * @brief Reseeds the %shuffle_order_engine object with the default seed for the underlying base class generator engine. */
@brief Reseeds the %shuffle_order_engine object with the default seed for the underlying base class generator engine.
[ "@brief", "Reseeds", "the", "%shuffle_order_engine", "object", "with", "the", "default", "seed", "for", "the", "underlying", "base", "class", "generator", "engine", "." ]
void seed() { _M_b.seed(); _M_initialize(); }
[ "void", "seed", "(", ")", "{", "_M_b", ".", "seed", "(", ")", ";", "_M_initialize", "(", ")", ";", "}" ]
@brief Reseeds the %shuffle_order_engine object with the default seed for the underlying base class generator engine.
[ "@brief", "Reseeds", "the", "%shuffle_order_engine", "object", "with", "the", "default", "seed", "for", "the", "underlying", "base", "class", "generator", "engine", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1e8caa023b37c3ed686bd6a4d28453c564007198
atrens/DragonFlyBSD-src
contrib/gcc-4.7/libstdc++-v3/include/bits/random.h
[ "BSD-3-Clause" ]
C
seed
void
void seed(result_type __s) { _M_b.seed(__s); _M_initialize(); }
/** * @brief Reseeds the %shuffle_order_engine object with the default seed * for the underlying base class generator engine. */
@brief Reseeds the %shuffle_order_engine object with the default seed for the underlying base class generator engine.
[ "@brief", "Reseeds", "the", "%shuffle_order_engine", "object", "with", "the", "default", "seed", "for", "the", "underlying", "base", "class", "generator", "engine", "." ]
void seed(result_type __s) { _M_b.seed(__s); _M_initialize(); }
[ "void", "seed", "(", "result_type", "__s", ")", "{", "_M_b", ".", "seed", "(", "__s", ")", ";", "_M_initialize", "(", ")", ";", "}" ]
@brief Reseeds the %shuffle_order_engine object with the default seed for the underlying base class generator engine.
[ "@brief", "Reseeds", "the", "%shuffle_order_engine", "object", "with", "the", "default", "seed", "for", "the", "underlying", "base", "class", "generator", "engine", "." ]
[]
[ { "param": "__s", "type": "result_type" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "__s", "type": "result_type", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e8caa023b37c3ed686bd6a4d28453c564007198
atrens/DragonFlyBSD-src
contrib/gcc-4.7/libstdc++-v3/include/bits/random.h
[ "BSD-3-Clause" ]
C
reset
void
void reset() { _M_gd_x.reset(); _M_gd_y.reset(); }
/** * @brief Resets the distribution state. */
@brief Resets the distribution state.
[ "@brief", "Resets", "the", "distribution", "state", "." ]
void reset() { _M_gd_x.reset(); _M_gd_y.reset(); }
[ "void", "reset", "(", ")", "{", "_M_gd_x", ".", "reset", "(", ")", ";", "_M_gd_y", ".", "reset", "(", ")", ";", "}" ]
@brief Resets the distribution state.
[ "@brief", "Resets", "the", "distribution", "state", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
1e8caa023b37c3ed686bd6a4d28453c564007198
atrens/DragonFlyBSD-src
contrib/gcc-4.7/libstdc++-v3/include/bits/random.h
[ "BSD-3-Clause" ]
C
reset
void
void reset() { _M_nd.reset(); _M_gd.reset(); }
/** * @brief Resets the distribution state. */
@brief Resets the distribution state.
[ "@brief", "Resets", "the", "distribution", "state", "." ]
void reset() { _M_nd.reset(); _M_gd.reset(); }
[ "void", "reset", "(", ")", "{", "_M_nd", ".", "reset", "(", ")", ";", "_M_gd", ".", "reset", "(", ")", ";", "}" ]
@brief Resets the distribution state.
[ "@brief", "Resets", "the", "distribution", "state", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6f603ffc895e5e474342cee1f329b46f1a019e2c
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-uncprop.c
[ "BSD-3-Clause" ]
C
equiv_hash
hashval_t
static hashval_t equiv_hash (const void *p) { tree const value = ((const struct equiv_hash_elt *)p)->value; return iterative_hash_expr (value, 0); }
/* Hashing and equality routines for the hash table. */
Hashing and equality routines for the hash table.
[ "Hashing", "and", "equality", "routines", "for", "the", "hash", "table", "." ]
static hashval_t equiv_hash (const void *p) { tree const value = ((const struct equiv_hash_elt *)p)->value; return iterative_hash_expr (value, 0); }
[ "static", "hashval_t", "equiv_hash", "(", "const", "void", "*", "p", ")", "{", "tree", "const", "value", "=", "(", "(", "const", "struct", "equiv_hash_elt", "*", ")", "p", ")", "->", "value", ";", "return", "iterative_hash_expr", "(", "value", ",", "0", ")", ";", "}" ]
Hashing and equality routines for the hash table.
[ "Hashing", "and", "equality", "routines", "for", "the", "hash", "table", "." ]
[]
[ { "param": "p", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f603ffc895e5e474342cee1f329b46f1a019e2c
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-uncprop.c
[ "BSD-3-Clause" ]
C
equiv_free
void
static void equiv_free (void *p) { struct equiv_hash_elt *elt = (struct equiv_hash_elt *) p; VEC_free (tree, heap, elt->equivalences); free (elt); }
/* Free an instance of equiv_hash_elt. */
Free an instance of equiv_hash_elt.
[ "Free", "an", "instance", "of", "equiv_hash_elt", "." ]
static void equiv_free (void *p) { struct equiv_hash_elt *elt = (struct equiv_hash_elt *) p; VEC_free (tree, heap, elt->equivalences); free (elt); }
[ "static", "void", "equiv_free", "(", "void", "*", "p", ")", "{", "struct", "equiv_hash_elt", "*", "elt", "=", "(", "struct", "equiv_hash_elt", "*", ")", "p", ";", "VEC_free", "(", "tree", ",", "heap", ",", "elt", "->", "equivalences", ")", ";", "free", "(", "elt", ")", ";", "}" ]
Free an instance of equiv_hash_elt.
[ "Free", "an", "instance", "of", "equiv_hash_elt", "." ]
[]
[ { "param": "p", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "p", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f603ffc895e5e474342cee1f329b46f1a019e2c
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-uncprop.c
[ "BSD-3-Clause" ]
C
remove_equivalence
void
static void remove_equivalence (tree value) { struct equiv_hash_elt equiv_hash_elt, *equiv_hash_elt_p; void **slot; equiv_hash_elt.value = value; equiv_hash_elt.equivalences = NULL; slot = htab_find_slot (equiv, &equiv_hash_elt, NO_INSERT); equiv_hash_elt_p = (struct equiv_hash_elt *) *slot; VEC_pop (tree, equiv_hash_elt_p->equivalences); }
/* Remove the most recently recorded equivalency for VALUE. */
Remove the most recently recorded equivalency for VALUE.
[ "Remove", "the", "most", "recently", "recorded", "equivalency", "for", "VALUE", "." ]
static void remove_equivalence (tree value) { struct equiv_hash_elt equiv_hash_elt, *equiv_hash_elt_p; void **slot; equiv_hash_elt.value = value; equiv_hash_elt.equivalences = NULL; slot = htab_find_slot (equiv, &equiv_hash_elt, NO_INSERT); equiv_hash_elt_p = (struct equiv_hash_elt *) *slot; VEC_pop (tree, equiv_hash_elt_p->equivalences); }
[ "static", "void", "remove_equivalence", "(", "tree", "value", ")", "{", "struct", "equiv_hash_elt", "equiv_hash_elt", ",", "*", "equiv_hash_elt_p", ";", "void", "*", "*", "slot", ";", "equiv_hash_elt", ".", "value", "=", "value", ";", "equiv_hash_elt", ".", "equivalences", "=", "NULL", ";", "slot", "=", "htab_find_slot", "(", "equiv", ",", "&", "equiv_hash_elt", ",", "NO_INSERT", ")", ";", "equiv_hash_elt_p", "=", "(", "struct", "equiv_hash_elt", "*", ")", "*", "slot", ";", "VEC_pop", "(", "tree", ",", "equiv_hash_elt_p", "->", "equivalences", ")", ";", "}" ]
Remove the most recently recorded equivalency for VALUE.
[ "Remove", "the", "most", "recently", "recorded", "equivalency", "for", "VALUE", "." ]
[]
[ { "param": "value", "type": "tree" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "value", "type": "tree", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f603ffc895e5e474342cee1f329b46f1a019e2c
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-uncprop.c
[ "BSD-3-Clause" ]
C
tree_ssa_uncprop
null
static unsigned int tree_ssa_uncprop (void) { struct dom_walk_data walk_data; basic_block bb; associate_equivalences_with_edges (); /* Create our global data structures. */ equiv = htab_create (1024, equiv_hash, equiv_eq, equiv_free); equiv_stack = VEC_alloc (tree, heap, 2); /* We're going to do a dominator walk, so ensure that we have dominance information. */ calculate_dominance_info (CDI_DOMINATORS); /* Setup callbacks for the generic dominator tree walker. */ walk_data.dom_direction = CDI_DOMINATORS; walk_data.initialize_block_local_data = NULL; walk_data.before_dom_children = uncprop_enter_block; walk_data.after_dom_children = uncprop_leave_block; walk_data.global_data = NULL; walk_data.block_local_data_size = 0; /* Now initialize the dominator walker. */ init_walk_dominator_tree (&walk_data); /* Recursively walk the dominator tree undoing unprofitable constant/copy propagations. */ walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR); /* Finalize and clean up. */ fini_walk_dominator_tree (&walk_data); /* EQUIV_STACK should already be empty at this point, so we just need to empty elements out of the hash table, free EQUIV_STACK, and cleanup the AUX field on the edges. */ htab_delete (equiv); VEC_free (tree, heap, equiv_stack); FOR_EACH_BB (bb) { edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->succs) { if (e->aux) { free (e->aux); e->aux = NULL; } } } return 0; }
/* Main driver for un-cprop. */
Main driver for un-cprop.
[ "Main", "driver", "for", "un", "-", "cprop", "." ]
static unsigned int tree_ssa_uncprop (void) { struct dom_walk_data walk_data; basic_block bb; associate_equivalences_with_edges (); equiv = htab_create (1024, equiv_hash, equiv_eq, equiv_free); equiv_stack = VEC_alloc (tree, heap, 2); calculate_dominance_info (CDI_DOMINATORS); walk_data.dom_direction = CDI_DOMINATORS; walk_data.initialize_block_local_data = NULL; walk_data.before_dom_children = uncprop_enter_block; walk_data.after_dom_children = uncprop_leave_block; walk_data.global_data = NULL; walk_data.block_local_data_size = 0; init_walk_dominator_tree (&walk_data); walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR); fini_walk_dominator_tree (&walk_data); htab_delete (equiv); VEC_free (tree, heap, equiv_stack); FOR_EACH_BB (bb) { edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->succs) { if (e->aux) { free (e->aux); e->aux = NULL; } } } return 0; }
[ "static", "unsigned", "int", "tree_ssa_uncprop", "(", "void", ")", "{", "struct", "dom_walk_data", "walk_data", ";", "basic_block", "bb", ";", "associate_equivalences_with_edges", "(", ")", ";", "equiv", "=", "htab_create", "(", "1024", ",", "equiv_hash", ",", "equiv_eq", ",", "equiv_free", ")", ";", "equiv_stack", "=", "VEC_alloc", "(", "tree", ",", "heap", ",", "2", ")", ";", "calculate_dominance_info", "(", "CDI_DOMINATORS", ")", ";", "walk_data", ".", "dom_direction", "=", "CDI_DOMINATORS", ";", "walk_data", ".", "initialize_block_local_data", "=", "NULL", ";", "walk_data", ".", "before_dom_children", "=", "uncprop_enter_block", ";", "walk_data", ".", "after_dom_children", "=", "uncprop_leave_block", ";", "walk_data", ".", "global_data", "=", "NULL", ";", "walk_data", ".", "block_local_data_size", "=", "0", ";", "init_walk_dominator_tree", "(", "&", "walk_data", ")", ";", "walk_dominator_tree", "(", "&", "walk_data", ",", "ENTRY_BLOCK_PTR", ")", ";", "fini_walk_dominator_tree", "(", "&", "walk_data", ")", ";", "htab_delete", "(", "equiv", ")", ";", "VEC_free", "(", "tree", ",", "heap", ",", "equiv_stack", ")", ";", "FOR_EACH_BB", "(", "bb", ")", "{", "edge", "e", ";", "edge_iterator", "ei", ";", "FOR_EACH_EDGE", "(", "e", ",", "ei", ",", "bb", "->", "succs", ")", "", "{", "if", "(", "e", "->", "aux", ")", "{", "free", "(", "e", "->", "aux", ")", ";", "e", "->", "aux", "=", "NULL", ";", "}", "}", "}", "return", "0", ";", "}" ]
Main driver for un-cprop.
[ "Main", "driver", "for", "un", "-", "cprop", "." ]
[ "/* Create our global data structures. */", "/* We're going to do a dominator walk, so ensure that we have\n dominance information. */", "/* Setup callbacks for the generic dominator tree walker. */", "/* Now initialize the dominator walker. */", "/* Recursively walk the dominator tree undoing unprofitable\n constant/copy propagations. */", "/* Finalize and clean up. */", "/* EQUIV_STACK should already be empty at this point, so we just\n need to empty elements out of the hash table, free EQUIV_STACK,\n and cleanup the AUX field on the edges. */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6f603ffc895e5e474342cee1f329b46f1a019e2c
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-uncprop.c
[ "BSD-3-Clause" ]
C
uncprop_into_successor_phis
void
static void uncprop_into_successor_phis (basic_block bb) { edge e; edge_iterator ei; /* For each successor edge, first temporarily record any equivalence on that edge. Then unpropagate values in any PHI nodes at the destination of the edge. Then remove the temporary equivalence. */ FOR_EACH_EDGE (e, ei, bb->succs) { gimple_seq phis = phi_nodes (e->dest); gimple_stmt_iterator gsi; /* If there are no PHI nodes in this destination, then there is no sense in recording any equivalences. */ if (gimple_seq_empty_p (phis)) continue; /* Record any equivalency associated with E. */ if (e->aux) { struct edge_equivalency *equiv = (struct edge_equivalency *) e->aux; record_equiv (equiv->rhs, equiv->lhs); } /* Walk over the PHI nodes, unpropagating values. */ for (gsi = gsi_start (phis) ; !gsi_end_p (gsi); gsi_next (&gsi)) { gimple phi = gsi_stmt (gsi); tree arg = PHI_ARG_DEF (phi, e->dest_idx); struct equiv_hash_elt equiv_hash_elt; void **slot; /* If the argument is not an invariant, or refers to the same underlying variable as the PHI result, then there's no point in un-propagating the argument. */ if (!is_gimple_min_invariant (arg) && SSA_NAME_VAR (arg) != SSA_NAME_VAR (PHI_RESULT (phi))) continue; /* Lookup this argument's value in the hash table. */ equiv_hash_elt.value = arg; equiv_hash_elt.equivalences = NULL; slot = htab_find_slot (equiv, &equiv_hash_elt, NO_INSERT); if (slot) { struct equiv_hash_elt *elt = (struct equiv_hash_elt *) *slot; int j; /* Walk every equivalence with the same value. If we find one with the same underlying variable as the PHI result, then replace the value in the argument with its equivalent SSA_NAME. Use the most recent equivalence as hopefully that results in shortest lifetimes. */ for (j = VEC_length (tree, elt->equivalences) - 1; j >= 0; j--) { tree equiv = VEC_index (tree, elt->equivalences, j); if (SSA_NAME_VAR (equiv) == SSA_NAME_VAR (PHI_RESULT (phi))) { SET_PHI_ARG_DEF (phi, e->dest_idx, equiv); break; } } } } /* If we had an equivalence associated with this edge, remove it. */ if (e->aux) { struct edge_equivalency *equiv = (struct edge_equivalency *) e->aux; remove_equivalence (equiv->rhs); } } }
/* Unpropagate values from PHI nodes in successor blocks of BB. */
Unpropagate values from PHI nodes in successor blocks of BB.
[ "Unpropagate", "values", "from", "PHI", "nodes", "in", "successor", "blocks", "of", "BB", "." ]
static void uncprop_into_successor_phis (basic_block bb) { edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->succs) { gimple_seq phis = phi_nodes (e->dest); gimple_stmt_iterator gsi; if (gimple_seq_empty_p (phis)) continue; if (e->aux) { struct edge_equivalency *equiv = (struct edge_equivalency *) e->aux; record_equiv (equiv->rhs, equiv->lhs); } for (gsi = gsi_start (phis) ; !gsi_end_p (gsi); gsi_next (&gsi)) { gimple phi = gsi_stmt (gsi); tree arg = PHI_ARG_DEF (phi, e->dest_idx); struct equiv_hash_elt equiv_hash_elt; void **slot; if (!is_gimple_min_invariant (arg) && SSA_NAME_VAR (arg) != SSA_NAME_VAR (PHI_RESULT (phi))) continue; equiv_hash_elt.value = arg; equiv_hash_elt.equivalences = NULL; slot = htab_find_slot (equiv, &equiv_hash_elt, NO_INSERT); if (slot) { struct equiv_hash_elt *elt = (struct equiv_hash_elt *) *slot; int j; for (j = VEC_length (tree, elt->equivalences) - 1; j >= 0; j--) { tree equiv = VEC_index (tree, elt->equivalences, j); if (SSA_NAME_VAR (equiv) == SSA_NAME_VAR (PHI_RESULT (phi))) { SET_PHI_ARG_DEF (phi, e->dest_idx, equiv); break; } } } } if (e->aux) { struct edge_equivalency *equiv = (struct edge_equivalency *) e->aux; remove_equivalence (equiv->rhs); } } }
[ "static", "void", "uncprop_into_successor_phis", "(", "basic_block", "bb", ")", "{", "edge", "e", ";", "edge_iterator", "ei", ";", "FOR_EACH_EDGE", "(", "e", ",", "ei", ",", "bb", "->", "succs", ")", "", "{", "gimple_seq", "phis", "=", "phi_nodes", "(", "e", "->", "dest", ")", ";", "gimple_stmt_iterator", "gsi", ";", "if", "(", "gimple_seq_empty_p", "(", "phis", ")", ")", "continue", ";", "if", "(", "e", "->", "aux", ")", "{", "struct", "edge_equivalency", "*", "equiv", "=", "(", "struct", "edge_equivalency", "*", ")", "e", "->", "aux", ";", "record_equiv", "(", "equiv", "->", "rhs", ",", "equiv", "->", "lhs", ")", ";", "}", "for", "(", "gsi", "=", "gsi_start", "(", "phis", ")", ";", "!", "gsi_end_p", "(", "gsi", ")", ";", "gsi_next", "(", "&", "gsi", ")", ")", "{", "gimple", "phi", "=", "gsi_stmt", "(", "gsi", ")", ";", "tree", "arg", "=", "PHI_ARG_DEF", "(", "phi", ",", "e", "->", "dest_idx", ")", ";", "struct", "equiv_hash_elt", "equiv_hash_elt", ";", "void", "*", "*", "slot", ";", "if", "(", "!", "is_gimple_min_invariant", "(", "arg", ")", "&&", "SSA_NAME_VAR", "(", "arg", ")", "!=", "SSA_NAME_VAR", "(", "PHI_RESULT", "(", "phi", ")", ")", ")", "continue", ";", "equiv_hash_elt", ".", "value", "=", "arg", ";", "equiv_hash_elt", ".", "equivalences", "=", "NULL", ";", "slot", "=", "htab_find_slot", "(", "equiv", ",", "&", "equiv_hash_elt", ",", "NO_INSERT", ")", ";", "if", "(", "slot", ")", "{", "struct", "equiv_hash_elt", "*", "elt", "=", "(", "struct", "equiv_hash_elt", "*", ")", "*", "slot", ";", "int", "j", ";", "for", "(", "j", "=", "VEC_length", "(", "tree", ",", "elt", "->", "equivalences", ")", "-", "1", ";", "j", ">=", "0", ";", "j", "--", ")", "{", "tree", "equiv", "=", "VEC_index", "(", "tree", ",", "elt", "->", "equivalences", ",", "j", ")", ";", "if", "(", "SSA_NAME_VAR", "(", "equiv", ")", "==", "SSA_NAME_VAR", "(", "PHI_RESULT", "(", "phi", ")", ")", ")", "{", "SET_PHI_ARG_DEF", "(", "phi", ",", "e", "->", "dest_idx", ",", "equiv", ")", ";", "break", ";", "}", "}", "}", "}", "if", "(", "e", "->", "aux", ")", "{", "struct", "edge_equivalency", "*", "equiv", "=", "(", "struct", "edge_equivalency", "*", ")", "e", "->", "aux", ";", "remove_equivalence", "(", "equiv", "->", "rhs", ")", ";", "}", "}", "}" ]
Unpropagate values from PHI nodes in successor blocks of BB.
[ "Unpropagate", "values", "from", "PHI", "nodes", "in", "successor", "blocks", "of", "BB", "." ]
[ "/* For each successor edge, first temporarily record any equivalence\n on that edge. Then unpropagate values in any PHI nodes at the\n destination of the edge. Then remove the temporary equivalence. */", "/* If there are no PHI nodes in this destination, then there is\n\t no sense in recording any equivalences. */", "/* Record any equivalency associated with E. */", "/* Walk over the PHI nodes, unpropagating values. */", "/* If the argument is not an invariant, or refers to the same\n\t underlying variable as the PHI result, then there's no\n\t point in un-propagating the argument. */", "/* Lookup this argument's value in the hash table. */", "/* Walk every equivalence with the same value. If we find\n\t\t one with the same underlying variable as the PHI result,\n\t\t then replace the value in the argument with its equivalent\n\t\t SSA_NAME. Use the most recent equivalence as hopefully\n\t\t that results in shortest lifetimes. */", "/* If we had an equivalence associated with this edge, remove it. */" ]
[ { "param": "bb", "type": "basic_block" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bb", "type": "basic_block", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6f603ffc895e5e474342cee1f329b46f1a019e2c
atrens/DragonFlyBSD-src
contrib/gcc-4.7/gcc/tree-ssa-uncprop.c
[ "BSD-3-Clause" ]
C
single_incoming_edge_ignoring_loop_edges
edge
static edge single_incoming_edge_ignoring_loop_edges (basic_block bb) { edge retval = NULL; edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->preds) { /* A loop back edge can be identified by the destination of the edge dominating the source of the edge. */ if (dominated_by_p (CDI_DOMINATORS, e->src, e->dest)) continue; /* If we have already seen a non-loop edge, then we must have multiple incoming non-loop edges and thus we return NULL. */ if (retval) return NULL; /* This is the first non-loop incoming edge we have found. Record it. */ retval = e; } return retval; }
/* Ignoring loop backedges, if BB has precisely one incoming edge then return that edge. Otherwise return NULL. */
Ignoring loop backedges, if BB has precisely one incoming edge then return that edge. Otherwise return NULL.
[ "Ignoring", "loop", "backedges", "if", "BB", "has", "precisely", "one", "incoming", "edge", "then", "return", "that", "edge", ".", "Otherwise", "return", "NULL", "." ]
static edge single_incoming_edge_ignoring_loop_edges (basic_block bb) { edge retval = NULL; edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->preds) { if (dominated_by_p (CDI_DOMINATORS, e->src, e->dest)) continue; if (retval) return NULL; retval = e; } return retval; }
[ "static", "edge", "single_incoming_edge_ignoring_loop_edges", "(", "basic_block", "bb", ")", "{", "edge", "retval", "=", "NULL", ";", "edge", "e", ";", "edge_iterator", "ei", ";", "FOR_EACH_EDGE", "(", "e", ",", "ei", ",", "bb", "->", "preds", ")", "", "{", "if", "(", "dominated_by_p", "(", "CDI_DOMINATORS", ",", "e", "->", "src", ",", "e", "->", "dest", ")", ")", "continue", ";", "if", "(", "retval", ")", "return", "NULL", ";", "retval", "=", "e", ";", "}", "return", "retval", ";", "}" ]
Ignoring loop backedges, if BB has precisely one incoming edge then return that edge.
[ "Ignoring", "loop", "backedges", "if", "BB", "has", "precisely", "one", "incoming", "edge", "then", "return", "that", "edge", "." ]
[ "/* A loop back edge can be identified by the destination of\n\t the edge dominating the source of the edge. */", "/* If we have already seen a non-loop edge, then we must have\n\t multiple incoming non-loop edges and thus we return NULL. */", "/* This is the first non-loop incoming edge we have found. Record\n\t it. */" ]
[ { "param": "bb", "type": "basic_block" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bb", "type": "basic_block", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71fe7510ac42dd2321ea323e7dc738cb77e91a9
atrens/DragonFlyBSD-src
sys/netgraph/ng_device.c
[ "BSD-3-Clause" ]
C
ng_device_cons
int
static int ng_device_cons(node_p node) { #ifdef NGD_DEBUG kprintf("%s()\n", __func__); #endif /* NGD_DEBUG */ return(EINVAL); }
/* * don't allow to be created, only the device can do that */
don't allow to be created, only the device can do that
[ "don", "'", "t", "allow", "to", "be", "created", "only", "the", "device", "can", "do", "that" ]
static int ng_device_cons(node_p node) { #ifdef NGD_DEBUG kprintf("%s()\n", __func__); #endif return(EINVAL); }
[ "static", "int", "ng_device_cons", "(", "node_p", "node", ")", "{", "#ifdef", "NGD_DEBUG", "kprintf", "(", "\"", "\\n", "\"", ",", "__func__", ")", ";", "#endif", "return", "(", "EINVAL", ")", ";", "}" ]
don't allow to be created, only the device can do that
[ "don", "'", "t", "allow", "to", "be", "created", "only", "the", "device", "can", "do", "that" ]
[ "/* NGD_DEBUG */" ]
[ { "param": "node", "type": "node_p" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "node", "type": "node_p", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71fe7510ac42dd2321ea323e7dc738cb77e91a9
atrens/DragonFlyBSD-src
sys/netgraph/ng_device.c
[ "BSD-3-Clause" ]
C
ng_device_rcvmsg
int
static int ng_device_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mesg **rptr) { kfree(msg, M_NETGRAPH); return(ENOTTY); }
/* * Receive control message. We just free it. */
Receive control message. We just free it.
[ "Receive", "control", "message", ".", "We", "just", "free", "it", "." ]
static int ng_device_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr, struct ng_mesg **rptr) { kfree(msg, M_NETGRAPH); return(ENOTTY); }
[ "static", "int", "ng_device_rcvmsg", "(", "node_p", "node", ",", "struct", "ng_mesg", "*", "msg", ",", "const", "char", "*", "retaddr", ",", "struct", "ng_mesg", "*", "*", "rptr", ")", "{", "kfree", "(", "msg", ",", "M_NETGRAPH", ")", ";", "return", "(", "ENOTTY", ")", ";", "}" ]
Receive control message.
[ "Receive", "control", "message", "." ]
[]
[ { "param": "node", "type": "node_p" }, { "param": "msg", "type": "struct ng_mesg" }, { "param": "retaddr", "type": "char" }, { "param": "rptr", "type": "struct ng_mesg" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "node", "type": "node_p", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "msg", "type": "struct ng_mesg", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "retaddr", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rptr", "type": "struct ng_mesg", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a71fe7510ac42dd2321ea323e7dc738cb77e91a9
atrens/DragonFlyBSD-src
sys/netgraph/ng_device.c
[ "BSD-3-Clause" ]
C
ng_device_connect
int
static int ng_device_connect(hook_p hook) { #ifdef NGD_DEBUG kprintf("%s()\n", __func__); #endif /* NGD_DEBUG */ return(0); }
/* * we gave ok to a new hook * now connect */
we gave ok to a new hook now connect
[ "we", "gave", "ok", "to", "a", "new", "hook", "now", "connect" ]
static int ng_device_connect(hook_p hook) { #ifdef NGD_DEBUG kprintf("%s()\n", __func__); #endif return(0); }
[ "static", "int", "ng_device_connect", "(", "hook_p", "hook", ")", "{", "#ifdef", "NGD_DEBUG", "kprintf", "(", "\"", "\\n", "\"", ",", "__func__", ")", ";", "#endif", "return", "(", "0", ")", ";", "}" ]
we gave ok to a new hook now connect
[ "we", "gave", "ok", "to", "a", "new", "hook", "now", "connect" ]
[ "/* NGD_DEBUG */" ]
[ { "param": "hook", "type": "hook_p" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "hook", "type": "hook_p", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }