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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_deferring_overflow_warnings_p | bool | bool
fold_deferring_overflow_warnings_p (void)
{
return fold_deferring_overflow_warnings > 0;
} | /* Whether we are deferring overflow warnings. */ | Whether we are deferring overflow warnings. | [
"Whether",
"we",
"are",
"deferring",
"overflow",
"warnings",
"."
] | bool
fold_deferring_overflow_warnings_p (void)
{
return fold_deferring_overflow_warnings > 0;
} | [
"bool",
"fold_deferring_overflow_warnings_p",
"(",
"void",
")",
"{",
"return",
"fold_deferring_overflow_warnings",
">",
"0",
";",
"}"
] | Whether we are deferring overflow warnings. | [
"Whether",
"we",
"are",
"deferring",
"overflow",
"warnings",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_overflow_warning | void | void
fold_overflow_warning (const char* gmsgid, enum warn_strict_overflow_code wc)
{
if (fold_deferring_overflow_warnings > 0)
{
if (fold_deferred_overflow_warning == NULL
|| wc < fold_deferred_overflow_code)
{
fold_deferred_overflow_warning = gmsgid;
fold_deferred_overflow_code = wc;
}
}
else if (issue_strict_overflow_warning (wc))
warning (OPT_Wstrict_overflow, gmsgid);
} | /* This is called when we fold something based on the fact that signed
overflow is undefined. */ | This is called when we fold something based on the fact that signed
overflow is undefined. | [
"This",
"is",
"called",
"when",
"we",
"fold",
"something",
"based",
"on",
"the",
"fact",
"that",
"signed",
"overflow",
"is",
"undefined",
"."
] | void
fold_overflow_warning (const char* gmsgid, enum warn_strict_overflow_code wc)
{
if (fold_deferring_overflow_warnings > 0)
{
if (fold_deferred_overflow_warning == NULL
|| wc < fold_deferred_overflow_code)
{
fold_deferred_overflow_warning = gmsgid;
fold_deferred_overflow_code = wc;
}
}
else if (issue_strict_overflow_warning (wc))
warning (OPT_Wstrict_overflow, gmsgid);
} | [
"void",
"fold_overflow_warning",
"(",
"const",
"char",
"*",
"gmsgid",
",",
"enum",
"warn_strict_overflow_code",
"wc",
")",
"{",
"if",
"(",
"fold_deferring_overflow_warnings",
">",
"0",
")",
"{",
"if",
"(",
"fold_deferred_overflow_warning",
"==",
"NULL",
"||",
"wc",
"<",
"fold_deferred_overflow_code",
")",
"{",
"fold_deferred_overflow_warning",
"=",
"gmsgid",
";",
"fold_deferred_overflow_code",
"=",
"wc",
";",
"}",
"}",
"else",
"if",
"(",
"issue_strict_overflow_warning",
"(",
"wc",
")",
")",
"warning",
"(",
"OPT_Wstrict_overflow",
",",
"gmsgid",
")",
";",
"}"
] | This is called when we fold something based on the fact that signed
overflow is undefined. | [
"This",
"is",
"called",
"when",
"we",
"fold",
"something",
"based",
"on",
"the",
"fact",
"that",
"signed",
"overflow",
"is",
"undefined",
"."
] | [] | [
{
"param": "gmsgid",
"type": "char"
},
{
"param": "wc",
"type": "enum warn_strict_overflow_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gmsgid",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wc",
"type": "enum warn_strict_overflow_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | negate_mathfn_p | bool | bool
negate_mathfn_p (combined_fn fn)
{
switch (fn)
{
CASE_CFN_ASIN:
CASE_CFN_ASINH:
CASE_CFN_ATAN:
CASE_CFN_ATANH:
CASE_CFN_CASIN:
CASE_CFN_CASINH:
CASE_CFN_CATAN:
CASE_CFN_CATANH:
CASE_CFN_CBRT:
CASE_CFN_CPROJ:
CASE_CFN_CSIN:
CASE_CFN_CSINH:
CASE_CFN_CTAN:
CASE_CFN_CTANH:
CASE_CFN_ERF:
CASE_CFN_LLROUND:
CASE_CFN_LROUND:
CASE_CFN_ROUND:
CASE_CFN_SIN:
CASE_CFN_SINH:
CASE_CFN_TAN:
CASE_CFN_TANH:
CASE_CFN_TRUNC:
return true;
CASE_CFN_LLRINT:
CASE_CFN_LRINT:
CASE_CFN_NEARBYINT:
CASE_CFN_RINT:
return !flag_rounding_math;
default:
break;
}
return false;
} | /* Return true if the built-in mathematical function specified by CODE
is odd, i.e. -f(x) == f(-x). */ | Return true if the built-in mathematical function specified by CODE
is odd, i.e. | [
"Return",
"true",
"if",
"the",
"built",
"-",
"in",
"mathematical",
"function",
"specified",
"by",
"CODE",
"is",
"odd",
"i",
".",
"e",
"."
] | bool
negate_mathfn_p (combined_fn fn)
{
switch (fn)
{
CASE_CFN_ASIN:
CASE_CFN_ASINH:
CASE_CFN_ATAN:
CASE_CFN_ATANH:
CASE_CFN_CASIN:
CASE_CFN_CASINH:
CASE_CFN_CATAN:
CASE_CFN_CATANH:
CASE_CFN_CBRT:
CASE_CFN_CPROJ:
CASE_CFN_CSIN:
CASE_CFN_CSINH:
CASE_CFN_CTAN:
CASE_CFN_CTANH:
CASE_CFN_ERF:
CASE_CFN_LLROUND:
CASE_CFN_LROUND:
CASE_CFN_ROUND:
CASE_CFN_SIN:
CASE_CFN_SINH:
CASE_CFN_TAN:
CASE_CFN_TANH:
CASE_CFN_TRUNC:
return true;
CASE_CFN_LLRINT:
CASE_CFN_LRINT:
CASE_CFN_NEARBYINT:
CASE_CFN_RINT:
return !flag_rounding_math;
default:
break;
}
return false;
} | [
"bool",
"negate_mathfn_p",
"(",
"combined_fn",
"fn",
")",
"{",
"switch",
"(",
"fn",
")",
"{",
"CASE_CFN_ASIN",
":",
"CASE_CFN_ASINH",
":",
"CASE_CFN_ATAN",
":",
"CASE_CFN_ATANH",
":",
"CASE_CFN_CASIN",
":",
"CASE_CFN_CASINH",
":",
"CASE_CFN_CATAN",
":",
"CASE_CFN_CATANH",
":",
"CASE_CFN_CBRT",
":",
"CASE_CFN_CPROJ",
":",
"CASE_CFN_CSIN",
":",
"CASE_CFN_CSINH",
":",
"CASE_CFN_CTAN",
":",
"CASE_CFN_CTANH",
":",
"CASE_CFN_ERF",
":",
"CASE_CFN_LLROUND",
":",
"CASE_CFN_LROUND",
":",
"CASE_CFN_ROUND",
":",
"CASE_CFN_SIN",
":",
"CASE_CFN_SINH",
":",
"CASE_CFN_TAN",
":",
"CASE_CFN_TANH",
":",
"CASE_CFN_TRUNC",
":",
"return",
"true",
";",
"CASE_CFN_LLRINT",
":",
"CASE_CFN_LRINT",
":",
"CASE_CFN_NEARBYINT",
":",
"CASE_CFN_RINT",
":",
"return",
"!",
"flag_rounding_math",
";",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] | Return true if the built-in mathematical function specified by CODE
is odd, i.e. | [
"Return",
"true",
"if",
"the",
"built",
"-",
"in",
"mathematical",
"function",
"specified",
"by",
"CODE",
"is",
"odd",
"i",
".",
"e",
"."
] | [] | [
{
"param": "fn",
"type": "combined_fn"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fn",
"type": "combined_fn",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | negate_expr | tree | static tree
negate_expr (tree t)
{
tree type, tem;
location_t loc;
if (t == NULL_TREE)
return NULL_TREE;
loc = EXPR_LOCATION (t);
type = TREE_TYPE (t);
STRIP_SIGN_NOPS (t);
tem = fold_negate_expr (loc, t);
if (!tem)
tem = build1_loc (loc, NEGATE_EXPR, TREE_TYPE (t), t);
return fold_convert_loc (loc, type, tem);
} | /* Like fold_negate_expr, but return a NEGATE_EXPR tree, if T can not be
negated in a simpler way. Also allow for T to be NULL_TREE, in which case
return NULL_TREE. */ | Like fold_negate_expr, but return a NEGATE_EXPR tree, if T can not be
negated in a simpler way. Also allow for T to be NULL_TREE, in which case
return NULL_TREE. | [
"Like",
"fold_negate_expr",
"but",
"return",
"a",
"NEGATE_EXPR",
"tree",
"if",
"T",
"can",
"not",
"be",
"negated",
"in",
"a",
"simpler",
"way",
".",
"Also",
"allow",
"for",
"T",
"to",
"be",
"NULL_TREE",
"in",
"which",
"case",
"return",
"NULL_TREE",
"."
] | static tree
negate_expr (tree t)
{
tree type, tem;
location_t loc;
if (t == NULL_TREE)
return NULL_TREE;
loc = EXPR_LOCATION (t);
type = TREE_TYPE (t);
STRIP_SIGN_NOPS (t);
tem = fold_negate_expr (loc, t);
if (!tem)
tem = build1_loc (loc, NEGATE_EXPR, TREE_TYPE (t), t);
return fold_convert_loc (loc, type, tem);
} | [
"static",
"tree",
"negate_expr",
"(",
"tree",
"t",
")",
"{",
"tree",
"type",
",",
"tem",
";",
"location_t",
"loc",
";",
"if",
"(",
"t",
"==",
"NULL_TREE",
")",
"return",
"NULL_TREE",
";",
"loc",
"=",
"EXPR_LOCATION",
"(",
"t",
")",
";",
"type",
"=",
"TREE_TYPE",
"(",
"t",
")",
";",
"STRIP_SIGN_NOPS",
"(",
"t",
")",
";",
"tem",
"=",
"fold_negate_expr",
"(",
"loc",
",",
"t",
")",
";",
"if",
"(",
"!",
"tem",
")",
"tem",
"=",
"build1_loc",
"(",
"loc",
",",
"NEGATE_EXPR",
",",
"TREE_TYPE",
"(",
"t",
")",
",",
"t",
")",
";",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"tem",
")",
";",
"}"
] | Like fold_negate_expr, but return a NEGATE_EXPR tree, if T can not be
negated in a simpler way. | [
"Like",
"fold_negate_expr",
"but",
"return",
"a",
"NEGATE_EXPR",
"tree",
"if",
"T",
"can",
"not",
"be",
"negated",
"in",
"a",
"simpler",
"way",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | split_tree | tree | static tree
split_tree (tree in, tree type, enum tree_code code,
tree *minus_varp, tree *conp, tree *minus_conp,
tree *litp, tree *minus_litp, int negate_p)
{
tree var = 0;
*minus_varp = 0;
*conp = 0;
*minus_conp = 0;
*litp = 0;
*minus_litp = 0;
/* Strip any conversions that don't change the machine mode or signedness. */
STRIP_SIGN_NOPS (in);
if (TREE_CODE (in) == INTEGER_CST || TREE_CODE (in) == REAL_CST
|| TREE_CODE (in) == FIXED_CST)
*litp = in;
else if (TREE_CODE (in) == code
|| ((! FLOAT_TYPE_P (TREE_TYPE (in)) || flag_associative_math)
&& ! SAT_FIXED_POINT_TYPE_P (TREE_TYPE (in))
/* We can associate addition and subtraction together (even
though the C standard doesn't say so) for integers because
the value is not affected. For reals, the value might be
affected, so we can't. */
&& ((code == PLUS_EXPR && TREE_CODE (in) == POINTER_PLUS_EXPR)
|| (code == PLUS_EXPR && TREE_CODE (in) == MINUS_EXPR)
|| (code == MINUS_EXPR
&& (TREE_CODE (in) == PLUS_EXPR
|| TREE_CODE (in) == POINTER_PLUS_EXPR)))))
{
tree op0 = TREE_OPERAND (in, 0);
tree op1 = TREE_OPERAND (in, 1);
int neg1_p = TREE_CODE (in) == MINUS_EXPR;
int neg_litp_p = 0, neg_conp_p = 0, neg_var_p = 0;
/* First see if either of the operands is a literal, then a constant. */
if (TREE_CODE (op0) == INTEGER_CST || TREE_CODE (op0) == REAL_CST
|| TREE_CODE (op0) == FIXED_CST)
*litp = op0, op0 = 0;
else if (TREE_CODE (op1) == INTEGER_CST || TREE_CODE (op1) == REAL_CST
|| TREE_CODE (op1) == FIXED_CST)
*litp = op1, neg_litp_p = neg1_p, op1 = 0;
if (op0 != 0 && TREE_CONSTANT (op0))
*conp = op0, op0 = 0;
else if (op1 != 0 && TREE_CONSTANT (op1))
*conp = op1, neg_conp_p = neg1_p, op1 = 0;
/* If we haven't dealt with either operand, this is not a case we can
decompose. Otherwise, VAR is either of the ones remaining, if any. */
if (op0 != 0 && op1 != 0)
var = in;
else if (op0 != 0)
var = op0;
else
var = op1, neg_var_p = neg1_p;
/* Now do any needed negations. */
if (neg_litp_p)
*minus_litp = *litp, *litp = 0;
if (neg_conp_p && *conp)
*minus_conp = *conp, *conp = 0;
if (neg_var_p && var)
*minus_varp = var, var = 0;
}
else if (TREE_CONSTANT (in))
*conp = in;
else if (TREE_CODE (in) == BIT_NOT_EXPR
&& code == PLUS_EXPR)
{
/* -1 - X is folded to ~X, undo that here. Do _not_ do this
when IN is constant. */
*litp = build_minus_one_cst (type);
*minus_varp = TREE_OPERAND (in, 0);
}
else
var = in;
if (negate_p)
{
if (*litp)
*minus_litp = *litp, *litp = 0;
else if (*minus_litp)
*litp = *minus_litp, *minus_litp = 0;
if (*conp)
*minus_conp = *conp, *conp = 0;
else if (*minus_conp)
*conp = *minus_conp, *minus_conp = 0;
if (var)
*minus_varp = var, var = 0;
else if (*minus_varp)
var = *minus_varp, *minus_varp = 0;
}
if (*litp
&& TREE_OVERFLOW_P (*litp))
*litp = drop_tree_overflow (*litp);
if (*minus_litp
&& TREE_OVERFLOW_P (*minus_litp))
*minus_litp = drop_tree_overflow (*minus_litp);
return var;
} | /* Split a tree IN into a constant, literal and variable parts that could be
combined with CODE to make IN. "constant" means an expression with
TREE_CONSTANT but that isn't an actual constant. CODE must be a
commutative arithmetic operation. Store the constant part into *CONP,
the literal in *LITP and return the variable part. If a part isn't
present, set it to null. If the tree does not decompose in this way,
return the entire tree as the variable part and the other parts as null.
If CODE is PLUS_EXPR we also split trees that use MINUS_EXPR. In that
case, we negate an operand that was subtracted. Except if it is a
literal for which we use *MINUS_LITP instead.
If NEGATE_P is true, we are negating all of IN, again except a literal
for which we use *MINUS_LITP instead. If a variable part is of pointer
type, it is negated after converting to TYPE. This prevents us from
generating illegal MINUS pointer expression. LOC is the location of
the converted variable part.
If IN is itself a literal or constant, return it as appropriate.
Note that we do not guarantee that any of the three values will be the
same type as IN, but they will have the same signedness and mode. */ | Split a tree IN into a constant, literal and variable parts that could be
combined with CODE to make IN. "constant" means an expression with
TREE_CONSTANT but that isn't an actual constant. CODE must be a
commutative arithmetic operation. Store the constant part into *CONP,
the literal in *LITP and return the variable part. If a part isn't
present, set it to null. If the tree does not decompose in this way,
return the entire tree as the variable part and the other parts as null.
If CODE is PLUS_EXPR we also split trees that use MINUS_EXPR. In that
case, we negate an operand that was subtracted. Except if it is a
literal for which we use *MINUS_LITP instead.
If NEGATE_P is true, we are negating all of IN, again except a literal
for which we use *MINUS_LITP instead. If a variable part is of pointer
type, it is negated after converting to TYPE. This prevents us from
generating illegal MINUS pointer expression. LOC is the location of
the converted variable part.
If IN is itself a literal or constant, return it as appropriate.
Note that we do not guarantee that any of the three values will be the
same type as IN, but they will have the same signedness and mode. | [
"Split",
"a",
"tree",
"IN",
"into",
"a",
"constant",
"literal",
"and",
"variable",
"parts",
"that",
"could",
"be",
"combined",
"with",
"CODE",
"to",
"make",
"IN",
".",
"\"",
"constant",
"\"",
"means",
"an",
"expression",
"with",
"TREE_CONSTANT",
"but",
"that",
"isn",
"'",
"t",
"an",
"actual",
"constant",
".",
"CODE",
"must",
"be",
"a",
"commutative",
"arithmetic",
"operation",
".",
"Store",
"the",
"constant",
"part",
"into",
"*",
"CONP",
"the",
"literal",
"in",
"*",
"LITP",
"and",
"return",
"the",
"variable",
"part",
".",
"If",
"a",
"part",
"isn",
"'",
"t",
"present",
"set",
"it",
"to",
"null",
".",
"If",
"the",
"tree",
"does",
"not",
"decompose",
"in",
"this",
"way",
"return",
"the",
"entire",
"tree",
"as",
"the",
"variable",
"part",
"and",
"the",
"other",
"parts",
"as",
"null",
".",
"If",
"CODE",
"is",
"PLUS_EXPR",
"we",
"also",
"split",
"trees",
"that",
"use",
"MINUS_EXPR",
".",
"In",
"that",
"case",
"we",
"negate",
"an",
"operand",
"that",
"was",
"subtracted",
".",
"Except",
"if",
"it",
"is",
"a",
"literal",
"for",
"which",
"we",
"use",
"*",
"MINUS_LITP",
"instead",
".",
"If",
"NEGATE_P",
"is",
"true",
"we",
"are",
"negating",
"all",
"of",
"IN",
"again",
"except",
"a",
"literal",
"for",
"which",
"we",
"use",
"*",
"MINUS_LITP",
"instead",
".",
"If",
"a",
"variable",
"part",
"is",
"of",
"pointer",
"type",
"it",
"is",
"negated",
"after",
"converting",
"to",
"TYPE",
".",
"This",
"prevents",
"us",
"from",
"generating",
"illegal",
"MINUS",
"pointer",
"expression",
".",
"LOC",
"is",
"the",
"location",
"of",
"the",
"converted",
"variable",
"part",
".",
"If",
"IN",
"is",
"itself",
"a",
"literal",
"or",
"constant",
"return",
"it",
"as",
"appropriate",
".",
"Note",
"that",
"we",
"do",
"not",
"guarantee",
"that",
"any",
"of",
"the",
"three",
"values",
"will",
"be",
"the",
"same",
"type",
"as",
"IN",
"but",
"they",
"will",
"have",
"the",
"same",
"signedness",
"and",
"mode",
"."
] | static tree
split_tree (tree in, tree type, enum tree_code code,
tree *minus_varp, tree *conp, tree *minus_conp,
tree *litp, tree *minus_litp, int negate_p)
{
tree var = 0;
*minus_varp = 0;
*conp = 0;
*minus_conp = 0;
*litp = 0;
*minus_litp = 0;
STRIP_SIGN_NOPS (in);
if (TREE_CODE (in) == INTEGER_CST || TREE_CODE (in) == REAL_CST
|| TREE_CODE (in) == FIXED_CST)
*litp = in;
else if (TREE_CODE (in) == code
|| ((! FLOAT_TYPE_P (TREE_TYPE (in)) || flag_associative_math)
&& ! SAT_FIXED_POINT_TYPE_P (TREE_TYPE (in))
&& ((code == PLUS_EXPR && TREE_CODE (in) == POINTER_PLUS_EXPR)
|| (code == PLUS_EXPR && TREE_CODE (in) == MINUS_EXPR)
|| (code == MINUS_EXPR
&& (TREE_CODE (in) == PLUS_EXPR
|| TREE_CODE (in) == POINTER_PLUS_EXPR)))))
{
tree op0 = TREE_OPERAND (in, 0);
tree op1 = TREE_OPERAND (in, 1);
int neg1_p = TREE_CODE (in) == MINUS_EXPR;
int neg_litp_p = 0, neg_conp_p = 0, neg_var_p = 0;
if (TREE_CODE (op0) == INTEGER_CST || TREE_CODE (op0) == REAL_CST
|| TREE_CODE (op0) == FIXED_CST)
*litp = op0, op0 = 0;
else if (TREE_CODE (op1) == INTEGER_CST || TREE_CODE (op1) == REAL_CST
|| TREE_CODE (op1) == FIXED_CST)
*litp = op1, neg_litp_p = neg1_p, op1 = 0;
if (op0 != 0 && TREE_CONSTANT (op0))
*conp = op0, op0 = 0;
else if (op1 != 0 && TREE_CONSTANT (op1))
*conp = op1, neg_conp_p = neg1_p, op1 = 0;
if (op0 != 0 && op1 != 0)
var = in;
else if (op0 != 0)
var = op0;
else
var = op1, neg_var_p = neg1_p;
if (neg_litp_p)
*minus_litp = *litp, *litp = 0;
if (neg_conp_p && *conp)
*minus_conp = *conp, *conp = 0;
if (neg_var_p && var)
*minus_varp = var, var = 0;
}
else if (TREE_CONSTANT (in))
*conp = in;
else if (TREE_CODE (in) == BIT_NOT_EXPR
&& code == PLUS_EXPR)
{
*litp = build_minus_one_cst (type);
*minus_varp = TREE_OPERAND (in, 0);
}
else
var = in;
if (negate_p)
{
if (*litp)
*minus_litp = *litp, *litp = 0;
else if (*minus_litp)
*litp = *minus_litp, *minus_litp = 0;
if (*conp)
*minus_conp = *conp, *conp = 0;
else if (*minus_conp)
*conp = *minus_conp, *minus_conp = 0;
if (var)
*minus_varp = var, var = 0;
else if (*minus_varp)
var = *minus_varp, *minus_varp = 0;
}
if (*litp
&& TREE_OVERFLOW_P (*litp))
*litp = drop_tree_overflow (*litp);
if (*minus_litp
&& TREE_OVERFLOW_P (*minus_litp))
*minus_litp = drop_tree_overflow (*minus_litp);
return var;
} | [
"static",
"tree",
"split_tree",
"(",
"tree",
"in",
",",
"tree",
"type",
",",
"enum",
"tree_code",
"code",
",",
"tree",
"*",
"minus_varp",
",",
"tree",
"*",
"conp",
",",
"tree",
"*",
"minus_conp",
",",
"tree",
"*",
"litp",
",",
"tree",
"*",
"minus_litp",
",",
"int",
"negate_p",
")",
"{",
"tree",
"var",
"=",
"0",
";",
"*",
"minus_varp",
"=",
"0",
";",
"*",
"conp",
"=",
"0",
";",
"*",
"minus_conp",
"=",
"0",
";",
"*",
"litp",
"=",
"0",
";",
"*",
"minus_litp",
"=",
"0",
";",
"STRIP_SIGN_NOPS",
"(",
"in",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"in",
")",
"==",
"INTEGER_CST",
"||",
"TREE_CODE",
"(",
"in",
")",
"==",
"REAL_CST",
"||",
"TREE_CODE",
"(",
"in",
")",
"==",
"FIXED_CST",
")",
"*",
"litp",
"=",
"in",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"in",
")",
"==",
"code",
"||",
"(",
"(",
"!",
"FLOAT_TYPE_P",
"(",
"TREE_TYPE",
"(",
"in",
")",
")",
"||",
"flag_associative_math",
")",
"&&",
"!",
"SAT_FIXED_POINT_TYPE_P",
"(",
"TREE_TYPE",
"(",
"in",
")",
")",
"&&",
"(",
"(",
"code",
"==",
"PLUS_EXPR",
"&&",
"TREE_CODE",
"(",
"in",
")",
"==",
"POINTER_PLUS_EXPR",
")",
"||",
"(",
"code",
"==",
"PLUS_EXPR",
"&&",
"TREE_CODE",
"(",
"in",
")",
"==",
"MINUS_EXPR",
")",
"||",
"(",
"code",
"==",
"MINUS_EXPR",
"&&",
"(",
"TREE_CODE",
"(",
"in",
")",
"==",
"PLUS_EXPR",
"||",
"TREE_CODE",
"(",
"in",
")",
"==",
"POINTER_PLUS_EXPR",
")",
")",
")",
")",
")",
"{",
"tree",
"op0",
"=",
"TREE_OPERAND",
"(",
"in",
",",
"0",
")",
";",
"tree",
"op1",
"=",
"TREE_OPERAND",
"(",
"in",
",",
"1",
")",
";",
"int",
"neg1_p",
"=",
"TREE_CODE",
"(",
"in",
")",
"==",
"MINUS_EXPR",
";",
"int",
"neg_litp_p",
"=",
"0",
",",
"neg_conp_p",
"=",
"0",
",",
"neg_var_p",
"=",
"0",
";",
"if",
"(",
"TREE_CODE",
"(",
"op0",
")",
"==",
"INTEGER_CST",
"||",
"TREE_CODE",
"(",
"op0",
")",
"==",
"REAL_CST",
"||",
"TREE_CODE",
"(",
"op0",
")",
"==",
"FIXED_CST",
")",
"*",
"litp",
"=",
"op0",
",",
"op0",
"=",
"0",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"op1",
")",
"==",
"INTEGER_CST",
"||",
"TREE_CODE",
"(",
"op1",
")",
"==",
"REAL_CST",
"||",
"TREE_CODE",
"(",
"op1",
")",
"==",
"FIXED_CST",
")",
"*",
"litp",
"=",
"op1",
",",
"neg_litp_p",
"=",
"neg1_p",
",",
"op1",
"=",
"0",
";",
"if",
"(",
"op0",
"!=",
"0",
"&&",
"TREE_CONSTANT",
"(",
"op0",
")",
")",
"*",
"conp",
"=",
"op0",
",",
"op0",
"=",
"0",
";",
"else",
"if",
"(",
"op1",
"!=",
"0",
"&&",
"TREE_CONSTANT",
"(",
"op1",
")",
")",
"*",
"conp",
"=",
"op1",
",",
"neg_conp_p",
"=",
"neg1_p",
",",
"op1",
"=",
"0",
";",
"if",
"(",
"op0",
"!=",
"0",
"&&",
"op1",
"!=",
"0",
")",
"var",
"=",
"in",
";",
"else",
"if",
"(",
"op0",
"!=",
"0",
")",
"var",
"=",
"op0",
";",
"else",
"var",
"=",
"op1",
",",
"neg_var_p",
"=",
"neg1_p",
";",
"if",
"(",
"neg_litp_p",
")",
"*",
"minus_litp",
"=",
"*",
"litp",
",",
"*",
"litp",
"=",
"0",
";",
"if",
"(",
"neg_conp_p",
"&&",
"*",
"conp",
")",
"*",
"minus_conp",
"=",
"*",
"conp",
",",
"*",
"conp",
"=",
"0",
";",
"if",
"(",
"neg_var_p",
"&&",
"var",
")",
"*",
"minus_varp",
"=",
"var",
",",
"var",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"TREE_CONSTANT",
"(",
"in",
")",
")",
"*",
"conp",
"=",
"in",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"in",
")",
"==",
"BIT_NOT_EXPR",
"&&",
"code",
"==",
"PLUS_EXPR",
")",
"{",
"*",
"litp",
"=",
"build_minus_one_cst",
"(",
"type",
")",
";",
"*",
"minus_varp",
"=",
"TREE_OPERAND",
"(",
"in",
",",
"0",
")",
";",
"}",
"else",
"var",
"=",
"in",
";",
"if",
"(",
"negate_p",
")",
"{",
"if",
"(",
"*",
"litp",
")",
"*",
"minus_litp",
"=",
"*",
"litp",
",",
"*",
"litp",
"=",
"0",
";",
"else",
"if",
"(",
"*",
"minus_litp",
")",
"*",
"litp",
"=",
"*",
"minus_litp",
",",
"*",
"minus_litp",
"=",
"0",
";",
"if",
"(",
"*",
"conp",
")",
"*",
"minus_conp",
"=",
"*",
"conp",
",",
"*",
"conp",
"=",
"0",
";",
"else",
"if",
"(",
"*",
"minus_conp",
")",
"*",
"conp",
"=",
"*",
"minus_conp",
",",
"*",
"minus_conp",
"=",
"0",
";",
"if",
"(",
"var",
")",
"*",
"minus_varp",
"=",
"var",
",",
"var",
"=",
"0",
";",
"else",
"if",
"(",
"*",
"minus_varp",
")",
"var",
"=",
"*",
"minus_varp",
",",
"*",
"minus_varp",
"=",
"0",
";",
"}",
"if",
"(",
"*",
"litp",
"&&",
"TREE_OVERFLOW_P",
"(",
"*",
"litp",
")",
")",
"*",
"litp",
"=",
"drop_tree_overflow",
"(",
"*",
"litp",
")",
";",
"if",
"(",
"*",
"minus_litp",
"&&",
"TREE_OVERFLOW_P",
"(",
"*",
"minus_litp",
")",
")",
"*",
"minus_litp",
"=",
"drop_tree_overflow",
"(",
"*",
"minus_litp",
")",
";",
"return",
"var",
";",
"}"
] | Split a tree IN into a constant, literal and variable parts that could be
combined with CODE to make IN. | [
"Split",
"a",
"tree",
"IN",
"into",
"a",
"constant",
"literal",
"and",
"variable",
"parts",
"that",
"could",
"be",
"combined",
"with",
"CODE",
"to",
"make",
"IN",
"."
] | [
"/* Strip any conversions that don't change the machine mode or signedness. */",
"/* We can associate addition and subtraction together (even\n\t\t though the C standard doesn't say so) for integers because\n\t\t the value is not affected. For reals, the value might be\n\t\t affected, so we can't. */",
"/* First see if either of the operands is a literal, then a constant. */",
"/* If we haven't dealt with either operand, this is not a case we can\n\t decompose. Otherwise, VAR is either of the ones remaining, if any. */",
"/* Now do any needed negations. */",
"/* -1 - X is folded to ~X, undo that here. Do _not_ do this\n when IN is constant. */"
] | [
{
"param": "in",
"type": "tree"
},
{
"param": "type",
"type": "tree"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "minus_varp",
"type": "tree"
},
{
"param": "conp",
"type": "tree"
},
{
"param": "minus_conp",
"type": "tree"
},
{
"param": "litp",
"type": "tree"
},
{
"param": "minus_litp",
"type": "tree"
},
{
"param": "negate_p",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "in",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "minus_varp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "conp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "minus_conp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "litp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "minus_litp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "negate_p",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | associate_trees | tree | static tree
associate_trees (location_t loc, tree t1, tree t2, enum tree_code code, tree type)
{
if (t1 == 0)
{
gcc_assert (t2 == 0 || code != MINUS_EXPR);
return t2;
}
else if (t2 == 0)
return t1;
/* If either input is CODE, a PLUS_EXPR, or a MINUS_EXPR, don't
try to fold this since we will have infinite recursion. But do
deal with any NEGATE_EXPRs. */
if (TREE_CODE (t1) == code || TREE_CODE (t2) == code
|| TREE_CODE (t1) == PLUS_EXPR || TREE_CODE (t2) == PLUS_EXPR
|| TREE_CODE (t1) == MINUS_EXPR || TREE_CODE (t2) == MINUS_EXPR)
{
if (code == PLUS_EXPR)
{
if (TREE_CODE (t1) == NEGATE_EXPR)
return build2_loc (loc, MINUS_EXPR, type,
fold_convert_loc (loc, type, t2),
fold_convert_loc (loc, type,
TREE_OPERAND (t1, 0)));
else if (TREE_CODE (t2) == NEGATE_EXPR)
return build2_loc (loc, MINUS_EXPR, type,
fold_convert_loc (loc, type, t1),
fold_convert_loc (loc, type,
TREE_OPERAND (t2, 0)));
else if (integer_zerop (t2))
return fold_convert_loc (loc, type, t1);
}
else if (code == MINUS_EXPR)
{
if (integer_zerop (t2))
return fold_convert_loc (loc, type, t1);
}
return build2_loc (loc, code, type, fold_convert_loc (loc, type, t1),
fold_convert_loc (loc, type, t2));
}
return fold_build2_loc (loc, code, type, fold_convert_loc (loc, type, t1),
fold_convert_loc (loc, type, t2));
} | /* Re-associate trees split by the above function. T1 and T2 are
either expressions to associate or null. Return the new
expression, if any. LOC is the location of the new expression. If
we build an operation, do it in TYPE and with CODE. */ | Re-associate trees split by the above function. T1 and T2 are
either expressions to associate or null. Return the new
expression, if any. LOC is the location of the new expression. If
we build an operation, do it in TYPE and with CODE. | [
"Re",
"-",
"associate",
"trees",
"split",
"by",
"the",
"above",
"function",
".",
"T1",
"and",
"T2",
"are",
"either",
"expressions",
"to",
"associate",
"or",
"null",
".",
"Return",
"the",
"new",
"expression",
"if",
"any",
".",
"LOC",
"is",
"the",
"location",
"of",
"the",
"new",
"expression",
".",
"If",
"we",
"build",
"an",
"operation",
"do",
"it",
"in",
"TYPE",
"and",
"with",
"CODE",
"."
] | static tree
associate_trees (location_t loc, tree t1, tree t2, enum tree_code code, tree type)
{
if (t1 == 0)
{
gcc_assert (t2 == 0 || code != MINUS_EXPR);
return t2;
}
else if (t2 == 0)
return t1;
if (TREE_CODE (t1) == code || TREE_CODE (t2) == code
|| TREE_CODE (t1) == PLUS_EXPR || TREE_CODE (t2) == PLUS_EXPR
|| TREE_CODE (t1) == MINUS_EXPR || TREE_CODE (t2) == MINUS_EXPR)
{
if (code == PLUS_EXPR)
{
if (TREE_CODE (t1) == NEGATE_EXPR)
return build2_loc (loc, MINUS_EXPR, type,
fold_convert_loc (loc, type, t2),
fold_convert_loc (loc, type,
TREE_OPERAND (t1, 0)));
else if (TREE_CODE (t2) == NEGATE_EXPR)
return build2_loc (loc, MINUS_EXPR, type,
fold_convert_loc (loc, type, t1),
fold_convert_loc (loc, type,
TREE_OPERAND (t2, 0)));
else if (integer_zerop (t2))
return fold_convert_loc (loc, type, t1);
}
else if (code == MINUS_EXPR)
{
if (integer_zerop (t2))
return fold_convert_loc (loc, type, t1);
}
return build2_loc (loc, code, type, fold_convert_loc (loc, type, t1),
fold_convert_loc (loc, type, t2));
}
return fold_build2_loc (loc, code, type, fold_convert_loc (loc, type, t1),
fold_convert_loc (loc, type, t2));
} | [
"static",
"tree",
"associate_trees",
"(",
"location_t",
"loc",
",",
"tree",
"t1",
",",
"tree",
"t2",
",",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
")",
"{",
"if",
"(",
"t1",
"==",
"0",
")",
"{",
"gcc_assert",
"(",
"t2",
"==",
"0",
"||",
"code",
"!=",
"MINUS_EXPR",
")",
";",
"return",
"t2",
";",
"}",
"else",
"if",
"(",
"t2",
"==",
"0",
")",
"return",
"t1",
";",
"if",
"(",
"TREE_CODE",
"(",
"t1",
")",
"==",
"code",
"||",
"TREE_CODE",
"(",
"t2",
")",
"==",
"code",
"||",
"TREE_CODE",
"(",
"t1",
")",
"==",
"PLUS_EXPR",
"||",
"TREE_CODE",
"(",
"t2",
")",
"==",
"PLUS_EXPR",
"||",
"TREE_CODE",
"(",
"t1",
")",
"==",
"MINUS_EXPR",
"||",
"TREE_CODE",
"(",
"t2",
")",
"==",
"MINUS_EXPR",
")",
"{",
"if",
"(",
"code",
"==",
"PLUS_EXPR",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"t1",
")",
"==",
"NEGATE_EXPR",
")",
"return",
"build2_loc",
"(",
"loc",
",",
"MINUS_EXPR",
",",
"type",
",",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"t2",
")",
",",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"TREE_OPERAND",
"(",
"t1",
",",
"0",
")",
")",
")",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t2",
")",
"==",
"NEGATE_EXPR",
")",
"return",
"build2_loc",
"(",
"loc",
",",
"MINUS_EXPR",
",",
"type",
",",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"t1",
")",
",",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"TREE_OPERAND",
"(",
"t2",
",",
"0",
")",
")",
")",
";",
"else",
"if",
"(",
"integer_zerop",
"(",
"t2",
")",
")",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"t1",
")",
";",
"}",
"else",
"if",
"(",
"code",
"==",
"MINUS_EXPR",
")",
"{",
"if",
"(",
"integer_zerop",
"(",
"t2",
")",
")",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"t1",
")",
";",
"}",
"return",
"build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"t1",
")",
",",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"t2",
")",
")",
";",
"}",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"t1",
")",
",",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"t2",
")",
")",
";",
"}"
] | Re-associate trees split by the above function. | [
"Re",
"-",
"associate",
"trees",
"split",
"by",
"the",
"above",
"function",
"."
] | [
"/* If either input is CODE, a PLUS_EXPR, or a MINUS_EXPR, don't\n try to fold this since we will have infinite recursion. But do\n deal with any NEGATE_EXPRs. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "t1",
"type": "tree"
},
{
"param": "t2",
"type": "tree"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t2",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | int_binop_types_match_p | bool | static bool
int_binop_types_match_p (enum tree_code code, const_tree type1, const_tree type2)
{
if (!INTEGRAL_TYPE_P (type1) && !POINTER_TYPE_P (type1))
return false;
if (!INTEGRAL_TYPE_P (type2) && !POINTER_TYPE_P (type2))
return false;
switch (code)
{
case LSHIFT_EXPR:
case RSHIFT_EXPR:
case LROTATE_EXPR:
case RROTATE_EXPR:
return true;
default:
break;
}
return TYPE_UNSIGNED (type1) == TYPE_UNSIGNED (type2)
&& TYPE_PRECISION (type1) == TYPE_PRECISION (type2)
&& TYPE_MODE (type1) == TYPE_MODE (type2);
} | /* Check whether TYPE1 and TYPE2 are equivalent integer types, suitable
for use in int_const_binop, size_binop and size_diffop. */ | Check whether TYPE1 and TYPE2 are equivalent integer types, suitable
for use in int_const_binop, size_binop and size_diffop. | [
"Check",
"whether",
"TYPE1",
"and",
"TYPE2",
"are",
"equivalent",
"integer",
"types",
"suitable",
"for",
"use",
"in",
"int_const_binop",
"size_binop",
"and",
"size_diffop",
"."
] | static bool
int_binop_types_match_p (enum tree_code code, const_tree type1, const_tree type2)
{
if (!INTEGRAL_TYPE_P (type1) && !POINTER_TYPE_P (type1))
return false;
if (!INTEGRAL_TYPE_P (type2) && !POINTER_TYPE_P (type2))
return false;
switch (code)
{
case LSHIFT_EXPR:
case RSHIFT_EXPR:
case LROTATE_EXPR:
case RROTATE_EXPR:
return true;
default:
break;
}
return TYPE_UNSIGNED (type1) == TYPE_UNSIGNED (type2)
&& TYPE_PRECISION (type1) == TYPE_PRECISION (type2)
&& TYPE_MODE (type1) == TYPE_MODE (type2);
} | [
"static",
"bool",
"int_binop_types_match_p",
"(",
"enum",
"tree_code",
"code",
",",
"const_tree",
"type1",
",",
"const_tree",
"type2",
")",
"{",
"if",
"(",
"!",
"INTEGRAL_TYPE_P",
"(",
"type1",
")",
"&&",
"!",
"POINTER_TYPE_P",
"(",
"type1",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"INTEGRAL_TYPE_P",
"(",
"type2",
")",
"&&",
"!",
"POINTER_TYPE_P",
"(",
"type2",
")",
")",
"return",
"false",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"LSHIFT_EXPR",
":",
"case",
"RSHIFT_EXPR",
":",
"case",
"LROTATE_EXPR",
":",
"case",
"RROTATE_EXPR",
":",
"return",
"true",
";",
"default",
":",
"break",
";",
"}",
"return",
"TYPE_UNSIGNED",
"(",
"type1",
")",
"==",
"TYPE_UNSIGNED",
"(",
"type2",
")",
"&&",
"TYPE_PRECISION",
"(",
"type1",
")",
"==",
"TYPE_PRECISION",
"(",
"type2",
")",
"&&",
"TYPE_MODE",
"(",
"type1",
")",
"==",
"TYPE_MODE",
"(",
"type2",
")",
";",
"}"
] | Check whether TYPE1 and TYPE2 are equivalent integer types, suitable
for use in int_const_binop, size_binop and size_diffop. | [
"Check",
"whether",
"TYPE1",
"and",
"TYPE2",
"are",
"equivalent",
"integer",
"types",
"suitable",
"for",
"use",
"in",
"int_const_binop",
"size_binop",
"and",
"size_diffop",
"."
] | [] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type1",
"type": "const_tree"
},
{
"param": "type2",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type1",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type2",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | distributes_over_addition_p | bool | static bool
distributes_over_addition_p (tree_code op, int opno)
{
switch (op)
{
case PLUS_EXPR:
case MINUS_EXPR:
case MULT_EXPR:
return true;
case LSHIFT_EXPR:
return opno == 1;
default:
return false;
}
} | /* Return true if binary operation OP distributes over addition in operand
OPNO, with the other operand being held constant. OPNO counts from 1. */ | Return true if binary operation OP distributes over addition in operand
OPNO, with the other operand being held constant. OPNO counts from 1. | [
"Return",
"true",
"if",
"binary",
"operation",
"OP",
"distributes",
"over",
"addition",
"in",
"operand",
"OPNO",
"with",
"the",
"other",
"operand",
"being",
"held",
"constant",
".",
"OPNO",
"counts",
"from",
"1",
"."
] | static bool
distributes_over_addition_p (tree_code op, int opno)
{
switch (op)
{
case PLUS_EXPR:
case MINUS_EXPR:
case MULT_EXPR:
return true;
case LSHIFT_EXPR:
return opno == 1;
default:
return false;
}
} | [
"static",
"bool",
"distributes_over_addition_p",
"(",
"tree_code",
"op",
",",
"int",
"opno",
")",
"{",
"switch",
"(",
"op",
")",
"{",
"case",
"PLUS_EXPR",
":",
"case",
"MINUS_EXPR",
":",
"case",
"MULT_EXPR",
":",
"return",
"true",
";",
"case",
"LSHIFT_EXPR",
":",
"return",
"opno",
"==",
"1",
";",
"default",
":",
"return",
"false",
";",
"}",
"}"
] | Return true if binary operation OP distributes over addition in operand
OPNO, with the other operand being held constant. | [
"Return",
"true",
"if",
"binary",
"operation",
"OP",
"distributes",
"over",
"addition",
"in",
"operand",
"OPNO",
"with",
"the",
"other",
"operand",
"being",
"held",
"constant",
"."
] | [] | [
{
"param": "op",
"type": "tree_code"
},
{
"param": "opno",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "op",
"type": "tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "opno",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | size_int_kind | tree | tree
size_int_kind (poly_int64 number, enum size_type_kind kind)
{
return build_int_cst (sizetype_tab[(int) kind], number);
} | /* Create a sizetype INT_CST node with NUMBER sign extended. KIND
indicates which particular sizetype to create. */ | Create a sizetype INT_CST node with NUMBER sign extended. KIND
indicates which particular sizetype to create. | [
"Create",
"a",
"sizetype",
"INT_CST",
"node",
"with",
"NUMBER",
"sign",
"extended",
".",
"KIND",
"indicates",
"which",
"particular",
"sizetype",
"to",
"create",
"."
] | tree
size_int_kind (poly_int64 number, enum size_type_kind kind)
{
return build_int_cst (sizetype_tab[(int) kind], number);
} | [
"tree",
"size_int_kind",
"(",
"poly_int64",
"number",
",",
"enum",
"size_type_kind",
"kind",
")",
"{",
"return",
"build_int_cst",
"(",
"sizetype_tab",
"[",
"(",
"int",
")",
"kind",
"]",
",",
"number",
")",
";",
"}"
] | Create a sizetype INT_CST node with NUMBER sign extended. | [
"Create",
"a",
"sizetype",
"INT_CST",
"node",
"with",
"NUMBER",
"sign",
"extended",
"."
] | [] | [
{
"param": "number",
"type": "poly_int64"
},
{
"param": "kind",
"type": "enum size_type_kind"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "number",
"type": "poly_int64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "kind",
"type": "enum size_type_kind",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | size_binop_loc | tree | tree
size_binop_loc (location_t loc, enum tree_code code, tree arg0, tree arg1)
{
tree type = TREE_TYPE (arg0);
if (arg0 == error_mark_node || arg1 == error_mark_node)
return error_mark_node;
gcc_assert (int_binop_types_match_p (code, TREE_TYPE (arg0),
TREE_TYPE (arg1)));
/* Handle the special case of two poly_int constants faster. */
if (poly_int_tree_p (arg0) && poly_int_tree_p (arg1))
{
/* And some specific cases even faster than that. */
if (code == PLUS_EXPR)
{
if (integer_zerop (arg0) && !TREE_OVERFLOW (arg0))
return arg1;
if (integer_zerop (arg1) && !TREE_OVERFLOW (arg1))
return arg0;
}
else if (code == MINUS_EXPR)
{
if (integer_zerop (arg1) && !TREE_OVERFLOW (arg1))
return arg0;
}
else if (code == MULT_EXPR)
{
if (integer_onep (arg0) && !TREE_OVERFLOW (arg0))
return arg1;
}
/* Handle general case of two integer constants. For sizetype
constant calculations we always want to know about overflow,
even in the unsigned case. */
tree res = int_const_binop_1 (code, arg0, arg1, -1);
if (res != NULL_TREE)
return res;
}
return fold_build2_loc (loc, code, type, arg0, arg1);
} | /* Combine operands OP1 and OP2 with arithmetic operation CODE. CODE
is a tree code. The type of the result is taken from the operands.
Both must be equivalent integer types, ala int_binop_types_match_p.
If the operands are constant, so is the result. */ | Combine operands OP1 and OP2 with arithmetic operation CODE. CODE
is a tree code. The type of the result is taken from the operands.
Both must be equivalent integer types, ala int_binop_types_match_p.
If the operands are constant, so is the result. | [
"Combine",
"operands",
"OP1",
"and",
"OP2",
"with",
"arithmetic",
"operation",
"CODE",
".",
"CODE",
"is",
"a",
"tree",
"code",
".",
"The",
"type",
"of",
"the",
"result",
"is",
"taken",
"from",
"the",
"operands",
".",
"Both",
"must",
"be",
"equivalent",
"integer",
"types",
"ala",
"int_binop_types_match_p",
".",
"If",
"the",
"operands",
"are",
"constant",
"so",
"is",
"the",
"result",
"."
] | tree
size_binop_loc (location_t loc, enum tree_code code, tree arg0, tree arg1)
{
tree type = TREE_TYPE (arg0);
if (arg0 == error_mark_node || arg1 == error_mark_node)
return error_mark_node;
gcc_assert (int_binop_types_match_p (code, TREE_TYPE (arg0),
TREE_TYPE (arg1)));
if (poly_int_tree_p (arg0) && poly_int_tree_p (arg1))
{
if (code == PLUS_EXPR)
{
if (integer_zerop (arg0) && !TREE_OVERFLOW (arg0))
return arg1;
if (integer_zerop (arg1) && !TREE_OVERFLOW (arg1))
return arg0;
}
else if (code == MINUS_EXPR)
{
if (integer_zerop (arg1) && !TREE_OVERFLOW (arg1))
return arg0;
}
else if (code == MULT_EXPR)
{
if (integer_onep (arg0) && !TREE_OVERFLOW (arg0))
return arg1;
}
tree res = int_const_binop_1 (code, arg0, arg1, -1);
if (res != NULL_TREE)
return res;
}
return fold_build2_loc (loc, code, type, arg0, arg1);
} | [
"tree",
"size_binop_loc",
"(",
"location_t",
"loc",
",",
"enum",
"tree_code",
"code",
",",
"tree",
"arg0",
",",
"tree",
"arg1",
")",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"arg0",
")",
";",
"if",
"(",
"arg0",
"==",
"error_mark_node",
"||",
"arg1",
"==",
"error_mark_node",
")",
"return",
"error_mark_node",
";",
"gcc_assert",
"(",
"int_binop_types_match_p",
"(",
"code",
",",
"TREE_TYPE",
"(",
"arg0",
")",
",",
"TREE_TYPE",
"(",
"arg1",
")",
")",
")",
";",
"if",
"(",
"poly_int_tree_p",
"(",
"arg0",
")",
"&&",
"poly_int_tree_p",
"(",
"arg1",
")",
")",
"{",
"if",
"(",
"code",
"==",
"PLUS_EXPR",
")",
"{",
"if",
"(",
"integer_zerop",
"(",
"arg0",
")",
"&&",
"!",
"TREE_OVERFLOW",
"(",
"arg0",
")",
")",
"return",
"arg1",
";",
"if",
"(",
"integer_zerop",
"(",
"arg1",
")",
"&&",
"!",
"TREE_OVERFLOW",
"(",
"arg1",
")",
")",
"return",
"arg0",
";",
"}",
"else",
"if",
"(",
"code",
"==",
"MINUS_EXPR",
")",
"{",
"if",
"(",
"integer_zerop",
"(",
"arg1",
")",
"&&",
"!",
"TREE_OVERFLOW",
"(",
"arg1",
")",
")",
"return",
"arg0",
";",
"}",
"else",
"if",
"(",
"code",
"==",
"MULT_EXPR",
")",
"{",
"if",
"(",
"integer_onep",
"(",
"arg0",
")",
"&&",
"!",
"TREE_OVERFLOW",
"(",
"arg0",
")",
")",
"return",
"arg1",
";",
"}",
"tree",
"res",
"=",
"int_const_binop_1",
"(",
"code",
",",
"arg0",
",",
"arg1",
",",
"-1",
")",
";",
"if",
"(",
"res",
"!=",
"NULL_TREE",
")",
"return",
"res",
";",
"}",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"arg0",
",",
"arg1",
")",
";",
"}"
] | Combine operands OP1 and OP2 with arithmetic operation CODE. | [
"Combine",
"operands",
"OP1",
"and",
"OP2",
"with",
"arithmetic",
"operation",
"CODE",
"."
] | [
"/* Handle the special case of two poly_int constants faster. */",
"/* And some specific cases even faster than that. */",
"/* Handle general case of two integer constants. For sizetype\n constant calculations we always want to know about overflow,\n\t even in the unsigned case. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "arg0",
"type": "tree"
},
{
"param": "arg1",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "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": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | size_diffop_loc | tree | tree
size_diffop_loc (location_t loc, tree arg0, tree arg1)
{
tree type = TREE_TYPE (arg0);
tree ctype;
gcc_assert (int_binop_types_match_p (MINUS_EXPR, TREE_TYPE (arg0),
TREE_TYPE (arg1)));
/* If the type is already signed, just do the simple thing. */
if (!TYPE_UNSIGNED (type))
return size_binop_loc (loc, MINUS_EXPR, arg0, arg1);
if (type == sizetype)
ctype = ssizetype;
else if (type == bitsizetype)
ctype = sbitsizetype;
else
ctype = signed_type_for (type);
/* If either operand is not a constant, do the conversions to the signed
type and subtract. The hardware will do the right thing with any
overflow in the subtraction. */
if (TREE_CODE (arg0) != INTEGER_CST || TREE_CODE (arg1) != INTEGER_CST)
return size_binop_loc (loc, MINUS_EXPR,
fold_convert_loc (loc, ctype, arg0),
fold_convert_loc (loc, ctype, arg1));
/* If ARG0 is larger than ARG1, subtract and return the result in CTYPE.
Otherwise, subtract the other way, convert to CTYPE (we know that can't
overflow) and negate (which can't either). Special-case a result
of zero while we're here. */
if (tree_int_cst_equal (arg0, arg1))
return build_int_cst (ctype, 0);
else if (tree_int_cst_lt (arg1, arg0))
return fold_convert_loc (loc, ctype,
size_binop_loc (loc, MINUS_EXPR, arg0, arg1));
else
return size_binop_loc (loc, MINUS_EXPR, build_int_cst (ctype, 0),
fold_convert_loc (loc, ctype,
size_binop_loc (loc,
MINUS_EXPR,
arg1, arg0)));
} | /* Given two values, either both of sizetype or both of bitsizetype,
compute the difference between the two values. Return the value
in signed type corresponding to the type of the operands. */ | Given two values, either both of sizetype or both of bitsizetype,
compute the difference between the two values. Return the value
in signed type corresponding to the type of the operands. | [
"Given",
"two",
"values",
"either",
"both",
"of",
"sizetype",
"or",
"both",
"of",
"bitsizetype",
"compute",
"the",
"difference",
"between",
"the",
"two",
"values",
".",
"Return",
"the",
"value",
"in",
"signed",
"type",
"corresponding",
"to",
"the",
"type",
"of",
"the",
"operands",
"."
] | tree
size_diffop_loc (location_t loc, tree arg0, tree arg1)
{
tree type = TREE_TYPE (arg0);
tree ctype;
gcc_assert (int_binop_types_match_p (MINUS_EXPR, TREE_TYPE (arg0),
TREE_TYPE (arg1)));
if (!TYPE_UNSIGNED (type))
return size_binop_loc (loc, MINUS_EXPR, arg0, arg1);
if (type == sizetype)
ctype = ssizetype;
else if (type == bitsizetype)
ctype = sbitsizetype;
else
ctype = signed_type_for (type);
if (TREE_CODE (arg0) != INTEGER_CST || TREE_CODE (arg1) != INTEGER_CST)
return size_binop_loc (loc, MINUS_EXPR,
fold_convert_loc (loc, ctype, arg0),
fold_convert_loc (loc, ctype, arg1));
if (tree_int_cst_equal (arg0, arg1))
return build_int_cst (ctype, 0);
else if (tree_int_cst_lt (arg1, arg0))
return fold_convert_loc (loc, ctype,
size_binop_loc (loc, MINUS_EXPR, arg0, arg1));
else
return size_binop_loc (loc, MINUS_EXPR, build_int_cst (ctype, 0),
fold_convert_loc (loc, ctype,
size_binop_loc (loc,
MINUS_EXPR,
arg1, arg0)));
} | [
"tree",
"size_diffop_loc",
"(",
"location_t",
"loc",
",",
"tree",
"arg0",
",",
"tree",
"arg1",
")",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"arg0",
")",
";",
"tree",
"ctype",
";",
"gcc_assert",
"(",
"int_binop_types_match_p",
"(",
"MINUS_EXPR",
",",
"TREE_TYPE",
"(",
"arg0",
")",
",",
"TREE_TYPE",
"(",
"arg1",
")",
")",
")",
";",
"if",
"(",
"!",
"TYPE_UNSIGNED",
"(",
"type",
")",
")",
"return",
"size_binop_loc",
"(",
"loc",
",",
"MINUS_EXPR",
",",
"arg0",
",",
"arg1",
")",
";",
"if",
"(",
"type",
"==",
"sizetype",
")",
"ctype",
"=",
"ssizetype",
";",
"else",
"if",
"(",
"type",
"==",
"bitsizetype",
")",
"ctype",
"=",
"sbitsizetype",
";",
"else",
"ctype",
"=",
"signed_type_for",
"(",
"type",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg0",
")",
"!=",
"INTEGER_CST",
"||",
"TREE_CODE",
"(",
"arg1",
")",
"!=",
"INTEGER_CST",
")",
"return",
"size_binop_loc",
"(",
"loc",
",",
"MINUS_EXPR",
",",
"fold_convert_loc",
"(",
"loc",
",",
"ctype",
",",
"arg0",
")",
",",
"fold_convert_loc",
"(",
"loc",
",",
"ctype",
",",
"arg1",
")",
")",
";",
"if",
"(",
"tree_int_cst_equal",
"(",
"arg0",
",",
"arg1",
")",
")",
"return",
"build_int_cst",
"(",
"ctype",
",",
"0",
")",
";",
"else",
"if",
"(",
"tree_int_cst_lt",
"(",
"arg1",
",",
"arg0",
")",
")",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"ctype",
",",
"size_binop_loc",
"(",
"loc",
",",
"MINUS_EXPR",
",",
"arg0",
",",
"arg1",
")",
")",
";",
"else",
"return",
"size_binop_loc",
"(",
"loc",
",",
"MINUS_EXPR",
",",
"build_int_cst",
"(",
"ctype",
",",
"0",
")",
",",
"fold_convert_loc",
"(",
"loc",
",",
"ctype",
",",
"size_binop_loc",
"(",
"loc",
",",
"MINUS_EXPR",
",",
"arg1",
",",
"arg0",
")",
")",
")",
";",
"}"
] | Given two values, either both of sizetype or both of bitsizetype,
compute the difference between the two values. | [
"Given",
"two",
"values",
"either",
"both",
"of",
"sizetype",
"or",
"both",
"of",
"bitsizetype",
"compute",
"the",
"difference",
"between",
"the",
"two",
"values",
"."
] | [
"/* If the type is already signed, just do the simple thing. */",
"/* If either operand is not a constant, do the conversions to the signed\n type and subtract. The hardware will do the right thing with any\n overflow in the subtraction. */",
"/* If ARG0 is larger than ARG1, subtract and return the result in CTYPE.\n Otherwise, subtract the other way, convert to CTYPE (we know that can't\n overflow) and negate (which can't either). Special-case a result\n of zero while we're here. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "arg0",
"type": "tree"
},
{
"param": "arg1",
"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
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_convert_const_int_from_fixed | tree | static tree
fold_convert_const_int_from_fixed (tree type, const_tree arg1)
{
tree t;
double_int temp, temp_trunc;
scalar_mode mode;
/* Right shift FIXED_CST to temp by fbit. */
temp = TREE_FIXED_CST (arg1).data;
mode = TREE_FIXED_CST (arg1).mode;
if (GET_MODE_FBIT (mode) < HOST_BITS_PER_DOUBLE_INT)
{
temp = temp.rshift (GET_MODE_FBIT (mode),
HOST_BITS_PER_DOUBLE_INT,
SIGNED_FIXED_POINT_MODE_P (mode));
/* Left shift temp to temp_trunc by fbit. */
temp_trunc = temp.lshift (GET_MODE_FBIT (mode),
HOST_BITS_PER_DOUBLE_INT,
SIGNED_FIXED_POINT_MODE_P (mode));
}
else
{
temp = double_int_zero;
temp_trunc = double_int_zero;
}
/* If FIXED_CST is negative, we need to round the value toward 0.
By checking if the fractional bits are not zero to add 1 to temp. */
if (SIGNED_FIXED_POINT_MODE_P (mode)
&& temp_trunc.is_negative ()
&& TREE_FIXED_CST (arg1).data != temp_trunc)
temp += double_int_one;
/* Given a fixed-point constant, make new constant with new type,
appropriately sign-extended or truncated. */
t = force_fit_type (type, temp, -1,
(temp.is_negative ()
&& (TYPE_UNSIGNED (type)
< TYPE_UNSIGNED (TREE_TYPE (arg1))))
| TREE_OVERFLOW (arg1));
return t;
} | /* A subroutine of fold_convert_const handling conversions of a
FIXED_CST to an integer type. */ | A subroutine of fold_convert_const handling conversions of a
FIXED_CST to an integer type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"of",
"a",
"FIXED_CST",
"to",
"an",
"integer",
"type",
"."
] | static tree
fold_convert_const_int_from_fixed (tree type, const_tree arg1)
{
tree t;
double_int temp, temp_trunc;
scalar_mode mode;
temp = TREE_FIXED_CST (arg1).data;
mode = TREE_FIXED_CST (arg1).mode;
if (GET_MODE_FBIT (mode) < HOST_BITS_PER_DOUBLE_INT)
{
temp = temp.rshift (GET_MODE_FBIT (mode),
HOST_BITS_PER_DOUBLE_INT,
SIGNED_FIXED_POINT_MODE_P (mode));
temp_trunc = temp.lshift (GET_MODE_FBIT (mode),
HOST_BITS_PER_DOUBLE_INT,
SIGNED_FIXED_POINT_MODE_P (mode));
}
else
{
temp = double_int_zero;
temp_trunc = double_int_zero;
}
if (SIGNED_FIXED_POINT_MODE_P (mode)
&& temp_trunc.is_negative ()
&& TREE_FIXED_CST (arg1).data != temp_trunc)
temp += double_int_one;
t = force_fit_type (type, temp, -1,
(temp.is_negative ()
&& (TYPE_UNSIGNED (type)
< TYPE_UNSIGNED (TREE_TYPE (arg1))))
| TREE_OVERFLOW (arg1));
return t;
} | [
"static",
"tree",
"fold_convert_const_int_from_fixed",
"(",
"tree",
"type",
",",
"const_tree",
"arg1",
")",
"{",
"tree",
"t",
";",
"double_int",
"temp",
",",
"temp_trunc",
";",
"scalar_mode",
"mode",
";",
"temp",
"=",
"TREE_FIXED_CST",
"(",
"arg1",
")",
".",
"data",
";",
"mode",
"=",
"TREE_FIXED_CST",
"(",
"arg1",
")",
".",
"mode",
";",
"if",
"(",
"GET_MODE_FBIT",
"(",
"mode",
")",
"<",
"HOST_BITS_PER_DOUBLE_INT",
")",
"{",
"temp",
"=",
"temp",
".",
"rshift",
"(",
"GET_MODE_FBIT",
"(",
"mode",
")",
",",
"HOST_BITS_PER_DOUBLE_INT",
",",
"SIGNED_FIXED_POINT_MODE_P",
"(",
"mode",
")",
")",
";",
"temp_trunc",
"=",
"temp",
".",
"lshift",
"(",
"GET_MODE_FBIT",
"(",
"mode",
")",
",",
"HOST_BITS_PER_DOUBLE_INT",
",",
"SIGNED_FIXED_POINT_MODE_P",
"(",
"mode",
")",
")",
";",
"}",
"else",
"{",
"temp",
"=",
"double_int_zero",
";",
"temp_trunc",
"=",
"double_int_zero",
";",
"}",
"if",
"(",
"SIGNED_FIXED_POINT_MODE_P",
"(",
"mode",
")",
"&&",
"temp_trunc",
".",
"is_negative",
"(",
")",
"&&",
"TREE_FIXED_CST",
"(",
"arg1",
")",
".",
"data",
"!=",
"temp_trunc",
")",
"temp",
"+=",
"double_int_one",
";",
"t",
"=",
"force_fit_type",
"(",
"type",
",",
"temp",
",",
"-1",
",",
"(",
"temp",
".",
"is_negative",
"(",
")",
"&&",
"(",
"TYPE_UNSIGNED",
"(",
"type",
")",
"<",
"TYPE_UNSIGNED",
"(",
"TREE_TYPE",
"(",
"arg1",
")",
")",
")",
")",
"|",
"TREE_OVERFLOW",
"(",
"arg1",
")",
")",
";",
"return",
"t",
";",
"}"
] | A subroutine of fold_convert_const handling conversions of a
FIXED_CST to an integer type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"of",
"a",
"FIXED_CST",
"to",
"an",
"integer",
"type",
"."
] | [
"/* Right shift FIXED_CST to temp by fbit. */",
"/* Left shift temp to temp_trunc by fbit. */",
"/* If FIXED_CST is negative, we need to round the value toward 0.\n By checking if the fractional bits are not zero to add 1 to temp. */",
"/* Given a fixed-point constant, make new constant with new type,\n appropriately sign-extended or truncated. */"
] | [
{
"param": "type",
"type": "tree"
},
{
"param": "arg1",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg1",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_convert_const_real_from_real | tree | static tree
fold_convert_const_real_from_real (tree type, const_tree arg1)
{
REAL_VALUE_TYPE value;
tree t;
/* Don't perform the operation if flag_signaling_nans is on
and the operand is a signaling NaN. */
if (HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg1)))
&& REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg1)))
return NULL_TREE;
real_convert (&value, TYPE_MODE (type), &TREE_REAL_CST (arg1));
t = build_real (type, value);
/* If converting an infinity or NAN to a representation that doesn't
have one, set the overflow bit so that we can produce some kind of
error message at the appropriate point if necessary. It's not the
most user-friendly message, but it's better than nothing. */
if (REAL_VALUE_ISINF (TREE_REAL_CST (arg1))
&& !MODE_HAS_INFINITIES (TYPE_MODE (type)))
TREE_OVERFLOW (t) = 1;
else if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1))
&& !MODE_HAS_NANS (TYPE_MODE (type)))
TREE_OVERFLOW (t) = 1;
/* Regular overflow, conversion produced an infinity in a mode that
can't represent them. */
else if (!MODE_HAS_INFINITIES (TYPE_MODE (type))
&& REAL_VALUE_ISINF (value)
&& !REAL_VALUE_ISINF (TREE_REAL_CST (arg1)))
TREE_OVERFLOW (t) = 1;
else
TREE_OVERFLOW (t) = TREE_OVERFLOW (arg1);
return t;
} | /* A subroutine of fold_convert_const handling conversions a REAL_CST
to another floating point type. */ | A subroutine of fold_convert_const handling conversions a REAL_CST
to another floating point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"a",
"REAL_CST",
"to",
"another",
"floating",
"point",
"type",
"."
] | static tree
fold_convert_const_real_from_real (tree type, const_tree arg1)
{
REAL_VALUE_TYPE value;
tree t;
if (HONOR_SNANS (TYPE_MODE (TREE_TYPE (arg1)))
&& REAL_VALUE_ISSIGNALING_NAN (TREE_REAL_CST (arg1)))
return NULL_TREE;
real_convert (&value, TYPE_MODE (type), &TREE_REAL_CST (arg1));
t = build_real (type, value);
if (REAL_VALUE_ISINF (TREE_REAL_CST (arg1))
&& !MODE_HAS_INFINITIES (TYPE_MODE (type)))
TREE_OVERFLOW (t) = 1;
else if (REAL_VALUE_ISNAN (TREE_REAL_CST (arg1))
&& !MODE_HAS_NANS (TYPE_MODE (type)))
TREE_OVERFLOW (t) = 1;
else if (!MODE_HAS_INFINITIES (TYPE_MODE (type))
&& REAL_VALUE_ISINF (value)
&& !REAL_VALUE_ISINF (TREE_REAL_CST (arg1)))
TREE_OVERFLOW (t) = 1;
else
TREE_OVERFLOW (t) = TREE_OVERFLOW (arg1);
return t;
} | [
"static",
"tree",
"fold_convert_const_real_from_real",
"(",
"tree",
"type",
",",
"const_tree",
"arg1",
")",
"{",
"REAL_VALUE_TYPE",
"value",
";",
"tree",
"t",
";",
"if",
"(",
"HONOR_SNANS",
"(",
"TYPE_MODE",
"(",
"TREE_TYPE",
"(",
"arg1",
")",
")",
")",
"&&",
"REAL_VALUE_ISSIGNALING_NAN",
"(",
"TREE_REAL_CST",
"(",
"arg1",
")",
")",
")",
"return",
"NULL_TREE",
";",
"real_convert",
"(",
"&",
"value",
",",
"TYPE_MODE",
"(",
"type",
")",
",",
"&",
"TREE_REAL_CST",
"(",
"arg1",
")",
")",
";",
"t",
"=",
"build_real",
"(",
"type",
",",
"value",
")",
";",
"if",
"(",
"REAL_VALUE_ISINF",
"(",
"TREE_REAL_CST",
"(",
"arg1",
")",
")",
"&&",
"!",
"MODE_HAS_INFINITIES",
"(",
"TYPE_MODE",
"(",
"type",
")",
")",
")",
"TREE_OVERFLOW",
"(",
"t",
")",
"=",
"1",
";",
"else",
"if",
"(",
"REAL_VALUE_ISNAN",
"(",
"TREE_REAL_CST",
"(",
"arg1",
")",
")",
"&&",
"!",
"MODE_HAS_NANS",
"(",
"TYPE_MODE",
"(",
"type",
")",
")",
")",
"TREE_OVERFLOW",
"(",
"t",
")",
"=",
"1",
";",
"else",
"if",
"(",
"!",
"MODE_HAS_INFINITIES",
"(",
"TYPE_MODE",
"(",
"type",
")",
")",
"&&",
"REAL_VALUE_ISINF",
"(",
"value",
")",
"&&",
"!",
"REAL_VALUE_ISINF",
"(",
"TREE_REAL_CST",
"(",
"arg1",
")",
")",
")",
"TREE_OVERFLOW",
"(",
"t",
")",
"=",
"1",
";",
"else",
"TREE_OVERFLOW",
"(",
"t",
")",
"=",
"TREE_OVERFLOW",
"(",
"arg1",
")",
";",
"return",
"t",
";",
"}"
] | A subroutine of fold_convert_const handling conversions a REAL_CST
to another floating point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"a",
"REAL_CST",
"to",
"another",
"floating",
"point",
"type",
"."
] | [
"/* Don't perform the operation if flag_signaling_nans is on\n and the operand is a signaling NaN. */",
"/* If converting an infinity or NAN to a representation that doesn't\n have one, set the overflow bit so that we can produce some kind of\n error message at the appropriate point if necessary. It's not the\n most user-friendly message, but it's better than nothing. */",
"/* Regular overflow, conversion produced an infinity in a mode that\n can't represent them. */"
] | [
{
"param": "type",
"type": "tree"
},
{
"param": "arg1",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg1",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_convert_const_real_from_fixed | tree | static tree
fold_convert_const_real_from_fixed (tree type, const_tree arg1)
{
REAL_VALUE_TYPE value;
tree t;
real_convert_from_fixed (&value, SCALAR_FLOAT_TYPE_MODE (type),
&TREE_FIXED_CST (arg1));
t = build_real (type, value);
TREE_OVERFLOW (t) = TREE_OVERFLOW (arg1);
return t;
} | /* A subroutine of fold_convert_const handling conversions a FIXED_CST
to a floating point type. */ | A subroutine of fold_convert_const handling conversions a FIXED_CST
to a floating point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"a",
"FIXED_CST",
"to",
"a",
"floating",
"point",
"type",
"."
] | static tree
fold_convert_const_real_from_fixed (tree type, const_tree arg1)
{
REAL_VALUE_TYPE value;
tree t;
real_convert_from_fixed (&value, SCALAR_FLOAT_TYPE_MODE (type),
&TREE_FIXED_CST (arg1));
t = build_real (type, value);
TREE_OVERFLOW (t) = TREE_OVERFLOW (arg1);
return t;
} | [
"static",
"tree",
"fold_convert_const_real_from_fixed",
"(",
"tree",
"type",
",",
"const_tree",
"arg1",
")",
"{",
"REAL_VALUE_TYPE",
"value",
";",
"tree",
"t",
";",
"real_convert_from_fixed",
"(",
"&",
"value",
",",
"SCALAR_FLOAT_TYPE_MODE",
"(",
"type",
")",
",",
"&",
"TREE_FIXED_CST",
"(",
"arg1",
")",
")",
";",
"t",
"=",
"build_real",
"(",
"type",
",",
"value",
")",
";",
"TREE_OVERFLOW",
"(",
"t",
")",
"=",
"TREE_OVERFLOW",
"(",
"arg1",
")",
";",
"return",
"t",
";",
"}"
] | A subroutine of fold_convert_const handling conversions a FIXED_CST
to a floating point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"a",
"FIXED_CST",
"to",
"a",
"floating",
"point",
"type",
"."
] | [] | [
{
"param": "type",
"type": "tree"
},
{
"param": "arg1",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg1",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_convert_const_fixed_from_fixed | tree | static tree
fold_convert_const_fixed_from_fixed (tree type, const_tree arg1)
{
FIXED_VALUE_TYPE value;
tree t;
bool overflow_p;
overflow_p = fixed_convert (&value, SCALAR_TYPE_MODE (type),
&TREE_FIXED_CST (arg1), TYPE_SATURATING (type));
t = build_fixed (type, value);
/* Propagate overflow flags. */
if (overflow_p | TREE_OVERFLOW (arg1))
TREE_OVERFLOW (t) = 1;
return t;
} | /* A subroutine of fold_convert_const handling conversions a FIXED_CST
to another fixed-point type. */ | A subroutine of fold_convert_const handling conversions a FIXED_CST
to another fixed-point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"a",
"FIXED_CST",
"to",
"another",
"fixed",
"-",
"point",
"type",
"."
] | static tree
fold_convert_const_fixed_from_fixed (tree type, const_tree arg1)
{
FIXED_VALUE_TYPE value;
tree t;
bool overflow_p;
overflow_p = fixed_convert (&value, SCALAR_TYPE_MODE (type),
&TREE_FIXED_CST (arg1), TYPE_SATURATING (type));
t = build_fixed (type, value);
if (overflow_p | TREE_OVERFLOW (arg1))
TREE_OVERFLOW (t) = 1;
return t;
} | [
"static",
"tree",
"fold_convert_const_fixed_from_fixed",
"(",
"tree",
"type",
",",
"const_tree",
"arg1",
")",
"{",
"FIXED_VALUE_TYPE",
"value",
";",
"tree",
"t",
";",
"bool",
"overflow_p",
";",
"overflow_p",
"=",
"fixed_convert",
"(",
"&",
"value",
",",
"SCALAR_TYPE_MODE",
"(",
"type",
")",
",",
"&",
"TREE_FIXED_CST",
"(",
"arg1",
")",
",",
"TYPE_SATURATING",
"(",
"type",
")",
")",
";",
"t",
"=",
"build_fixed",
"(",
"type",
",",
"value",
")",
";",
"if",
"(",
"overflow_p",
"|",
"TREE_OVERFLOW",
"(",
"arg1",
")",
")",
"TREE_OVERFLOW",
"(",
"t",
")",
"=",
"1",
";",
"return",
"t",
";",
"}"
] | A subroutine of fold_convert_const handling conversions a FIXED_CST
to another fixed-point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"a",
"FIXED_CST",
"to",
"another",
"fixed",
"-",
"point",
"type",
"."
] | [
"/* Propagate overflow flags. */"
] | [
{
"param": "type",
"type": "tree"
},
{
"param": "arg1",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg1",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_convert_const_fixed_from_int | tree | static tree
fold_convert_const_fixed_from_int (tree type, const_tree arg1)
{
FIXED_VALUE_TYPE value;
tree t;
bool overflow_p;
double_int di;
gcc_assert (TREE_INT_CST_NUNITS (arg1) <= 2);
di.low = TREE_INT_CST_ELT (arg1, 0);
if (TREE_INT_CST_NUNITS (arg1) == 1)
di.high = (HOST_WIDE_INT) di.low < 0 ? HOST_WIDE_INT_M1 : 0;
else
di.high = TREE_INT_CST_ELT (arg1, 1);
overflow_p = fixed_convert_from_int (&value, SCALAR_TYPE_MODE (type), di,
TYPE_UNSIGNED (TREE_TYPE (arg1)),
TYPE_SATURATING (type));
t = build_fixed (type, value);
/* Propagate overflow flags. */
if (overflow_p | TREE_OVERFLOW (arg1))
TREE_OVERFLOW (t) = 1;
return t;
} | /* A subroutine of fold_convert_const handling conversions an INTEGER_CST
to a fixed-point type. */ | A subroutine of fold_convert_const handling conversions an INTEGER_CST
to a fixed-point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"an",
"INTEGER_CST",
"to",
"a",
"fixed",
"-",
"point",
"type",
"."
] | static tree
fold_convert_const_fixed_from_int (tree type, const_tree arg1)
{
FIXED_VALUE_TYPE value;
tree t;
bool overflow_p;
double_int di;
gcc_assert (TREE_INT_CST_NUNITS (arg1) <= 2);
di.low = TREE_INT_CST_ELT (arg1, 0);
if (TREE_INT_CST_NUNITS (arg1) == 1)
di.high = (HOST_WIDE_INT) di.low < 0 ? HOST_WIDE_INT_M1 : 0;
else
di.high = TREE_INT_CST_ELT (arg1, 1);
overflow_p = fixed_convert_from_int (&value, SCALAR_TYPE_MODE (type), di,
TYPE_UNSIGNED (TREE_TYPE (arg1)),
TYPE_SATURATING (type));
t = build_fixed (type, value);
if (overflow_p | TREE_OVERFLOW (arg1))
TREE_OVERFLOW (t) = 1;
return t;
} | [
"static",
"tree",
"fold_convert_const_fixed_from_int",
"(",
"tree",
"type",
",",
"const_tree",
"arg1",
")",
"{",
"FIXED_VALUE_TYPE",
"value",
";",
"tree",
"t",
";",
"bool",
"overflow_p",
";",
"double_int",
"di",
";",
"gcc_assert",
"(",
"TREE_INT_CST_NUNITS",
"(",
"arg1",
")",
"<=",
"2",
")",
";",
"di",
".",
"low",
"=",
"TREE_INT_CST_ELT",
"(",
"arg1",
",",
"0",
")",
";",
"if",
"(",
"TREE_INT_CST_NUNITS",
"(",
"arg1",
")",
"==",
"1",
")",
"di",
".",
"high",
"=",
"(",
"HOST_WIDE_INT",
")",
"di",
".",
"low",
"<",
"0",
"?",
"HOST_WIDE_INT_M1",
":",
"0",
";",
"else",
"di",
".",
"high",
"=",
"TREE_INT_CST_ELT",
"(",
"arg1",
",",
"1",
")",
";",
"overflow_p",
"=",
"fixed_convert_from_int",
"(",
"&",
"value",
",",
"SCALAR_TYPE_MODE",
"(",
"type",
")",
",",
"di",
",",
"TYPE_UNSIGNED",
"(",
"TREE_TYPE",
"(",
"arg1",
")",
")",
",",
"TYPE_SATURATING",
"(",
"type",
")",
")",
";",
"t",
"=",
"build_fixed",
"(",
"type",
",",
"value",
")",
";",
"if",
"(",
"overflow_p",
"|",
"TREE_OVERFLOW",
"(",
"arg1",
")",
")",
"TREE_OVERFLOW",
"(",
"t",
")",
"=",
"1",
";",
"return",
"t",
";",
"}"
] | A subroutine of fold_convert_const handling conversions an INTEGER_CST
to a fixed-point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"an",
"INTEGER_CST",
"to",
"a",
"fixed",
"-",
"point",
"type",
"."
] | [
"/* Propagate overflow flags. */"
] | [
{
"param": "type",
"type": "tree"
},
{
"param": "arg1",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg1",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_convert_const_fixed_from_real | tree | static tree
fold_convert_const_fixed_from_real (tree type, const_tree arg1)
{
FIXED_VALUE_TYPE value;
tree t;
bool overflow_p;
overflow_p = fixed_convert_from_real (&value, SCALAR_TYPE_MODE (type),
&TREE_REAL_CST (arg1),
TYPE_SATURATING (type));
t = build_fixed (type, value);
/* Propagate overflow flags. */
if (overflow_p | TREE_OVERFLOW (arg1))
TREE_OVERFLOW (t) = 1;
return t;
} | /* A subroutine of fold_convert_const handling conversions a REAL_CST
to a fixed-point type. */ | A subroutine of fold_convert_const handling conversions a REAL_CST
to a fixed-point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"a",
"REAL_CST",
"to",
"a",
"fixed",
"-",
"point",
"type",
"."
] | static tree
fold_convert_const_fixed_from_real (tree type, const_tree arg1)
{
FIXED_VALUE_TYPE value;
tree t;
bool overflow_p;
overflow_p = fixed_convert_from_real (&value, SCALAR_TYPE_MODE (type),
&TREE_REAL_CST (arg1),
TYPE_SATURATING (type));
t = build_fixed (type, value);
if (overflow_p | TREE_OVERFLOW (arg1))
TREE_OVERFLOW (t) = 1;
return t;
} | [
"static",
"tree",
"fold_convert_const_fixed_from_real",
"(",
"tree",
"type",
",",
"const_tree",
"arg1",
")",
"{",
"FIXED_VALUE_TYPE",
"value",
";",
"tree",
"t",
";",
"bool",
"overflow_p",
";",
"overflow_p",
"=",
"fixed_convert_from_real",
"(",
"&",
"value",
",",
"SCALAR_TYPE_MODE",
"(",
"type",
")",
",",
"&",
"TREE_REAL_CST",
"(",
"arg1",
")",
",",
"TYPE_SATURATING",
"(",
"type",
")",
")",
";",
"t",
"=",
"build_fixed",
"(",
"type",
",",
"value",
")",
";",
"if",
"(",
"overflow_p",
"|",
"TREE_OVERFLOW",
"(",
"arg1",
")",
")",
"TREE_OVERFLOW",
"(",
"t",
")",
"=",
"1",
";",
"return",
"t",
";",
"}"
] | A subroutine of fold_convert_const handling conversions a REAL_CST
to a fixed-point type. | [
"A",
"subroutine",
"of",
"fold_convert_const",
"handling",
"conversions",
"a",
"REAL_CST",
"to",
"a",
"fixed",
"-",
"point",
"type",
"."
] | [
"/* Propagate overflow flags. */"
] | [
{
"param": "type",
"type": "tree"
},
{
"param": "arg1",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg1",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | build_zero_vector | tree | static tree
build_zero_vector (tree type)
{
tree t;
t = fold_convert_const (NOP_EXPR, TREE_TYPE (type), integer_zero_node);
return build_vector_from_val (type, t);
} | /* Construct a vector of zero elements of vector type TYPE. */ | Construct a vector of zero elements of vector type TYPE. | [
"Construct",
"a",
"vector",
"of",
"zero",
"elements",
"of",
"vector",
"type",
"TYPE",
"."
] | static tree
build_zero_vector (tree type)
{
tree t;
t = fold_convert_const (NOP_EXPR, TREE_TYPE (type), integer_zero_node);
return build_vector_from_val (type, t);
} | [
"static",
"tree",
"build_zero_vector",
"(",
"tree",
"type",
")",
"{",
"tree",
"t",
";",
"t",
"=",
"fold_convert_const",
"(",
"NOP_EXPR",
",",
"TREE_TYPE",
"(",
"type",
")",
",",
"integer_zero_node",
")",
";",
"return",
"build_vector_from_val",
"(",
"type",
",",
"t",
")",
";",
"}"
] | Construct a vector of zero elements of vector type TYPE. | [
"Construct",
"a",
"vector",
"of",
"zero",
"elements",
"of",
"vector",
"type",
"TYPE",
"."
] | [] | [
{
"param": "type",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_convertible_p | bool | bool
fold_convertible_p (const_tree type, const_tree arg)
{
tree orig = TREE_TYPE (arg);
if (type == orig)
return true;
if (TREE_CODE (arg) == ERROR_MARK
|| TREE_CODE (type) == ERROR_MARK
|| TREE_CODE (orig) == ERROR_MARK)
return false;
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig))
return true;
switch (TREE_CODE (type))
{
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
case POINTER_TYPE: case REFERENCE_TYPE:
case OFFSET_TYPE:
return (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
|| TREE_CODE (orig) == OFFSET_TYPE);
case REAL_TYPE:
case FIXED_POINT_TYPE:
case VECTOR_TYPE:
case VOID_TYPE:
return TREE_CODE (type) == TREE_CODE (orig);
default:
return false;
}
} | /* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. */ | Returns true, if ARG is convertible to TYPE using a NOP_EXPR. | [
"Returns",
"true",
"if",
"ARG",
"is",
"convertible",
"to",
"TYPE",
"using",
"a",
"NOP_EXPR",
"."
] | bool
fold_convertible_p (const_tree type, const_tree arg)
{
tree orig = TREE_TYPE (arg);
if (type == orig)
return true;
if (TREE_CODE (arg) == ERROR_MARK
|| TREE_CODE (type) == ERROR_MARK
|| TREE_CODE (orig) == ERROR_MARK)
return false;
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig))
return true;
switch (TREE_CODE (type))
{
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
case POINTER_TYPE: case REFERENCE_TYPE:
case OFFSET_TYPE:
return (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
|| TREE_CODE (orig) == OFFSET_TYPE);
case REAL_TYPE:
case FIXED_POINT_TYPE:
case VECTOR_TYPE:
case VOID_TYPE:
return TREE_CODE (type) == TREE_CODE (orig);
default:
return false;
}
} | [
"bool",
"fold_convertible_p",
"(",
"const_tree",
"type",
",",
"const_tree",
"arg",
")",
"{",
"tree",
"orig",
"=",
"TREE_TYPE",
"(",
"arg",
")",
";",
"if",
"(",
"type",
"==",
"orig",
")",
"return",
"true",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"ERROR_MARK",
"||",
"TREE_CODE",
"(",
"type",
")",
"==",
"ERROR_MARK",
"||",
"TREE_CODE",
"(",
"orig",
")",
"==",
"ERROR_MARK",
")",
"return",
"false",
";",
"if",
"(",
"TYPE_MAIN_VARIANT",
"(",
"type",
")",
"==",
"TYPE_MAIN_VARIANT",
"(",
"orig",
")",
")",
"return",
"true",
";",
"switch",
"(",
"TREE_CODE",
"(",
"type",
")",
")",
"{",
"case",
"INTEGER_TYPE",
":",
"case",
"ENUMERAL_TYPE",
":",
"case",
"BOOLEAN_TYPE",
":",
"case",
"POINTER_TYPE",
":",
"case",
"REFERENCE_TYPE",
":",
"case",
"OFFSET_TYPE",
":",
"return",
"(",
"INTEGRAL_TYPE_P",
"(",
"orig",
")",
"||",
"POINTER_TYPE_P",
"(",
"orig",
")",
"||",
"TREE_CODE",
"(",
"orig",
")",
"==",
"OFFSET_TYPE",
")",
";",
"case",
"REAL_TYPE",
":",
"case",
"FIXED_POINT_TYPE",
":",
"case",
"VECTOR_TYPE",
":",
"case",
"VOID_TYPE",
":",
"return",
"TREE_CODE",
"(",
"type",
")",
"==",
"TREE_CODE",
"(",
"orig",
")",
";",
"default",
":",
"return",
"false",
";",
"}",
"}"
] | Returns true, if ARG is convertible to TYPE using a NOP_EXPR. | [
"Returns",
"true",
"if",
"ARG",
"is",
"convertible",
"to",
"TYPE",
"using",
"a",
"NOP_EXPR",
"."
] | [] | [
{
"param": "type",
"type": "const_tree"
},
{
"param": "arg",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_convert_loc | tree | tree
fold_convert_loc (location_t loc, tree type, tree arg)
{
tree orig = TREE_TYPE (arg);
tree tem;
if (type == orig)
return arg;
if (TREE_CODE (arg) == ERROR_MARK
|| TREE_CODE (type) == ERROR_MARK
|| TREE_CODE (orig) == ERROR_MARK)
return error_mark_node;
switch (TREE_CODE (type))
{
case POINTER_TYPE:
case REFERENCE_TYPE:
/* Handle conversions between pointers to different address spaces. */
if (POINTER_TYPE_P (orig)
&& (TYPE_ADDR_SPACE (TREE_TYPE (type))
!= TYPE_ADDR_SPACE (TREE_TYPE (orig))))
return fold_build1_loc (loc, ADDR_SPACE_CONVERT_EXPR, type, arg);
/* fall through */
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
case OFFSET_TYPE:
if (TREE_CODE (arg) == INTEGER_CST)
{
tem = fold_convert_const (NOP_EXPR, type, arg);
if (tem != NULL_TREE)
return tem;
}
if (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
|| TREE_CODE (orig) == OFFSET_TYPE)
return fold_build1_loc (loc, NOP_EXPR, type, arg);
if (TREE_CODE (orig) == COMPLEX_TYPE)
return fold_convert_loc (loc, type,
fold_build1_loc (loc, REALPART_EXPR,
TREE_TYPE (orig), arg));
gcc_assert (TREE_CODE (orig) == VECTOR_TYPE
&& tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg);
case REAL_TYPE:
if (TREE_CODE (arg) == INTEGER_CST)
{
tem = fold_convert_const (FLOAT_EXPR, type, arg);
if (tem != NULL_TREE)
return tem;
}
else if (TREE_CODE (arg) == REAL_CST)
{
tem = fold_convert_const (NOP_EXPR, type, arg);
if (tem != NULL_TREE)
return tem;
}
else if (TREE_CODE (arg) == FIXED_CST)
{
tem = fold_convert_const (FIXED_CONVERT_EXPR, type, arg);
if (tem != NULL_TREE)
return tem;
}
switch (TREE_CODE (orig))
{
case INTEGER_TYPE:
case BOOLEAN_TYPE: case ENUMERAL_TYPE:
case POINTER_TYPE: case REFERENCE_TYPE:
return fold_build1_loc (loc, FLOAT_EXPR, type, arg);
case REAL_TYPE:
return fold_build1_loc (loc, NOP_EXPR, type, arg);
case FIXED_POINT_TYPE:
return fold_build1_loc (loc, FIXED_CONVERT_EXPR, type, arg);
case COMPLEX_TYPE:
tem = fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig), arg);
return fold_convert_loc (loc, type, tem);
default:
gcc_unreachable ();
}
case FIXED_POINT_TYPE:
if (TREE_CODE (arg) == FIXED_CST || TREE_CODE (arg) == INTEGER_CST
|| TREE_CODE (arg) == REAL_CST)
{
tem = fold_convert_const (FIXED_CONVERT_EXPR, type, arg);
if (tem != NULL_TREE)
goto fold_convert_exit;
}
switch (TREE_CODE (orig))
{
case FIXED_POINT_TYPE:
case INTEGER_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case REAL_TYPE:
return fold_build1_loc (loc, FIXED_CONVERT_EXPR, type, arg);
case COMPLEX_TYPE:
tem = fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig), arg);
return fold_convert_loc (loc, type, tem);
default:
gcc_unreachable ();
}
case COMPLEX_TYPE:
switch (TREE_CODE (orig))
{
case INTEGER_TYPE:
case BOOLEAN_TYPE: case ENUMERAL_TYPE:
case POINTER_TYPE: case REFERENCE_TYPE:
case REAL_TYPE:
case FIXED_POINT_TYPE:
return fold_build2_loc (loc, COMPLEX_EXPR, type,
fold_convert_loc (loc, TREE_TYPE (type), arg),
fold_convert_loc (loc, TREE_TYPE (type),
integer_zero_node));
case COMPLEX_TYPE:
{
tree rpart, ipart;
if (TREE_CODE (arg) == COMPLEX_EXPR)
{
rpart = fold_convert_loc (loc, TREE_TYPE (type),
TREE_OPERAND (arg, 0));
ipart = fold_convert_loc (loc, TREE_TYPE (type),
TREE_OPERAND (arg, 1));
return fold_build2_loc (loc, COMPLEX_EXPR, type, rpart, ipart);
}
arg = save_expr (arg);
rpart = fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig), arg);
ipart = fold_build1_loc (loc, IMAGPART_EXPR, TREE_TYPE (orig), arg);
rpart = fold_convert_loc (loc, TREE_TYPE (type), rpart);
ipart = fold_convert_loc (loc, TREE_TYPE (type), ipart);
return fold_build2_loc (loc, COMPLEX_EXPR, type, rpart, ipart);
}
default:
gcc_unreachable ();
}
case VECTOR_TYPE:
if (integer_zerop (arg))
return build_zero_vector (type);
gcc_assert (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
gcc_assert (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
|| TREE_CODE (orig) == VECTOR_TYPE);
return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg);
case VOID_TYPE:
tem = fold_ignored_result (arg);
return fold_build1_loc (loc, NOP_EXPR, type, tem);
default:
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig))
return fold_build1_loc (loc, NOP_EXPR, type, arg);
gcc_unreachable ();
}
fold_convert_exit:
protected_set_expr_location_unshare (tem, loc);
return tem;
} | /* Convert expression ARG to type TYPE. Used by the middle-end for
simple conversions in preference to calling the front-end's convert. */ | Convert expression ARG to type TYPE. Used by the middle-end for
simple conversions in preference to calling the front-end's convert. | [
"Convert",
"expression",
"ARG",
"to",
"type",
"TYPE",
".",
"Used",
"by",
"the",
"middle",
"-",
"end",
"for",
"simple",
"conversions",
"in",
"preference",
"to",
"calling",
"the",
"front",
"-",
"end",
"'",
"s",
"convert",
"."
] | tree
fold_convert_loc (location_t loc, tree type, tree arg)
{
tree orig = TREE_TYPE (arg);
tree tem;
if (type == orig)
return arg;
if (TREE_CODE (arg) == ERROR_MARK
|| TREE_CODE (type) == ERROR_MARK
|| TREE_CODE (orig) == ERROR_MARK)
return error_mark_node;
switch (TREE_CODE (type))
{
case POINTER_TYPE:
case REFERENCE_TYPE:
if (POINTER_TYPE_P (orig)
&& (TYPE_ADDR_SPACE (TREE_TYPE (type))
!= TYPE_ADDR_SPACE (TREE_TYPE (orig))))
return fold_build1_loc (loc, ADDR_SPACE_CONVERT_EXPR, type, arg);
case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
case OFFSET_TYPE:
if (TREE_CODE (arg) == INTEGER_CST)
{
tem = fold_convert_const (NOP_EXPR, type, arg);
if (tem != NULL_TREE)
return tem;
}
if (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
|| TREE_CODE (orig) == OFFSET_TYPE)
return fold_build1_loc (loc, NOP_EXPR, type, arg);
if (TREE_CODE (orig) == COMPLEX_TYPE)
return fold_convert_loc (loc, type,
fold_build1_loc (loc, REALPART_EXPR,
TREE_TYPE (orig), arg));
gcc_assert (TREE_CODE (orig) == VECTOR_TYPE
&& tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg);
case REAL_TYPE:
if (TREE_CODE (arg) == INTEGER_CST)
{
tem = fold_convert_const (FLOAT_EXPR, type, arg);
if (tem != NULL_TREE)
return tem;
}
else if (TREE_CODE (arg) == REAL_CST)
{
tem = fold_convert_const (NOP_EXPR, type, arg);
if (tem != NULL_TREE)
return tem;
}
else if (TREE_CODE (arg) == FIXED_CST)
{
tem = fold_convert_const (FIXED_CONVERT_EXPR, type, arg);
if (tem != NULL_TREE)
return tem;
}
switch (TREE_CODE (orig))
{
case INTEGER_TYPE:
case BOOLEAN_TYPE: case ENUMERAL_TYPE:
case POINTER_TYPE: case REFERENCE_TYPE:
return fold_build1_loc (loc, FLOAT_EXPR, type, arg);
case REAL_TYPE:
return fold_build1_loc (loc, NOP_EXPR, type, arg);
case FIXED_POINT_TYPE:
return fold_build1_loc (loc, FIXED_CONVERT_EXPR, type, arg);
case COMPLEX_TYPE:
tem = fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig), arg);
return fold_convert_loc (loc, type, tem);
default:
gcc_unreachable ();
}
case FIXED_POINT_TYPE:
if (TREE_CODE (arg) == FIXED_CST || TREE_CODE (arg) == INTEGER_CST
|| TREE_CODE (arg) == REAL_CST)
{
tem = fold_convert_const (FIXED_CONVERT_EXPR, type, arg);
if (tem != NULL_TREE)
goto fold_convert_exit;
}
switch (TREE_CODE (orig))
{
case FIXED_POINT_TYPE:
case INTEGER_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case REAL_TYPE:
return fold_build1_loc (loc, FIXED_CONVERT_EXPR, type, arg);
case COMPLEX_TYPE:
tem = fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig), arg);
return fold_convert_loc (loc, type, tem);
default:
gcc_unreachable ();
}
case COMPLEX_TYPE:
switch (TREE_CODE (orig))
{
case INTEGER_TYPE:
case BOOLEAN_TYPE: case ENUMERAL_TYPE:
case POINTER_TYPE: case REFERENCE_TYPE:
case REAL_TYPE:
case FIXED_POINT_TYPE:
return fold_build2_loc (loc, COMPLEX_EXPR, type,
fold_convert_loc (loc, TREE_TYPE (type), arg),
fold_convert_loc (loc, TREE_TYPE (type),
integer_zero_node));
case COMPLEX_TYPE:
{
tree rpart, ipart;
if (TREE_CODE (arg) == COMPLEX_EXPR)
{
rpart = fold_convert_loc (loc, TREE_TYPE (type),
TREE_OPERAND (arg, 0));
ipart = fold_convert_loc (loc, TREE_TYPE (type),
TREE_OPERAND (arg, 1));
return fold_build2_loc (loc, COMPLEX_EXPR, type, rpart, ipart);
}
arg = save_expr (arg);
rpart = fold_build1_loc (loc, REALPART_EXPR, TREE_TYPE (orig), arg);
ipart = fold_build1_loc (loc, IMAGPART_EXPR, TREE_TYPE (orig), arg);
rpart = fold_convert_loc (loc, TREE_TYPE (type), rpart);
ipart = fold_convert_loc (loc, TREE_TYPE (type), ipart);
return fold_build2_loc (loc, COMPLEX_EXPR, type, rpart, ipart);
}
default:
gcc_unreachable ();
}
case VECTOR_TYPE:
if (integer_zerop (arg))
return build_zero_vector (type);
gcc_assert (tree_int_cst_equal (TYPE_SIZE (type), TYPE_SIZE (orig)));
gcc_assert (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
|| TREE_CODE (orig) == VECTOR_TYPE);
return fold_build1_loc (loc, VIEW_CONVERT_EXPR, type, arg);
case VOID_TYPE:
tem = fold_ignored_result (arg);
return fold_build1_loc (loc, NOP_EXPR, type, tem);
default:
if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (orig))
return fold_build1_loc (loc, NOP_EXPR, type, arg);
gcc_unreachable ();
}
fold_convert_exit:
protected_set_expr_location_unshare (tem, loc);
return tem;
} | [
"tree",
"fold_convert_loc",
"(",
"location_t",
"loc",
",",
"tree",
"type",
",",
"tree",
"arg",
")",
"{",
"tree",
"orig",
"=",
"TREE_TYPE",
"(",
"arg",
")",
";",
"tree",
"tem",
";",
"if",
"(",
"type",
"==",
"orig",
")",
"return",
"arg",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"ERROR_MARK",
"||",
"TREE_CODE",
"(",
"type",
")",
"==",
"ERROR_MARK",
"||",
"TREE_CODE",
"(",
"orig",
")",
"==",
"ERROR_MARK",
")",
"return",
"error_mark_node",
";",
"switch",
"(",
"TREE_CODE",
"(",
"type",
")",
")",
"{",
"case",
"POINTER_TYPE",
":",
"case",
"REFERENCE_TYPE",
":",
"if",
"(",
"POINTER_TYPE_P",
"(",
"orig",
")",
"&&",
"(",
"TYPE_ADDR_SPACE",
"(",
"TREE_TYPE",
"(",
"type",
")",
")",
"!=",
"TYPE_ADDR_SPACE",
"(",
"TREE_TYPE",
"(",
"orig",
")",
")",
")",
")",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"ADDR_SPACE_CONVERT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"case",
"INTEGER_TYPE",
":",
"case",
"ENUMERAL_TYPE",
":",
"case",
"BOOLEAN_TYPE",
":",
"case",
"OFFSET_TYPE",
":",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"INTEGER_CST",
")",
"{",
"tem",
"=",
"fold_convert_const",
"(",
"NOP_EXPR",
",",
"type",
",",
"arg",
")",
";",
"if",
"(",
"tem",
"!=",
"NULL_TREE",
")",
"return",
"tem",
";",
"}",
"if",
"(",
"INTEGRAL_TYPE_P",
"(",
"orig",
")",
"||",
"POINTER_TYPE_P",
"(",
"orig",
")",
"||",
"TREE_CODE",
"(",
"orig",
")",
"==",
"OFFSET_TYPE",
")",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"NOP_EXPR",
",",
"type",
",",
"arg",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"orig",
")",
"==",
"COMPLEX_TYPE",
")",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"fold_build1_loc",
"(",
"loc",
",",
"REALPART_EXPR",
",",
"TREE_TYPE",
"(",
"orig",
")",
",",
"arg",
")",
")",
";",
"gcc_assert",
"(",
"TREE_CODE",
"(",
"orig",
")",
"==",
"VECTOR_TYPE",
"&&",
"tree_int_cst_equal",
"(",
"TYPE_SIZE",
"(",
"type",
")",
",",
"TYPE_SIZE",
"(",
"orig",
")",
")",
")",
";",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"VIEW_CONVERT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"case",
"REAL_TYPE",
":",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"INTEGER_CST",
")",
"{",
"tem",
"=",
"fold_convert_const",
"(",
"FLOAT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"if",
"(",
"tem",
"!=",
"NULL_TREE",
")",
"return",
"tem",
";",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"REAL_CST",
")",
"{",
"tem",
"=",
"fold_convert_const",
"(",
"NOP_EXPR",
",",
"type",
",",
"arg",
")",
";",
"if",
"(",
"tem",
"!=",
"NULL_TREE",
")",
"return",
"tem",
";",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"FIXED_CST",
")",
"{",
"tem",
"=",
"fold_convert_const",
"(",
"FIXED_CONVERT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"if",
"(",
"tem",
"!=",
"NULL_TREE",
")",
"return",
"tem",
";",
"}",
"switch",
"(",
"TREE_CODE",
"(",
"orig",
")",
")",
"{",
"case",
"INTEGER_TYPE",
":",
"case",
"BOOLEAN_TYPE",
":",
"case",
"ENUMERAL_TYPE",
":",
"case",
"POINTER_TYPE",
":",
"case",
"REFERENCE_TYPE",
":",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"FLOAT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"case",
"REAL_TYPE",
":",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"NOP_EXPR",
",",
"type",
",",
"arg",
")",
";",
"case",
"FIXED_POINT_TYPE",
":",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"FIXED_CONVERT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"case",
"COMPLEX_TYPE",
":",
"tem",
"=",
"fold_build1_loc",
"(",
"loc",
",",
"REALPART_EXPR",
",",
"TREE_TYPE",
"(",
"orig",
")",
",",
"arg",
")",
";",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"tem",
")",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"case",
"FIXED_POINT_TYPE",
":",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"FIXED_CST",
"||",
"TREE_CODE",
"(",
"arg",
")",
"==",
"INTEGER_CST",
"||",
"TREE_CODE",
"(",
"arg",
")",
"==",
"REAL_CST",
")",
"{",
"tem",
"=",
"fold_convert_const",
"(",
"FIXED_CONVERT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"if",
"(",
"tem",
"!=",
"NULL_TREE",
")",
"goto",
"fold_convert_exit",
";",
"}",
"switch",
"(",
"TREE_CODE",
"(",
"orig",
")",
")",
"{",
"case",
"FIXED_POINT_TYPE",
":",
"case",
"INTEGER_TYPE",
":",
"case",
"ENUMERAL_TYPE",
":",
"case",
"BOOLEAN_TYPE",
":",
"case",
"REAL_TYPE",
":",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"FIXED_CONVERT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"case",
"COMPLEX_TYPE",
":",
"tem",
"=",
"fold_build1_loc",
"(",
"loc",
",",
"REALPART_EXPR",
",",
"TREE_TYPE",
"(",
"orig",
")",
",",
"arg",
")",
";",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"tem",
")",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"case",
"COMPLEX_TYPE",
":",
"switch",
"(",
"TREE_CODE",
"(",
"orig",
")",
")",
"{",
"case",
"INTEGER_TYPE",
":",
"case",
"BOOLEAN_TYPE",
":",
"case",
"ENUMERAL_TYPE",
":",
"case",
"POINTER_TYPE",
":",
"case",
"REFERENCE_TYPE",
":",
"case",
"REAL_TYPE",
":",
"case",
"FIXED_POINT_TYPE",
":",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"COMPLEX_EXPR",
",",
"type",
",",
"fold_convert_loc",
"(",
"loc",
",",
"TREE_TYPE",
"(",
"type",
")",
",",
"arg",
")",
",",
"fold_convert_loc",
"(",
"loc",
",",
"TREE_TYPE",
"(",
"type",
")",
",",
"integer_zero_node",
")",
")",
";",
"case",
"COMPLEX_TYPE",
":",
"{",
"tree",
"rpart",
",",
"ipart",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"COMPLEX_EXPR",
")",
"{",
"rpart",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"TREE_TYPE",
"(",
"type",
")",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
";",
"ipart",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"TREE_TYPE",
"(",
"type",
")",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
";",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"COMPLEX_EXPR",
",",
"type",
",",
"rpart",
",",
"ipart",
")",
";",
"}",
"arg",
"=",
"save_expr",
"(",
"arg",
")",
";",
"rpart",
"=",
"fold_build1_loc",
"(",
"loc",
",",
"REALPART_EXPR",
",",
"TREE_TYPE",
"(",
"orig",
")",
",",
"arg",
")",
";",
"ipart",
"=",
"fold_build1_loc",
"(",
"loc",
",",
"IMAGPART_EXPR",
",",
"TREE_TYPE",
"(",
"orig",
")",
",",
"arg",
")",
";",
"rpart",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"TREE_TYPE",
"(",
"type",
")",
",",
"rpart",
")",
";",
"ipart",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"TREE_TYPE",
"(",
"type",
")",
",",
"ipart",
")",
";",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"COMPLEX_EXPR",
",",
"type",
",",
"rpart",
",",
"ipart",
")",
";",
"}",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"case",
"VECTOR_TYPE",
":",
"if",
"(",
"integer_zerop",
"(",
"arg",
")",
")",
"return",
"build_zero_vector",
"(",
"type",
")",
";",
"gcc_assert",
"(",
"tree_int_cst_equal",
"(",
"TYPE_SIZE",
"(",
"type",
")",
",",
"TYPE_SIZE",
"(",
"orig",
")",
")",
")",
";",
"gcc_assert",
"(",
"INTEGRAL_TYPE_P",
"(",
"orig",
")",
"||",
"POINTER_TYPE_P",
"(",
"orig",
")",
"||",
"TREE_CODE",
"(",
"orig",
")",
"==",
"VECTOR_TYPE",
")",
";",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"VIEW_CONVERT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"case",
"VOID_TYPE",
":",
"tem",
"=",
"fold_ignored_result",
"(",
"arg",
")",
";",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"NOP_EXPR",
",",
"type",
",",
"tem",
")",
";",
"default",
":",
"if",
"(",
"TYPE_MAIN_VARIANT",
"(",
"type",
")",
"==",
"TYPE_MAIN_VARIANT",
"(",
"orig",
")",
")",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"NOP_EXPR",
",",
"type",
",",
"arg",
")",
";",
"gcc_unreachable",
"(",
")",
";",
"}",
"fold_convert_exit",
":",
"protected_set_expr_location_unshare",
"(",
"tem",
",",
"loc",
")",
";",
"return",
"tem",
";",
"}"
] | Convert expression ARG to type TYPE. | [
"Convert",
"expression",
"ARG",
"to",
"type",
"TYPE",
"."
] | [
"/* Handle conversions between pointers to different address spaces. */",
"/* fall through */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "type",
"type": "tree"
},
{
"param": "arg",
"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
},
{
"identifier": "arg",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | maybe_lvalue_p | bool | static bool
maybe_lvalue_p (const_tree x)
{
/* We only need to wrap lvalue tree codes. */
switch (TREE_CODE (x))
{
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
case LABEL_DECL:
case FUNCTION_DECL:
case SSA_NAME:
case COMPONENT_REF:
case MEM_REF:
case INDIRECT_REF:
case ARRAY_REF:
case ARRAY_RANGE_REF:
case BIT_FIELD_REF:
case OBJ_TYPE_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
case SAVE_EXPR:
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case COMPOUND_EXPR:
case MODIFY_EXPR:
case TARGET_EXPR:
case COND_EXPR:
case BIND_EXPR:
break;
default:
/* Assume the worst for front-end tree codes. */
if ((int)TREE_CODE (x) >= NUM_TREE_CODES)
break;
return false;
}
return true;
} | /* Return false if expr can be assumed not to be an lvalue, true
otherwise. */ | Return false if expr can be assumed not to be an lvalue, true
otherwise. | [
"Return",
"false",
"if",
"expr",
"can",
"be",
"assumed",
"not",
"to",
"be",
"an",
"lvalue",
"true",
"otherwise",
"."
] | static bool
maybe_lvalue_p (const_tree x)
{
switch (TREE_CODE (x))
{
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
case LABEL_DECL:
case FUNCTION_DECL:
case SSA_NAME:
case COMPONENT_REF:
case MEM_REF:
case INDIRECT_REF:
case ARRAY_REF:
case ARRAY_RANGE_REF:
case BIT_FIELD_REF:
case OBJ_TYPE_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
case SAVE_EXPR:
case TRY_CATCH_EXPR:
case WITH_CLEANUP_EXPR:
case COMPOUND_EXPR:
case MODIFY_EXPR:
case TARGET_EXPR:
case COND_EXPR:
case BIND_EXPR:
break;
default:
if ((int)TREE_CODE (x) >= NUM_TREE_CODES)
break;
return false;
}
return true;
} | [
"static",
"bool",
"maybe_lvalue_p",
"(",
"const_tree",
"x",
")",
"{",
"switch",
"(",
"TREE_CODE",
"(",
"x",
")",
")",
"{",
"case",
"VAR_DECL",
":",
"case",
"PARM_DECL",
":",
"case",
"RESULT_DECL",
":",
"case",
"LABEL_DECL",
":",
"case",
"FUNCTION_DECL",
":",
"case",
"SSA_NAME",
":",
"case",
"COMPONENT_REF",
":",
"case",
"MEM_REF",
":",
"case",
"INDIRECT_REF",
":",
"case",
"ARRAY_REF",
":",
"case",
"ARRAY_RANGE_REF",
":",
"case",
"BIT_FIELD_REF",
":",
"case",
"OBJ_TYPE_REF",
":",
"case",
"REALPART_EXPR",
":",
"case",
"IMAGPART_EXPR",
":",
"case",
"PREINCREMENT_EXPR",
":",
"case",
"PREDECREMENT_EXPR",
":",
"case",
"SAVE_EXPR",
":",
"case",
"TRY_CATCH_EXPR",
":",
"case",
"WITH_CLEANUP_EXPR",
":",
"case",
"COMPOUND_EXPR",
":",
"case",
"MODIFY_EXPR",
":",
"case",
"TARGET_EXPR",
":",
"case",
"COND_EXPR",
":",
"case",
"BIND_EXPR",
":",
"break",
";",
"default",
":",
"if",
"(",
"(",
"int",
")",
"TREE_CODE",
"(",
"x",
")",
">=",
"NUM_TREE_CODES",
")",
"break",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Return false if expr can be assumed not to be an lvalue, true
otherwise. | [
"Return",
"false",
"if",
"expr",
"can",
"be",
"assumed",
"not",
"to",
"be",
"an",
"lvalue",
"true",
"otherwise",
"."
] | [
"/* We only need to wrap lvalue tree codes. */",
"/* Assume the worst for front-end tree codes. */"
] | [
{
"param": "x",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | non_lvalue_loc | tree | tree
non_lvalue_loc (location_t loc, tree x)
{
/* While we are in GIMPLE, NON_LVALUE_EXPR doesn't mean anything to
us. */
if (in_gimple_form)
return x;
if (! maybe_lvalue_p (x))
return x;
return build1_loc (loc, NON_LVALUE_EXPR, TREE_TYPE (x), x);
} | /* Return an expr equal to X but certainly not valid as an lvalue. */ | Return an expr equal to X but certainly not valid as an lvalue. | [
"Return",
"an",
"expr",
"equal",
"to",
"X",
"but",
"certainly",
"not",
"valid",
"as",
"an",
"lvalue",
"."
] | tree
non_lvalue_loc (location_t loc, tree x)
{
if (in_gimple_form)
return x;
if (! maybe_lvalue_p (x))
return x;
return build1_loc (loc, NON_LVALUE_EXPR, TREE_TYPE (x), x);
} | [
"tree",
"non_lvalue_loc",
"(",
"location_t",
"loc",
",",
"tree",
"x",
")",
"{",
"if",
"(",
"in_gimple_form",
")",
"return",
"x",
";",
"if",
"(",
"!",
"maybe_lvalue_p",
"(",
"x",
")",
")",
"return",
"x",
";",
"return",
"build1_loc",
"(",
"loc",
",",
"NON_LVALUE_EXPR",
",",
"TREE_TYPE",
"(",
"x",
")",
",",
"x",
")",
";",
"}"
] | Return an expr equal to X but certainly not valid as an lvalue. | [
"Return",
"an",
"expr",
"equal",
"to",
"X",
"but",
"certainly",
"not",
"valid",
"as",
"an",
"lvalue",
"."
] | [
"/* While we are in GIMPLE, NON_LVALUE_EXPR doesn't mean anything to\n us. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "x",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | pedantic_non_lvalue_loc | tree | static tree
pedantic_non_lvalue_loc (location_t loc, tree x)
{
return protected_set_expr_location_unshare (x, loc);
} | /* When pedantic, return an expr equal to X but certainly not valid as a
pedantic lvalue. Otherwise, return X. */ | When pedantic, return an expr equal to X but certainly not valid as a
pedantic lvalue. Otherwise, return X. | [
"When",
"pedantic",
"return",
"an",
"expr",
"equal",
"to",
"X",
"but",
"certainly",
"not",
"valid",
"as",
"a",
"pedantic",
"lvalue",
".",
"Otherwise",
"return",
"X",
"."
] | static tree
pedantic_non_lvalue_loc (location_t loc, tree x)
{
return protected_set_expr_location_unshare (x, loc);
} | [
"static",
"tree",
"pedantic_non_lvalue_loc",
"(",
"location_t",
"loc",
",",
"tree",
"x",
")",
"{",
"return",
"protected_set_expr_location_unshare",
"(",
"x",
",",
"loc",
")",
";",
"}"
] | When pedantic, return an expr equal to X but certainly not valid as a
pedantic lvalue. | [
"When",
"pedantic",
"return",
"an",
"expr",
"equal",
"to",
"X",
"but",
"certainly",
"not",
"valid",
"as",
"a",
"pedantic",
"lvalue",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "x",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | invert_tree_comparison | null | enum tree_code
invert_tree_comparison (enum tree_code code, bool honor_nans)
{
if (honor_nans && flag_trapping_math && code != EQ_EXPR && code != NE_EXPR
&& code != ORDERED_EXPR && code != UNORDERED_EXPR)
return ERROR_MARK;
switch (code)
{
case EQ_EXPR:
return NE_EXPR;
case NE_EXPR:
return EQ_EXPR;
case GT_EXPR:
return honor_nans ? UNLE_EXPR : LE_EXPR;
case GE_EXPR:
return honor_nans ? UNLT_EXPR : LT_EXPR;
case LT_EXPR:
return honor_nans ? UNGE_EXPR : GE_EXPR;
case LE_EXPR:
return honor_nans ? UNGT_EXPR : GT_EXPR;
case LTGT_EXPR:
return UNEQ_EXPR;
case UNEQ_EXPR:
return LTGT_EXPR;
case UNGT_EXPR:
return LE_EXPR;
case UNGE_EXPR:
return LT_EXPR;
case UNLT_EXPR:
return GE_EXPR;
case UNLE_EXPR:
return GT_EXPR;
case ORDERED_EXPR:
return UNORDERED_EXPR;
case UNORDERED_EXPR:
return ORDERED_EXPR;
default:
gcc_unreachable ();
}
} | /* Given a tree comparison code, return the code that is the logical inverse.
It is generally not safe to do this for floating-point comparisons, except
for EQ_EXPR, NE_EXPR, ORDERED_EXPR and UNORDERED_EXPR, so we return
ERROR_MARK in this case. */ | Given a tree comparison code, return the code that is the logical inverse.
It is generally not safe to do this for floating-point comparisons, except
for EQ_EXPR, NE_EXPR, ORDERED_EXPR and UNORDERED_EXPR, so we return
ERROR_MARK in this case. | [
"Given",
"a",
"tree",
"comparison",
"code",
"return",
"the",
"code",
"that",
"is",
"the",
"logical",
"inverse",
".",
"It",
"is",
"generally",
"not",
"safe",
"to",
"do",
"this",
"for",
"floating",
"-",
"point",
"comparisons",
"except",
"for",
"EQ_EXPR",
"NE_EXPR",
"ORDERED_EXPR",
"and",
"UNORDERED_EXPR",
"so",
"we",
"return",
"ERROR_MARK",
"in",
"this",
"case",
"."
] | enum tree_code
invert_tree_comparison (enum tree_code code, bool honor_nans)
{
if (honor_nans && flag_trapping_math && code != EQ_EXPR && code != NE_EXPR
&& code != ORDERED_EXPR && code != UNORDERED_EXPR)
return ERROR_MARK;
switch (code)
{
case EQ_EXPR:
return NE_EXPR;
case NE_EXPR:
return EQ_EXPR;
case GT_EXPR:
return honor_nans ? UNLE_EXPR : LE_EXPR;
case GE_EXPR:
return honor_nans ? UNLT_EXPR : LT_EXPR;
case LT_EXPR:
return honor_nans ? UNGE_EXPR : GE_EXPR;
case LE_EXPR:
return honor_nans ? UNGT_EXPR : GT_EXPR;
case LTGT_EXPR:
return UNEQ_EXPR;
case UNEQ_EXPR:
return LTGT_EXPR;
case UNGT_EXPR:
return LE_EXPR;
case UNGE_EXPR:
return LT_EXPR;
case UNLT_EXPR:
return GE_EXPR;
case UNLE_EXPR:
return GT_EXPR;
case ORDERED_EXPR:
return UNORDERED_EXPR;
case UNORDERED_EXPR:
return ORDERED_EXPR;
default:
gcc_unreachable ();
}
} | [
"enum",
"tree_code",
"invert_tree_comparison",
"(",
"enum",
"tree_code",
"code",
",",
"bool",
"honor_nans",
")",
"{",
"if",
"(",
"honor_nans",
"&&",
"flag_trapping_math",
"&&",
"code",
"!=",
"EQ_EXPR",
"&&",
"code",
"!=",
"NE_EXPR",
"&&",
"code",
"!=",
"ORDERED_EXPR",
"&&",
"code",
"!=",
"UNORDERED_EXPR",
")",
"return",
"ERROR_MARK",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"EQ_EXPR",
":",
"return",
"NE_EXPR",
";",
"case",
"NE_EXPR",
":",
"return",
"EQ_EXPR",
";",
"case",
"GT_EXPR",
":",
"return",
"honor_nans",
"?",
"UNLE_EXPR",
":",
"LE_EXPR",
";",
"case",
"GE_EXPR",
":",
"return",
"honor_nans",
"?",
"UNLT_EXPR",
":",
"LT_EXPR",
";",
"case",
"LT_EXPR",
":",
"return",
"honor_nans",
"?",
"UNGE_EXPR",
":",
"GE_EXPR",
";",
"case",
"LE_EXPR",
":",
"return",
"honor_nans",
"?",
"UNGT_EXPR",
":",
"GT_EXPR",
";",
"case",
"LTGT_EXPR",
":",
"return",
"UNEQ_EXPR",
";",
"case",
"UNEQ_EXPR",
":",
"return",
"LTGT_EXPR",
";",
"case",
"UNGT_EXPR",
":",
"return",
"LE_EXPR",
";",
"case",
"UNGE_EXPR",
":",
"return",
"LT_EXPR",
";",
"case",
"UNLT_EXPR",
":",
"return",
"GE_EXPR",
";",
"case",
"UNLE_EXPR",
":",
"return",
"GT_EXPR",
";",
"case",
"ORDERED_EXPR",
":",
"return",
"UNORDERED_EXPR",
";",
"case",
"UNORDERED_EXPR",
":",
"return",
"ORDERED_EXPR",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"}"
] | Given a tree comparison code, return the code that is the logical inverse. | [
"Given",
"a",
"tree",
"comparison",
"code",
"return",
"the",
"code",
"that",
"is",
"the",
"logical",
"inverse",
"."
] | [] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "honor_nans",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "honor_nans",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | swap_tree_comparison | null | enum tree_code
swap_tree_comparison (enum tree_code code)
{
switch (code)
{
case EQ_EXPR:
case NE_EXPR:
case ORDERED_EXPR:
case UNORDERED_EXPR:
case LTGT_EXPR:
case UNEQ_EXPR:
return code;
case GT_EXPR:
return LT_EXPR;
case GE_EXPR:
return LE_EXPR;
case LT_EXPR:
return GT_EXPR;
case LE_EXPR:
return GE_EXPR;
case UNGT_EXPR:
return UNLT_EXPR;
case UNGE_EXPR:
return UNLE_EXPR;
case UNLT_EXPR:
return UNGT_EXPR;
case UNLE_EXPR:
return UNGE_EXPR;
default:
gcc_unreachable ();
}
} | /* Similar, but return the comparison that results if the operands are
swapped. This is safe for floating-point. */ | Similar, but return the comparison that results if the operands are
swapped. This is safe for floating-point. | [
"Similar",
"but",
"return",
"the",
"comparison",
"that",
"results",
"if",
"the",
"operands",
"are",
"swapped",
".",
"This",
"is",
"safe",
"for",
"floating",
"-",
"point",
"."
] | enum tree_code
swap_tree_comparison (enum tree_code code)
{
switch (code)
{
case EQ_EXPR:
case NE_EXPR:
case ORDERED_EXPR:
case UNORDERED_EXPR:
case LTGT_EXPR:
case UNEQ_EXPR:
return code;
case GT_EXPR:
return LT_EXPR;
case GE_EXPR:
return LE_EXPR;
case LT_EXPR:
return GT_EXPR;
case LE_EXPR:
return GE_EXPR;
case UNGT_EXPR:
return UNLT_EXPR;
case UNGE_EXPR:
return UNLE_EXPR;
case UNLT_EXPR:
return UNGT_EXPR;
case UNLE_EXPR:
return UNGE_EXPR;
default:
gcc_unreachable ();
}
} | [
"enum",
"tree_code",
"swap_tree_comparison",
"(",
"enum",
"tree_code",
"code",
")",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"EQ_EXPR",
":",
"case",
"NE_EXPR",
":",
"case",
"ORDERED_EXPR",
":",
"case",
"UNORDERED_EXPR",
":",
"case",
"LTGT_EXPR",
":",
"case",
"UNEQ_EXPR",
":",
"return",
"code",
";",
"case",
"GT_EXPR",
":",
"return",
"LT_EXPR",
";",
"case",
"GE_EXPR",
":",
"return",
"LE_EXPR",
";",
"case",
"LT_EXPR",
":",
"return",
"GT_EXPR",
";",
"case",
"LE_EXPR",
":",
"return",
"GE_EXPR",
";",
"case",
"UNGT_EXPR",
":",
"return",
"UNLT_EXPR",
";",
"case",
"UNGE_EXPR",
":",
"return",
"UNLE_EXPR",
";",
"case",
"UNLT_EXPR",
":",
"return",
"UNGT_EXPR",
";",
"case",
"UNLE_EXPR",
":",
"return",
"UNGE_EXPR",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"}"
] | Similar, but return the comparison that results if the operands are
swapped. | [
"Similar",
"but",
"return",
"the",
"comparison",
"that",
"results",
"if",
"the",
"operands",
"are",
"swapped",
"."
] | [] | [
{
"param": "code",
"type": "enum tree_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | comparison_to_compcode | null | static enum comparison_code
comparison_to_compcode (enum tree_code code)
{
switch (code)
{
case LT_EXPR:
return COMPCODE_LT;
case EQ_EXPR:
return COMPCODE_EQ;
case LE_EXPR:
return COMPCODE_LE;
case GT_EXPR:
return COMPCODE_GT;
case NE_EXPR:
return COMPCODE_NE;
case GE_EXPR:
return COMPCODE_GE;
case ORDERED_EXPR:
return COMPCODE_ORD;
case UNORDERED_EXPR:
return COMPCODE_UNORD;
case UNLT_EXPR:
return COMPCODE_UNLT;
case UNEQ_EXPR:
return COMPCODE_UNEQ;
case UNLE_EXPR:
return COMPCODE_UNLE;
case UNGT_EXPR:
return COMPCODE_UNGT;
case LTGT_EXPR:
return COMPCODE_LTGT;
case UNGE_EXPR:
return COMPCODE_UNGE;
default:
gcc_unreachable ();
}
} | /* Convert a comparison tree code from an enum tree_code representation
into a compcode bit-based encoding. This function is the inverse of
compcode_to_comparison. */ | Convert a comparison tree code from an enum tree_code representation
into a compcode bit-based encoding. This function is the inverse of
compcode_to_comparison. | [
"Convert",
"a",
"comparison",
"tree",
"code",
"from",
"an",
"enum",
"tree_code",
"representation",
"into",
"a",
"compcode",
"bit",
"-",
"based",
"encoding",
".",
"This",
"function",
"is",
"the",
"inverse",
"of",
"compcode_to_comparison",
"."
] | static enum comparison_code
comparison_to_compcode (enum tree_code code)
{
switch (code)
{
case LT_EXPR:
return COMPCODE_LT;
case EQ_EXPR:
return COMPCODE_EQ;
case LE_EXPR:
return COMPCODE_LE;
case GT_EXPR:
return COMPCODE_GT;
case NE_EXPR:
return COMPCODE_NE;
case GE_EXPR:
return COMPCODE_GE;
case ORDERED_EXPR:
return COMPCODE_ORD;
case UNORDERED_EXPR:
return COMPCODE_UNORD;
case UNLT_EXPR:
return COMPCODE_UNLT;
case UNEQ_EXPR:
return COMPCODE_UNEQ;
case UNLE_EXPR:
return COMPCODE_UNLE;
case UNGT_EXPR:
return COMPCODE_UNGT;
case LTGT_EXPR:
return COMPCODE_LTGT;
case UNGE_EXPR:
return COMPCODE_UNGE;
default:
gcc_unreachable ();
}
} | [
"static",
"enum",
"comparison_code",
"comparison_to_compcode",
"(",
"enum",
"tree_code",
"code",
")",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"LT_EXPR",
":",
"return",
"COMPCODE_LT",
";",
"case",
"EQ_EXPR",
":",
"return",
"COMPCODE_EQ",
";",
"case",
"LE_EXPR",
":",
"return",
"COMPCODE_LE",
";",
"case",
"GT_EXPR",
":",
"return",
"COMPCODE_GT",
";",
"case",
"NE_EXPR",
":",
"return",
"COMPCODE_NE",
";",
"case",
"GE_EXPR",
":",
"return",
"COMPCODE_GE",
";",
"case",
"ORDERED_EXPR",
":",
"return",
"COMPCODE_ORD",
";",
"case",
"UNORDERED_EXPR",
":",
"return",
"COMPCODE_UNORD",
";",
"case",
"UNLT_EXPR",
":",
"return",
"COMPCODE_UNLT",
";",
"case",
"UNEQ_EXPR",
":",
"return",
"COMPCODE_UNEQ",
";",
"case",
"UNLE_EXPR",
":",
"return",
"COMPCODE_UNLE",
";",
"case",
"UNGT_EXPR",
":",
"return",
"COMPCODE_UNGT",
";",
"case",
"LTGT_EXPR",
":",
"return",
"COMPCODE_LTGT",
";",
"case",
"UNGE_EXPR",
":",
"return",
"COMPCODE_UNGE",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"}"
] | Convert a comparison tree code from an enum tree_code representation
into a compcode bit-based encoding. | [
"Convert",
"a",
"comparison",
"tree",
"code",
"from",
"an",
"enum",
"tree_code",
"representation",
"into",
"a",
"compcode",
"bit",
"-",
"based",
"encoding",
"."
] | [] | [
{
"param": "code",
"type": "enum tree_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | compcode_to_comparison | null | static enum tree_code
compcode_to_comparison (enum comparison_code code)
{
switch (code)
{
case COMPCODE_LT:
return LT_EXPR;
case COMPCODE_EQ:
return EQ_EXPR;
case COMPCODE_LE:
return LE_EXPR;
case COMPCODE_GT:
return GT_EXPR;
case COMPCODE_NE:
return NE_EXPR;
case COMPCODE_GE:
return GE_EXPR;
case COMPCODE_ORD:
return ORDERED_EXPR;
case COMPCODE_UNORD:
return UNORDERED_EXPR;
case COMPCODE_UNLT:
return UNLT_EXPR;
case COMPCODE_UNEQ:
return UNEQ_EXPR;
case COMPCODE_UNLE:
return UNLE_EXPR;
case COMPCODE_UNGT:
return UNGT_EXPR;
case COMPCODE_LTGT:
return LTGT_EXPR;
case COMPCODE_UNGE:
return UNGE_EXPR;
default:
gcc_unreachable ();
}
} | /* Convert a compcode bit-based encoding of a comparison operator back
to GCC's enum tree_code representation. This function is the
inverse of comparison_to_compcode. */ | Convert a compcode bit-based encoding of a comparison operator back
to GCC's enum tree_code representation. This function is the
inverse of comparison_to_compcode. | [
"Convert",
"a",
"compcode",
"bit",
"-",
"based",
"encoding",
"of",
"a",
"comparison",
"operator",
"back",
"to",
"GCC",
"'",
"s",
"enum",
"tree_code",
"representation",
".",
"This",
"function",
"is",
"the",
"inverse",
"of",
"comparison_to_compcode",
"."
] | static enum tree_code
compcode_to_comparison (enum comparison_code code)
{
switch (code)
{
case COMPCODE_LT:
return LT_EXPR;
case COMPCODE_EQ:
return EQ_EXPR;
case COMPCODE_LE:
return LE_EXPR;
case COMPCODE_GT:
return GT_EXPR;
case COMPCODE_NE:
return NE_EXPR;
case COMPCODE_GE:
return GE_EXPR;
case COMPCODE_ORD:
return ORDERED_EXPR;
case COMPCODE_UNORD:
return UNORDERED_EXPR;
case COMPCODE_UNLT:
return UNLT_EXPR;
case COMPCODE_UNEQ:
return UNEQ_EXPR;
case COMPCODE_UNLE:
return UNLE_EXPR;
case COMPCODE_UNGT:
return UNGT_EXPR;
case COMPCODE_LTGT:
return LTGT_EXPR;
case COMPCODE_UNGE:
return UNGE_EXPR;
default:
gcc_unreachable ();
}
} | [
"static",
"enum",
"tree_code",
"compcode_to_comparison",
"(",
"enum",
"comparison_code",
"code",
")",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"COMPCODE_LT",
":",
"return",
"LT_EXPR",
";",
"case",
"COMPCODE_EQ",
":",
"return",
"EQ_EXPR",
";",
"case",
"COMPCODE_LE",
":",
"return",
"LE_EXPR",
";",
"case",
"COMPCODE_GT",
":",
"return",
"GT_EXPR",
";",
"case",
"COMPCODE_NE",
":",
"return",
"NE_EXPR",
";",
"case",
"COMPCODE_GE",
":",
"return",
"GE_EXPR",
";",
"case",
"COMPCODE_ORD",
":",
"return",
"ORDERED_EXPR",
";",
"case",
"COMPCODE_UNORD",
":",
"return",
"UNORDERED_EXPR",
";",
"case",
"COMPCODE_UNLT",
":",
"return",
"UNLT_EXPR",
";",
"case",
"COMPCODE_UNEQ",
":",
"return",
"UNEQ_EXPR",
";",
"case",
"COMPCODE_UNLE",
":",
"return",
"UNLE_EXPR",
";",
"case",
"COMPCODE_UNGT",
":",
"return",
"UNGT_EXPR",
";",
"case",
"COMPCODE_LTGT",
":",
"return",
"LTGT_EXPR",
";",
"case",
"COMPCODE_UNGE",
":",
"return",
"UNGE_EXPR",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"}"
] | Convert a compcode bit-based encoding of a comparison operator back
to GCC's enum tree_code representation. | [
"Convert",
"a",
"compcode",
"bit",
"-",
"based",
"encoding",
"of",
"a",
"comparison",
"operator",
"back",
"to",
"GCC",
"'",
"s",
"enum",
"tree_code",
"representation",
"."
] | [] | [
{
"param": "code",
"type": "enum comparison_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum comparison_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | combine_comparisons | tree | tree
combine_comparisons (location_t loc,
enum tree_code code, enum tree_code lcode,
enum tree_code rcode, tree truth_type,
tree ll_arg, tree lr_arg)
{
bool honor_nans = HONOR_NANS (ll_arg);
enum comparison_code lcompcode = comparison_to_compcode (lcode);
enum comparison_code rcompcode = comparison_to_compcode (rcode);
int compcode;
switch (code)
{
case TRUTH_AND_EXPR: case TRUTH_ANDIF_EXPR:
compcode = lcompcode & rcompcode;
break;
case TRUTH_OR_EXPR: case TRUTH_ORIF_EXPR:
compcode = lcompcode | rcompcode;
break;
default:
return NULL_TREE;
}
if (!honor_nans)
{
/* Eliminate unordered comparisons, as well as LTGT and ORD
which are not used unless the mode has NaNs. */
compcode &= ~COMPCODE_UNORD;
if (compcode == COMPCODE_LTGT)
compcode = COMPCODE_NE;
else if (compcode == COMPCODE_ORD)
compcode = COMPCODE_TRUE;
}
else if (flag_trapping_math)
{
/* Check that the original operation and the optimized ones will trap
under the same condition. */
bool ltrap = (lcompcode & COMPCODE_UNORD) == 0
&& (lcompcode != COMPCODE_EQ)
&& (lcompcode != COMPCODE_ORD);
bool rtrap = (rcompcode & COMPCODE_UNORD) == 0
&& (rcompcode != COMPCODE_EQ)
&& (rcompcode != COMPCODE_ORD);
bool trap = (compcode & COMPCODE_UNORD) == 0
&& (compcode != COMPCODE_EQ)
&& (compcode != COMPCODE_ORD);
/* In a short-circuited boolean expression the LHS might be
such that the RHS, if evaluated, will never trap. For
example, in ORD (x, y) && (x < y), we evaluate the RHS only
if neither x nor y is NaN. (This is a mixed blessing: for
example, the expression above will never trap, hence
optimizing it to x < y would be invalid). */
if ((code == TRUTH_ORIF_EXPR && (lcompcode & COMPCODE_UNORD))
|| (code == TRUTH_ANDIF_EXPR && !(lcompcode & COMPCODE_UNORD)))
rtrap = false;
/* If the comparison was short-circuited, and only the RHS
trapped, we may now generate a spurious trap. */
if (rtrap && !ltrap
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR))
return NULL_TREE;
/* If we changed the conditions that cause a trap, we lose. */
if ((ltrap || rtrap) != trap)
return NULL_TREE;
}
if (compcode == COMPCODE_TRUE)
return constant_boolean_node (true, truth_type);
else if (compcode == COMPCODE_FALSE)
return constant_boolean_node (false, truth_type);
else
{
enum tree_code tcode;
tcode = compcode_to_comparison ((enum comparison_code) compcode);
return fold_build2_loc (loc, tcode, truth_type, ll_arg, lr_arg);
}
} | /* Return a tree for the comparison which is the combination of
doing the AND or OR (depending on CODE) of the two operations LCODE
and RCODE on the identical operands LL_ARG and LR_ARG. Take into account
the possibility of trapping if the mode has NaNs, and return NULL_TREE
if this makes the transformation invalid. */ | Return a tree for the comparison which is the combination of
doing the AND or OR (depending on CODE) of the two operations LCODE
and RCODE on the identical operands LL_ARG and LR_ARG. Take into account
the possibility of trapping if the mode has NaNs, and return NULL_TREE
if this makes the transformation invalid. | [
"Return",
"a",
"tree",
"for",
"the",
"comparison",
"which",
"is",
"the",
"combination",
"of",
"doing",
"the",
"AND",
"or",
"OR",
"(",
"depending",
"on",
"CODE",
")",
"of",
"the",
"two",
"operations",
"LCODE",
"and",
"RCODE",
"on",
"the",
"identical",
"operands",
"LL_ARG",
"and",
"LR_ARG",
".",
"Take",
"into",
"account",
"the",
"possibility",
"of",
"trapping",
"if",
"the",
"mode",
"has",
"NaNs",
"and",
"return",
"NULL_TREE",
"if",
"this",
"makes",
"the",
"transformation",
"invalid",
"."
] | tree
combine_comparisons (location_t loc,
enum tree_code code, enum tree_code lcode,
enum tree_code rcode, tree truth_type,
tree ll_arg, tree lr_arg)
{
bool honor_nans = HONOR_NANS (ll_arg);
enum comparison_code lcompcode = comparison_to_compcode (lcode);
enum comparison_code rcompcode = comparison_to_compcode (rcode);
int compcode;
switch (code)
{
case TRUTH_AND_EXPR: case TRUTH_ANDIF_EXPR:
compcode = lcompcode & rcompcode;
break;
case TRUTH_OR_EXPR: case TRUTH_ORIF_EXPR:
compcode = lcompcode | rcompcode;
break;
default:
return NULL_TREE;
}
if (!honor_nans)
{
compcode &= ~COMPCODE_UNORD;
if (compcode == COMPCODE_LTGT)
compcode = COMPCODE_NE;
else if (compcode == COMPCODE_ORD)
compcode = COMPCODE_TRUE;
}
else if (flag_trapping_math)
{
bool ltrap = (lcompcode & COMPCODE_UNORD) == 0
&& (lcompcode != COMPCODE_EQ)
&& (lcompcode != COMPCODE_ORD);
bool rtrap = (rcompcode & COMPCODE_UNORD) == 0
&& (rcompcode != COMPCODE_EQ)
&& (rcompcode != COMPCODE_ORD);
bool trap = (compcode & COMPCODE_UNORD) == 0
&& (compcode != COMPCODE_EQ)
&& (compcode != COMPCODE_ORD);
if ((code == TRUTH_ORIF_EXPR && (lcompcode & COMPCODE_UNORD))
|| (code == TRUTH_ANDIF_EXPR && !(lcompcode & COMPCODE_UNORD)))
rtrap = false;
if (rtrap && !ltrap
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR))
return NULL_TREE;
if ((ltrap || rtrap) != trap)
return NULL_TREE;
}
if (compcode == COMPCODE_TRUE)
return constant_boolean_node (true, truth_type);
else if (compcode == COMPCODE_FALSE)
return constant_boolean_node (false, truth_type);
else
{
enum tree_code tcode;
tcode = compcode_to_comparison ((enum comparison_code) compcode);
return fold_build2_loc (loc, tcode, truth_type, ll_arg, lr_arg);
}
} | [
"tree",
"combine_comparisons",
"(",
"location_t",
"loc",
",",
"enum",
"tree_code",
"code",
",",
"enum",
"tree_code",
"lcode",
",",
"enum",
"tree_code",
"rcode",
",",
"tree",
"truth_type",
",",
"tree",
"ll_arg",
",",
"tree",
"lr_arg",
")",
"{",
"bool",
"honor_nans",
"=",
"HONOR_NANS",
"(",
"ll_arg",
")",
";",
"enum",
"comparison_code",
"lcompcode",
"=",
"comparison_to_compcode",
"(",
"lcode",
")",
";",
"enum",
"comparison_code",
"rcompcode",
"=",
"comparison_to_compcode",
"(",
"rcode",
")",
";",
"int",
"compcode",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"TRUTH_AND_EXPR",
":",
"case",
"TRUTH_ANDIF_EXPR",
":",
"compcode",
"=",
"lcompcode",
"&",
"rcompcode",
";",
"break",
";",
"case",
"TRUTH_OR_EXPR",
":",
"case",
"TRUTH_ORIF_EXPR",
":",
"compcode",
"=",
"lcompcode",
"|",
"rcompcode",
";",
"break",
";",
"default",
":",
"return",
"NULL_TREE",
";",
"}",
"if",
"(",
"!",
"honor_nans",
")",
"{",
"compcode",
"&=",
"~",
"COMPCODE_UNORD",
";",
"if",
"(",
"compcode",
"==",
"COMPCODE_LTGT",
")",
"compcode",
"=",
"COMPCODE_NE",
";",
"else",
"if",
"(",
"compcode",
"==",
"COMPCODE_ORD",
")",
"compcode",
"=",
"COMPCODE_TRUE",
";",
"}",
"else",
"if",
"(",
"flag_trapping_math",
")",
"{",
"bool",
"ltrap",
"=",
"(",
"lcompcode",
"&",
"COMPCODE_UNORD",
")",
"==",
"0",
"&&",
"(",
"lcompcode",
"!=",
"COMPCODE_EQ",
")",
"&&",
"(",
"lcompcode",
"!=",
"COMPCODE_ORD",
")",
";",
"bool",
"rtrap",
"=",
"(",
"rcompcode",
"&",
"COMPCODE_UNORD",
")",
"==",
"0",
"&&",
"(",
"rcompcode",
"!=",
"COMPCODE_EQ",
")",
"&&",
"(",
"rcompcode",
"!=",
"COMPCODE_ORD",
")",
";",
"bool",
"trap",
"=",
"(",
"compcode",
"&",
"COMPCODE_UNORD",
")",
"==",
"0",
"&&",
"(",
"compcode",
"!=",
"COMPCODE_EQ",
")",
"&&",
"(",
"compcode",
"!=",
"COMPCODE_ORD",
")",
";",
"if",
"(",
"(",
"code",
"==",
"TRUTH_ORIF_EXPR",
"&&",
"(",
"lcompcode",
"&",
"COMPCODE_UNORD",
")",
")",
"||",
"(",
"code",
"==",
"TRUTH_ANDIF_EXPR",
"&&",
"!",
"(",
"lcompcode",
"&",
"COMPCODE_UNORD",
")",
")",
")",
"rtrap",
"=",
"false",
";",
"if",
"(",
"rtrap",
"&&",
"!",
"ltrap",
"&&",
"(",
"code",
"==",
"TRUTH_ANDIF_EXPR",
"||",
"code",
"==",
"TRUTH_ORIF_EXPR",
")",
")",
"return",
"NULL_TREE",
";",
"if",
"(",
"(",
"ltrap",
"||",
"rtrap",
")",
"!=",
"trap",
")",
"return",
"NULL_TREE",
";",
"}",
"if",
"(",
"compcode",
"==",
"COMPCODE_TRUE",
")",
"return",
"constant_boolean_node",
"(",
"true",
",",
"truth_type",
")",
";",
"else",
"if",
"(",
"compcode",
"==",
"COMPCODE_FALSE",
")",
"return",
"constant_boolean_node",
"(",
"false",
",",
"truth_type",
")",
";",
"else",
"{",
"enum",
"tree_code",
"tcode",
";",
"tcode",
"=",
"compcode_to_comparison",
"(",
"(",
"enum",
"comparison_code",
")",
"compcode",
")",
";",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"tcode",
",",
"truth_type",
",",
"ll_arg",
",",
"lr_arg",
")",
";",
"}",
"}"
] | Return a tree for the comparison which is the combination of
doing the AND or OR (depending on CODE) of the two operations LCODE
and RCODE on the identical operands LL_ARG and LR_ARG. | [
"Return",
"a",
"tree",
"for",
"the",
"comparison",
"which",
"is",
"the",
"combination",
"of",
"doing",
"the",
"AND",
"or",
"OR",
"(",
"depending",
"on",
"CODE",
")",
"of",
"the",
"two",
"operations",
"LCODE",
"and",
"RCODE",
"on",
"the",
"identical",
"operands",
"LL_ARG",
"and",
"LR_ARG",
"."
] | [
"/* Eliminate unordered comparisons, as well as LTGT and ORD\n\t which are not used unless the mode has NaNs. */",
"/* Check that the original operation and the optimized ones will trap\n\t under the same condition. */",
"/* In a short-circuited boolean expression the LHS might be\n\t such that the RHS, if evaluated, will never trap. For\n\t example, in ORD (x, y) && (x < y), we evaluate the RHS only\n\t if neither x nor y is NaN. (This is a mixed blessing: for\n\t example, the expression above will never trap, hence\n\t optimizing it to x < y would be invalid). */",
"/* If the comparison was short-circuited, and only the RHS\n\t trapped, we may now generate a spurious trap. */",
"/* If we changed the conditions that cause a trap, we lose. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "lcode",
"type": "enum tree_code"
},
{
"param": "rcode",
"type": "enum tree_code"
},
{
"param": "truth_type",
"type": "tree"
},
{
"param": "ll_arg",
"type": "tree"
},
{
"param": "lr_arg",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lcode",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rcode",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "truth_type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ll_arg",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lr_arg",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | operand_equal_for_comparison_p | bool | static bool
operand_equal_for_comparison_p (tree arg0, tree arg1)
{
if (operand_equal_p (arg0, arg1, 0))
return true;
if (! INTEGRAL_TYPE_P (TREE_TYPE (arg0))
|| ! INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
return false;
/* Discard any conversions that don't change the modes of ARG0 and ARG1
and see if the inner values are the same. This removes any
signedness comparison, which doesn't matter here. */
tree op0 = arg0;
tree op1 = arg1;
STRIP_NOPS (op0);
STRIP_NOPS (op1);
if (operand_equal_p (op0, op1, 0))
return true;
/* Discard a single widening conversion from ARG1 and see if the inner
value is the same as ARG0. */
if (CONVERT_EXPR_P (arg1)
&& INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0)))
&& TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 0)))
< TYPE_PRECISION (TREE_TYPE (arg1))
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
return true;
return false;
} | /* Similar to operand_equal_p, but see if ARG0 might be a variant of ARG1
with a different signedness or a narrower precision. */ | Similar to operand_equal_p, but see if ARG0 might be a variant of ARG1
with a different signedness or a narrower precision. | [
"Similar",
"to",
"operand_equal_p",
"but",
"see",
"if",
"ARG0",
"might",
"be",
"a",
"variant",
"of",
"ARG1",
"with",
"a",
"different",
"signedness",
"or",
"a",
"narrower",
"precision",
"."
] | static bool
operand_equal_for_comparison_p (tree arg0, tree arg1)
{
if (operand_equal_p (arg0, arg1, 0))
return true;
if (! INTEGRAL_TYPE_P (TREE_TYPE (arg0))
|| ! INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
return false;
tree op0 = arg0;
tree op1 = arg1;
STRIP_NOPS (op0);
STRIP_NOPS (op1);
if (operand_equal_p (op0, op1, 0))
return true;
if (CONVERT_EXPR_P (arg1)
&& INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (arg1, 0)))
&& TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg1, 0)))
< TYPE_PRECISION (TREE_TYPE (arg1))
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
return true;
return false;
} | [
"static",
"bool",
"operand_equal_for_comparison_p",
"(",
"tree",
"arg0",
",",
"tree",
"arg1",
")",
"{",
"if",
"(",
"operand_equal_p",
"(",
"arg0",
",",
"arg1",
",",
"0",
")",
")",
"return",
"true",
";",
"if",
"(",
"!",
"INTEGRAL_TYPE_P",
"(",
"TREE_TYPE",
"(",
"arg0",
")",
")",
"||",
"!",
"INTEGRAL_TYPE_P",
"(",
"TREE_TYPE",
"(",
"arg1",
")",
")",
")",
"return",
"false",
";",
"tree",
"op0",
"=",
"arg0",
";",
"tree",
"op1",
"=",
"arg1",
";",
"STRIP_NOPS",
"(",
"op0",
")",
";",
"STRIP_NOPS",
"(",
"op1",
")",
";",
"if",
"(",
"operand_equal_p",
"(",
"op0",
",",
"op1",
",",
"0",
")",
")",
"return",
"true",
";",
"if",
"(",
"CONVERT_EXPR_P",
"(",
"arg1",
")",
"&&",
"INTEGRAL_TYPE_P",
"(",
"TREE_TYPE",
"(",
"TREE_OPERAND",
"(",
"arg1",
",",
"0",
")",
")",
")",
"&&",
"TYPE_PRECISION",
"(",
"TREE_TYPE",
"(",
"TREE_OPERAND",
"(",
"arg1",
",",
"0",
")",
")",
")",
"<",
"TYPE_PRECISION",
"(",
"TREE_TYPE",
"(",
"arg1",
")",
")",
"&&",
"operand_equal_p",
"(",
"arg0",
",",
"TREE_OPERAND",
"(",
"arg1",
",",
"0",
")",
",",
"0",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | Similar to operand_equal_p, but see if ARG0 might be a variant of ARG1
with a different signedness or a narrower precision. | [
"Similar",
"to",
"operand_equal_p",
"but",
"see",
"if",
"ARG0",
"might",
"be",
"a",
"variant",
"of",
"ARG1",
"with",
"a",
"different",
"signedness",
"or",
"a",
"narrower",
"precision",
"."
] | [
"/* Discard any conversions that don't change the modes of ARG0 and ARG1\n and see if the inner values are the same. This removes any\n signedness comparison, which doesn't matter here. */",
"/* Discard a single widening conversion from ARG1 and see if the inner\n value is the same as ARG0. */"
] | [
{
"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": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | twoval_comparison_p | int | static int
twoval_comparison_p (tree arg, tree *cval1, tree *cval2)
{
enum tree_code code = TREE_CODE (arg);
enum tree_code_class tclass = TREE_CODE_CLASS (code);
/* We can handle some of the tcc_expression cases here. */
if (tclass == tcc_expression && code == TRUTH_NOT_EXPR)
tclass = tcc_unary;
else if (tclass == tcc_expression
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR
|| code == COMPOUND_EXPR))
tclass = tcc_binary;
switch (tclass)
{
case tcc_unary:
return twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2);
case tcc_binary:
return (twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2)
&& twoval_comparison_p (TREE_OPERAND (arg, 1), cval1, cval2));
case tcc_constant:
return 1;
case tcc_expression:
if (code == COND_EXPR)
return (twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2)
&& twoval_comparison_p (TREE_OPERAND (arg, 1), cval1, cval2)
&& twoval_comparison_p (TREE_OPERAND (arg, 2), cval1, cval2));
return 0;
case tcc_comparison:
/* First see if we can handle the first operand, then the second. For
the second operand, we know *CVAL1 can't be zero. It must be that
one side of the comparison is each of the values; test for the
case where this isn't true by failing if the two operands
are the same. */
if (operand_equal_p (TREE_OPERAND (arg, 0),
TREE_OPERAND (arg, 1), 0))
return 0;
if (*cval1 == 0)
*cval1 = TREE_OPERAND (arg, 0);
else if (operand_equal_p (*cval1, TREE_OPERAND (arg, 0), 0))
;
else if (*cval2 == 0)
*cval2 = TREE_OPERAND (arg, 0);
else if (operand_equal_p (*cval2, TREE_OPERAND (arg, 0), 0))
;
else
return 0;
if (operand_equal_p (*cval1, TREE_OPERAND (arg, 1), 0))
;
else if (*cval2 == 0)
*cval2 = TREE_OPERAND (arg, 1);
else if (operand_equal_p (*cval2, TREE_OPERAND (arg, 1), 0))
;
else
return 0;
return 1;
default:
return 0;
}
} | /* See if ARG is an expression that is either a comparison or is performing
arithmetic on comparisons. The comparisons must only be comparing
two different values, which will be stored in *CVAL1 and *CVAL2; if
they are nonzero it means that some operands have already been found.
No variables may be used anywhere else in the expression except in the
comparisons.
If this is true, return 1. Otherwise, return zero. */ | See if ARG is an expression that is either a comparison or is performing
arithmetic on comparisons. The comparisons must only be comparing
two different values, which will be stored in *CVAL1 and *CVAL2; if
they are nonzero it means that some operands have already been found.
No variables may be used anywhere else in the expression except in the
comparisons.
If this is true, return 1. Otherwise, return zero. | [
"See",
"if",
"ARG",
"is",
"an",
"expression",
"that",
"is",
"either",
"a",
"comparison",
"or",
"is",
"performing",
"arithmetic",
"on",
"comparisons",
".",
"The",
"comparisons",
"must",
"only",
"be",
"comparing",
"two",
"different",
"values",
"which",
"will",
"be",
"stored",
"in",
"*",
"CVAL1",
"and",
"*",
"CVAL2",
";",
"if",
"they",
"are",
"nonzero",
"it",
"means",
"that",
"some",
"operands",
"have",
"already",
"been",
"found",
".",
"No",
"variables",
"may",
"be",
"used",
"anywhere",
"else",
"in",
"the",
"expression",
"except",
"in",
"the",
"comparisons",
".",
"If",
"this",
"is",
"true",
"return",
"1",
".",
"Otherwise",
"return",
"zero",
"."
] | static int
twoval_comparison_p (tree arg, tree *cval1, tree *cval2)
{
enum tree_code code = TREE_CODE (arg);
enum tree_code_class tclass = TREE_CODE_CLASS (code);
if (tclass == tcc_expression && code == TRUTH_NOT_EXPR)
tclass = tcc_unary;
else if (tclass == tcc_expression
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR
|| code == COMPOUND_EXPR))
tclass = tcc_binary;
switch (tclass)
{
case tcc_unary:
return twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2);
case tcc_binary:
return (twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2)
&& twoval_comparison_p (TREE_OPERAND (arg, 1), cval1, cval2));
case tcc_constant:
return 1;
case tcc_expression:
if (code == COND_EXPR)
return (twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2)
&& twoval_comparison_p (TREE_OPERAND (arg, 1), cval1, cval2)
&& twoval_comparison_p (TREE_OPERAND (arg, 2), cval1, cval2));
return 0;
case tcc_comparison:
if (operand_equal_p (TREE_OPERAND (arg, 0),
TREE_OPERAND (arg, 1), 0))
return 0;
if (*cval1 == 0)
*cval1 = TREE_OPERAND (arg, 0);
else if (operand_equal_p (*cval1, TREE_OPERAND (arg, 0), 0))
;
else if (*cval2 == 0)
*cval2 = TREE_OPERAND (arg, 0);
else if (operand_equal_p (*cval2, TREE_OPERAND (arg, 0), 0))
;
else
return 0;
if (operand_equal_p (*cval1, TREE_OPERAND (arg, 1), 0))
;
else if (*cval2 == 0)
*cval2 = TREE_OPERAND (arg, 1);
else if (operand_equal_p (*cval2, TREE_OPERAND (arg, 1), 0))
;
else
return 0;
return 1;
default:
return 0;
}
} | [
"static",
"int",
"twoval_comparison_p",
"(",
"tree",
"arg",
",",
"tree",
"*",
"cval1",
",",
"tree",
"*",
"cval2",
")",
"{",
"enum",
"tree_code",
"code",
"=",
"TREE_CODE",
"(",
"arg",
")",
";",
"enum",
"tree_code_class",
"tclass",
"=",
"TREE_CODE_CLASS",
"(",
"code",
")",
";",
"if",
"(",
"tclass",
"==",
"tcc_expression",
"&&",
"code",
"==",
"TRUTH_NOT_EXPR",
")",
"tclass",
"=",
"tcc_unary",
";",
"else",
"if",
"(",
"tclass",
"==",
"tcc_expression",
"&&",
"(",
"code",
"==",
"TRUTH_ANDIF_EXPR",
"||",
"code",
"==",
"TRUTH_ORIF_EXPR",
"||",
"code",
"==",
"COMPOUND_EXPR",
")",
")",
"tclass",
"=",
"tcc_binary",
";",
"switch",
"(",
"tclass",
")",
"{",
"case",
"tcc_unary",
":",
"return",
"twoval_comparison_p",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"cval1",
",",
"cval2",
")",
";",
"case",
"tcc_binary",
":",
"return",
"(",
"twoval_comparison_p",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"cval1",
",",
"cval2",
")",
"&&",
"twoval_comparison_p",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"cval1",
",",
"cval2",
")",
")",
";",
"case",
"tcc_constant",
":",
"return",
"1",
";",
"case",
"tcc_expression",
":",
"if",
"(",
"code",
"==",
"COND_EXPR",
")",
"return",
"(",
"twoval_comparison_p",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"cval1",
",",
"cval2",
")",
"&&",
"twoval_comparison_p",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"cval1",
",",
"cval2",
")",
"&&",
"twoval_comparison_p",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"2",
")",
",",
"cval1",
",",
"cval2",
")",
")",
";",
"return",
"0",
";",
"case",
"tcc_comparison",
":",
"if",
"(",
"operand_equal_p",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"0",
")",
")",
"return",
"0",
";",
"if",
"(",
"*",
"cval1",
"==",
"0",
")",
"*",
"cval1",
"=",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
";",
"else",
"if",
"(",
"operand_equal_p",
"(",
"*",
"cval1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"0",
")",
")",
";",
"else",
"if",
"(",
"*",
"cval2",
"==",
"0",
")",
"*",
"cval2",
"=",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
";",
"else",
"if",
"(",
"operand_equal_p",
"(",
"*",
"cval2",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"0",
")",
")",
";",
"else",
"return",
"0",
";",
"if",
"(",
"operand_equal_p",
"(",
"*",
"cval1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"0",
")",
")",
";",
"else",
"if",
"(",
"*",
"cval2",
"==",
"0",
")",
"*",
"cval2",
"=",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
";",
"else",
"if",
"(",
"operand_equal_p",
"(",
"*",
"cval2",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"0",
")",
")",
";",
"else",
"return",
"0",
";",
"return",
"1",
";",
"default",
":",
"return",
"0",
";",
"}",
"}"
] | See if ARG is an expression that is either a comparison or is performing
arithmetic on comparisons. | [
"See",
"if",
"ARG",
"is",
"an",
"expression",
"that",
"is",
"either",
"a",
"comparison",
"or",
"is",
"performing",
"arithmetic",
"on",
"comparisons",
"."
] | [
"/* We can handle some of the tcc_expression cases here. */",
"/* First see if we can handle the first operand, then the second. For\n\t the second operand, we know *CVAL1 can't be zero. It must be that\n\t one side of the comparison is each of the values; test for the\n\t case where this isn't true by failing if the two operands\n\t are the same. */"
] | [
{
"param": "arg",
"type": "tree"
},
{
"param": "cval1",
"type": "tree"
},
{
"param": "cval2",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arg",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cval1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cval2",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | eval_subst | tree | static tree
eval_subst (location_t loc, tree arg, tree old0, tree new0,
tree old1, tree new1)
{
tree type = TREE_TYPE (arg);
enum tree_code code = TREE_CODE (arg);
enum tree_code_class tclass = TREE_CODE_CLASS (code);
/* We can handle some of the tcc_expression cases here. */
if (tclass == tcc_expression && code == TRUTH_NOT_EXPR)
tclass = tcc_unary;
else if (tclass == tcc_expression
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR))
tclass = tcc_binary;
switch (tclass)
{
case tcc_unary:
return fold_build1_loc (loc, code, type,
eval_subst (loc, TREE_OPERAND (arg, 0),
old0, new0, old1, new1));
case tcc_binary:
return fold_build2_loc (loc, code, type,
eval_subst (loc, TREE_OPERAND (arg, 0),
old0, new0, old1, new1),
eval_subst (loc, TREE_OPERAND (arg, 1),
old0, new0, old1, new1));
case tcc_expression:
switch (code)
{
case SAVE_EXPR:
return eval_subst (loc, TREE_OPERAND (arg, 0), old0, new0,
old1, new1);
case COMPOUND_EXPR:
return eval_subst (loc, TREE_OPERAND (arg, 1), old0, new0,
old1, new1);
case COND_EXPR:
return fold_build3_loc (loc, code, type,
eval_subst (loc, TREE_OPERAND (arg, 0),
old0, new0, old1, new1),
eval_subst (loc, TREE_OPERAND (arg, 1),
old0, new0, old1, new1),
eval_subst (loc, TREE_OPERAND (arg, 2),
old0, new0, old1, new1));
default:
break;
}
/* Fall through - ??? */
case tcc_comparison:
{
tree arg0 = TREE_OPERAND (arg, 0);
tree arg1 = TREE_OPERAND (arg, 1);
/* We need to check both for exact equality and tree equality. The
former will be true if the operand has a side-effect. In that
case, we know the operand occurred exactly once. */
if (arg0 == old0 || operand_equal_p (arg0, old0, 0))
arg0 = new0;
else if (arg0 == old1 || operand_equal_p (arg0, old1, 0))
arg0 = new1;
if (arg1 == old0 || operand_equal_p (arg1, old0, 0))
arg1 = new0;
else if (arg1 == old1 || operand_equal_p (arg1, old1, 0))
arg1 = new1;
return fold_build2_loc (loc, code, type, arg0, arg1);
}
default:
return arg;
}
} | /* ARG is a tree that is known to contain just arithmetic operations and
comparisons. Evaluate the operations in the tree substituting NEW0 for
any occurrence of OLD0 as an operand of a comparison and likewise for
NEW1 and OLD1. */ | ARG is a tree that is known to contain just arithmetic operations and
comparisons. Evaluate the operations in the tree substituting NEW0 for
any occurrence of OLD0 as an operand of a comparison and likewise for
NEW1 and OLD1. | [
"ARG",
"is",
"a",
"tree",
"that",
"is",
"known",
"to",
"contain",
"just",
"arithmetic",
"operations",
"and",
"comparisons",
".",
"Evaluate",
"the",
"operations",
"in",
"the",
"tree",
"substituting",
"NEW0",
"for",
"any",
"occurrence",
"of",
"OLD0",
"as",
"an",
"operand",
"of",
"a",
"comparison",
"and",
"likewise",
"for",
"NEW1",
"and",
"OLD1",
"."
] | static tree
eval_subst (location_t loc, tree arg, tree old0, tree new0,
tree old1, tree new1)
{
tree type = TREE_TYPE (arg);
enum tree_code code = TREE_CODE (arg);
enum tree_code_class tclass = TREE_CODE_CLASS (code);
if (tclass == tcc_expression && code == TRUTH_NOT_EXPR)
tclass = tcc_unary;
else if (tclass == tcc_expression
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR))
tclass = tcc_binary;
switch (tclass)
{
case tcc_unary:
return fold_build1_loc (loc, code, type,
eval_subst (loc, TREE_OPERAND (arg, 0),
old0, new0, old1, new1));
case tcc_binary:
return fold_build2_loc (loc, code, type,
eval_subst (loc, TREE_OPERAND (arg, 0),
old0, new0, old1, new1),
eval_subst (loc, TREE_OPERAND (arg, 1),
old0, new0, old1, new1));
case tcc_expression:
switch (code)
{
case SAVE_EXPR:
return eval_subst (loc, TREE_OPERAND (arg, 0), old0, new0,
old1, new1);
case COMPOUND_EXPR:
return eval_subst (loc, TREE_OPERAND (arg, 1), old0, new0,
old1, new1);
case COND_EXPR:
return fold_build3_loc (loc, code, type,
eval_subst (loc, TREE_OPERAND (arg, 0),
old0, new0, old1, new1),
eval_subst (loc, TREE_OPERAND (arg, 1),
old0, new0, old1, new1),
eval_subst (loc, TREE_OPERAND (arg, 2),
old0, new0, old1, new1));
default:
break;
}
case tcc_comparison:
{
tree arg0 = TREE_OPERAND (arg, 0);
tree arg1 = TREE_OPERAND (arg, 1);
if (arg0 == old0 || operand_equal_p (arg0, old0, 0))
arg0 = new0;
else if (arg0 == old1 || operand_equal_p (arg0, old1, 0))
arg0 = new1;
if (arg1 == old0 || operand_equal_p (arg1, old0, 0))
arg1 = new0;
else if (arg1 == old1 || operand_equal_p (arg1, old1, 0))
arg1 = new1;
return fold_build2_loc (loc, code, type, arg0, arg1);
}
default:
return arg;
}
} | [
"static",
"tree",
"eval_subst",
"(",
"location_t",
"loc",
",",
"tree",
"arg",
",",
"tree",
"old0",
",",
"tree",
"new0",
",",
"tree",
"old1",
",",
"tree",
"new1",
")",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"arg",
")",
";",
"enum",
"tree_code",
"code",
"=",
"TREE_CODE",
"(",
"arg",
")",
";",
"enum",
"tree_code_class",
"tclass",
"=",
"TREE_CODE_CLASS",
"(",
"code",
")",
";",
"if",
"(",
"tclass",
"==",
"tcc_expression",
"&&",
"code",
"==",
"TRUTH_NOT_EXPR",
")",
"tclass",
"=",
"tcc_unary",
";",
"else",
"if",
"(",
"tclass",
"==",
"tcc_expression",
"&&",
"(",
"code",
"==",
"TRUTH_ANDIF_EXPR",
"||",
"code",
"==",
"TRUTH_ORIF_EXPR",
")",
")",
"tclass",
"=",
"tcc_binary",
";",
"switch",
"(",
"tclass",
")",
"{",
"case",
"tcc_unary",
":",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"eval_subst",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"old0",
",",
"new0",
",",
"old1",
",",
"new1",
")",
")",
";",
"case",
"tcc_binary",
":",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"eval_subst",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"old0",
",",
"new0",
",",
"old1",
",",
"new1",
")",
",",
"eval_subst",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"old0",
",",
"new0",
",",
"old1",
",",
"new1",
")",
")",
";",
"case",
"tcc_expression",
":",
"switch",
"(",
"code",
")",
"{",
"case",
"SAVE_EXPR",
":",
"return",
"eval_subst",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"old0",
",",
"new0",
",",
"old1",
",",
"new1",
")",
";",
"case",
"COMPOUND_EXPR",
":",
"return",
"eval_subst",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"old0",
",",
"new0",
",",
"old1",
",",
"new1",
")",
";",
"case",
"COND_EXPR",
":",
"return",
"fold_build3_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"eval_subst",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"old0",
",",
"new0",
",",
"old1",
",",
"new1",
")",
",",
"eval_subst",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"old0",
",",
"new0",
",",
"old1",
",",
"new1",
")",
",",
"eval_subst",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"2",
")",
",",
"old0",
",",
"new0",
",",
"old1",
",",
"new1",
")",
")",
";",
"default",
":",
"break",
";",
"}",
"case",
"tcc_comparison",
":",
"{",
"tree",
"arg0",
"=",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
";",
"tree",
"arg1",
"=",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
";",
"if",
"(",
"arg0",
"==",
"old0",
"||",
"operand_equal_p",
"(",
"arg0",
",",
"old0",
",",
"0",
")",
")",
"arg0",
"=",
"new0",
";",
"else",
"if",
"(",
"arg0",
"==",
"old1",
"||",
"operand_equal_p",
"(",
"arg0",
",",
"old1",
",",
"0",
")",
")",
"arg0",
"=",
"new1",
";",
"if",
"(",
"arg1",
"==",
"old0",
"||",
"operand_equal_p",
"(",
"arg1",
",",
"old0",
",",
"0",
")",
")",
"arg1",
"=",
"new0",
";",
"else",
"if",
"(",
"arg1",
"==",
"old1",
"||",
"operand_equal_p",
"(",
"arg1",
",",
"old1",
",",
"0",
")",
")",
"arg1",
"=",
"new1",
";",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"arg0",
",",
"arg1",
")",
";",
"}",
"default",
":",
"return",
"arg",
";",
"}",
"}"
] | ARG is a tree that is known to contain just arithmetic operations and
comparisons. | [
"ARG",
"is",
"a",
"tree",
"that",
"is",
"known",
"to",
"contain",
"just",
"arithmetic",
"operations",
"and",
"comparisons",
"."
] | [
"/* We can handle some of the tcc_expression cases here. */",
"/* Fall through - ??? */",
"/* We need to check both for exact equality and tree equality. The\n\t former will be true if the operand has a side-effect. In that\n\t case, we know the operand occurred exactly once. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "arg",
"type": "tree"
},
{
"param": "old0",
"type": "tree"
},
{
"param": "new0",
"type": "tree"
},
{
"param": "old1",
"type": "tree"
},
{
"param": "new1",
"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": "old0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "new0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "old1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "new1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | omit_one_operand_loc | tree | tree
omit_one_operand_loc (location_t loc, tree type, tree result, tree omitted)
{
tree t = fold_convert_loc (loc, type, result);
/* If the resulting operand is an empty statement, just return the omitted
statement casted to void. */
if (IS_EMPTY_STMT (t) && TREE_SIDE_EFFECTS (omitted))
return build1_loc (loc, NOP_EXPR, void_type_node,
fold_ignored_result (omitted));
if (TREE_SIDE_EFFECTS (omitted))
return build2_loc (loc, COMPOUND_EXPR, type,
fold_ignored_result (omitted), t);
return non_lvalue_loc (loc, t);
} | /* Return a tree for the case when the result of an expression is RESULT
converted to TYPE and OMITTED was previously an operand of the expression
but is now not needed (e.g., we folded OMITTED * 0).
If OMITTED has side effects, we must evaluate it. Otherwise, just do
the conversion of RESULT to TYPE. */ | Return a tree for the case when the result of an expression is RESULT
converted to TYPE and OMITTED was previously an operand of the expression
but is now not needed .
If OMITTED has side effects, we must evaluate it. Otherwise, just do
the conversion of RESULT to TYPE. | [
"Return",
"a",
"tree",
"for",
"the",
"case",
"when",
"the",
"result",
"of",
"an",
"expression",
"is",
"RESULT",
"converted",
"to",
"TYPE",
"and",
"OMITTED",
"was",
"previously",
"an",
"operand",
"of",
"the",
"expression",
"but",
"is",
"now",
"not",
"needed",
".",
"If",
"OMITTED",
"has",
"side",
"effects",
"we",
"must",
"evaluate",
"it",
".",
"Otherwise",
"just",
"do",
"the",
"conversion",
"of",
"RESULT",
"to",
"TYPE",
"."
] | tree
omit_one_operand_loc (location_t loc, tree type, tree result, tree omitted)
{
tree t = fold_convert_loc (loc, type, result);
if (IS_EMPTY_STMT (t) && TREE_SIDE_EFFECTS (omitted))
return build1_loc (loc, NOP_EXPR, void_type_node,
fold_ignored_result (omitted));
if (TREE_SIDE_EFFECTS (omitted))
return build2_loc (loc, COMPOUND_EXPR, type,
fold_ignored_result (omitted), t);
return non_lvalue_loc (loc, t);
} | [
"tree",
"omit_one_operand_loc",
"(",
"location_t",
"loc",
",",
"tree",
"type",
",",
"tree",
"result",
",",
"tree",
"omitted",
")",
"{",
"tree",
"t",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"result",
")",
";",
"if",
"(",
"IS_EMPTY_STMT",
"(",
"t",
")",
"&&",
"TREE_SIDE_EFFECTS",
"(",
"omitted",
")",
")",
"return",
"build1_loc",
"(",
"loc",
",",
"NOP_EXPR",
",",
"void_type_node",
",",
"fold_ignored_result",
"(",
"omitted",
")",
")",
";",
"if",
"(",
"TREE_SIDE_EFFECTS",
"(",
"omitted",
")",
")",
"return",
"build2_loc",
"(",
"loc",
",",
"COMPOUND_EXPR",
",",
"type",
",",
"fold_ignored_result",
"(",
"omitted",
")",
",",
"t",
")",
";",
"return",
"non_lvalue_loc",
"(",
"loc",
",",
"t",
")",
";",
"}"
] | Return a tree for the case when the result of an expression is RESULT
converted to TYPE and OMITTED was previously an operand of the expression
but is now not needed (e.g., we folded OMITTED * 0). | [
"Return",
"a",
"tree",
"for",
"the",
"case",
"when",
"the",
"result",
"of",
"an",
"expression",
"is",
"RESULT",
"converted",
"to",
"TYPE",
"and",
"OMITTED",
"was",
"previously",
"an",
"operand",
"of",
"the",
"expression",
"but",
"is",
"now",
"not",
"needed",
"(",
"e",
".",
"g",
".",
"we",
"folded",
"OMITTED",
"*",
"0",
")",
"."
] | [
"/* If the resulting operand is an empty statement, just return the omitted\n statement casted to void. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "type",
"type": "tree"
},
{
"param": "result",
"type": "tree"
},
{
"param": "omitted",
"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
},
{
"identifier": "result",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "omitted",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | omit_two_operands_loc | tree | tree
omit_two_operands_loc (location_t loc, tree type, tree result,
tree omitted1, tree omitted2)
{
tree t = fold_convert_loc (loc, type, result);
if (TREE_SIDE_EFFECTS (omitted2))
t = build2_loc (loc, COMPOUND_EXPR, type, omitted2, t);
if (TREE_SIDE_EFFECTS (omitted1))
t = build2_loc (loc, COMPOUND_EXPR, type, omitted1, t);
return TREE_CODE (t) != COMPOUND_EXPR ? non_lvalue_loc (loc, t) : t;
} | /* Return a tree for the case when the result of an expression is RESULT
converted to TYPE and OMITTED1 and OMITTED2 were previously operands
of the expression but are now not needed.
If OMITTED1 or OMITTED2 has side effects, they must be evaluated.
If both OMITTED1 and OMITTED2 have side effects, OMITTED1 is
evaluated before OMITTED2. Otherwise, if neither has side effects,
just do the conversion of RESULT to TYPE. */ | Return a tree for the case when the result of an expression is RESULT
converted to TYPE and OMITTED1 and OMITTED2 were previously operands
of the expression but are now not needed.
If OMITTED1 or OMITTED2 has side effects, they must be evaluated. | [
"Return",
"a",
"tree",
"for",
"the",
"case",
"when",
"the",
"result",
"of",
"an",
"expression",
"is",
"RESULT",
"converted",
"to",
"TYPE",
"and",
"OMITTED1",
"and",
"OMITTED2",
"were",
"previously",
"operands",
"of",
"the",
"expression",
"but",
"are",
"now",
"not",
"needed",
".",
"If",
"OMITTED1",
"or",
"OMITTED2",
"has",
"side",
"effects",
"they",
"must",
"be",
"evaluated",
"."
] | tree
omit_two_operands_loc (location_t loc, tree type, tree result,
tree omitted1, tree omitted2)
{
tree t = fold_convert_loc (loc, type, result);
if (TREE_SIDE_EFFECTS (omitted2))
t = build2_loc (loc, COMPOUND_EXPR, type, omitted2, t);
if (TREE_SIDE_EFFECTS (omitted1))
t = build2_loc (loc, COMPOUND_EXPR, type, omitted1, t);
return TREE_CODE (t) != COMPOUND_EXPR ? non_lvalue_loc (loc, t) : t;
} | [
"tree",
"omit_two_operands_loc",
"(",
"location_t",
"loc",
",",
"tree",
"type",
",",
"tree",
"result",
",",
"tree",
"omitted1",
",",
"tree",
"omitted2",
")",
"{",
"tree",
"t",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"result",
")",
";",
"if",
"(",
"TREE_SIDE_EFFECTS",
"(",
"omitted2",
")",
")",
"t",
"=",
"build2_loc",
"(",
"loc",
",",
"COMPOUND_EXPR",
",",
"type",
",",
"omitted2",
",",
"t",
")",
";",
"if",
"(",
"TREE_SIDE_EFFECTS",
"(",
"omitted1",
")",
")",
"t",
"=",
"build2_loc",
"(",
"loc",
",",
"COMPOUND_EXPR",
",",
"type",
",",
"omitted1",
",",
"t",
")",
";",
"return",
"TREE_CODE",
"(",
"t",
")",
"!=",
"COMPOUND_EXPR",
"?",
"non_lvalue_loc",
"(",
"loc",
",",
"t",
")",
":",
"t",
";",
"}"
] | Return a tree for the case when the result of an expression is RESULT
converted to TYPE and OMITTED1 and OMITTED2 were previously operands
of the expression but are now not needed. | [
"Return",
"a",
"tree",
"for",
"the",
"case",
"when",
"the",
"result",
"of",
"an",
"expression",
"is",
"RESULT",
"converted",
"to",
"TYPE",
"and",
"OMITTED1",
"and",
"OMITTED2",
"were",
"previously",
"operands",
"of",
"the",
"expression",
"but",
"are",
"now",
"not",
"needed",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "type",
"type": "tree"
},
{
"param": "result",
"type": "tree"
},
{
"param": "omitted1",
"type": "tree"
},
{
"param": "omitted2",
"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
},
{
"identifier": "result",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "omitted1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "omitted2",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_truth_not_expr | tree | static tree
fold_truth_not_expr (location_t loc, tree arg)
{
tree type = TREE_TYPE (arg);
enum tree_code code = TREE_CODE (arg);
location_t loc1, loc2;
/* If this is a comparison, we can simply invert it, except for
floating-point non-equality comparisons, in which case we just
enclose a TRUTH_NOT_EXPR around what we have. */
if (TREE_CODE_CLASS (code) == tcc_comparison)
{
tree op_type = TREE_TYPE (TREE_OPERAND (arg, 0));
if (FLOAT_TYPE_P (op_type)
&& flag_trapping_math
&& code != ORDERED_EXPR && code != UNORDERED_EXPR
&& code != NE_EXPR && code != EQ_EXPR)
return NULL_TREE;
code = invert_tree_comparison (code, HONOR_NANS (op_type));
if (code == ERROR_MARK)
return NULL_TREE;
tree ret = build2_loc (loc, code, type, TREE_OPERAND (arg, 0),
TREE_OPERAND (arg, 1));
if (TREE_NO_WARNING (arg))
TREE_NO_WARNING (ret) = 1;
return ret;
}
switch (code)
{
case INTEGER_CST:
return constant_boolean_node (integer_zerop (arg), type);
case TRUTH_AND_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, TRUTH_OR_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
case TRUTH_OR_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, TRUTH_AND_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
case TRUTH_XOR_EXPR:
/* Here we can invert either operand. We invert the first operand
unless the second operand is a TRUTH_NOT_EXPR in which case our
result is the XOR of the first operand with the inside of the
negation of the second operand. */
if (TREE_CODE (TREE_OPERAND (arg, 1)) == TRUTH_NOT_EXPR)
return build2_loc (loc, TRUTH_XOR_EXPR, type, TREE_OPERAND (arg, 0),
TREE_OPERAND (TREE_OPERAND (arg, 1), 0));
else
return build2_loc (loc, TRUTH_XOR_EXPR, type,
invert_truthvalue_loc (loc, TREE_OPERAND (arg, 0)),
TREE_OPERAND (arg, 1));
case TRUTH_ANDIF_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, TRUTH_ORIF_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
case TRUTH_ORIF_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, TRUTH_ANDIF_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
case TRUTH_NOT_EXPR:
return TREE_OPERAND (arg, 0);
case COND_EXPR:
{
tree arg1 = TREE_OPERAND (arg, 1);
tree arg2 = TREE_OPERAND (arg, 2);
loc1 = expr_location_or (TREE_OPERAND (arg, 1), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 2), loc);
/* A COND_EXPR may have a throw as one operand, which
then has void type. Just leave void operands
as they are. */
return build3_loc (loc, COND_EXPR, type, TREE_OPERAND (arg, 0),
VOID_TYPE_P (TREE_TYPE (arg1))
? arg1 : invert_truthvalue_loc (loc1, arg1),
VOID_TYPE_P (TREE_TYPE (arg2))
? arg2 : invert_truthvalue_loc (loc2, arg2));
}
case COMPOUND_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, COMPOUND_EXPR, type,
TREE_OPERAND (arg, 0),
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 1)));
case NON_LVALUE_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
return invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0));
CASE_CONVERT:
if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE)
return build1_loc (loc, TRUTH_NOT_EXPR, type, arg);
/* fall through */
case FLOAT_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
return build1_loc (loc, TREE_CODE (arg), type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)));
case BIT_AND_EXPR:
if (!integer_onep (TREE_OPERAND (arg, 1)))
return NULL_TREE;
return build2_loc (loc, EQ_EXPR, type, arg, build_int_cst (type, 0));
case SAVE_EXPR:
return build1_loc (loc, TRUTH_NOT_EXPR, type, arg);
case CLEANUP_POINT_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
return build1_loc (loc, CLEANUP_POINT_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)));
default:
return NULL_TREE;
}
} | /* Return a simplified tree node for the truth-negation of ARG. This
never alters ARG itself. We assume that ARG is an operation that
returns a truth value (0 or 1).
FIXME: one would think we would fold the result, but it causes
problems with the dominator optimizer. */ | Return a simplified tree node for the truth-negation of ARG. This
never alters ARG itself. We assume that ARG is an operation that
returns a truth value (0 or 1).
one would think we would fold the result, but it causes
problems with the dominator optimizer. | [
"Return",
"a",
"simplified",
"tree",
"node",
"for",
"the",
"truth",
"-",
"negation",
"of",
"ARG",
".",
"This",
"never",
"alters",
"ARG",
"itself",
".",
"We",
"assume",
"that",
"ARG",
"is",
"an",
"operation",
"that",
"returns",
"a",
"truth",
"value",
"(",
"0",
"or",
"1",
")",
".",
"one",
"would",
"think",
"we",
"would",
"fold",
"the",
"result",
"but",
"it",
"causes",
"problems",
"with",
"the",
"dominator",
"optimizer",
"."
] | static tree
fold_truth_not_expr (location_t loc, tree arg)
{
tree type = TREE_TYPE (arg);
enum tree_code code = TREE_CODE (arg);
location_t loc1, loc2;
if (TREE_CODE_CLASS (code) == tcc_comparison)
{
tree op_type = TREE_TYPE (TREE_OPERAND (arg, 0));
if (FLOAT_TYPE_P (op_type)
&& flag_trapping_math
&& code != ORDERED_EXPR && code != UNORDERED_EXPR
&& code != NE_EXPR && code != EQ_EXPR)
return NULL_TREE;
code = invert_tree_comparison (code, HONOR_NANS (op_type));
if (code == ERROR_MARK)
return NULL_TREE;
tree ret = build2_loc (loc, code, type, TREE_OPERAND (arg, 0),
TREE_OPERAND (arg, 1));
if (TREE_NO_WARNING (arg))
TREE_NO_WARNING (ret) = 1;
return ret;
}
switch (code)
{
case INTEGER_CST:
return constant_boolean_node (integer_zerop (arg), type);
case TRUTH_AND_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, TRUTH_OR_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
case TRUTH_OR_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, TRUTH_AND_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
case TRUTH_XOR_EXPR:
if (TREE_CODE (TREE_OPERAND (arg, 1)) == TRUTH_NOT_EXPR)
return build2_loc (loc, TRUTH_XOR_EXPR, type, TREE_OPERAND (arg, 0),
TREE_OPERAND (TREE_OPERAND (arg, 1), 0));
else
return build2_loc (loc, TRUTH_XOR_EXPR, type,
invert_truthvalue_loc (loc, TREE_OPERAND (arg, 0)),
TREE_OPERAND (arg, 1));
case TRUTH_ANDIF_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, TRUTH_ORIF_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
case TRUTH_ORIF_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, TRUTH_ANDIF_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)),
invert_truthvalue_loc (loc2, TREE_OPERAND (arg, 1)));
case TRUTH_NOT_EXPR:
return TREE_OPERAND (arg, 0);
case COND_EXPR:
{
tree arg1 = TREE_OPERAND (arg, 1);
tree arg2 = TREE_OPERAND (arg, 2);
loc1 = expr_location_or (TREE_OPERAND (arg, 1), loc);
loc2 = expr_location_or (TREE_OPERAND (arg, 2), loc);
return build3_loc (loc, COND_EXPR, type, TREE_OPERAND (arg, 0),
VOID_TYPE_P (TREE_TYPE (arg1))
? arg1 : invert_truthvalue_loc (loc1, arg1),
VOID_TYPE_P (TREE_TYPE (arg2))
? arg2 : invert_truthvalue_loc (loc2, arg2));
}
case COMPOUND_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 1), loc);
return build2_loc (loc, COMPOUND_EXPR, type,
TREE_OPERAND (arg, 0),
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 1)));
case NON_LVALUE_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
return invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0));
CASE_CONVERT:
if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE)
return build1_loc (loc, TRUTH_NOT_EXPR, type, arg);
case FLOAT_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
return build1_loc (loc, TREE_CODE (arg), type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)));
case BIT_AND_EXPR:
if (!integer_onep (TREE_OPERAND (arg, 1)))
return NULL_TREE;
return build2_loc (loc, EQ_EXPR, type, arg, build_int_cst (type, 0));
case SAVE_EXPR:
return build1_loc (loc, TRUTH_NOT_EXPR, type, arg);
case CLEANUP_POINT_EXPR:
loc1 = expr_location_or (TREE_OPERAND (arg, 0), loc);
return build1_loc (loc, CLEANUP_POINT_EXPR, type,
invert_truthvalue_loc (loc1, TREE_OPERAND (arg, 0)));
default:
return NULL_TREE;
}
} | [
"static",
"tree",
"fold_truth_not_expr",
"(",
"location_t",
"loc",
",",
"tree",
"arg",
")",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"arg",
")",
";",
"enum",
"tree_code",
"code",
"=",
"TREE_CODE",
"(",
"arg",
")",
";",
"location_t",
"loc1",
",",
"loc2",
";",
"if",
"(",
"TREE_CODE_CLASS",
"(",
"code",
")",
"==",
"tcc_comparison",
")",
"{",
"tree",
"op_type",
"=",
"TREE_TYPE",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
";",
"if",
"(",
"FLOAT_TYPE_P",
"(",
"op_type",
")",
"&&",
"flag_trapping_math",
"&&",
"code",
"!=",
"ORDERED_EXPR",
"&&",
"code",
"!=",
"UNORDERED_EXPR",
"&&",
"code",
"!=",
"NE_EXPR",
"&&",
"code",
"!=",
"EQ_EXPR",
")",
"return",
"NULL_TREE",
";",
"code",
"=",
"invert_tree_comparison",
"(",
"code",
",",
"HONOR_NANS",
"(",
"op_type",
")",
")",
";",
"if",
"(",
"code",
"==",
"ERROR_MARK",
")",
"return",
"NULL_TREE",
";",
"tree",
"ret",
"=",
"build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
";",
"if",
"(",
"TREE_NO_WARNING",
"(",
"arg",
")",
")",
"TREE_NO_WARNING",
"(",
"ret",
")",
"=",
"1",
";",
"return",
"ret",
";",
"}",
"switch",
"(",
"code",
")",
"{",
"case",
"INTEGER_CST",
":",
"return",
"constant_boolean_node",
"(",
"integer_zerop",
"(",
"arg",
")",
",",
"type",
")",
";",
"case",
"TRUTH_AND_EXPR",
":",
"loc1",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"loc",
")",
";",
"loc2",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"loc",
")",
";",
"return",
"build2_loc",
"(",
"loc",
",",
"TRUTH_OR_EXPR",
",",
"type",
",",
"invert_truthvalue_loc",
"(",
"loc1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
",",
"invert_truthvalue_loc",
"(",
"loc2",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
")",
";",
"case",
"TRUTH_OR_EXPR",
":",
"loc1",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"loc",
")",
";",
"loc2",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"loc",
")",
";",
"return",
"build2_loc",
"(",
"loc",
",",
"TRUTH_AND_EXPR",
",",
"type",
",",
"invert_truthvalue_loc",
"(",
"loc1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
",",
"invert_truthvalue_loc",
"(",
"loc2",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
")",
";",
"case",
"TRUTH_XOR_EXPR",
":",
"if",
"(",
"TREE_CODE",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
"==",
"TRUTH_NOT_EXPR",
")",
"return",
"build2_loc",
"(",
"loc",
",",
"TRUTH_XOR_EXPR",
",",
"type",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"0",
")",
")",
";",
"else",
"return",
"build2_loc",
"(",
"loc",
",",
"TRUTH_XOR_EXPR",
",",
"type",
",",
"invert_truthvalue_loc",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
";",
"case",
"TRUTH_ANDIF_EXPR",
":",
"loc1",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"loc",
")",
";",
"loc2",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"loc",
")",
";",
"return",
"build2_loc",
"(",
"loc",
",",
"TRUTH_ORIF_EXPR",
",",
"type",
",",
"invert_truthvalue_loc",
"(",
"loc1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
",",
"invert_truthvalue_loc",
"(",
"loc2",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
")",
";",
"case",
"TRUTH_ORIF_EXPR",
":",
"loc1",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"loc",
")",
";",
"loc2",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"loc",
")",
";",
"return",
"build2_loc",
"(",
"loc",
",",
"TRUTH_ANDIF_EXPR",
",",
"type",
",",
"invert_truthvalue_loc",
"(",
"loc1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
",",
"invert_truthvalue_loc",
"(",
"loc2",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
")",
";",
"case",
"TRUTH_NOT_EXPR",
":",
"return",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
";",
"case",
"COND_EXPR",
":",
"{",
"tree",
"arg1",
"=",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
";",
"tree",
"arg2",
"=",
"TREE_OPERAND",
"(",
"arg",
",",
"2",
")",
";",
"loc1",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"loc",
")",
";",
"loc2",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"2",
")",
",",
"loc",
")",
";",
"return",
"build3_loc",
"(",
"loc",
",",
"COND_EXPR",
",",
"type",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"VOID_TYPE_P",
"(",
"TREE_TYPE",
"(",
"arg1",
")",
")",
"?",
"arg1",
":",
"invert_truthvalue_loc",
"(",
"loc1",
",",
"arg1",
")",
",",
"VOID_TYPE_P",
"(",
"TREE_TYPE",
"(",
"arg2",
")",
")",
"?",
"arg2",
":",
"invert_truthvalue_loc",
"(",
"loc2",
",",
"arg2",
")",
")",
";",
"}",
"case",
"COMPOUND_EXPR",
":",
"loc1",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
",",
"loc",
")",
";",
"return",
"build2_loc",
"(",
"loc",
",",
"COMPOUND_EXPR",
",",
"type",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"invert_truthvalue_loc",
"(",
"loc1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
")",
";",
"case",
"NON_LVALUE_EXPR",
":",
"loc1",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"loc",
")",
";",
"return",
"invert_truthvalue_loc",
"(",
"loc1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
";",
"CASE_CONVERT",
":",
"if",
"(",
"TREE_CODE",
"(",
"TREE_TYPE",
"(",
"arg",
")",
")",
"==",
"BOOLEAN_TYPE",
")",
"return",
"build1_loc",
"(",
"loc",
",",
"TRUTH_NOT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"case",
"FLOAT_EXPR",
":",
"loc1",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"loc",
")",
";",
"return",
"build1_loc",
"(",
"loc",
",",
"TREE_CODE",
"(",
"arg",
")",
",",
"type",
",",
"invert_truthvalue_loc",
"(",
"loc1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
")",
";",
"case",
"BIT_AND_EXPR",
":",
"if",
"(",
"!",
"integer_onep",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"1",
")",
")",
")",
"return",
"NULL_TREE",
";",
"return",
"build2_loc",
"(",
"loc",
",",
"EQ_EXPR",
",",
"type",
",",
"arg",
",",
"build_int_cst",
"(",
"type",
",",
"0",
")",
")",
";",
"case",
"SAVE_EXPR",
":",
"return",
"build1_loc",
"(",
"loc",
",",
"TRUTH_NOT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"case",
"CLEANUP_POINT_EXPR",
":",
"loc1",
"=",
"expr_location_or",
"(",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
",",
"loc",
")",
";",
"return",
"build1_loc",
"(",
"loc",
",",
"CLEANUP_POINT_EXPR",
",",
"type",
",",
"invert_truthvalue_loc",
"(",
"loc1",
",",
"TREE_OPERAND",
"(",
"arg",
",",
"0",
")",
")",
")",
";",
"default",
":",
"return",
"NULL_TREE",
";",
"}",
"}"
] | Return a simplified tree node for the truth-negation of ARG. | [
"Return",
"a",
"simplified",
"tree",
"node",
"for",
"the",
"truth",
"-",
"negation",
"of",
"ARG",
"."
] | [
"/* If this is a comparison, we can simply invert it, except for\n floating-point non-equality comparisons, in which case we just\n enclose a TRUTH_NOT_EXPR around what we have. */",
"/* Here we can invert either operand. We invert the first operand\n\t unless the second operand is a TRUTH_NOT_EXPR in which case our\n\t result is the XOR of the first operand with the inside of the\n\t negation of the second operand. */",
"/* A COND_EXPR may have a throw as one operand, which\n\t then has void type. Just leave void operands\n\t as they are. */",
"/* fall through */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "arg",
"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
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_invert_truthvalue | tree | static tree
fold_invert_truthvalue (location_t loc, tree arg)
{
tree type = TREE_TYPE (arg);
return fold_unary_loc (loc, VECTOR_TYPE_P (type)
? BIT_NOT_EXPR
: TRUTH_NOT_EXPR,
type, arg);
} | /* Fold the truth-negation of ARG. This never alters ARG itself. We
assume that ARG is an operation that returns a truth value (0 or 1
for scalars, 0 or -1 for vectors). Return the folded expression if
folding is successful. Otherwise, return NULL_TREE. */ | Fold the truth-negation of ARG. This never alters ARG itself. We
assume that ARG is an operation that returns a truth value (0 or 1
for scalars, 0 or -1 for vectors). Return the folded expression if
folding is successful. | [
"Fold",
"the",
"truth",
"-",
"negation",
"of",
"ARG",
".",
"This",
"never",
"alters",
"ARG",
"itself",
".",
"We",
"assume",
"that",
"ARG",
"is",
"an",
"operation",
"that",
"returns",
"a",
"truth",
"value",
"(",
"0",
"or",
"1",
"for",
"scalars",
"0",
"or",
"-",
"1",
"for",
"vectors",
")",
".",
"Return",
"the",
"folded",
"expression",
"if",
"folding",
"is",
"successful",
"."
] | static tree
fold_invert_truthvalue (location_t loc, tree arg)
{
tree type = TREE_TYPE (arg);
return fold_unary_loc (loc, VECTOR_TYPE_P (type)
? BIT_NOT_EXPR
: TRUTH_NOT_EXPR,
type, arg);
} | [
"static",
"tree",
"fold_invert_truthvalue",
"(",
"location_t",
"loc",
",",
"tree",
"arg",
")",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"arg",
")",
";",
"return",
"fold_unary_loc",
"(",
"loc",
",",
"VECTOR_TYPE_P",
"(",
"type",
")",
"?",
"BIT_NOT_EXPR",
":",
"TRUTH_NOT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"}"
] | Fold the truth-negation of ARG. | [
"Fold",
"the",
"truth",
"-",
"negation",
"of",
"ARG",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "arg",
"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
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | invert_truthvalue_loc | tree | tree
invert_truthvalue_loc (location_t loc, tree arg)
{
if (TREE_CODE (arg) == ERROR_MARK)
return arg;
tree type = TREE_TYPE (arg);
return fold_build1_loc (loc, VECTOR_TYPE_P (type)
? BIT_NOT_EXPR
: TRUTH_NOT_EXPR,
type, arg);
} | /* Return a simplified tree node for the truth-negation of ARG. This
never alters ARG itself. We assume that ARG is an operation that
returns a truth value (0 or 1 for scalars, 0 or -1 for vectors). */ | Return a simplified tree node for the truth-negation of ARG. This
never alters ARG itself. We assume that ARG is an operation that
returns a truth value (0 or 1 for scalars, 0 or -1 for vectors). | [
"Return",
"a",
"simplified",
"tree",
"node",
"for",
"the",
"truth",
"-",
"negation",
"of",
"ARG",
".",
"This",
"never",
"alters",
"ARG",
"itself",
".",
"We",
"assume",
"that",
"ARG",
"is",
"an",
"operation",
"that",
"returns",
"a",
"truth",
"value",
"(",
"0",
"or",
"1",
"for",
"scalars",
"0",
"or",
"-",
"1",
"for",
"vectors",
")",
"."
] | tree
invert_truthvalue_loc (location_t loc, tree arg)
{
if (TREE_CODE (arg) == ERROR_MARK)
return arg;
tree type = TREE_TYPE (arg);
return fold_build1_loc (loc, VECTOR_TYPE_P (type)
? BIT_NOT_EXPR
: TRUTH_NOT_EXPR,
type, arg);
} | [
"tree",
"invert_truthvalue_loc",
"(",
"location_t",
"loc",
",",
"tree",
"arg",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"ERROR_MARK",
")",
"return",
"arg",
";",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"arg",
")",
";",
"return",
"fold_build1_loc",
"(",
"loc",
",",
"VECTOR_TYPE_P",
"(",
"type",
")",
"?",
"BIT_NOT_EXPR",
":",
"TRUTH_NOT_EXPR",
",",
"type",
",",
"arg",
")",
";",
"}"
] | Return a simplified tree node for the truth-negation of ARG. | [
"Return",
"a",
"simplified",
"tree",
"node",
"for",
"the",
"truth",
"-",
"negation",
"of",
"ARG",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "arg",
"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
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | make_bit_field_ref | tree | static tree
make_bit_field_ref (location_t loc, tree inner, tree orig_inner, tree type,
HOST_WIDE_INT bitsize, poly_int64 bitpos,
int unsignedp, int reversep)
{
tree result, bftype;
/* Attempt not to lose the access path if possible. */
if (TREE_CODE (orig_inner) == COMPONENT_REF)
{
tree ninner = TREE_OPERAND (orig_inner, 0);
machine_mode nmode;
poly_int64 nbitsize, nbitpos;
tree noffset;
int nunsignedp, nreversep, nvolatilep = 0;
tree base = get_inner_reference (ninner, &nbitsize, &nbitpos,
&noffset, &nmode, &nunsignedp,
&nreversep, &nvolatilep);
if (base == inner
&& noffset == NULL_TREE
&& known_subrange_p (bitpos, bitsize, nbitpos, nbitsize)
&& !reversep
&& !nreversep
&& !nvolatilep)
{
inner = ninner;
bitpos -= nbitpos;
}
}
alias_set_type iset = get_alias_set (orig_inner);
if (iset == 0 && get_alias_set (inner) != iset)
inner = fold_build2 (MEM_REF, TREE_TYPE (inner),
build_fold_addr_expr (inner),
build_int_cst (ptr_type_node, 0));
if (known_eq (bitpos, 0) && !reversep)
{
tree size = TYPE_SIZE (TREE_TYPE (inner));
if ((INTEGRAL_TYPE_P (TREE_TYPE (inner))
|| POINTER_TYPE_P (TREE_TYPE (inner)))
&& tree_fits_shwi_p (size)
&& tree_to_shwi (size) == bitsize)
return fold_convert_loc (loc, type, inner);
}
bftype = type;
if (TYPE_PRECISION (bftype) != bitsize
|| TYPE_UNSIGNED (bftype) == !unsignedp)
bftype = build_nonstandard_integer_type (bitsize, 0);
result = build3_loc (loc, BIT_FIELD_REF, bftype, inner,
bitsize_int (bitsize), bitsize_int (bitpos));
REF_REVERSE_STORAGE_ORDER (result) = reversep;
if (bftype != type)
result = fold_convert_loc (loc, type, result);
return result;
} | /* Return a BIT_FIELD_REF of type TYPE to refer to BITSIZE bits of INNER
starting at BITPOS. The field is unsigned if UNSIGNEDP is nonzero
and uses reverse storage order if REVERSEP is nonzero. ORIG_INNER
is the original memory reference used to preserve the alias set of
the access. */ | Return a BIT_FIELD_REF of type TYPE to refer to BITSIZE bits of INNER
starting at BITPOS. The field is unsigned if UNSIGNEDP is nonzero
and uses reverse storage order if REVERSEP is nonzero. ORIG_INNER
is the original memory reference used to preserve the alias set of
the access. | [
"Return",
"a",
"BIT_FIELD_REF",
"of",
"type",
"TYPE",
"to",
"refer",
"to",
"BITSIZE",
"bits",
"of",
"INNER",
"starting",
"at",
"BITPOS",
".",
"The",
"field",
"is",
"unsigned",
"if",
"UNSIGNEDP",
"is",
"nonzero",
"and",
"uses",
"reverse",
"storage",
"order",
"if",
"REVERSEP",
"is",
"nonzero",
".",
"ORIG_INNER",
"is",
"the",
"original",
"memory",
"reference",
"used",
"to",
"preserve",
"the",
"alias",
"set",
"of",
"the",
"access",
"."
] | static tree
make_bit_field_ref (location_t loc, tree inner, tree orig_inner, tree type,
HOST_WIDE_INT bitsize, poly_int64 bitpos,
int unsignedp, int reversep)
{
tree result, bftype;
if (TREE_CODE (orig_inner) == COMPONENT_REF)
{
tree ninner = TREE_OPERAND (orig_inner, 0);
machine_mode nmode;
poly_int64 nbitsize, nbitpos;
tree noffset;
int nunsignedp, nreversep, nvolatilep = 0;
tree base = get_inner_reference (ninner, &nbitsize, &nbitpos,
&noffset, &nmode, &nunsignedp,
&nreversep, &nvolatilep);
if (base == inner
&& noffset == NULL_TREE
&& known_subrange_p (bitpos, bitsize, nbitpos, nbitsize)
&& !reversep
&& !nreversep
&& !nvolatilep)
{
inner = ninner;
bitpos -= nbitpos;
}
}
alias_set_type iset = get_alias_set (orig_inner);
if (iset == 0 && get_alias_set (inner) != iset)
inner = fold_build2 (MEM_REF, TREE_TYPE (inner),
build_fold_addr_expr (inner),
build_int_cst (ptr_type_node, 0));
if (known_eq (bitpos, 0) && !reversep)
{
tree size = TYPE_SIZE (TREE_TYPE (inner));
if ((INTEGRAL_TYPE_P (TREE_TYPE (inner))
|| POINTER_TYPE_P (TREE_TYPE (inner)))
&& tree_fits_shwi_p (size)
&& tree_to_shwi (size) == bitsize)
return fold_convert_loc (loc, type, inner);
}
bftype = type;
if (TYPE_PRECISION (bftype) != bitsize
|| TYPE_UNSIGNED (bftype) == !unsignedp)
bftype = build_nonstandard_integer_type (bitsize, 0);
result = build3_loc (loc, BIT_FIELD_REF, bftype, inner,
bitsize_int (bitsize), bitsize_int (bitpos));
REF_REVERSE_STORAGE_ORDER (result) = reversep;
if (bftype != type)
result = fold_convert_loc (loc, type, result);
return result;
} | [
"static",
"tree",
"make_bit_field_ref",
"(",
"location_t",
"loc",
",",
"tree",
"inner",
",",
"tree",
"orig_inner",
",",
"tree",
"type",
",",
"HOST_WIDE_INT",
"bitsize",
",",
"poly_int64",
"bitpos",
",",
"int",
"unsignedp",
",",
"int",
"reversep",
")",
"{",
"tree",
"result",
",",
"bftype",
";",
"if",
"(",
"TREE_CODE",
"(",
"orig_inner",
")",
"==",
"COMPONENT_REF",
")",
"{",
"tree",
"ninner",
"=",
"TREE_OPERAND",
"(",
"orig_inner",
",",
"0",
")",
";",
"machine_mode",
"nmode",
";",
"poly_int64",
"nbitsize",
",",
"nbitpos",
";",
"tree",
"noffset",
";",
"int",
"nunsignedp",
",",
"nreversep",
",",
"nvolatilep",
"=",
"0",
";",
"tree",
"base",
"=",
"get_inner_reference",
"(",
"ninner",
",",
"&",
"nbitsize",
",",
"&",
"nbitpos",
",",
"&",
"noffset",
",",
"&",
"nmode",
",",
"&",
"nunsignedp",
",",
"&",
"nreversep",
",",
"&",
"nvolatilep",
")",
";",
"if",
"(",
"base",
"==",
"inner",
"&&",
"noffset",
"==",
"NULL_TREE",
"&&",
"known_subrange_p",
"(",
"bitpos",
",",
"bitsize",
",",
"nbitpos",
",",
"nbitsize",
")",
"&&",
"!",
"reversep",
"&&",
"!",
"nreversep",
"&&",
"!",
"nvolatilep",
")",
"{",
"inner",
"=",
"ninner",
";",
"bitpos",
"-=",
"nbitpos",
";",
"}",
"}",
"alias_set_type",
"iset",
"=",
"get_alias_set",
"(",
"orig_inner",
")",
";",
"if",
"(",
"iset",
"==",
"0",
"&&",
"get_alias_set",
"(",
"inner",
")",
"!=",
"iset",
")",
"inner",
"=",
"fold_build2",
"(",
"MEM_REF",
",",
"TREE_TYPE",
"(",
"inner",
")",
",",
"build_fold_addr_expr",
"(",
"inner",
")",
",",
"build_int_cst",
"(",
"ptr_type_node",
",",
"0",
")",
")",
";",
"if",
"(",
"known_eq",
"(",
"bitpos",
",",
"0",
")",
"&&",
"!",
"reversep",
")",
"{",
"tree",
"size",
"=",
"TYPE_SIZE",
"(",
"TREE_TYPE",
"(",
"inner",
")",
")",
";",
"if",
"(",
"(",
"INTEGRAL_TYPE_P",
"(",
"TREE_TYPE",
"(",
"inner",
")",
")",
"||",
"POINTER_TYPE_P",
"(",
"TREE_TYPE",
"(",
"inner",
")",
")",
")",
"&&",
"tree_fits_shwi_p",
"(",
"size",
")",
"&&",
"tree_to_shwi",
"(",
"size",
")",
"==",
"bitsize",
")",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"inner",
")",
";",
"}",
"bftype",
"=",
"type",
";",
"if",
"(",
"TYPE_PRECISION",
"(",
"bftype",
")",
"!=",
"bitsize",
"||",
"TYPE_UNSIGNED",
"(",
"bftype",
")",
"==",
"!",
"unsignedp",
")",
"bftype",
"=",
"build_nonstandard_integer_type",
"(",
"bitsize",
",",
"0",
")",
";",
"result",
"=",
"build3_loc",
"(",
"loc",
",",
"BIT_FIELD_REF",
",",
"bftype",
",",
"inner",
",",
"bitsize_int",
"(",
"bitsize",
")",
",",
"bitsize_int",
"(",
"bitpos",
")",
")",
";",
"REF_REVERSE_STORAGE_ORDER",
"(",
"result",
")",
"=",
"reversep",
";",
"if",
"(",
"bftype",
"!=",
"type",
")",
"result",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Return a BIT_FIELD_REF of type TYPE to refer to BITSIZE bits of INNER
starting at BITPOS. | [
"Return",
"a",
"BIT_FIELD_REF",
"of",
"type",
"TYPE",
"to",
"refer",
"to",
"BITSIZE",
"bits",
"of",
"INNER",
"starting",
"at",
"BITPOS",
"."
] | [
"/* Attempt not to lose the access path if possible. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "inner",
"type": "tree"
},
{
"param": "orig_inner",
"type": "tree"
},
{
"param": "type",
"type": "tree"
},
{
"param": "bitsize",
"type": "HOST_WIDE_INT"
},
{
"param": "bitpos",
"type": "poly_int64"
},
{
"param": "unsignedp",
"type": "int"
},
{
"param": "reversep",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inner",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "orig_inner",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitsize",
"type": "HOST_WIDE_INT",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bitpos",
"type": "poly_int64",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "unsignedp",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reversep",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | decode_field_reference | tree | static tree
decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize,
HOST_WIDE_INT *pbitpos, machine_mode *pmode,
int *punsignedp, int *preversep, int *pvolatilep,
tree *pmask, tree *pand_mask)
{
tree exp = *exp_;
tree outer_type = 0;
tree and_mask = 0;
tree mask, inner, offset;
tree unsigned_type;
unsigned int precision;
/* All the optimizations using this function assume integer fields.
There are problems with FP fields since the type_for_size call
below can fail for, e.g., XFmode. */
if (! INTEGRAL_TYPE_P (TREE_TYPE (exp)))
return 0;
/* We are interested in the bare arrangement of bits, so strip everything
that doesn't affect the machine mode. However, record the type of the
outermost expression if it may matter below. */
if (CONVERT_EXPR_P (exp)
|| TREE_CODE (exp) == NON_LVALUE_EXPR)
outer_type = TREE_TYPE (exp);
STRIP_NOPS (exp);
if (TREE_CODE (exp) == BIT_AND_EXPR)
{
and_mask = TREE_OPERAND (exp, 1);
exp = TREE_OPERAND (exp, 0);
STRIP_NOPS (exp); STRIP_NOPS (and_mask);
if (TREE_CODE (and_mask) != INTEGER_CST)
return 0;
}
poly_int64 poly_bitsize, poly_bitpos;
inner = get_inner_reference (exp, &poly_bitsize, &poly_bitpos, &offset,
pmode, punsignedp, preversep, pvolatilep);
if ((inner == exp && and_mask == 0)
|| !poly_bitsize.is_constant (pbitsize)
|| !poly_bitpos.is_constant (pbitpos)
|| *pbitsize < 0
|| offset != 0
|| TREE_CODE (inner) == PLACEHOLDER_EXPR
/* Reject out-of-bound accesses (PR79731). */
|| (! AGGREGATE_TYPE_P (TREE_TYPE (inner))
&& compare_tree_int (TYPE_SIZE (TREE_TYPE (inner)),
*pbitpos + *pbitsize) < 0))
return 0;
*exp_ = exp;
/* If the number of bits in the reference is the same as the bitsize of
the outer type, then the outer type gives the signedness. Otherwise
(in case of a small bitfield) the signedness is unchanged. */
if (outer_type && *pbitsize == TYPE_PRECISION (outer_type))
*punsignedp = TYPE_UNSIGNED (outer_type);
/* Compute the mask to access the bitfield. */
unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1);
precision = TYPE_PRECISION (unsigned_type);
mask = build_int_cst_type (unsigned_type, -1);
mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize));
mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize));
/* Merge it with the mask we found in the BIT_AND_EXPR, if any. */
if (and_mask != 0)
mask = fold_build2_loc (loc, BIT_AND_EXPR, unsigned_type,
fold_convert_loc (loc, unsigned_type, and_mask), mask);
*pmask = mask;
*pand_mask = and_mask;
return inner;
} | /* Subroutine for fold_truth_andor_1: decode a field reference.
If EXP is a comparison reference, we return the innermost reference.
*PBITSIZE is set to the number of bits in the reference, *PBITPOS is
set to the starting bit number.
If the innermost field can be completely contained in a mode-sized
unit, *PMODE is set to that mode. Otherwise, it is set to VOIDmode.
*PVOLATILEP is set to 1 if the any expression encountered is volatile;
otherwise it is not changed.
*PUNSIGNEDP is set to the signedness of the field.
*PREVERSEP is set to the storage order of the field.
*PMASK is set to the mask used. This is either contained in a
BIT_AND_EXPR or derived from the width of the field.
*PAND_MASK is set to the mask found in a BIT_AND_EXPR, if any.
Return 0 if this is not a component reference or is one that we can't
do anything with. */ | Subroutine for fold_truth_andor_1: decode a field reference.
If EXP is a comparison reference, we return the innermost reference.
PBITSIZE is set to the number of bits in the reference, *PBITPOS is
set to the starting bit number.
If the innermost field can be completely contained in a mode-sized
unit, *PMODE is set to that mode. Otherwise, it is set to VOIDmode.
PVOLATILEP is set to 1 if the any expression encountered is volatile;
otherwise it is not changed.
PUNSIGNEDP is set to the signedness of the field.
PREVERSEP is set to the storage order of the field.
PMASK is set to the mask used. This is either contained in a
BIT_AND_EXPR or derived from the width of the field.
PAND_MASK is set to the mask found in a BIT_AND_EXPR, if any.
Return 0 if this is not a component reference or is one that we can't
do anything with. | [
"Subroutine",
"for",
"fold_truth_andor_1",
":",
"decode",
"a",
"field",
"reference",
".",
"If",
"EXP",
"is",
"a",
"comparison",
"reference",
"we",
"return",
"the",
"innermost",
"reference",
".",
"PBITSIZE",
"is",
"set",
"to",
"the",
"number",
"of",
"bits",
"in",
"the",
"reference",
"*",
"PBITPOS",
"is",
"set",
"to",
"the",
"starting",
"bit",
"number",
".",
"If",
"the",
"innermost",
"field",
"can",
"be",
"completely",
"contained",
"in",
"a",
"mode",
"-",
"sized",
"unit",
"*",
"PMODE",
"is",
"set",
"to",
"that",
"mode",
".",
"Otherwise",
"it",
"is",
"set",
"to",
"VOIDmode",
".",
"PVOLATILEP",
"is",
"set",
"to",
"1",
"if",
"the",
"any",
"expression",
"encountered",
"is",
"volatile",
";",
"otherwise",
"it",
"is",
"not",
"changed",
".",
"PUNSIGNEDP",
"is",
"set",
"to",
"the",
"signedness",
"of",
"the",
"field",
".",
"PREVERSEP",
"is",
"set",
"to",
"the",
"storage",
"order",
"of",
"the",
"field",
".",
"PMASK",
"is",
"set",
"to",
"the",
"mask",
"used",
".",
"This",
"is",
"either",
"contained",
"in",
"a",
"BIT_AND_EXPR",
"or",
"derived",
"from",
"the",
"width",
"of",
"the",
"field",
".",
"PAND_MASK",
"is",
"set",
"to",
"the",
"mask",
"found",
"in",
"a",
"BIT_AND_EXPR",
"if",
"any",
".",
"Return",
"0",
"if",
"this",
"is",
"not",
"a",
"component",
"reference",
"or",
"is",
"one",
"that",
"we",
"can",
"'",
"t",
"do",
"anything",
"with",
"."
] | static tree
decode_field_reference (location_t loc, tree *exp_, HOST_WIDE_INT *pbitsize,
HOST_WIDE_INT *pbitpos, machine_mode *pmode,
int *punsignedp, int *preversep, int *pvolatilep,
tree *pmask, tree *pand_mask)
{
tree exp = *exp_;
tree outer_type = 0;
tree and_mask = 0;
tree mask, inner, offset;
tree unsigned_type;
unsigned int precision;
if (! INTEGRAL_TYPE_P (TREE_TYPE (exp)))
return 0;
if (CONVERT_EXPR_P (exp)
|| TREE_CODE (exp) == NON_LVALUE_EXPR)
outer_type = TREE_TYPE (exp);
STRIP_NOPS (exp);
if (TREE_CODE (exp) == BIT_AND_EXPR)
{
and_mask = TREE_OPERAND (exp, 1);
exp = TREE_OPERAND (exp, 0);
STRIP_NOPS (exp); STRIP_NOPS (and_mask);
if (TREE_CODE (and_mask) != INTEGER_CST)
return 0;
}
poly_int64 poly_bitsize, poly_bitpos;
inner = get_inner_reference (exp, &poly_bitsize, &poly_bitpos, &offset,
pmode, punsignedp, preversep, pvolatilep);
if ((inner == exp && and_mask == 0)
|| !poly_bitsize.is_constant (pbitsize)
|| !poly_bitpos.is_constant (pbitpos)
|| *pbitsize < 0
|| offset != 0
|| TREE_CODE (inner) == PLACEHOLDER_EXPR
|| (! AGGREGATE_TYPE_P (TREE_TYPE (inner))
&& compare_tree_int (TYPE_SIZE (TREE_TYPE (inner)),
*pbitpos + *pbitsize) < 0))
return 0;
*exp_ = exp;
if (outer_type && *pbitsize == TYPE_PRECISION (outer_type))
*punsignedp = TYPE_UNSIGNED (outer_type);
unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1);
precision = TYPE_PRECISION (unsigned_type);
mask = build_int_cst_type (unsigned_type, -1);
mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize));
mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize));
if (and_mask != 0)
mask = fold_build2_loc (loc, BIT_AND_EXPR, unsigned_type,
fold_convert_loc (loc, unsigned_type, and_mask), mask);
*pmask = mask;
*pand_mask = and_mask;
return inner;
} | [
"static",
"tree",
"decode_field_reference",
"(",
"location_t",
"loc",
",",
"tree",
"*",
"exp_",
",",
"HOST_WIDE_INT",
"*",
"pbitsize",
",",
"HOST_WIDE_INT",
"*",
"pbitpos",
",",
"machine_mode",
"*",
"pmode",
",",
"int",
"*",
"punsignedp",
",",
"int",
"*",
"preversep",
",",
"int",
"*",
"pvolatilep",
",",
"tree",
"*",
"pmask",
",",
"tree",
"*",
"pand_mask",
")",
"{",
"tree",
"exp",
"=",
"*",
"exp_",
";",
"tree",
"outer_type",
"=",
"0",
";",
"tree",
"and_mask",
"=",
"0",
";",
"tree",
"mask",
",",
"inner",
",",
"offset",
";",
"tree",
"unsigned_type",
";",
"unsigned",
"int",
"precision",
";",
"if",
"(",
"!",
"INTEGRAL_TYPE_P",
"(",
"TREE_TYPE",
"(",
"exp",
")",
")",
")",
"return",
"0",
";",
"if",
"(",
"CONVERT_EXPR_P",
"(",
"exp",
")",
"||",
"TREE_CODE",
"(",
"exp",
")",
"==",
"NON_LVALUE_EXPR",
")",
"outer_type",
"=",
"TREE_TYPE",
"(",
"exp",
")",
";",
"STRIP_NOPS",
"(",
"exp",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"exp",
")",
"==",
"BIT_AND_EXPR",
")",
"{",
"and_mask",
"=",
"TREE_OPERAND",
"(",
"exp",
",",
"1",
")",
";",
"exp",
"=",
"TREE_OPERAND",
"(",
"exp",
",",
"0",
")",
";",
"STRIP_NOPS",
"(",
"exp",
")",
";",
"STRIP_NOPS",
"(",
"and_mask",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"and_mask",
")",
"!=",
"INTEGER_CST",
")",
"return",
"0",
";",
"}",
"poly_int64",
"poly_bitsize",
",",
"poly_bitpos",
";",
"inner",
"=",
"get_inner_reference",
"(",
"exp",
",",
"&",
"poly_bitsize",
",",
"&",
"poly_bitpos",
",",
"&",
"offset",
",",
"pmode",
",",
"punsignedp",
",",
"preversep",
",",
"pvolatilep",
")",
";",
"if",
"(",
"(",
"inner",
"==",
"exp",
"&&",
"and_mask",
"==",
"0",
")",
"||",
"!",
"poly_bitsize",
".",
"is_constant",
"(",
"pbitsize",
")",
"||",
"!",
"poly_bitpos",
".",
"is_constant",
"(",
"pbitpos",
")",
"||",
"*",
"pbitsize",
"<",
"0",
"||",
"offset",
"!=",
"0",
"||",
"TREE_CODE",
"(",
"inner",
")",
"==",
"PLACEHOLDER_EXPR",
"||",
"(",
"!",
"AGGREGATE_TYPE_P",
"(",
"TREE_TYPE",
"(",
"inner",
")",
")",
"&&",
"compare_tree_int",
"(",
"TYPE_SIZE",
"(",
"TREE_TYPE",
"(",
"inner",
")",
")",
",",
"*",
"pbitpos",
"+",
"*",
"pbitsize",
")",
"<",
"0",
")",
")",
"return",
"0",
";",
"*",
"exp_",
"=",
"exp",
";",
"if",
"(",
"outer_type",
"&&",
"*",
"pbitsize",
"==",
"TYPE_PRECISION",
"(",
"outer_type",
")",
")",
"*",
"punsignedp",
"=",
"TYPE_UNSIGNED",
"(",
"outer_type",
")",
";",
"unsigned_type",
"=",
"lang_hooks",
".",
"types",
".",
"type_for_size",
"(",
"*",
"pbitsize",
",",
"1",
")",
";",
"precision",
"=",
"TYPE_PRECISION",
"(",
"unsigned_type",
")",
";",
"mask",
"=",
"build_int_cst_type",
"(",
"unsigned_type",
",",
"-1",
")",
";",
"mask",
"=",
"const_binop",
"(",
"LSHIFT_EXPR",
",",
"mask",
",",
"size_int",
"(",
"precision",
"-",
"*",
"pbitsize",
")",
")",
";",
"mask",
"=",
"const_binop",
"(",
"RSHIFT_EXPR",
",",
"mask",
",",
"size_int",
"(",
"precision",
"-",
"*",
"pbitsize",
")",
")",
";",
"if",
"(",
"and_mask",
"!=",
"0",
")",
"mask",
"=",
"fold_build2_loc",
"(",
"loc",
",",
"BIT_AND_EXPR",
",",
"unsigned_type",
",",
"fold_convert_loc",
"(",
"loc",
",",
"unsigned_type",
",",
"and_mask",
")",
",",
"mask",
")",
";",
"*",
"pmask",
"=",
"mask",
";",
"*",
"pand_mask",
"=",
"and_mask",
";",
"return",
"inner",
";",
"}"
] | Subroutine for fold_truth_andor_1: decode a field reference. | [
"Subroutine",
"for",
"fold_truth_andor_1",
":",
"decode",
"a",
"field",
"reference",
"."
] | [
"/* All the optimizations using this function assume integer fields.\n There are problems with FP fields since the type_for_size call\n below can fail for, e.g., XFmode. */",
"/* We are interested in the bare arrangement of bits, so strip everything\n that doesn't affect the machine mode. However, record the type of the\n outermost expression if it may matter below. */",
"/* Reject out-of-bound accesses (PR79731). */",
"/* If the number of bits in the reference is the same as the bitsize of\n the outer type, then the outer type gives the signedness. Otherwise\n (in case of a small bitfield) the signedness is unchanged. */",
"/* Compute the mask to access the bitfield. */",
"/* Merge it with the mask we found in the BIT_AND_EXPR, if any. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "exp_",
"type": "tree"
},
{
"param": "pbitsize",
"type": "HOST_WIDE_INT"
},
{
"param": "pbitpos",
"type": "HOST_WIDE_INT"
},
{
"param": "pmode",
"type": "machine_mode"
},
{
"param": "punsignedp",
"type": "int"
},
{
"param": "preversep",
"type": "int"
},
{
"param": "pvolatilep",
"type": "int"
},
{
"param": "pmask",
"type": "tree"
},
{
"param": "pand_mask",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "exp_",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pbitsize",
"type": "HOST_WIDE_INT",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pbitpos",
"type": "HOST_WIDE_INT",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmode",
"type": "machine_mode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "punsignedp",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "preversep",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pvolatilep",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pmask",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pand_mask",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | simple_operand_p | int | static int
simple_operand_p (const_tree exp)
{
/* Strip any conversions that don't change the machine mode. */
STRIP_NOPS (exp);
return (CONSTANT_CLASS_P (exp)
|| TREE_CODE (exp) == SSA_NAME
|| (DECL_P (exp)
&& ! TREE_ADDRESSABLE (exp)
&& ! TREE_THIS_VOLATILE (exp)
&& ! DECL_NONLOCAL (exp)
/* Don't regard global variables as simple. They may be
allocated in ways unknown to the compiler (shared memory,
#pragma weak, etc). */
&& ! TREE_PUBLIC (exp)
&& ! DECL_EXTERNAL (exp)
/* Weakrefs are not safe to be read, since they can be NULL.
They are !TREE_PUBLIC && !DECL_EXTERNAL but still
have DECL_WEAK flag set. */
&& (! VAR_OR_FUNCTION_DECL_P (exp) || ! DECL_WEAK (exp))
/* Loading a static variable is unduly expensive, but global
registers aren't expensive. */
&& (! TREE_STATIC (exp) || DECL_REGISTER (exp))));
} | /* Subroutine for fold_truth_andor_1: determine if an operand is simple enough
to be evaluated unconditionally. */ | Subroutine for fold_truth_andor_1: determine if an operand is simple enough
to be evaluated unconditionally. | [
"Subroutine",
"for",
"fold_truth_andor_1",
":",
"determine",
"if",
"an",
"operand",
"is",
"simple",
"enough",
"to",
"be",
"evaluated",
"unconditionally",
"."
] | static int
simple_operand_p (const_tree exp)
{
STRIP_NOPS (exp);
return (CONSTANT_CLASS_P (exp)
|| TREE_CODE (exp) == SSA_NAME
|| (DECL_P (exp)
&& ! TREE_ADDRESSABLE (exp)
&& ! TREE_THIS_VOLATILE (exp)
&& ! DECL_NONLOCAL (exp)
&& ! TREE_PUBLIC (exp)
&& ! DECL_EXTERNAL (exp)
&& (! VAR_OR_FUNCTION_DECL_P (exp) || ! DECL_WEAK (exp))
&& (! TREE_STATIC (exp) || DECL_REGISTER (exp))));
} | [
"static",
"int",
"simple_operand_p",
"(",
"const_tree",
"exp",
")",
"{",
"STRIP_NOPS",
"(",
"exp",
")",
";",
"return",
"(",
"CONSTANT_CLASS_P",
"(",
"exp",
")",
"||",
"TREE_CODE",
"(",
"exp",
")",
"==",
"SSA_NAME",
"||",
"(",
"DECL_P",
"(",
"exp",
")",
"&&",
"!",
"TREE_ADDRESSABLE",
"(",
"exp",
")",
"&&",
"!",
"TREE_THIS_VOLATILE",
"(",
"exp",
")",
"&&",
"!",
"DECL_NONLOCAL",
"(",
"exp",
")",
"&&",
"!",
"TREE_PUBLIC",
"(",
"exp",
")",
"&&",
"!",
"DECL_EXTERNAL",
"(",
"exp",
")",
"&&",
"(",
"!",
"VAR_OR_FUNCTION_DECL_P",
"(",
"exp",
")",
"||",
"!",
"DECL_WEAK",
"(",
"exp",
")",
")",
"&&",
"(",
"!",
"TREE_STATIC",
"(",
"exp",
")",
"||",
"DECL_REGISTER",
"(",
"exp",
")",
")",
")",
")",
";",
"}"
] | Subroutine for fold_truth_andor_1: determine if an operand is simple enough
to be evaluated unconditionally. | [
"Subroutine",
"for",
"fold_truth_andor_1",
":",
"determine",
"if",
"an",
"operand",
"is",
"simple",
"enough",
"to",
"be",
"evaluated",
"unconditionally",
"."
] | [
"/* Strip any conversions that don't change the machine mode. */",
"/* Don't regard global variables as simple. They may be\n\t\t allocated in ways unknown to the compiler (shared memory,\n\t\t #pragma weak, etc). */",
"/* Weakrefs are not safe to be read, since they can be NULL.\n \t\t They are !TREE_PUBLIC && !DECL_EXTERNAL but still\n\t\t have DECL_WEAK flag set. */",
"/* Loading a static variable is unduly expensive, but global\n\t\t registers aren't expensive. */"
] | [
{
"param": "exp",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "exp",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | simple_operand_p_2 | bool | static bool
simple_operand_p_2 (tree exp)
{
enum tree_code code;
if (TREE_SIDE_EFFECTS (exp)
|| tree_could_trap_p (exp))
return false;
while (CONVERT_EXPR_P (exp))
exp = TREE_OPERAND (exp, 0);
code = TREE_CODE (exp);
if (TREE_CODE_CLASS (code) == tcc_comparison)
return (simple_operand_p (TREE_OPERAND (exp, 0))
&& simple_operand_p (TREE_OPERAND (exp, 1)));
if (code == TRUTH_NOT_EXPR)
return simple_operand_p_2 (TREE_OPERAND (exp, 0));
return simple_operand_p (exp);
} | /* Subroutine for fold_truth_andor: determine if an operand is simple enough
to be evaluated unconditionally.
I addition to simple_operand_p, we assume that comparisons, conversions,
and logic-not operations are simple, if their operands are simple, too. */ | Subroutine for fold_truth_andor: determine if an operand is simple enough
to be evaluated unconditionally.
I addition to simple_operand_p, we assume that comparisons, conversions,
and logic-not operations are simple, if their operands are simple, too. | [
"Subroutine",
"for",
"fold_truth_andor",
":",
"determine",
"if",
"an",
"operand",
"is",
"simple",
"enough",
"to",
"be",
"evaluated",
"unconditionally",
".",
"I",
"addition",
"to",
"simple_operand_p",
"we",
"assume",
"that",
"comparisons",
"conversions",
"and",
"logic",
"-",
"not",
"operations",
"are",
"simple",
"if",
"their",
"operands",
"are",
"simple",
"too",
"."
] | static bool
simple_operand_p_2 (tree exp)
{
enum tree_code code;
if (TREE_SIDE_EFFECTS (exp)
|| tree_could_trap_p (exp))
return false;
while (CONVERT_EXPR_P (exp))
exp = TREE_OPERAND (exp, 0);
code = TREE_CODE (exp);
if (TREE_CODE_CLASS (code) == tcc_comparison)
return (simple_operand_p (TREE_OPERAND (exp, 0))
&& simple_operand_p (TREE_OPERAND (exp, 1)));
if (code == TRUTH_NOT_EXPR)
return simple_operand_p_2 (TREE_OPERAND (exp, 0));
return simple_operand_p (exp);
} | [
"static",
"bool",
"simple_operand_p_2",
"(",
"tree",
"exp",
")",
"{",
"enum",
"tree_code",
"code",
";",
"if",
"(",
"TREE_SIDE_EFFECTS",
"(",
"exp",
")",
"||",
"tree_could_trap_p",
"(",
"exp",
")",
")",
"return",
"false",
";",
"while",
"(",
"CONVERT_EXPR_P",
"(",
"exp",
")",
")",
"exp",
"=",
"TREE_OPERAND",
"(",
"exp",
",",
"0",
")",
";",
"code",
"=",
"TREE_CODE",
"(",
"exp",
")",
";",
"if",
"(",
"TREE_CODE_CLASS",
"(",
"code",
")",
"==",
"tcc_comparison",
")",
"return",
"(",
"simple_operand_p",
"(",
"TREE_OPERAND",
"(",
"exp",
",",
"0",
")",
")",
"&&",
"simple_operand_p",
"(",
"TREE_OPERAND",
"(",
"exp",
",",
"1",
")",
")",
")",
";",
"if",
"(",
"code",
"==",
"TRUTH_NOT_EXPR",
")",
"return",
"simple_operand_p_2",
"(",
"TREE_OPERAND",
"(",
"exp",
",",
"0",
")",
")",
";",
"return",
"simple_operand_p",
"(",
"exp",
")",
";",
"}"
] | Subroutine for fold_truth_andor: determine if an operand is simple enough
to be evaluated unconditionally. | [
"Subroutine",
"for",
"fold_truth_andor",
":",
"determine",
"if",
"an",
"operand",
"is",
"simple",
"enough",
"to",
"be",
"evaluated",
"unconditionally",
"."
] | [] | [
{
"param": "exp",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "exp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | range_binop | tree | static tree
range_binop (enum tree_code code, tree type, tree arg0, int upper0_p,
tree arg1, int upper1_p)
{
tree tem;
int result;
int sgn0, sgn1;
/* If neither arg represents infinity, do the normal operation.
Else, if not a comparison, return infinity. Else handle the special
comparison rules. Note that most of the cases below won't occur, but
are handled for consistency. */
if (arg0 != 0 && arg1 != 0)
{
tem = fold_build2 (code, type != 0 ? type : TREE_TYPE (arg0),
arg0, fold_convert (TREE_TYPE (arg0), arg1));
STRIP_NOPS (tem);
return TREE_CODE (tem) == INTEGER_CST ? tem : 0;
}
if (TREE_CODE_CLASS (code) != tcc_comparison)
return 0;
/* Set SGN[01] to -1 if ARG[01] is a lower bound, 1 for upper, and 0
for neither. In real maths, we cannot assume open ended ranges are
the same. But, this is computer arithmetic, where numbers are finite.
We can therefore make the transformation of any unbounded range with
the value Z, Z being greater than any representable number. This permits
us to treat unbounded ranges as equal. */
sgn0 = arg0 != 0 ? 0 : (upper0_p ? 1 : -1);
sgn1 = arg1 != 0 ? 0 : (upper1_p ? 1 : -1);
switch (code)
{
case EQ_EXPR:
result = sgn0 == sgn1;
break;
case NE_EXPR:
result = sgn0 != sgn1;
break;
case LT_EXPR:
result = sgn0 < sgn1;
break;
case LE_EXPR:
result = sgn0 <= sgn1;
break;
case GT_EXPR:
result = sgn0 > sgn1;
break;
case GE_EXPR:
result = sgn0 >= sgn1;
break;
default:
gcc_unreachable ();
}
return constant_boolean_node (result, type);
} | /* Return the result of applying CODE to ARG0 and ARG1, but handle the case
of ARG0 and/or ARG1 being omitted, meaning an unlimited range. UPPER0_P
and UPPER1_P are nonzero if the respective argument is an upper bound
and zero for a lower. TYPE, if nonzero, is the type of the result; it
must be specified for a comparison. ARG1 will be converted to ARG0's
type if both are specified. */ | Return the result of applying CODE to ARG0 and ARG1, but handle the case
of ARG0 and/or ARG1 being omitted, meaning an unlimited range. UPPER0_P
and UPPER1_P are nonzero if the respective argument is an upper bound
and zero for a lower. TYPE, if nonzero, is the type of the result; it
must be specified for a comparison. ARG1 will be converted to ARG0's
type if both are specified. | [
"Return",
"the",
"result",
"of",
"applying",
"CODE",
"to",
"ARG0",
"and",
"ARG1",
"but",
"handle",
"the",
"case",
"of",
"ARG0",
"and",
"/",
"or",
"ARG1",
"being",
"omitted",
"meaning",
"an",
"unlimited",
"range",
".",
"UPPER0_P",
"and",
"UPPER1_P",
"are",
"nonzero",
"if",
"the",
"respective",
"argument",
"is",
"an",
"upper",
"bound",
"and",
"zero",
"for",
"a",
"lower",
".",
"TYPE",
"if",
"nonzero",
"is",
"the",
"type",
"of",
"the",
"result",
";",
"it",
"must",
"be",
"specified",
"for",
"a",
"comparison",
".",
"ARG1",
"will",
"be",
"converted",
"to",
"ARG0",
"'",
"s",
"type",
"if",
"both",
"are",
"specified",
"."
] | static tree
range_binop (enum tree_code code, tree type, tree arg0, int upper0_p,
tree arg1, int upper1_p)
{
tree tem;
int result;
int sgn0, sgn1;
if (arg0 != 0 && arg1 != 0)
{
tem = fold_build2 (code, type != 0 ? type : TREE_TYPE (arg0),
arg0, fold_convert (TREE_TYPE (arg0), arg1));
STRIP_NOPS (tem);
return TREE_CODE (tem) == INTEGER_CST ? tem : 0;
}
if (TREE_CODE_CLASS (code) != tcc_comparison)
return 0;
sgn0 = arg0 != 0 ? 0 : (upper0_p ? 1 : -1);
sgn1 = arg1 != 0 ? 0 : (upper1_p ? 1 : -1);
switch (code)
{
case EQ_EXPR:
result = sgn0 == sgn1;
break;
case NE_EXPR:
result = sgn0 != sgn1;
break;
case LT_EXPR:
result = sgn0 < sgn1;
break;
case LE_EXPR:
result = sgn0 <= sgn1;
break;
case GT_EXPR:
result = sgn0 > sgn1;
break;
case GE_EXPR:
result = sgn0 >= sgn1;
break;
default:
gcc_unreachable ();
}
return constant_boolean_node (result, type);
} | [
"static",
"tree",
"range_binop",
"(",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"arg0",
",",
"int",
"upper0_p",
",",
"tree",
"arg1",
",",
"int",
"upper1_p",
")",
"{",
"tree",
"tem",
";",
"int",
"result",
";",
"int",
"sgn0",
",",
"sgn1",
";",
"if",
"(",
"arg0",
"!=",
"0",
"&&",
"arg1",
"!=",
"0",
")",
"{",
"tem",
"=",
"fold_build2",
"(",
"code",
",",
"type",
"!=",
"0",
"?",
"type",
":",
"TREE_TYPE",
"(",
"arg0",
")",
",",
"arg0",
",",
"fold_convert",
"(",
"TREE_TYPE",
"(",
"arg0",
")",
",",
"arg1",
")",
")",
";",
"STRIP_NOPS",
"(",
"tem",
")",
";",
"return",
"TREE_CODE",
"(",
"tem",
")",
"==",
"INTEGER_CST",
"?",
"tem",
":",
"0",
";",
"}",
"if",
"(",
"TREE_CODE_CLASS",
"(",
"code",
")",
"!=",
"tcc_comparison",
")",
"return",
"0",
";",
"sgn0",
"=",
"arg0",
"!=",
"0",
"?",
"0",
":",
"(",
"upper0_p",
"?",
"1",
":",
"-1",
")",
";",
"sgn1",
"=",
"arg1",
"!=",
"0",
"?",
"0",
":",
"(",
"upper1_p",
"?",
"1",
":",
"-1",
")",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"EQ_EXPR",
":",
"result",
"=",
"sgn0",
"==",
"sgn1",
";",
"break",
";",
"case",
"NE_EXPR",
":",
"result",
"=",
"sgn0",
"!=",
"sgn1",
";",
"break",
";",
"case",
"LT_EXPR",
":",
"result",
"=",
"sgn0",
"<",
"sgn1",
";",
"break",
";",
"case",
"LE_EXPR",
":",
"result",
"=",
"sgn0",
"<=",
"sgn1",
";",
"break",
";",
"case",
"GT_EXPR",
":",
"result",
"=",
"sgn0",
">",
"sgn1",
";",
"break",
";",
"case",
"GE_EXPR",
":",
"result",
"=",
"sgn0",
">=",
"sgn1",
";",
"break",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"return",
"constant_boolean_node",
"(",
"result",
",",
"type",
")",
";",
"}"
] | Return the result of applying CODE to ARG0 and ARG1, but handle the case
of ARG0 and/or ARG1 being omitted, meaning an unlimited range. | [
"Return",
"the",
"result",
"of",
"applying",
"CODE",
"to",
"ARG0",
"and",
"ARG1",
"but",
"handle",
"the",
"case",
"of",
"ARG0",
"and",
"/",
"or",
"ARG1",
"being",
"omitted",
"meaning",
"an",
"unlimited",
"range",
"."
] | [
"/* If neither arg represents infinity, do the normal operation.\n Else, if not a comparison, return infinity. Else handle the special\n comparison rules. Note that most of the cases below won't occur, but\n are handled for consistency. */",
"/* Set SGN[01] to -1 if ARG[01] is a lower bound, 1 for upper, and 0\n for neither. In real maths, we cannot assume open ended ranges are\n the same. But, this is computer arithmetic, where numbers are finite.\n We can therefore make the transformation of any unbounded range with\n the value Z, Z being greater than any representable number. This permits\n us to treat unbounded ranges as equal. */"
] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "arg0",
"type": "tree"
},
{
"param": "upper0_p",
"type": "int"
},
{
"param": "arg1",
"type": "tree"
},
{
"param": "upper1_p",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upper0_p",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "upper1_p",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | make_range | tree | tree
make_range (tree exp, int *pin_p, tree *plow, tree *phigh,
bool *strict_overflow_p)
{
enum tree_code code;
tree arg0, arg1 = NULL_TREE;
tree exp_type, nexp;
int in_p;
tree low, high;
location_t loc = EXPR_LOCATION (exp);
/* Start with simply saying "EXP != 0" and then look at the code of EXP
and see if we can refine the range. Some of the cases below may not
happen, but it doesn't seem worth worrying about this. We "continue"
the outer loop when we've changed something; otherwise we "break"
the switch, which will "break" the while. */
in_p = 0;
low = high = build_int_cst (TREE_TYPE (exp), 0);
while (1)
{
code = TREE_CODE (exp);
exp_type = TREE_TYPE (exp);
arg0 = NULL_TREE;
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
{
if (TREE_OPERAND_LENGTH (exp) > 0)
arg0 = TREE_OPERAND (exp, 0);
if (TREE_CODE_CLASS (code) == tcc_binary
|| TREE_CODE_CLASS (code) == tcc_comparison
|| (TREE_CODE_CLASS (code) == tcc_expression
&& TREE_OPERAND_LENGTH (exp) > 1))
arg1 = TREE_OPERAND (exp, 1);
}
if (arg0 == NULL_TREE)
break;
nexp = make_range_step (loc, code, arg0, arg1, exp_type, &low,
&high, &in_p, strict_overflow_p);
if (nexp == NULL_TREE)
break;
exp = nexp;
}
/* If EXP is a constant, we can evaluate whether this is true or false. */
if (TREE_CODE (exp) == INTEGER_CST)
{
in_p = in_p == (integer_onep (range_binop (GE_EXPR, integer_type_node,
exp, 0, low, 0))
&& integer_onep (range_binop (LE_EXPR, integer_type_node,
exp, 1, high, 1)));
low = high = 0;
exp = 0;
}
*pin_p = in_p, *plow = low, *phigh = high;
return exp;
} | /* Given EXP, a logical expression, set the range it is testing into
variables denoted by PIN_P, PLOW, and PHIGH. Return the expression
actually being tested. *PLOW and *PHIGH will be made of the same
type as the returned expression. If EXP is not a comparison, we
will most likely not be returning a useful value and range. Set
*STRICT_OVERFLOW_P to true if the return value is only valid
because signed overflow is undefined; otherwise, do not change
*STRICT_OVERFLOW_P. */ | Given EXP, a logical expression, set the range it is testing into
variables denoted by PIN_P, PLOW, and PHIGH. Return the expression
actually being tested. *PLOW and *PHIGH will be made of the same
type as the returned expression. If EXP is not a comparison, we
will most likely not be returning a useful value and range. Set
STRICT_OVERFLOW_P to true if the return value is only valid
because signed overflow is undefined; otherwise, do not change
STRICT_OVERFLOW_P. | [
"Given",
"EXP",
"a",
"logical",
"expression",
"set",
"the",
"range",
"it",
"is",
"testing",
"into",
"variables",
"denoted",
"by",
"PIN_P",
"PLOW",
"and",
"PHIGH",
".",
"Return",
"the",
"expression",
"actually",
"being",
"tested",
".",
"*",
"PLOW",
"and",
"*",
"PHIGH",
"will",
"be",
"made",
"of",
"the",
"same",
"type",
"as",
"the",
"returned",
"expression",
".",
"If",
"EXP",
"is",
"not",
"a",
"comparison",
"we",
"will",
"most",
"likely",
"not",
"be",
"returning",
"a",
"useful",
"value",
"and",
"range",
".",
"Set",
"STRICT_OVERFLOW_P",
"to",
"true",
"if",
"the",
"return",
"value",
"is",
"only",
"valid",
"because",
"signed",
"overflow",
"is",
"undefined",
";",
"otherwise",
"do",
"not",
"change",
"STRICT_OVERFLOW_P",
"."
] | tree
make_range (tree exp, int *pin_p, tree *plow, tree *phigh,
bool *strict_overflow_p)
{
enum tree_code code;
tree arg0, arg1 = NULL_TREE;
tree exp_type, nexp;
int in_p;
tree low, high;
location_t loc = EXPR_LOCATION (exp);
in_p = 0;
low = high = build_int_cst (TREE_TYPE (exp), 0);
while (1)
{
code = TREE_CODE (exp);
exp_type = TREE_TYPE (exp);
arg0 = NULL_TREE;
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
{
if (TREE_OPERAND_LENGTH (exp) > 0)
arg0 = TREE_OPERAND (exp, 0);
if (TREE_CODE_CLASS (code) == tcc_binary
|| TREE_CODE_CLASS (code) == tcc_comparison
|| (TREE_CODE_CLASS (code) == tcc_expression
&& TREE_OPERAND_LENGTH (exp) > 1))
arg1 = TREE_OPERAND (exp, 1);
}
if (arg0 == NULL_TREE)
break;
nexp = make_range_step (loc, code, arg0, arg1, exp_type, &low,
&high, &in_p, strict_overflow_p);
if (nexp == NULL_TREE)
break;
exp = nexp;
}
if (TREE_CODE (exp) == INTEGER_CST)
{
in_p = in_p == (integer_onep (range_binop (GE_EXPR, integer_type_node,
exp, 0, low, 0))
&& integer_onep (range_binop (LE_EXPR, integer_type_node,
exp, 1, high, 1)));
low = high = 0;
exp = 0;
}
*pin_p = in_p, *plow = low, *phigh = high;
return exp;
} | [
"tree",
"make_range",
"(",
"tree",
"exp",
",",
"int",
"*",
"pin_p",
",",
"tree",
"*",
"plow",
",",
"tree",
"*",
"phigh",
",",
"bool",
"*",
"strict_overflow_p",
")",
"{",
"enum",
"tree_code",
"code",
";",
"tree",
"arg0",
",",
"arg1",
"=",
"NULL_TREE",
";",
"tree",
"exp_type",
",",
"nexp",
";",
"int",
"in_p",
";",
"tree",
"low",
",",
"high",
";",
"location_t",
"loc",
"=",
"EXPR_LOCATION",
"(",
"exp",
")",
";",
"in_p",
"=",
"0",
";",
"low",
"=",
"high",
"=",
"build_int_cst",
"(",
"TREE_TYPE",
"(",
"exp",
")",
",",
"0",
")",
";",
"while",
"(",
"1",
")",
"{",
"code",
"=",
"TREE_CODE",
"(",
"exp",
")",
";",
"exp_type",
"=",
"TREE_TYPE",
"(",
"exp",
")",
";",
"arg0",
"=",
"NULL_TREE",
";",
"if",
"(",
"IS_EXPR_CODE_CLASS",
"(",
"TREE_CODE_CLASS",
"(",
"code",
")",
")",
")",
"{",
"if",
"(",
"TREE_OPERAND_LENGTH",
"(",
"exp",
")",
">",
"0",
")",
"arg0",
"=",
"TREE_OPERAND",
"(",
"exp",
",",
"0",
")",
";",
"if",
"(",
"TREE_CODE_CLASS",
"(",
"code",
")",
"==",
"tcc_binary",
"||",
"TREE_CODE_CLASS",
"(",
"code",
")",
"==",
"tcc_comparison",
"||",
"(",
"TREE_CODE_CLASS",
"(",
"code",
")",
"==",
"tcc_expression",
"&&",
"TREE_OPERAND_LENGTH",
"(",
"exp",
")",
">",
"1",
")",
")",
"arg1",
"=",
"TREE_OPERAND",
"(",
"exp",
",",
"1",
")",
";",
"}",
"if",
"(",
"arg0",
"==",
"NULL_TREE",
")",
"break",
";",
"nexp",
"=",
"make_range_step",
"(",
"loc",
",",
"code",
",",
"arg0",
",",
"arg1",
",",
"exp_type",
",",
"&",
"low",
",",
"&",
"high",
",",
"&",
"in_p",
",",
"strict_overflow_p",
")",
";",
"if",
"(",
"nexp",
"==",
"NULL_TREE",
")",
"break",
";",
"exp",
"=",
"nexp",
";",
"}",
"if",
"(",
"TREE_CODE",
"(",
"exp",
")",
"==",
"INTEGER_CST",
")",
"{",
"in_p",
"=",
"in_p",
"==",
"(",
"integer_onep",
"(",
"range_binop",
"(",
"GE_EXPR",
",",
"integer_type_node",
",",
"exp",
",",
"0",
",",
"low",
",",
"0",
")",
")",
"&&",
"integer_onep",
"(",
"range_binop",
"(",
"LE_EXPR",
",",
"integer_type_node",
",",
"exp",
",",
"1",
",",
"high",
",",
"1",
")",
")",
")",
";",
"low",
"=",
"high",
"=",
"0",
";",
"exp",
"=",
"0",
";",
"}",
"*",
"pin_p",
"=",
"in_p",
",",
"*",
"plow",
"=",
"low",
",",
"*",
"phigh",
"=",
"high",
";",
"return",
"exp",
";",
"}"
] | Given EXP, a logical expression, set the range it is testing into
variables denoted by PIN_P, PLOW, and PHIGH. | [
"Given",
"EXP",
"a",
"logical",
"expression",
"set",
"the",
"range",
"it",
"is",
"testing",
"into",
"variables",
"denoted",
"by",
"PIN_P",
"PLOW",
"and",
"PHIGH",
"."
] | [
"/* Start with simply saying \"EXP != 0\" and then look at the code of EXP\n and see if we can refine the range. Some of the cases below may not\n happen, but it doesn't seem worth worrying about this. We \"continue\"\n the outer loop when we've changed something; otherwise we \"break\"\n the switch, which will \"break\" the while. */",
"/* If EXP is a constant, we can evaluate whether this is true or false. */"
] | [
{
"param": "exp",
"type": "tree"
},
{
"param": "pin_p",
"type": "int"
},
{
"param": "plow",
"type": "tree"
},
{
"param": "phigh",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "exp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pin_p",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "plow",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "phigh",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | range_check_type | tree | tree
range_check_type (tree etype)
{
/* First make sure that arithmetics in this type is valid, then make sure
that it wraps around. */
if (TREE_CODE (etype) == ENUMERAL_TYPE || TREE_CODE (etype) == BOOLEAN_TYPE)
etype = lang_hooks.types.type_for_size (TYPE_PRECISION (etype),
TYPE_UNSIGNED (etype));
if (TREE_CODE (etype) == INTEGER_TYPE && !TYPE_OVERFLOW_WRAPS (etype))
{
tree utype, minv, maxv;
/* Check if (unsigned) INT_MAX + 1 == (unsigned) INT_MIN
for the type in question, as we rely on this here. */
utype = unsigned_type_for (etype);
maxv = fold_convert (utype, TYPE_MAX_VALUE (etype));
maxv = range_binop (PLUS_EXPR, NULL_TREE, maxv, 1,
build_int_cst (TREE_TYPE (maxv), 1), 1);
minv = fold_convert (utype, TYPE_MIN_VALUE (etype));
if (integer_zerop (range_binop (NE_EXPR, integer_type_node,
minv, 1, maxv, 1)))
etype = utype;
else
return NULL_TREE;
}
return etype;
} | /* Helper routine for build_range_check and match.pd. Return the type to
perform the check or NULL if it shouldn't be optimized. */ | Helper routine for build_range_check and match.pd. Return the type to
perform the check or NULL if it shouldn't be optimized. | [
"Helper",
"routine",
"for",
"build_range_check",
"and",
"match",
".",
"pd",
".",
"Return",
"the",
"type",
"to",
"perform",
"the",
"check",
"or",
"NULL",
"if",
"it",
"shouldn",
"'",
"t",
"be",
"optimized",
"."
] | tree
range_check_type (tree etype)
{
if (TREE_CODE (etype) == ENUMERAL_TYPE || TREE_CODE (etype) == BOOLEAN_TYPE)
etype = lang_hooks.types.type_for_size (TYPE_PRECISION (etype),
TYPE_UNSIGNED (etype));
if (TREE_CODE (etype) == INTEGER_TYPE && !TYPE_OVERFLOW_WRAPS (etype))
{
tree utype, minv, maxv;
utype = unsigned_type_for (etype);
maxv = fold_convert (utype, TYPE_MAX_VALUE (etype));
maxv = range_binop (PLUS_EXPR, NULL_TREE, maxv, 1,
build_int_cst (TREE_TYPE (maxv), 1), 1);
minv = fold_convert (utype, TYPE_MIN_VALUE (etype));
if (integer_zerop (range_binop (NE_EXPR, integer_type_node,
minv, 1, maxv, 1)))
etype = utype;
else
return NULL_TREE;
}
return etype;
} | [
"tree",
"range_check_type",
"(",
"tree",
"etype",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"etype",
")",
"==",
"ENUMERAL_TYPE",
"||",
"TREE_CODE",
"(",
"etype",
")",
"==",
"BOOLEAN_TYPE",
")",
"etype",
"=",
"lang_hooks",
".",
"types",
".",
"type_for_size",
"(",
"TYPE_PRECISION",
"(",
"etype",
")",
",",
"TYPE_UNSIGNED",
"(",
"etype",
")",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"etype",
")",
"==",
"INTEGER_TYPE",
"&&",
"!",
"TYPE_OVERFLOW_WRAPS",
"(",
"etype",
")",
")",
"{",
"tree",
"utype",
",",
"minv",
",",
"maxv",
";",
"utype",
"=",
"unsigned_type_for",
"(",
"etype",
")",
";",
"maxv",
"=",
"fold_convert",
"(",
"utype",
",",
"TYPE_MAX_VALUE",
"(",
"etype",
")",
")",
";",
"maxv",
"=",
"range_binop",
"(",
"PLUS_EXPR",
",",
"NULL_TREE",
",",
"maxv",
",",
"1",
",",
"build_int_cst",
"(",
"TREE_TYPE",
"(",
"maxv",
")",
",",
"1",
")",
",",
"1",
")",
";",
"minv",
"=",
"fold_convert",
"(",
"utype",
",",
"TYPE_MIN_VALUE",
"(",
"etype",
")",
")",
";",
"if",
"(",
"integer_zerop",
"(",
"range_binop",
"(",
"NE_EXPR",
",",
"integer_type_node",
",",
"minv",
",",
"1",
",",
"maxv",
",",
"1",
")",
")",
")",
"etype",
"=",
"utype",
";",
"else",
"return",
"NULL_TREE",
";",
"}",
"return",
"etype",
";",
"}"
] | Helper routine for build_range_check and match.pd. | [
"Helper",
"routine",
"for",
"build_range_check",
"and",
"match",
".",
"pd",
"."
] | [
"/* First make sure that arithmetics in this type is valid, then make sure\n that it wraps around. */",
"/* Check if (unsigned) INT_MAX + 1 == (unsigned) INT_MIN\n\t for the type in question, as we rely on this here. */"
] | [
{
"param": "etype",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "etype",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | range_predecessor | tree | static tree
range_predecessor (tree val)
{
tree type = TREE_TYPE (val);
if (INTEGRAL_TYPE_P (type)
&& operand_equal_p (val, TYPE_MIN_VALUE (type), 0))
return 0;
else
return range_binop (MINUS_EXPR, NULL_TREE, val, 0,
build_int_cst (TREE_TYPE (val), 1), 0);
} | /* Return the predecessor of VAL in its type, handling the infinite case. */ | Return the predecessor of VAL in its type, handling the infinite case. | [
"Return",
"the",
"predecessor",
"of",
"VAL",
"in",
"its",
"type",
"handling",
"the",
"infinite",
"case",
"."
] | static tree
range_predecessor (tree val)
{
tree type = TREE_TYPE (val);
if (INTEGRAL_TYPE_P (type)
&& operand_equal_p (val, TYPE_MIN_VALUE (type), 0))
return 0;
else
return range_binop (MINUS_EXPR, NULL_TREE, val, 0,
build_int_cst (TREE_TYPE (val), 1), 0);
} | [
"static",
"tree",
"range_predecessor",
"(",
"tree",
"val",
")",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"val",
")",
";",
"if",
"(",
"INTEGRAL_TYPE_P",
"(",
"type",
")",
"&&",
"operand_equal_p",
"(",
"val",
",",
"TYPE_MIN_VALUE",
"(",
"type",
")",
",",
"0",
")",
")",
"return",
"0",
";",
"else",
"return",
"range_binop",
"(",
"MINUS_EXPR",
",",
"NULL_TREE",
",",
"val",
",",
"0",
",",
"build_int_cst",
"(",
"TREE_TYPE",
"(",
"val",
")",
",",
"1",
")",
",",
"0",
")",
";",
"}"
] | Return the predecessor of VAL in its type, handling the infinite case. | [
"Return",
"the",
"predecessor",
"of",
"VAL",
"in",
"its",
"type",
"handling",
"the",
"infinite",
"case",
"."
] | [] | [
{
"param": "val",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "val",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | range_successor | tree | static tree
range_successor (tree val)
{
tree type = TREE_TYPE (val);
if (INTEGRAL_TYPE_P (type)
&& operand_equal_p (val, TYPE_MAX_VALUE (type), 0))
return 0;
else
return range_binop (PLUS_EXPR, NULL_TREE, val, 0,
build_int_cst (TREE_TYPE (val), 1), 0);
} | /* Return the successor of VAL in its type, handling the infinite case. */ | Return the successor of VAL in its type, handling the infinite case. | [
"Return",
"the",
"successor",
"of",
"VAL",
"in",
"its",
"type",
"handling",
"the",
"infinite",
"case",
"."
] | static tree
range_successor (tree val)
{
tree type = TREE_TYPE (val);
if (INTEGRAL_TYPE_P (type)
&& operand_equal_p (val, TYPE_MAX_VALUE (type), 0))
return 0;
else
return range_binop (PLUS_EXPR, NULL_TREE, val, 0,
build_int_cst (TREE_TYPE (val), 1), 0);
} | [
"static",
"tree",
"range_successor",
"(",
"tree",
"val",
")",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"val",
")",
";",
"if",
"(",
"INTEGRAL_TYPE_P",
"(",
"type",
")",
"&&",
"operand_equal_p",
"(",
"val",
",",
"TYPE_MAX_VALUE",
"(",
"type",
")",
",",
"0",
")",
")",
"return",
"0",
";",
"else",
"return",
"range_binop",
"(",
"PLUS_EXPR",
",",
"NULL_TREE",
",",
"val",
",",
"0",
",",
"build_int_cst",
"(",
"TREE_TYPE",
"(",
"val",
")",
",",
"1",
")",
",",
"0",
")",
";",
"}"
] | Return the successor of VAL in its type, handling the infinite case. | [
"Return",
"the",
"successor",
"of",
"VAL",
"in",
"its",
"type",
"handling",
"the",
"infinite",
"case",
"."
] | [] | [
{
"param": "val",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "val",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | merge_ranges | bool | bool
merge_ranges (int *pin_p, tree *plow, tree *phigh, int in0_p, tree low0,
tree high0, int in1_p, tree low1, tree high1)
{
int no_overlap;
int subset;
int temp;
tree tem;
int in_p;
tree low, high;
int lowequal = ((low0 == 0 && low1 == 0)
|| integer_onep (range_binop (EQ_EXPR, integer_type_node,
low0, 0, low1, 0)));
int highequal = ((high0 == 0 && high1 == 0)
|| integer_onep (range_binop (EQ_EXPR, integer_type_node,
high0, 1, high1, 1)));
/* Make range 0 be the range that starts first, or ends last if they
start at the same value. Swap them if it isn't. */
if (integer_onep (range_binop (GT_EXPR, integer_type_node,
low0, 0, low1, 0))
|| (lowequal
&& integer_onep (range_binop (GT_EXPR, integer_type_node,
high1, 1, high0, 1))))
{
temp = in0_p, in0_p = in1_p, in1_p = temp;
tem = low0, low0 = low1, low1 = tem;
tem = high0, high0 = high1, high1 = tem;
}
/* Now flag two cases, whether the ranges are disjoint or whether the
second range is totally subsumed in the first. Note that the tests
below are simplified by the ones above. */
no_overlap = integer_onep (range_binop (LT_EXPR, integer_type_node,
high0, 1, low1, 0));
subset = integer_onep (range_binop (LE_EXPR, integer_type_node,
high1, 1, high0, 1));
/* We now have four cases, depending on whether we are including or
excluding the two ranges. */
if (in0_p && in1_p)
{
/* If they don't overlap, the result is false. If the second range
is a subset it is the result. Otherwise, the range is from the start
of the second to the end of the first. */
if (no_overlap)
in_p = 0, low = high = 0;
else if (subset)
in_p = 1, low = low1, high = high1;
else
in_p = 1, low = low1, high = high0;
}
else if (in0_p && ! in1_p)
{
/* If they don't overlap, the result is the first range. If they are
equal, the result is false. If the second range is a subset of the
first, and the ranges begin at the same place, we go from just after
the end of the second range to the end of the first. If the second
range is not a subset of the first, or if it is a subset and both
ranges end at the same place, the range starts at the start of the
first range and ends just before the second range.
Otherwise, we can't describe this as a single range. */
if (no_overlap)
in_p = 1, low = low0, high = high0;
else if (lowequal && highequal)
in_p = 0, low = high = 0;
else if (subset && lowequal)
{
low = range_successor (high1);
high = high0;
in_p = 1;
if (low == 0)
{
/* We are in the weird situation where high0 > high1 but
high1 has no successor. Punt. */
return 0;
}
}
else if (! subset || highequal)
{
low = low0;
high = range_predecessor (low1);
in_p = 1;
if (high == 0)
{
/* low0 < low1 but low1 has no predecessor. Punt. */
return 0;
}
}
else
return 0;
}
else if (! in0_p && in1_p)
{
/* If they don't overlap, the result is the second range. If the second
is a subset of the first, the result is false. Otherwise,
the range starts just after the first range and ends at the
end of the second. */
if (no_overlap)
in_p = 1, low = low1, high = high1;
else if (subset || highequal)
in_p = 0, low = high = 0;
else
{
low = range_successor (high0);
high = high1;
in_p = 1;
if (low == 0)
{
/* high1 > high0 but high0 has no successor. Punt. */
return 0;
}
}
}
else
{
/* The case where we are excluding both ranges. Here the complex case
is if they don't overlap. In that case, the only time we have a
range is if they are adjacent. If the second is a subset of the
first, the result is the first. Otherwise, the range to exclude
starts at the beginning of the first range and ends at the end of the
second. */
if (no_overlap)
{
if (integer_onep (range_binop (EQ_EXPR, integer_type_node,
range_successor (high0),
1, low1, 0)))
in_p = 0, low = low0, high = high1;
else
{
/* Canonicalize - [min, x] into - [-, x]. */
if (low0 && TREE_CODE (low0) == INTEGER_CST)
switch (TREE_CODE (TREE_TYPE (low0)))
{
case ENUMERAL_TYPE:
if (maybe_ne (TYPE_PRECISION (TREE_TYPE (low0)),
GET_MODE_BITSIZE
(TYPE_MODE (TREE_TYPE (low0)))))
break;
/* FALLTHROUGH */
case INTEGER_TYPE:
if (tree_int_cst_equal (low0,
TYPE_MIN_VALUE (TREE_TYPE (low0))))
low0 = 0;
break;
case POINTER_TYPE:
if (TYPE_UNSIGNED (TREE_TYPE (low0))
&& integer_zerop (low0))
low0 = 0;
break;
default:
break;
}
/* Canonicalize - [x, max] into - [x, -]. */
if (high1 && TREE_CODE (high1) == INTEGER_CST)
switch (TREE_CODE (TREE_TYPE (high1)))
{
case ENUMERAL_TYPE:
if (maybe_ne (TYPE_PRECISION (TREE_TYPE (high1)),
GET_MODE_BITSIZE
(TYPE_MODE (TREE_TYPE (high1)))))
break;
/* FALLTHROUGH */
case INTEGER_TYPE:
if (tree_int_cst_equal (high1,
TYPE_MAX_VALUE (TREE_TYPE (high1))))
high1 = 0;
break;
case POINTER_TYPE:
if (TYPE_UNSIGNED (TREE_TYPE (high1))
&& integer_zerop (range_binop (PLUS_EXPR, NULL_TREE,
high1, 1,
build_int_cst (TREE_TYPE (high1), 1),
1)))
high1 = 0;
break;
default:
break;
}
/* The ranges might be also adjacent between the maximum and
minimum values of the given type. For
- [{min,-}, x] and - [y, {max,-}] ranges where x + 1 < y
return + [x + 1, y - 1]. */
if (low0 == 0 && high1 == 0)
{
low = range_successor (high0);
high = range_predecessor (low1);
if (low == 0 || high == 0)
return 0;
in_p = 1;
}
else
return 0;
}
}
else if (subset)
in_p = 0, low = low0, high = high0;
else
in_p = 0, low = low0, high = high1;
}
*pin_p = in_p, *plow = low, *phigh = high;
return 1;
} | /* Given two ranges, see if we can merge them into one. Return 1 if we
can, 0 if we can't. Set the output range into the specified parameters. */ | Given two ranges, see if we can merge them into one. Return 1 if we
can, 0 if we can't. Set the output range into the specified parameters. | [
"Given",
"two",
"ranges",
"see",
"if",
"we",
"can",
"merge",
"them",
"into",
"one",
".",
"Return",
"1",
"if",
"we",
"can",
"0",
"if",
"we",
"can",
"'",
"t",
".",
"Set",
"the",
"output",
"range",
"into",
"the",
"specified",
"parameters",
"."
] | bool
merge_ranges (int *pin_p, tree *plow, tree *phigh, int in0_p, tree low0,
tree high0, int in1_p, tree low1, tree high1)
{
int no_overlap;
int subset;
int temp;
tree tem;
int in_p;
tree low, high;
int lowequal = ((low0 == 0 && low1 == 0)
|| integer_onep (range_binop (EQ_EXPR, integer_type_node,
low0, 0, low1, 0)));
int highequal = ((high0 == 0 && high1 == 0)
|| integer_onep (range_binop (EQ_EXPR, integer_type_node,
high0, 1, high1, 1)));
if (integer_onep (range_binop (GT_EXPR, integer_type_node,
low0, 0, low1, 0))
|| (lowequal
&& integer_onep (range_binop (GT_EXPR, integer_type_node,
high1, 1, high0, 1))))
{
temp = in0_p, in0_p = in1_p, in1_p = temp;
tem = low0, low0 = low1, low1 = tem;
tem = high0, high0 = high1, high1 = tem;
}
no_overlap = integer_onep (range_binop (LT_EXPR, integer_type_node,
high0, 1, low1, 0));
subset = integer_onep (range_binop (LE_EXPR, integer_type_node,
high1, 1, high0, 1));
if (in0_p && in1_p)
{
if (no_overlap)
in_p = 0, low = high = 0;
else if (subset)
in_p = 1, low = low1, high = high1;
else
in_p = 1, low = low1, high = high0;
}
else if (in0_p && ! in1_p)
{
if (no_overlap)
in_p = 1, low = low0, high = high0;
else if (lowequal && highequal)
in_p = 0, low = high = 0;
else if (subset && lowequal)
{
low = range_successor (high1);
high = high0;
in_p = 1;
if (low == 0)
{
return 0;
}
}
else if (! subset || highequal)
{
low = low0;
high = range_predecessor (low1);
in_p = 1;
if (high == 0)
{
return 0;
}
}
else
return 0;
}
else if (! in0_p && in1_p)
{
if (no_overlap)
in_p = 1, low = low1, high = high1;
else if (subset || highequal)
in_p = 0, low = high = 0;
else
{
low = range_successor (high0);
high = high1;
in_p = 1;
if (low == 0)
{
return 0;
}
}
}
else
{
if (no_overlap)
{
if (integer_onep (range_binop (EQ_EXPR, integer_type_node,
range_successor (high0),
1, low1, 0)))
in_p = 0, low = low0, high = high1;
else
{
if (low0 && TREE_CODE (low0) == INTEGER_CST)
switch (TREE_CODE (TREE_TYPE (low0)))
{
case ENUMERAL_TYPE:
if (maybe_ne (TYPE_PRECISION (TREE_TYPE (low0)),
GET_MODE_BITSIZE
(TYPE_MODE (TREE_TYPE (low0)))))
break;
case INTEGER_TYPE:
if (tree_int_cst_equal (low0,
TYPE_MIN_VALUE (TREE_TYPE (low0))))
low0 = 0;
break;
case POINTER_TYPE:
if (TYPE_UNSIGNED (TREE_TYPE (low0))
&& integer_zerop (low0))
low0 = 0;
break;
default:
break;
}
if (high1 && TREE_CODE (high1) == INTEGER_CST)
switch (TREE_CODE (TREE_TYPE (high1)))
{
case ENUMERAL_TYPE:
if (maybe_ne (TYPE_PRECISION (TREE_TYPE (high1)),
GET_MODE_BITSIZE
(TYPE_MODE (TREE_TYPE (high1)))))
break;
case INTEGER_TYPE:
if (tree_int_cst_equal (high1,
TYPE_MAX_VALUE (TREE_TYPE (high1))))
high1 = 0;
break;
case POINTER_TYPE:
if (TYPE_UNSIGNED (TREE_TYPE (high1))
&& integer_zerop (range_binop (PLUS_EXPR, NULL_TREE,
high1, 1,
build_int_cst (TREE_TYPE (high1), 1),
1)))
high1 = 0;
break;
default:
break;
}
if (low0 == 0 && high1 == 0)
{
low = range_successor (high0);
high = range_predecessor (low1);
if (low == 0 || high == 0)
return 0;
in_p = 1;
}
else
return 0;
}
}
else if (subset)
in_p = 0, low = low0, high = high0;
else
in_p = 0, low = low0, high = high1;
}
*pin_p = in_p, *plow = low, *phigh = high;
return 1;
} | [
"bool",
"merge_ranges",
"(",
"int",
"*",
"pin_p",
",",
"tree",
"*",
"plow",
",",
"tree",
"*",
"phigh",
",",
"int",
"in0_p",
",",
"tree",
"low0",
",",
"tree",
"high0",
",",
"int",
"in1_p",
",",
"tree",
"low1",
",",
"tree",
"high1",
")",
"{",
"int",
"no_overlap",
";",
"int",
"subset",
";",
"int",
"temp",
";",
"tree",
"tem",
";",
"int",
"in_p",
";",
"tree",
"low",
",",
"high",
";",
"int",
"lowequal",
"=",
"(",
"(",
"low0",
"==",
"0",
"&&",
"low1",
"==",
"0",
")",
"||",
"integer_onep",
"(",
"range_binop",
"(",
"EQ_EXPR",
",",
"integer_type_node",
",",
"low0",
",",
"0",
",",
"low1",
",",
"0",
")",
")",
")",
";",
"int",
"highequal",
"=",
"(",
"(",
"high0",
"==",
"0",
"&&",
"high1",
"==",
"0",
")",
"||",
"integer_onep",
"(",
"range_binop",
"(",
"EQ_EXPR",
",",
"integer_type_node",
",",
"high0",
",",
"1",
",",
"high1",
",",
"1",
")",
")",
")",
";",
"if",
"(",
"integer_onep",
"(",
"range_binop",
"(",
"GT_EXPR",
",",
"integer_type_node",
",",
"low0",
",",
"0",
",",
"low1",
",",
"0",
")",
")",
"||",
"(",
"lowequal",
"&&",
"integer_onep",
"(",
"range_binop",
"(",
"GT_EXPR",
",",
"integer_type_node",
",",
"high1",
",",
"1",
",",
"high0",
",",
"1",
")",
")",
")",
")",
"{",
"temp",
"=",
"in0_p",
",",
"in0_p",
"=",
"in1_p",
",",
"in1_p",
"=",
"temp",
";",
"tem",
"=",
"low0",
",",
"low0",
"=",
"low1",
",",
"low1",
"=",
"tem",
";",
"tem",
"=",
"high0",
",",
"high0",
"=",
"high1",
",",
"high1",
"=",
"tem",
";",
"}",
"no_overlap",
"=",
"integer_onep",
"(",
"range_binop",
"(",
"LT_EXPR",
",",
"integer_type_node",
",",
"high0",
",",
"1",
",",
"low1",
",",
"0",
")",
")",
";",
"subset",
"=",
"integer_onep",
"(",
"range_binop",
"(",
"LE_EXPR",
",",
"integer_type_node",
",",
"high1",
",",
"1",
",",
"high0",
",",
"1",
")",
")",
";",
"if",
"(",
"in0_p",
"&&",
"in1_p",
")",
"{",
"if",
"(",
"no_overlap",
")",
"in_p",
"=",
"0",
",",
"low",
"=",
"high",
"=",
"0",
";",
"else",
"if",
"(",
"subset",
")",
"in_p",
"=",
"1",
",",
"low",
"=",
"low1",
",",
"high",
"=",
"high1",
";",
"else",
"in_p",
"=",
"1",
",",
"low",
"=",
"low1",
",",
"high",
"=",
"high0",
";",
"}",
"else",
"if",
"(",
"in0_p",
"&&",
"!",
"in1_p",
")",
"{",
"if",
"(",
"no_overlap",
")",
"in_p",
"=",
"1",
",",
"low",
"=",
"low0",
",",
"high",
"=",
"high0",
";",
"else",
"if",
"(",
"lowequal",
"&&",
"highequal",
")",
"in_p",
"=",
"0",
",",
"low",
"=",
"high",
"=",
"0",
";",
"else",
"if",
"(",
"subset",
"&&",
"lowequal",
")",
"{",
"low",
"=",
"range_successor",
"(",
"high1",
")",
";",
"high",
"=",
"high0",
";",
"in_p",
"=",
"1",
";",
"if",
"(",
"low",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"subset",
"||",
"highequal",
")",
"{",
"low",
"=",
"low0",
";",
"high",
"=",
"range_predecessor",
"(",
"low1",
")",
";",
"in_p",
"=",
"1",
";",
"if",
"(",
"high",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"}",
"else",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"!",
"in0_p",
"&&",
"in1_p",
")",
"{",
"if",
"(",
"no_overlap",
")",
"in_p",
"=",
"1",
",",
"low",
"=",
"low1",
",",
"high",
"=",
"high1",
";",
"else",
"if",
"(",
"subset",
"||",
"highequal",
")",
"in_p",
"=",
"0",
",",
"low",
"=",
"high",
"=",
"0",
";",
"else",
"{",
"low",
"=",
"range_successor",
"(",
"high0",
")",
";",
"high",
"=",
"high1",
";",
"in_p",
"=",
"1",
";",
"if",
"(",
"low",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"no_overlap",
")",
"{",
"if",
"(",
"integer_onep",
"(",
"range_binop",
"(",
"EQ_EXPR",
",",
"integer_type_node",
",",
"range_successor",
"(",
"high0",
")",
",",
"1",
",",
"low1",
",",
"0",
")",
")",
")",
"in_p",
"=",
"0",
",",
"low",
"=",
"low0",
",",
"high",
"=",
"high1",
";",
"else",
"{",
"if",
"(",
"low0",
"&&",
"TREE_CODE",
"(",
"low0",
")",
"==",
"INTEGER_CST",
")",
"switch",
"(",
"TREE_CODE",
"(",
"TREE_TYPE",
"(",
"low0",
")",
")",
")",
"{",
"case",
"ENUMERAL_TYPE",
":",
"if",
"(",
"maybe_ne",
"(",
"TYPE_PRECISION",
"(",
"TREE_TYPE",
"(",
"low0",
")",
")",
",",
"GET_MODE_BITSIZE",
"(",
"TYPE_MODE",
"(",
"TREE_TYPE",
"(",
"low0",
")",
")",
")",
")",
")",
"break",
";",
"case",
"INTEGER_TYPE",
":",
"if",
"(",
"tree_int_cst_equal",
"(",
"low0",
",",
"TYPE_MIN_VALUE",
"(",
"TREE_TYPE",
"(",
"low0",
")",
")",
")",
")",
"low0",
"=",
"0",
";",
"break",
";",
"case",
"POINTER_TYPE",
":",
"if",
"(",
"TYPE_UNSIGNED",
"(",
"TREE_TYPE",
"(",
"low0",
")",
")",
"&&",
"integer_zerop",
"(",
"low0",
")",
")",
"low0",
"=",
"0",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"if",
"(",
"high1",
"&&",
"TREE_CODE",
"(",
"high1",
")",
"==",
"INTEGER_CST",
")",
"switch",
"(",
"TREE_CODE",
"(",
"TREE_TYPE",
"(",
"high1",
")",
")",
")",
"{",
"case",
"ENUMERAL_TYPE",
":",
"if",
"(",
"maybe_ne",
"(",
"TYPE_PRECISION",
"(",
"TREE_TYPE",
"(",
"high1",
")",
")",
",",
"GET_MODE_BITSIZE",
"(",
"TYPE_MODE",
"(",
"TREE_TYPE",
"(",
"high1",
")",
")",
")",
")",
")",
"break",
";",
"case",
"INTEGER_TYPE",
":",
"if",
"(",
"tree_int_cst_equal",
"(",
"high1",
",",
"TYPE_MAX_VALUE",
"(",
"TREE_TYPE",
"(",
"high1",
")",
")",
")",
")",
"high1",
"=",
"0",
";",
"break",
";",
"case",
"POINTER_TYPE",
":",
"if",
"(",
"TYPE_UNSIGNED",
"(",
"TREE_TYPE",
"(",
"high1",
")",
")",
"&&",
"integer_zerop",
"(",
"range_binop",
"(",
"PLUS_EXPR",
",",
"NULL_TREE",
",",
"high1",
",",
"1",
",",
"build_int_cst",
"(",
"TREE_TYPE",
"(",
"high1",
")",
",",
"1",
")",
",",
"1",
")",
")",
")",
"high1",
"=",
"0",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"if",
"(",
"low0",
"==",
"0",
"&&",
"high1",
"==",
"0",
")",
"{",
"low",
"=",
"range_successor",
"(",
"high0",
")",
";",
"high",
"=",
"range_predecessor",
"(",
"low1",
")",
";",
"if",
"(",
"low",
"==",
"0",
"||",
"high",
"==",
"0",
")",
"return",
"0",
";",
"in_p",
"=",
"1",
";",
"}",
"else",
"return",
"0",
";",
"}",
"}",
"else",
"if",
"(",
"subset",
")",
"in_p",
"=",
"0",
",",
"low",
"=",
"low0",
",",
"high",
"=",
"high0",
";",
"else",
"in_p",
"=",
"0",
",",
"low",
"=",
"low0",
",",
"high",
"=",
"high1",
";",
"}",
"*",
"pin_p",
"=",
"in_p",
",",
"*",
"plow",
"=",
"low",
",",
"*",
"phigh",
"=",
"high",
";",
"return",
"1",
";",
"}"
] | Given two ranges, see if we can merge them into one. | [
"Given",
"two",
"ranges",
"see",
"if",
"we",
"can",
"merge",
"them",
"into",
"one",
"."
] | [
"/* Make range 0 be the range that starts first, or ends last if they\n start at the same value. Swap them if it isn't. */",
"/* Now flag two cases, whether the ranges are disjoint or whether the\n second range is totally subsumed in the first. Note that the tests\n below are simplified by the ones above. */",
"/* We now have four cases, depending on whether we are including or\n excluding the two ranges. */",
"/* If they don't overlap, the result is false. If the second range\n\t is a subset it is the result. Otherwise, the range is from the start\n\t of the second to the end of the first. */",
"/* If they don't overlap, the result is the first range. If they are\n\t equal, the result is false. If the second range is a subset of the\n\t first, and the ranges begin at the same place, we go from just after\n\t the end of the second range to the end of the first. If the second\n\t range is not a subset of the first, or if it is a subset and both\n\t ranges end at the same place, the range starts at the start of the\n\t first range and ends just before the second range.\n\t Otherwise, we can't describe this as a single range. */",
"/* We are in the weird situation where high0 > high1 but\n\t\t high1 has no successor. Punt. */",
"/* low0 < low1 but low1 has no predecessor. Punt. */",
"/* If they don't overlap, the result is the second range. If the second\n\t is a subset of the first, the result is false. Otherwise,\n\t the range starts just after the first range and ends at the\n\t end of the second. */",
"/* high1 > high0 but high0 has no successor. Punt. */",
"/* The case where we are excluding both ranges. Here the complex case\n\t is if they don't overlap. In that case, the only time we have a\n\t range is if they are adjacent. If the second is a subset of the\n\t first, the result is the first. Otherwise, the range to exclude\n\t starts at the beginning of the first range and ends at the end of the\n\t second. */",
"/* Canonicalize - [min, x] into - [-, x]. */",
"/* FALLTHROUGH */",
"/* Canonicalize - [x, max] into - [x, -]. */",
"/* FALLTHROUGH */",
"/* The ranges might be also adjacent between the maximum and\n\t minimum values of the given type. For\n\t - [{min,-}, x] and - [y, {max,-}] ranges where x + 1 < y\n\t return + [x + 1, y - 1]. */"
] | [
{
"param": "pin_p",
"type": "int"
},
{
"param": "plow",
"type": "tree"
},
{
"param": "phigh",
"type": "tree"
},
{
"param": "in0_p",
"type": "int"
},
{
"param": "low0",
"type": "tree"
},
{
"param": "high0",
"type": "tree"
},
{
"param": "in1_p",
"type": "int"
},
{
"param": "low1",
"type": "tree"
},
{
"param": "high1",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pin_p",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "plow",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "phigh",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "in0_p",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "low0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "high0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "in1_p",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "low1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "high1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_cond_expr_with_comparison | tree | static tree
fold_cond_expr_with_comparison (location_t loc, tree type,
tree arg0, tree arg1, tree arg2)
{
enum tree_code comp_code = TREE_CODE (arg0);
tree arg00 = TREE_OPERAND (arg0, 0);
tree arg01 = TREE_OPERAND (arg0, 1);
tree arg1_type = TREE_TYPE (arg1);
tree tem;
STRIP_NOPS (arg1);
STRIP_NOPS (arg2);
/* If we have A op 0 ? A : -A, consider applying the following
transformations:
A == 0? A : -A same as -A
A != 0? A : -A same as A
A >= 0? A : -A same as abs (A)
A > 0? A : -A same as abs (A)
A <= 0? A : -A same as -abs (A)
A < 0? A : -A same as -abs (A)
None of these transformations work for modes with signed
zeros. If A is +/-0, the first two transformations will
change the sign of the result (from +0 to -0, or vice
versa). The last four will fix the sign of the result,
even though the original expressions could be positive or
negative, depending on the sign of A.
Note that all these transformations are correct if A is
NaN, since the two alternatives (A and -A) are also NaNs. */
if (!HONOR_SIGNED_ZEROS (element_mode (type))
&& (FLOAT_TYPE_P (TREE_TYPE (arg01))
? real_zerop (arg01)
: integer_zerop (arg01))
&& ((TREE_CODE (arg2) == NEGATE_EXPR
&& operand_equal_p (TREE_OPERAND (arg2, 0), arg1, 0))
/* In the case that A is of the form X-Y, '-A' (arg2) may
have already been folded to Y-X, check for that. */
|| (TREE_CODE (arg1) == MINUS_EXPR
&& TREE_CODE (arg2) == MINUS_EXPR
&& operand_equal_p (TREE_OPERAND (arg1, 0),
TREE_OPERAND (arg2, 1), 0)
&& operand_equal_p (TREE_OPERAND (arg1, 1),
TREE_OPERAND (arg2, 0), 0))))
switch (comp_code)
{
case EQ_EXPR:
case UNEQ_EXPR:
tem = fold_convert_loc (loc, arg1_type, arg1);
return fold_convert_loc (loc, type, negate_expr (tem));
case NE_EXPR:
case LTGT_EXPR:
return fold_convert_loc (loc, type, arg1);
case UNGE_EXPR:
case UNGT_EXPR:
if (flag_trapping_math)
break;
/* Fall through. */
case GE_EXPR:
case GT_EXPR:
if (TYPE_UNSIGNED (TREE_TYPE (arg1)))
break;
tem = fold_build1_loc (loc, ABS_EXPR, TREE_TYPE (arg1), arg1);
return fold_convert_loc (loc, type, tem);
case UNLE_EXPR:
case UNLT_EXPR:
if (flag_trapping_math)
break;
/* FALLTHRU */
case LE_EXPR:
case LT_EXPR:
if (TYPE_UNSIGNED (TREE_TYPE (arg1)))
break;
tem = fold_build1_loc (loc, ABS_EXPR, TREE_TYPE (arg1), arg1);
return negate_expr (fold_convert_loc (loc, type, tem));
default:
gcc_assert (TREE_CODE_CLASS (comp_code) == tcc_comparison);
break;
}
/* A != 0 ? A : 0 is simply A, unless A is -0. Likewise
A == 0 ? A : 0 is always 0 unless A is -0. Note that
both transformations are correct when A is NaN: A != 0
is then true, and A == 0 is false. */
if (!HONOR_SIGNED_ZEROS (element_mode (type))
&& integer_zerop (arg01) && integer_zerop (arg2))
{
if (comp_code == NE_EXPR)
return fold_convert_loc (loc, type, arg1);
else if (comp_code == EQ_EXPR)
return build_zero_cst (type);
}
/* Try some transformations of A op B ? A : B.
A == B? A : B same as B
A != B? A : B same as A
A >= B? A : B same as max (A, B)
A > B? A : B same as max (B, A)
A <= B? A : B same as min (A, B)
A < B? A : B same as min (B, A)
As above, these transformations don't work in the presence
of signed zeros. For example, if A and B are zeros of
opposite sign, the first two transformations will change
the sign of the result. In the last four, the original
expressions give different results for (A=+0, B=-0) and
(A=-0, B=+0), but the transformed expressions do not.
The first two transformations are correct if either A or B
is a NaN. In the first transformation, the condition will
be false, and B will indeed be chosen. In the case of the
second transformation, the condition A != B will be true,
and A will be chosen.
The conversions to max() and min() are not correct if B is
a number and A is not. The conditions in the original
expressions will be false, so all four give B. The min()
and max() versions would give a NaN instead. */
if (!HONOR_SIGNED_ZEROS (element_mode (type))
&& operand_equal_for_comparison_p (arg01, arg2)
/* Avoid these transformations if the COND_EXPR may be used
as an lvalue in the C++ front-end. PR c++/19199. */
&& (in_gimple_form
|| VECTOR_TYPE_P (type)
|| (! lang_GNU_CXX ()
&& strcmp (lang_hooks.name, "GNU Objective-C++") != 0)
|| ! maybe_lvalue_p (arg1)
|| ! maybe_lvalue_p (arg2)))
{
tree comp_op0 = arg00;
tree comp_op1 = arg01;
tree comp_type = TREE_TYPE (comp_op0);
switch (comp_code)
{
case EQ_EXPR:
return fold_convert_loc (loc, type, arg2);
case NE_EXPR:
return fold_convert_loc (loc, type, arg1);
case LE_EXPR:
case LT_EXPR:
case UNLE_EXPR:
case UNLT_EXPR:
/* In C++ a ?: expression can be an lvalue, so put the
operand which will be used if they are equal first
so that we can convert this back to the
corresponding COND_EXPR. */
if (!HONOR_NANS (arg1))
{
comp_op0 = fold_convert_loc (loc, comp_type, comp_op0);
comp_op1 = fold_convert_loc (loc, comp_type, comp_op1);
tem = (comp_code == LE_EXPR || comp_code == UNLE_EXPR)
? fold_build2_loc (loc, MIN_EXPR, comp_type, comp_op0, comp_op1)
: fold_build2_loc (loc, MIN_EXPR, comp_type,
comp_op1, comp_op0);
return fold_convert_loc (loc, type, tem);
}
break;
case GE_EXPR:
case GT_EXPR:
case UNGE_EXPR:
case UNGT_EXPR:
if (!HONOR_NANS (arg1))
{
comp_op0 = fold_convert_loc (loc, comp_type, comp_op0);
comp_op1 = fold_convert_loc (loc, comp_type, comp_op1);
tem = (comp_code == GE_EXPR || comp_code == UNGE_EXPR)
? fold_build2_loc (loc, MAX_EXPR, comp_type, comp_op0, comp_op1)
: fold_build2_loc (loc, MAX_EXPR, comp_type,
comp_op1, comp_op0);
return fold_convert_loc (loc, type, tem);
}
break;
case UNEQ_EXPR:
if (!HONOR_NANS (arg1))
return fold_convert_loc (loc, type, arg2);
break;
case LTGT_EXPR:
if (!HONOR_NANS (arg1))
return fold_convert_loc (loc, type, arg1);
break;
default:
gcc_assert (TREE_CODE_CLASS (comp_code) == tcc_comparison);
break;
}
}
return NULL_TREE;
} | /* Subroutine of fold, looking inside expressions of the form
A op B ? A : C, where ARG0, ARG1 and ARG2 are the three operands
of the COND_EXPR. This function is being used also to optimize
A op B ? C : A, by reversing the comparison first.
Return a folded expression whose code is not a COND_EXPR
anymore, or NULL_TREE if no folding opportunity is found. */ | Subroutine of fold, looking inside expressions of the form
A op B . A : C, where ARG0, ARG1 and ARG2 are the three operands
of the COND_EXPR. This function is being used also to optimize
A op B . C : A, by reversing the comparison first.
Return a folded expression whose code is not a COND_EXPR
anymore, or NULL_TREE if no folding opportunity is found. | [
"Subroutine",
"of",
"fold",
"looking",
"inside",
"expressions",
"of",
"the",
"form",
"A",
"op",
"B",
".",
"A",
":",
"C",
"where",
"ARG0",
"ARG1",
"and",
"ARG2",
"are",
"the",
"three",
"operands",
"of",
"the",
"COND_EXPR",
".",
"This",
"function",
"is",
"being",
"used",
"also",
"to",
"optimize",
"A",
"op",
"B",
".",
"C",
":",
"A",
"by",
"reversing",
"the",
"comparison",
"first",
".",
"Return",
"a",
"folded",
"expression",
"whose",
"code",
"is",
"not",
"a",
"COND_EXPR",
"anymore",
"or",
"NULL_TREE",
"if",
"no",
"folding",
"opportunity",
"is",
"found",
"."
] | static tree
fold_cond_expr_with_comparison (location_t loc, tree type,
tree arg0, tree arg1, tree arg2)
{
enum tree_code comp_code = TREE_CODE (arg0);
tree arg00 = TREE_OPERAND (arg0, 0);
tree arg01 = TREE_OPERAND (arg0, 1);
tree arg1_type = TREE_TYPE (arg1);
tree tem;
STRIP_NOPS (arg1);
STRIP_NOPS (arg2);
if (!HONOR_SIGNED_ZEROS (element_mode (type))
&& (FLOAT_TYPE_P (TREE_TYPE (arg01))
? real_zerop (arg01)
: integer_zerop (arg01))
&& ((TREE_CODE (arg2) == NEGATE_EXPR
&& operand_equal_p (TREE_OPERAND (arg2, 0), arg1, 0))
|| (TREE_CODE (arg1) == MINUS_EXPR
&& TREE_CODE (arg2) == MINUS_EXPR
&& operand_equal_p (TREE_OPERAND (arg1, 0),
TREE_OPERAND (arg2, 1), 0)
&& operand_equal_p (TREE_OPERAND (arg1, 1),
TREE_OPERAND (arg2, 0), 0))))
switch (comp_code)
{
case EQ_EXPR:
case UNEQ_EXPR:
tem = fold_convert_loc (loc, arg1_type, arg1);
return fold_convert_loc (loc, type, negate_expr (tem));
case NE_EXPR:
case LTGT_EXPR:
return fold_convert_loc (loc, type, arg1);
case UNGE_EXPR:
case UNGT_EXPR:
if (flag_trapping_math)
break;
case GE_EXPR:
case GT_EXPR:
if (TYPE_UNSIGNED (TREE_TYPE (arg1)))
break;
tem = fold_build1_loc (loc, ABS_EXPR, TREE_TYPE (arg1), arg1);
return fold_convert_loc (loc, type, tem);
case UNLE_EXPR:
case UNLT_EXPR:
if (flag_trapping_math)
break;
case LE_EXPR:
case LT_EXPR:
if (TYPE_UNSIGNED (TREE_TYPE (arg1)))
break;
tem = fold_build1_loc (loc, ABS_EXPR, TREE_TYPE (arg1), arg1);
return negate_expr (fold_convert_loc (loc, type, tem));
default:
gcc_assert (TREE_CODE_CLASS (comp_code) == tcc_comparison);
break;
}
if (!HONOR_SIGNED_ZEROS (element_mode (type))
&& integer_zerop (arg01) && integer_zerop (arg2))
{
if (comp_code == NE_EXPR)
return fold_convert_loc (loc, type, arg1);
else if (comp_code == EQ_EXPR)
return build_zero_cst (type);
}
if (!HONOR_SIGNED_ZEROS (element_mode (type))
&& operand_equal_for_comparison_p (arg01, arg2)
&& (in_gimple_form
|| VECTOR_TYPE_P (type)
|| (! lang_GNU_CXX ()
&& strcmp (lang_hooks.name, "GNU Objective-C++") != 0)
|| ! maybe_lvalue_p (arg1)
|| ! maybe_lvalue_p (arg2)))
{
tree comp_op0 = arg00;
tree comp_op1 = arg01;
tree comp_type = TREE_TYPE (comp_op0);
switch (comp_code)
{
case EQ_EXPR:
return fold_convert_loc (loc, type, arg2);
case NE_EXPR:
return fold_convert_loc (loc, type, arg1);
case LE_EXPR:
case LT_EXPR:
case UNLE_EXPR:
case UNLT_EXPR:
if (!HONOR_NANS (arg1))
{
comp_op0 = fold_convert_loc (loc, comp_type, comp_op0);
comp_op1 = fold_convert_loc (loc, comp_type, comp_op1);
tem = (comp_code == LE_EXPR || comp_code == UNLE_EXPR)
? fold_build2_loc (loc, MIN_EXPR, comp_type, comp_op0, comp_op1)
: fold_build2_loc (loc, MIN_EXPR, comp_type,
comp_op1, comp_op0);
return fold_convert_loc (loc, type, tem);
}
break;
case GE_EXPR:
case GT_EXPR:
case UNGE_EXPR:
case UNGT_EXPR:
if (!HONOR_NANS (arg1))
{
comp_op0 = fold_convert_loc (loc, comp_type, comp_op0);
comp_op1 = fold_convert_loc (loc, comp_type, comp_op1);
tem = (comp_code == GE_EXPR || comp_code == UNGE_EXPR)
? fold_build2_loc (loc, MAX_EXPR, comp_type, comp_op0, comp_op1)
: fold_build2_loc (loc, MAX_EXPR, comp_type,
comp_op1, comp_op0);
return fold_convert_loc (loc, type, tem);
}
break;
case UNEQ_EXPR:
if (!HONOR_NANS (arg1))
return fold_convert_loc (loc, type, arg2);
break;
case LTGT_EXPR:
if (!HONOR_NANS (arg1))
return fold_convert_loc (loc, type, arg1);
break;
default:
gcc_assert (TREE_CODE_CLASS (comp_code) == tcc_comparison);
break;
}
}
return NULL_TREE;
} | [
"static",
"tree",
"fold_cond_expr_with_comparison",
"(",
"location_t",
"loc",
",",
"tree",
"type",
",",
"tree",
"arg0",
",",
"tree",
"arg1",
",",
"tree",
"arg2",
")",
"{",
"enum",
"tree_code",
"comp_code",
"=",
"TREE_CODE",
"(",
"arg0",
")",
";",
"tree",
"arg00",
"=",
"TREE_OPERAND",
"(",
"arg0",
",",
"0",
")",
";",
"tree",
"arg01",
"=",
"TREE_OPERAND",
"(",
"arg0",
",",
"1",
")",
";",
"tree",
"arg1_type",
"=",
"TREE_TYPE",
"(",
"arg1",
")",
";",
"tree",
"tem",
";",
"STRIP_NOPS",
"(",
"arg1",
")",
";",
"STRIP_NOPS",
"(",
"arg2",
")",
";",
"if",
"(",
"!",
"HONOR_SIGNED_ZEROS",
"(",
"element_mode",
"(",
"type",
")",
")",
"&&",
"(",
"FLOAT_TYPE_P",
"(",
"TREE_TYPE",
"(",
"arg01",
")",
")",
"?",
"real_zerop",
"(",
"arg01",
")",
":",
"integer_zerop",
"(",
"arg01",
")",
")",
"&&",
"(",
"(",
"TREE_CODE",
"(",
"arg2",
")",
"==",
"NEGATE_EXPR",
"&&",
"operand_equal_p",
"(",
"TREE_OPERAND",
"(",
"arg2",
",",
"0",
")",
",",
"arg1",
",",
"0",
")",
")",
"||",
"(",
"TREE_CODE",
"(",
"arg1",
")",
"==",
"MINUS_EXPR",
"&&",
"TREE_CODE",
"(",
"arg2",
")",
"==",
"MINUS_EXPR",
"&&",
"operand_equal_p",
"(",
"TREE_OPERAND",
"(",
"arg1",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"arg2",
",",
"1",
")",
",",
"0",
")",
"&&",
"operand_equal_p",
"(",
"TREE_OPERAND",
"(",
"arg1",
",",
"1",
")",
",",
"TREE_OPERAND",
"(",
"arg2",
",",
"0",
")",
",",
"0",
")",
")",
")",
")",
"switch",
"(",
"comp_code",
")",
"{",
"case",
"EQ_EXPR",
":",
"case",
"UNEQ_EXPR",
":",
"tem",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"arg1_type",
",",
"arg1",
")",
";",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"negate_expr",
"(",
"tem",
")",
")",
";",
"case",
"NE_EXPR",
":",
"case",
"LTGT_EXPR",
":",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"arg1",
")",
";",
"case",
"UNGE_EXPR",
":",
"case",
"UNGT_EXPR",
":",
"if",
"(",
"flag_trapping_math",
")",
"break",
";",
"case",
"GE_EXPR",
":",
"case",
"GT_EXPR",
":",
"if",
"(",
"TYPE_UNSIGNED",
"(",
"TREE_TYPE",
"(",
"arg1",
")",
")",
")",
"break",
";",
"tem",
"=",
"fold_build1_loc",
"(",
"loc",
",",
"ABS_EXPR",
",",
"TREE_TYPE",
"(",
"arg1",
")",
",",
"arg1",
")",
";",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"tem",
")",
";",
"case",
"UNLE_EXPR",
":",
"case",
"UNLT_EXPR",
":",
"if",
"(",
"flag_trapping_math",
")",
"break",
";",
"case",
"LE_EXPR",
":",
"case",
"LT_EXPR",
":",
"if",
"(",
"TYPE_UNSIGNED",
"(",
"TREE_TYPE",
"(",
"arg1",
")",
")",
")",
"break",
";",
"tem",
"=",
"fold_build1_loc",
"(",
"loc",
",",
"ABS_EXPR",
",",
"TREE_TYPE",
"(",
"arg1",
")",
",",
"arg1",
")",
";",
"return",
"negate_expr",
"(",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"tem",
")",
")",
";",
"default",
":",
"gcc_assert",
"(",
"TREE_CODE_CLASS",
"(",
"comp_code",
")",
"==",
"tcc_comparison",
")",
";",
"break",
";",
"}",
"if",
"(",
"!",
"HONOR_SIGNED_ZEROS",
"(",
"element_mode",
"(",
"type",
")",
")",
"&&",
"integer_zerop",
"(",
"arg01",
")",
"&&",
"integer_zerop",
"(",
"arg2",
")",
")",
"{",
"if",
"(",
"comp_code",
"==",
"NE_EXPR",
")",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"arg1",
")",
";",
"else",
"if",
"(",
"comp_code",
"==",
"EQ_EXPR",
")",
"return",
"build_zero_cst",
"(",
"type",
")",
";",
"}",
"if",
"(",
"!",
"HONOR_SIGNED_ZEROS",
"(",
"element_mode",
"(",
"type",
")",
")",
"&&",
"operand_equal_for_comparison_p",
"(",
"arg01",
",",
"arg2",
")",
"&&",
"(",
"in_gimple_form",
"||",
"VECTOR_TYPE_P",
"(",
"type",
")",
"||",
"(",
"!",
"lang_GNU_CXX",
"(",
")",
"&&",
"strcmp",
"(",
"lang_hooks",
".",
"name",
",",
"\"",
"\"",
")",
"!=",
"0",
")",
"||",
"!",
"maybe_lvalue_p",
"(",
"arg1",
")",
"||",
"!",
"maybe_lvalue_p",
"(",
"arg2",
")",
")",
")",
"{",
"tree",
"comp_op0",
"=",
"arg00",
";",
"tree",
"comp_op1",
"=",
"arg01",
";",
"tree",
"comp_type",
"=",
"TREE_TYPE",
"(",
"comp_op0",
")",
";",
"switch",
"(",
"comp_code",
")",
"{",
"case",
"EQ_EXPR",
":",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"arg2",
")",
";",
"case",
"NE_EXPR",
":",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"arg1",
")",
";",
"case",
"LE_EXPR",
":",
"case",
"LT_EXPR",
":",
"case",
"UNLE_EXPR",
":",
"case",
"UNLT_EXPR",
":",
"if",
"(",
"!",
"HONOR_NANS",
"(",
"arg1",
")",
")",
"{",
"comp_op0",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"comp_type",
",",
"comp_op0",
")",
";",
"comp_op1",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"comp_type",
",",
"comp_op1",
")",
";",
"tem",
"=",
"(",
"comp_code",
"==",
"LE_EXPR",
"||",
"comp_code",
"==",
"UNLE_EXPR",
")",
"?",
"fold_build2_loc",
"(",
"loc",
",",
"MIN_EXPR",
",",
"comp_type",
",",
"comp_op0",
",",
"comp_op1",
")",
":",
"fold_build2_loc",
"(",
"loc",
",",
"MIN_EXPR",
",",
"comp_type",
",",
"comp_op1",
",",
"comp_op0",
")",
";",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"tem",
")",
";",
"}",
"break",
";",
"case",
"GE_EXPR",
":",
"case",
"GT_EXPR",
":",
"case",
"UNGE_EXPR",
":",
"case",
"UNGT_EXPR",
":",
"if",
"(",
"!",
"HONOR_NANS",
"(",
"arg1",
")",
")",
"{",
"comp_op0",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"comp_type",
",",
"comp_op0",
")",
";",
"comp_op1",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"comp_type",
",",
"comp_op1",
")",
";",
"tem",
"=",
"(",
"comp_code",
"==",
"GE_EXPR",
"||",
"comp_code",
"==",
"UNGE_EXPR",
")",
"?",
"fold_build2_loc",
"(",
"loc",
",",
"MAX_EXPR",
",",
"comp_type",
",",
"comp_op0",
",",
"comp_op1",
")",
":",
"fold_build2_loc",
"(",
"loc",
",",
"MAX_EXPR",
",",
"comp_type",
",",
"comp_op1",
",",
"comp_op0",
")",
";",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"tem",
")",
";",
"}",
"break",
";",
"case",
"UNEQ_EXPR",
":",
"if",
"(",
"!",
"HONOR_NANS",
"(",
"arg1",
")",
")",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"arg2",
")",
";",
"break",
";",
"case",
"LTGT_EXPR",
":",
"if",
"(",
"!",
"HONOR_NANS",
"(",
"arg1",
")",
")",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"arg1",
")",
";",
"break",
";",
"default",
":",
"gcc_assert",
"(",
"TREE_CODE_CLASS",
"(",
"comp_code",
")",
"==",
"tcc_comparison",
")",
";",
"break",
";",
"}",
"}",
"return",
"NULL_TREE",
";",
"}"
] | Subroutine of fold, looking inside expressions of the form
A op B ? | [
"Subroutine",
"of",
"fold",
"looking",
"inside",
"expressions",
"of",
"the",
"form",
"A",
"op",
"B",
"?"
] | [
"/* If we have A op 0 ? A : -A, consider applying the following\n transformations:\n\n A == 0? A : -A same as -A\n A != 0? A : -A same as A\n A >= 0? A : -A same as abs (A)\n A > 0? A : -A same as abs (A)\n A <= 0? A : -A same as -abs (A)\n A < 0? A : -A same as -abs (A)\n\n None of these transformations work for modes with signed\n zeros. If A is +/-0, the first two transformations will\n change the sign of the result (from +0 to -0, or vice\n versa). The last four will fix the sign of the result,\n even though the original expressions could be positive or\n negative, depending on the sign of A.\n\n Note that all these transformations are correct if A is\n NaN, since the two alternatives (A and -A) are also NaNs. */",
"/* In the case that A is of the form X-Y, '-A' (arg2) may\n\t have already been folded to Y-X, check for that. */",
"/* Fall through. */",
"/* FALLTHRU */",
"/* A != 0 ? A : 0 is simply A, unless A is -0. Likewise\n A == 0 ? A : 0 is always 0 unless A is -0. Note that\n both transformations are correct when A is NaN: A != 0\n is then true, and A == 0 is false. */",
"/* Try some transformations of A op B ? A : B.\n\n A == B? A : B same as B\n A != B? A : B same as A\n A >= B? A : B same as max (A, B)\n A > B? A : B same as max (B, A)\n A <= B? A : B same as min (A, B)\n A < B? A : B same as min (B, A)\n\n As above, these transformations don't work in the presence\n of signed zeros. For example, if A and B are zeros of\n opposite sign, the first two transformations will change\n the sign of the result. In the last four, the original\n expressions give different results for (A=+0, B=-0) and\n (A=-0, B=+0), but the transformed expressions do not.\n\n The first two transformations are correct if either A or B\n is a NaN. In the first transformation, the condition will\n be false, and B will indeed be chosen. In the case of the\n second transformation, the condition A != B will be true,\n and A will be chosen.\n\n The conversions to max() and min() are not correct if B is\n a number and A is not. The conditions in the original\n expressions will be false, so all four give B. The min()\n and max() versions would give a NaN instead. */",
"/* Avoid these transformations if the COND_EXPR may be used\n\t as an lvalue in the C++ front-end. PR c++/19199. */",
"/* In C++ a ?: expression can be an lvalue, so put the\n\t operand which will be used if they are equal first\n\t so that we can convert this back to the\n\t corresponding COND_EXPR. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "type",
"type": "tree"
},
{
"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": "type",
"type": "tree",
"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": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | extract_muldiv | tree | static tree
extract_muldiv (tree t, tree c, enum tree_code code, tree wide_type,
bool *strict_overflow_p)
{
/* To avoid exponential search depth, refuse to allow recursion past
three levels. Beyond that (1) it's highly unlikely that we'll find
something interesting and (2) we've probably processed it before
when we built the inner expression. */
static int depth;
tree ret;
if (depth > 3)
return NULL;
depth++;
ret = extract_muldiv_1 (t, c, code, wide_type, strict_overflow_p);
depth--;
return ret;
} | /* T is an integer expression that is being multiplied, divided, or taken a
modulus (CODE says which and what kind of divide or modulus) by a
constant C. See if we can eliminate that operation by folding it with
other operations already in T. WIDE_TYPE, if non-null, is a type that
should be used for the computation if wider than our type.
For example, if we are dividing (X * 8) + (Y * 16) by 4, we can return
(X * 2) + (Y * 4). We must, however, be assured that either the original
expression would not overflow or that overflow is undefined for the type
in the language in question.
If we return a non-null expression, it is an equivalent form of the
original computation, but need not be in the original type.
We set *STRICT_OVERFLOW_P to true if the return values depends on
signed overflow being undefined. Otherwise we do not change
*STRICT_OVERFLOW_P. */ | T is an integer expression that is being multiplied, divided, or taken a
modulus (CODE says which and what kind of divide or modulus) by a
constant C. See if we can eliminate that operation by folding it with
other operations already in T. WIDE_TYPE, if non-null, is a type that
should be used for the computation if wider than our type.
For example, if we are dividing (X * 8) + (Y * 16) by 4, we can return
(X * 2) + (Y * 4). We must, however, be assured that either the original
expression would not overflow or that overflow is undefined for the type
in the language in question.
If we return a non-null expression, it is an equivalent form of the
original computation, but need not be in the original type.
We set *STRICT_OVERFLOW_P to true if the return values depends on
signed overflow being undefined. Otherwise we do not change
STRICT_OVERFLOW_P. | [
"T",
"is",
"an",
"integer",
"expression",
"that",
"is",
"being",
"multiplied",
"divided",
"or",
"taken",
"a",
"modulus",
"(",
"CODE",
"says",
"which",
"and",
"what",
"kind",
"of",
"divide",
"or",
"modulus",
")",
"by",
"a",
"constant",
"C",
".",
"See",
"if",
"we",
"can",
"eliminate",
"that",
"operation",
"by",
"folding",
"it",
"with",
"other",
"operations",
"already",
"in",
"T",
".",
"WIDE_TYPE",
"if",
"non",
"-",
"null",
"is",
"a",
"type",
"that",
"should",
"be",
"used",
"for",
"the",
"computation",
"if",
"wider",
"than",
"our",
"type",
".",
"For",
"example",
"if",
"we",
"are",
"dividing",
"(",
"X",
"*",
"8",
")",
"+",
"(",
"Y",
"*",
"16",
")",
"by",
"4",
"we",
"can",
"return",
"(",
"X",
"*",
"2",
")",
"+",
"(",
"Y",
"*",
"4",
")",
".",
"We",
"must",
"however",
"be",
"assured",
"that",
"either",
"the",
"original",
"expression",
"would",
"not",
"overflow",
"or",
"that",
"overflow",
"is",
"undefined",
"for",
"the",
"type",
"in",
"the",
"language",
"in",
"question",
".",
"If",
"we",
"return",
"a",
"non",
"-",
"null",
"expression",
"it",
"is",
"an",
"equivalent",
"form",
"of",
"the",
"original",
"computation",
"but",
"need",
"not",
"be",
"in",
"the",
"original",
"type",
".",
"We",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
"if",
"the",
"return",
"values",
"depends",
"on",
"signed",
"overflow",
"being",
"undefined",
".",
"Otherwise",
"we",
"do",
"not",
"change",
"STRICT_OVERFLOW_P",
"."
] | static tree
extract_muldiv (tree t, tree c, enum tree_code code, tree wide_type,
bool *strict_overflow_p)
{
static int depth;
tree ret;
if (depth > 3)
return NULL;
depth++;
ret = extract_muldiv_1 (t, c, code, wide_type, strict_overflow_p);
depth--;
return ret;
} | [
"static",
"tree",
"extract_muldiv",
"(",
"tree",
"t",
",",
"tree",
"c",
",",
"enum",
"tree_code",
"code",
",",
"tree",
"wide_type",
",",
"bool",
"*",
"strict_overflow_p",
")",
"{",
"static",
"int",
"depth",
";",
"tree",
"ret",
";",
"if",
"(",
"depth",
">",
"3",
")",
"return",
"NULL",
";",
"depth",
"++",
";",
"ret",
"=",
"extract_muldiv_1",
"(",
"t",
",",
"c",
",",
"code",
",",
"wide_type",
",",
"strict_overflow_p",
")",
";",
"depth",
"--",
";",
"return",
"ret",
";",
"}"
] | T is an integer expression that is being multiplied, divided, or taken a
modulus (CODE says which and what kind of divide or modulus) by a
constant C. See if we can eliminate that operation by folding it with
other operations already in T. WIDE_TYPE, if non-null, is a type that
should be used for the computation if wider than our type. | [
"T",
"is",
"an",
"integer",
"expression",
"that",
"is",
"being",
"multiplied",
"divided",
"or",
"taken",
"a",
"modulus",
"(",
"CODE",
"says",
"which",
"and",
"what",
"kind",
"of",
"divide",
"or",
"modulus",
")",
"by",
"a",
"constant",
"C",
".",
"See",
"if",
"we",
"can",
"eliminate",
"that",
"operation",
"by",
"folding",
"it",
"with",
"other",
"operations",
"already",
"in",
"T",
".",
"WIDE_TYPE",
"if",
"non",
"-",
"null",
"is",
"a",
"type",
"that",
"should",
"be",
"used",
"for",
"the",
"computation",
"if",
"wider",
"than",
"our",
"type",
"."
] | [
"/* To avoid exponential search depth, refuse to allow recursion past\n three levels. Beyond that (1) it's highly unlikely that we'll find\n something interesting and (2) we've probably processed it before\n when we built the inner expression. */"
] | [
{
"param": "t",
"type": "tree"
},
{
"param": "c",
"type": "tree"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "wide_type",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "c",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wide_type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_swap_operands_p | bool | bool
tree_swap_operands_p (const_tree arg0, const_tree arg1)
{
if (CONSTANT_CLASS_P (arg1))
return 0;
if (CONSTANT_CLASS_P (arg0))
return 1;
STRIP_NOPS (arg0);
STRIP_NOPS (arg1);
if (TREE_CONSTANT (arg1))
return 0;
if (TREE_CONSTANT (arg0))
return 1;
/* It is preferable to swap two SSA_NAME to ensure a canonical form
for commutative and comparison operators. Ensuring a canonical
form allows the optimizers to find additional redundancies without
having to explicitly check for both orderings. */
if (TREE_CODE (arg0) == SSA_NAME
&& TREE_CODE (arg1) == SSA_NAME
&& SSA_NAME_VERSION (arg0) > SSA_NAME_VERSION (arg1))
return 1;
/* Put SSA_NAMEs last. */
if (TREE_CODE (arg1) == SSA_NAME)
return 0;
if (TREE_CODE (arg0) == SSA_NAME)
return 1;
/* Put variables last. */
if (DECL_P (arg1))
return 0;
if (DECL_P (arg0))
return 1;
return 0;
} | /* Test whether it is preferable two swap two operands, ARG0 and
ARG1, for example because ARG0 is an integer constant and ARG1
isn't. */ | Test whether it is preferable two swap two operands, ARG0 and
ARG1, for example because ARG0 is an integer constant and ARG1
isn't. | [
"Test",
"whether",
"it",
"is",
"preferable",
"two",
"swap",
"two",
"operands",
"ARG0",
"and",
"ARG1",
"for",
"example",
"because",
"ARG0",
"is",
"an",
"integer",
"constant",
"and",
"ARG1",
"isn",
"'",
"t",
"."
] | bool
tree_swap_operands_p (const_tree arg0, const_tree arg1)
{
if (CONSTANT_CLASS_P (arg1))
return 0;
if (CONSTANT_CLASS_P (arg0))
return 1;
STRIP_NOPS (arg0);
STRIP_NOPS (arg1);
if (TREE_CONSTANT (arg1))
return 0;
if (TREE_CONSTANT (arg0))
return 1;
if (TREE_CODE (arg0) == SSA_NAME
&& TREE_CODE (arg1) == SSA_NAME
&& SSA_NAME_VERSION (arg0) > SSA_NAME_VERSION (arg1))
return 1;
if (TREE_CODE (arg1) == SSA_NAME)
return 0;
if (TREE_CODE (arg0) == SSA_NAME)
return 1;
if (DECL_P (arg1))
return 0;
if (DECL_P (arg0))
return 1;
return 0;
} | [
"bool",
"tree_swap_operands_p",
"(",
"const_tree",
"arg0",
",",
"const_tree",
"arg1",
")",
"{",
"if",
"(",
"CONSTANT_CLASS_P",
"(",
"arg1",
")",
")",
"return",
"0",
";",
"if",
"(",
"CONSTANT_CLASS_P",
"(",
"arg0",
")",
")",
"return",
"1",
";",
"STRIP_NOPS",
"(",
"arg0",
")",
";",
"STRIP_NOPS",
"(",
"arg1",
")",
";",
"if",
"(",
"TREE_CONSTANT",
"(",
"arg1",
")",
")",
"return",
"0",
";",
"if",
"(",
"TREE_CONSTANT",
"(",
"arg0",
")",
")",
"return",
"1",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"SSA_NAME",
"&&",
"TREE_CODE",
"(",
"arg1",
")",
"==",
"SSA_NAME",
"&&",
"SSA_NAME_VERSION",
"(",
"arg0",
")",
">",
"SSA_NAME_VERSION",
"(",
"arg1",
")",
")",
"return",
"1",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg1",
")",
"==",
"SSA_NAME",
")",
"return",
"0",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"SSA_NAME",
")",
"return",
"1",
";",
"if",
"(",
"DECL_P",
"(",
"arg1",
")",
")",
"return",
"0",
";",
"if",
"(",
"DECL_P",
"(",
"arg0",
")",
")",
"return",
"1",
";",
"return",
"0",
";",
"}"
] | Test whether it is preferable two swap two operands, ARG0 and
ARG1, for example because ARG0 is an integer constant and ARG1
isn't. | [
"Test",
"whether",
"it",
"is",
"preferable",
"two",
"swap",
"two",
"operands",
"ARG0",
"and",
"ARG1",
"for",
"example",
"because",
"ARG0",
"is",
"an",
"integer",
"constant",
"and",
"ARG1",
"isn",
"'",
"t",
"."
] | [
"/* It is preferable to swap two SSA_NAME to ensure a canonical form\n for commutative and comparison operators. Ensuring a canonical\n form allows the optimizers to find additional redundancies without\n having to explicitly check for both orderings. */",
"/* Put SSA_NAMEs last. */",
"/* Put variables last. */"
] | [
{
"param": "arg0",
"type": "const_tree"
},
{
"param": "arg1",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arg0",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg1",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | can_native_interpret_type_p | bool | static bool
can_native_interpret_type_p (tree type)
{
switch (TREE_CODE (type))
{
case INTEGER_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case POINTER_TYPE:
case REFERENCE_TYPE:
case FIXED_POINT_TYPE:
case REAL_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
return true;
default:
return false;
}
} | /* Returns true if we can interpret the contents of a native encoding
as TYPE. */ | Returns true if we can interpret the contents of a native encoding
as TYPE. | [
"Returns",
"true",
"if",
"we",
"can",
"interpret",
"the",
"contents",
"of",
"a",
"native",
"encoding",
"as",
"TYPE",
"."
] | static bool
can_native_interpret_type_p (tree type)
{
switch (TREE_CODE (type))
{
case INTEGER_TYPE:
case ENUMERAL_TYPE:
case BOOLEAN_TYPE:
case POINTER_TYPE:
case REFERENCE_TYPE:
case FIXED_POINT_TYPE:
case REAL_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
return true;
default:
return false;
}
} | [
"static",
"bool",
"can_native_interpret_type_p",
"(",
"tree",
"type",
")",
"{",
"switch",
"(",
"TREE_CODE",
"(",
"type",
")",
")",
"{",
"case",
"INTEGER_TYPE",
":",
"case",
"ENUMERAL_TYPE",
":",
"case",
"BOOLEAN_TYPE",
":",
"case",
"POINTER_TYPE",
":",
"case",
"REFERENCE_TYPE",
":",
"case",
"FIXED_POINT_TYPE",
":",
"case",
"REAL_TYPE",
":",
"case",
"COMPLEX_TYPE",
":",
"case",
"VECTOR_TYPE",
":",
"return",
"true",
";",
"default",
":",
"return",
"false",
";",
"}",
"}"
] | Returns true if we can interpret the contents of a native encoding
as TYPE. | [
"Returns",
"true",
"if",
"we",
"can",
"interpret",
"the",
"contents",
"of",
"a",
"native",
"encoding",
"as",
"TYPE",
"."
] | [] | [
{
"param": "type",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_view_convert_expr | tree | static tree
fold_view_convert_expr (tree type, tree expr)
{
/* We support up to 512-bit values (for V8DFmode). */
unsigned char buffer[64];
int len;
/* Check that the host and target are sane. */
if (CHAR_BIT != 8 || BITS_PER_UNIT != 8)
return NULL_TREE;
len = native_encode_expr (expr, buffer, sizeof (buffer));
if (len == 0)
return NULL_TREE;
return native_interpret_expr (type, buffer, len);
} | /* Fold a VIEW_CONVERT_EXPR of a constant expression EXPR to type
TYPE at compile-time. If we're unable to perform the conversion
return NULL_TREE. */ | Fold a VIEW_CONVERT_EXPR of a constant expression EXPR to type
TYPE at compile-time. If we're unable to perform the conversion
return NULL_TREE. | [
"Fold",
"a",
"VIEW_CONVERT_EXPR",
"of",
"a",
"constant",
"expression",
"EXPR",
"to",
"type",
"TYPE",
"at",
"compile",
"-",
"time",
".",
"If",
"we",
"'",
"re",
"unable",
"to",
"perform",
"the",
"conversion",
"return",
"NULL_TREE",
"."
] | static tree
fold_view_convert_expr (tree type, tree expr)
{
unsigned char buffer[64];
int len;
if (CHAR_BIT != 8 || BITS_PER_UNIT != 8)
return NULL_TREE;
len = native_encode_expr (expr, buffer, sizeof (buffer));
if (len == 0)
return NULL_TREE;
return native_interpret_expr (type, buffer, len);
} | [
"static",
"tree",
"fold_view_convert_expr",
"(",
"tree",
"type",
",",
"tree",
"expr",
")",
"{",
"unsigned",
"char",
"buffer",
"[",
"64",
"]",
";",
"int",
"len",
";",
"if",
"(",
"CHAR_BIT",
"!=",
"8",
"||",
"BITS_PER_UNIT",
"!=",
"8",
")",
"return",
"NULL_TREE",
";",
"len",
"=",
"native_encode_expr",
"(",
"expr",
",",
"buffer",
",",
"sizeof",
"(",
"buffer",
")",
")",
";",
"if",
"(",
"len",
"==",
"0",
")",
"return",
"NULL_TREE",
";",
"return",
"native_interpret_expr",
"(",
"type",
",",
"buffer",
",",
"len",
")",
";",
"}"
] | Fold a VIEW_CONVERT_EXPR of a constant expression EXPR to type
TYPE at compile-time. | [
"Fold",
"a",
"VIEW_CONVERT_EXPR",
"of",
"a",
"constant",
"expression",
"EXPR",
"to",
"type",
"TYPE",
"at",
"compile",
"-",
"time",
"."
] | [
"/* We support up to 512-bit values (for V8DFmode). */",
"/* Check that the host and target are sane. */"
] | [
{
"param": "type",
"type": "tree"
},
{
"param": "expr",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "expr",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | build_fold_addr_expr_with_type_loc | tree | tree
build_fold_addr_expr_with_type_loc (location_t loc, tree t, tree ptrtype)
{
/* The size of the object is not relevant when talking about its address. */
if (TREE_CODE (t) == WITH_SIZE_EXPR)
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == INDIRECT_REF)
{
t = TREE_OPERAND (t, 0);
if (TREE_TYPE (t) != ptrtype)
t = build1_loc (loc, NOP_EXPR, ptrtype, t);
}
else if (TREE_CODE (t) == MEM_REF
&& integer_zerop (TREE_OPERAND (t, 1)))
return TREE_OPERAND (t, 0);
else if (TREE_CODE (t) == MEM_REF
&& TREE_CODE (TREE_OPERAND (t, 0)) == INTEGER_CST)
return fold_binary (POINTER_PLUS_EXPR, ptrtype,
TREE_OPERAND (t, 0),
convert_to_ptrofftype (TREE_OPERAND (t, 1)));
else if (TREE_CODE (t) == VIEW_CONVERT_EXPR)
{
t = build_fold_addr_expr_loc (loc, TREE_OPERAND (t, 0));
if (TREE_TYPE (t) != ptrtype)
t = fold_convert_loc (loc, ptrtype, t);
}
else
t = build1_loc (loc, ADDR_EXPR, ptrtype, t);
return t;
} | /* Build an expression for the address of T. Folds away INDIRECT_REF
to avoid confusing the gimplify process. */ | Build an expression for the address of T. Folds away INDIRECT_REF
to avoid confusing the gimplify process. | [
"Build",
"an",
"expression",
"for",
"the",
"address",
"of",
"T",
".",
"Folds",
"away",
"INDIRECT_REF",
"to",
"avoid",
"confusing",
"the",
"gimplify",
"process",
"."
] | tree
build_fold_addr_expr_with_type_loc (location_t loc, tree t, tree ptrtype)
{
if (TREE_CODE (t) == WITH_SIZE_EXPR)
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == INDIRECT_REF)
{
t = TREE_OPERAND (t, 0);
if (TREE_TYPE (t) != ptrtype)
t = build1_loc (loc, NOP_EXPR, ptrtype, t);
}
else if (TREE_CODE (t) == MEM_REF
&& integer_zerop (TREE_OPERAND (t, 1)))
return TREE_OPERAND (t, 0);
else if (TREE_CODE (t) == MEM_REF
&& TREE_CODE (TREE_OPERAND (t, 0)) == INTEGER_CST)
return fold_binary (POINTER_PLUS_EXPR, ptrtype,
TREE_OPERAND (t, 0),
convert_to_ptrofftype (TREE_OPERAND (t, 1)));
else if (TREE_CODE (t) == VIEW_CONVERT_EXPR)
{
t = build_fold_addr_expr_loc (loc, TREE_OPERAND (t, 0));
if (TREE_TYPE (t) != ptrtype)
t = fold_convert_loc (loc, ptrtype, t);
}
else
t = build1_loc (loc, ADDR_EXPR, ptrtype, t);
return t;
} | [
"tree",
"build_fold_addr_expr_with_type_loc",
"(",
"location_t",
"loc",
",",
"tree",
"t",
",",
"tree",
"ptrtype",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"WITH_SIZE_EXPR",
")",
"t",
"=",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"INDIRECT_REF",
")",
"{",
"t",
"=",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
";",
"if",
"(",
"TREE_TYPE",
"(",
"t",
")",
"!=",
"ptrtype",
")",
"t",
"=",
"build1_loc",
"(",
"loc",
",",
"NOP_EXPR",
",",
"ptrtype",
",",
"t",
")",
";",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"MEM_REF",
"&&",
"integer_zerop",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
")",
"return",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"MEM_REF",
"&&",
"TREE_CODE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
")",
"==",
"INTEGER_CST",
")",
"return",
"fold_binary",
"(",
"POINTER_PLUS_EXPR",
",",
"ptrtype",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"convert_to_ptrofftype",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
")",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"VIEW_CONVERT_EXPR",
")",
"{",
"t",
"=",
"build_fold_addr_expr_loc",
"(",
"loc",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
")",
";",
"if",
"(",
"TREE_TYPE",
"(",
"t",
")",
"!=",
"ptrtype",
")",
"t",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"ptrtype",
",",
"t",
")",
";",
"}",
"else",
"t",
"=",
"build1_loc",
"(",
"loc",
",",
"ADDR_EXPR",
",",
"ptrtype",
",",
"t",
")",
";",
"return",
"t",
";",
"}"
] | Build an expression for the address of T. Folds away INDIRECT_REF
to avoid confusing the gimplify process. | [
"Build",
"an",
"expression",
"for",
"the",
"address",
"of",
"T",
".",
"Folds",
"away",
"INDIRECT_REF",
"to",
"avoid",
"confusing",
"the",
"gimplify",
"process",
"."
] | [
"/* The size of the object is not relevant when talking about its address. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "t",
"type": "tree"
},
{
"param": "ptrtype",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ptrtype",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | build_fold_addr_expr_loc | tree | tree
build_fold_addr_expr_loc (location_t loc, tree t)
{
tree ptrtype = build_pointer_type (TREE_TYPE (t));
return build_fold_addr_expr_with_type_loc (loc, t, ptrtype);
} | /* Build an expression for the address of T. */ | Build an expression for the address of T. | [
"Build",
"an",
"expression",
"for",
"the",
"address",
"of",
"T",
"."
] | tree
build_fold_addr_expr_loc (location_t loc, tree t)
{
tree ptrtype = build_pointer_type (TREE_TYPE (t));
return build_fold_addr_expr_with_type_loc (loc, t, ptrtype);
} | [
"tree",
"build_fold_addr_expr_loc",
"(",
"location_t",
"loc",
",",
"tree",
"t",
")",
"{",
"tree",
"ptrtype",
"=",
"build_pointer_type",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
";",
"return",
"build_fold_addr_expr_with_type_loc",
"(",
"loc",
",",
"t",
",",
"ptrtype",
")",
";",
"}"
] | Build an expression for the address of T. | [
"Build",
"an",
"expression",
"for",
"the",
"address",
"of",
"T",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_unary_ignore_overflow_loc | tree | tree
fold_unary_ignore_overflow_loc (location_t loc, enum tree_code code,
tree type, tree op0)
{
tree res = fold_unary_loc (loc, code, type, op0);
if (res
&& TREE_CODE (res) == INTEGER_CST
&& TREE_CODE (op0) == INTEGER_CST
&& CONVERT_EXPR_CODE_P (code))
TREE_OVERFLOW (res) = TREE_OVERFLOW (op0);
return res;
} | /* If the operation was a conversion do _not_ mark a resulting constant
with TREE_OVERFLOW if the original constant was not. These conversions
have implementation defined behavior and retaining the TREE_OVERFLOW
flag here would confuse later passes such as VRP. */ | If the operation was a conversion do _not_ mark a resulting constant
with TREE_OVERFLOW if the original constant was not. These conversions
have implementation defined behavior and retaining the TREE_OVERFLOW
flag here would confuse later passes such as VRP. | [
"If",
"the",
"operation",
"was",
"a",
"conversion",
"do",
"_not_",
"mark",
"a",
"resulting",
"constant",
"with",
"TREE_OVERFLOW",
"if",
"the",
"original",
"constant",
"was",
"not",
".",
"These",
"conversions",
"have",
"implementation",
"defined",
"behavior",
"and",
"retaining",
"the",
"TREE_OVERFLOW",
"flag",
"here",
"would",
"confuse",
"later",
"passes",
"such",
"as",
"VRP",
"."
] | tree
fold_unary_ignore_overflow_loc (location_t loc, enum tree_code code,
tree type, tree op0)
{
tree res = fold_unary_loc (loc, code, type, op0);
if (res
&& TREE_CODE (res) == INTEGER_CST
&& TREE_CODE (op0) == INTEGER_CST
&& CONVERT_EXPR_CODE_P (code))
TREE_OVERFLOW (res) = TREE_OVERFLOW (op0);
return res;
} | [
"tree",
"fold_unary_ignore_overflow_loc",
"(",
"location_t",
"loc",
",",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"op0",
")",
"{",
"tree",
"res",
"=",
"fold_unary_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"op0",
")",
";",
"if",
"(",
"res",
"&&",
"TREE_CODE",
"(",
"res",
")",
"==",
"INTEGER_CST",
"&&",
"TREE_CODE",
"(",
"op0",
")",
"==",
"INTEGER_CST",
"&&",
"CONVERT_EXPR_CODE_P",
"(",
"code",
")",
")",
"TREE_OVERFLOW",
"(",
"res",
")",
"=",
"TREE_OVERFLOW",
"(",
"op0",
")",
";",
"return",
"res",
";",
"}"
] | If the operation was a conversion do _not_ mark a resulting constant
with TREE_OVERFLOW if the original constant was not. | [
"If",
"the",
"operation",
"was",
"a",
"conversion",
"do",
"_not_",
"mark",
"a",
"resulting",
"constant",
"with",
"TREE_OVERFLOW",
"if",
"the",
"original",
"constant",
"was",
"not",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "op0",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_truth_andor | tree | static tree
fold_truth_andor (location_t loc, enum tree_code code, tree type,
tree arg0, tree arg1, tree op0, tree op1)
{
tree tem;
/* We only do these simplifications if we are optimizing. */
if (!optimize)
return NULL_TREE;
/* Check for things like (A || B) && (A || C). We can convert this
to A || (B && C). Note that either operator can be any of the four
truth and/or operations and the transformation will still be
valid. Also note that we only care about order for the
ANDIF and ORIF operators. If B contains side effects, this
might change the truth-value of A. */
if (TREE_CODE (arg0) == TREE_CODE (arg1)
&& (TREE_CODE (arg0) == TRUTH_ANDIF_EXPR
|| TREE_CODE (arg0) == TRUTH_ORIF_EXPR
|| TREE_CODE (arg0) == TRUTH_AND_EXPR
|| TREE_CODE (arg0) == TRUTH_OR_EXPR)
&& ! TREE_SIDE_EFFECTS (TREE_OPERAND (arg0, 1)))
{
tree a00 = TREE_OPERAND (arg0, 0);
tree a01 = TREE_OPERAND (arg0, 1);
tree a10 = TREE_OPERAND (arg1, 0);
tree a11 = TREE_OPERAND (arg1, 1);
int commutative = ((TREE_CODE (arg0) == TRUTH_OR_EXPR
|| TREE_CODE (arg0) == TRUTH_AND_EXPR)
&& (code == TRUTH_AND_EXPR
|| code == TRUTH_OR_EXPR));
if (operand_equal_p (a00, a10, 0))
return fold_build2_loc (loc, TREE_CODE (arg0), type, a00,
fold_build2_loc (loc, code, type, a01, a11));
else if (commutative && operand_equal_p (a00, a11, 0))
return fold_build2_loc (loc, TREE_CODE (arg0), type, a00,
fold_build2_loc (loc, code, type, a01, a10));
else if (commutative && operand_equal_p (a01, a10, 0))
return fold_build2_loc (loc, TREE_CODE (arg0), type, a01,
fold_build2_loc (loc, code, type, a00, a11));
/* This case if tricky because we must either have commutative
operators or else A10 must not have side-effects. */
else if ((commutative || ! TREE_SIDE_EFFECTS (a10))
&& operand_equal_p (a01, a11, 0))
return fold_build2_loc (loc, TREE_CODE (arg0), type,
fold_build2_loc (loc, code, type, a00, a10),
a01);
}
/* See if we can build a range comparison. */
if ((tem = fold_range_test (loc, code, type, op0, op1)) != 0)
return tem;
if ((code == TRUTH_ANDIF_EXPR && TREE_CODE (arg0) == TRUTH_ORIF_EXPR)
|| (code == TRUTH_ORIF_EXPR && TREE_CODE (arg0) == TRUTH_ANDIF_EXPR))
{
tem = merge_truthop_with_opposite_arm (loc, arg0, arg1, true);
if (tem)
return fold_build2_loc (loc, code, type, tem, arg1);
}
if ((code == TRUTH_ANDIF_EXPR && TREE_CODE (arg1) == TRUTH_ORIF_EXPR)
|| (code == TRUTH_ORIF_EXPR && TREE_CODE (arg1) == TRUTH_ANDIF_EXPR))
{
tem = merge_truthop_with_opposite_arm (loc, arg1, arg0, false);
if (tem)
return fold_build2_loc (loc, code, type, arg0, tem);
}
/* Check for the possibility of merging component references. If our
lhs is another similar operation, try to merge its rhs with our
rhs. Then try to merge our lhs and rhs. */
if (TREE_CODE (arg0) == code
&& (tem = fold_truth_andor_1 (loc, code, type,
TREE_OPERAND (arg0, 1), arg1)) != 0)
return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), tem);
if ((tem = fold_truth_andor_1 (loc, code, type, arg0, arg1)) != 0)
return tem;
bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT;
if (PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT) != -1)
logical_op_non_short_circuit
= PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT);
if (logical_op_non_short_circuit
&& !flag_sanitize_coverage
&& (code == TRUTH_AND_EXPR
|| code == TRUTH_ANDIF_EXPR
|| code == TRUTH_OR_EXPR
|| code == TRUTH_ORIF_EXPR))
{
enum tree_code ncode, icode;
ncode = (code == TRUTH_ANDIF_EXPR || code == TRUTH_AND_EXPR)
? TRUTH_AND_EXPR : TRUTH_OR_EXPR;
icode = ncode == TRUTH_AND_EXPR ? TRUTH_ANDIF_EXPR : TRUTH_ORIF_EXPR;
/* Transform ((A AND-IF B) AND[-IF] C) into (A AND-IF (B AND C)),
or ((A OR-IF B) OR[-IF] C) into (A OR-IF (B OR C))
We don't want to pack more than two leafs to a non-IF AND/OR
expression.
If tree-code of left-hand operand isn't an AND/OR-IF code and not
equal to IF-CODE, then we don't want to add right-hand operand.
If the inner right-hand side of left-hand operand has
side-effects, or isn't simple, then we can't add to it,
as otherwise we might destroy if-sequence. */
if (TREE_CODE (arg0) == icode
&& simple_operand_p_2 (arg1)
/* Needed for sequence points to handle trappings, and
side-effects. */
&& simple_operand_p_2 (TREE_OPERAND (arg0, 1)))
{
tem = fold_build2_loc (loc, ncode, type, TREE_OPERAND (arg0, 1),
arg1);
return fold_build2_loc (loc, icode, type, TREE_OPERAND (arg0, 0),
tem);
}
/* Same as above but for (A AND[-IF] (B AND-IF C)) -> ((A AND B) AND-IF C),
or (A OR[-IF] (B OR-IF C) -> ((A OR B) OR-IF C). */
else if (TREE_CODE (arg1) == icode
&& simple_operand_p_2 (arg0)
/* Needed for sequence points to handle trappings, and
side-effects. */
&& simple_operand_p_2 (TREE_OPERAND (arg1, 0)))
{
tem = fold_build2_loc (loc, ncode, type,
arg0, TREE_OPERAND (arg1, 0));
return fold_build2_loc (loc, icode, type, tem,
TREE_OPERAND (arg1, 1));
}
/* Transform (A AND-IF B) into (A AND B), or (A OR-IF B)
into (A OR B).
For sequence point consistancy, we need to check for trapping,
and side-effects. */
else if (code == icode && simple_operand_p_2 (arg0)
&& simple_operand_p_2 (arg1))
return fold_build2_loc (loc, ncode, type, arg0, arg1);
}
return NULL_TREE;
} | /* Fold a binary bitwise/truth expression of code CODE and type TYPE with
operands OP0 and OP1. LOC is the location of the resulting expression.
ARG0 and ARG1 are the NOP_STRIPed results of OP0 and OP1.
Return the folded expression if folding is successful. Otherwise,
return NULL_TREE. */ | Fold a binary bitwise/truth expression of code CODE and type TYPE with
operands OP0 and OP1. LOC is the location of the resulting expression.
ARG0 and ARG1 are the NOP_STRIPed results of OP0 and OP1.
Return the folded expression if folding is successful. | [
"Fold",
"a",
"binary",
"bitwise",
"/",
"truth",
"expression",
"of",
"code",
"CODE",
"and",
"type",
"TYPE",
"with",
"operands",
"OP0",
"and",
"OP1",
".",
"LOC",
"is",
"the",
"location",
"of",
"the",
"resulting",
"expression",
".",
"ARG0",
"and",
"ARG1",
"are",
"the",
"NOP_STRIPed",
"results",
"of",
"OP0",
"and",
"OP1",
".",
"Return",
"the",
"folded",
"expression",
"if",
"folding",
"is",
"successful",
"."
] | static tree
fold_truth_andor (location_t loc, enum tree_code code, tree type,
tree arg0, tree arg1, tree op0, tree op1)
{
tree tem;
if (!optimize)
return NULL_TREE;
if (TREE_CODE (arg0) == TREE_CODE (arg1)
&& (TREE_CODE (arg0) == TRUTH_ANDIF_EXPR
|| TREE_CODE (arg0) == TRUTH_ORIF_EXPR
|| TREE_CODE (arg0) == TRUTH_AND_EXPR
|| TREE_CODE (arg0) == TRUTH_OR_EXPR)
&& ! TREE_SIDE_EFFECTS (TREE_OPERAND (arg0, 1)))
{
tree a00 = TREE_OPERAND (arg0, 0);
tree a01 = TREE_OPERAND (arg0, 1);
tree a10 = TREE_OPERAND (arg1, 0);
tree a11 = TREE_OPERAND (arg1, 1);
int commutative = ((TREE_CODE (arg0) == TRUTH_OR_EXPR
|| TREE_CODE (arg0) == TRUTH_AND_EXPR)
&& (code == TRUTH_AND_EXPR
|| code == TRUTH_OR_EXPR));
if (operand_equal_p (a00, a10, 0))
return fold_build2_loc (loc, TREE_CODE (arg0), type, a00,
fold_build2_loc (loc, code, type, a01, a11));
else if (commutative && operand_equal_p (a00, a11, 0))
return fold_build2_loc (loc, TREE_CODE (arg0), type, a00,
fold_build2_loc (loc, code, type, a01, a10));
else if (commutative && operand_equal_p (a01, a10, 0))
return fold_build2_loc (loc, TREE_CODE (arg0), type, a01,
fold_build2_loc (loc, code, type, a00, a11));
else if ((commutative || ! TREE_SIDE_EFFECTS (a10))
&& operand_equal_p (a01, a11, 0))
return fold_build2_loc (loc, TREE_CODE (arg0), type,
fold_build2_loc (loc, code, type, a00, a10),
a01);
}
if ((tem = fold_range_test (loc, code, type, op0, op1)) != 0)
return tem;
if ((code == TRUTH_ANDIF_EXPR && TREE_CODE (arg0) == TRUTH_ORIF_EXPR)
|| (code == TRUTH_ORIF_EXPR && TREE_CODE (arg0) == TRUTH_ANDIF_EXPR))
{
tem = merge_truthop_with_opposite_arm (loc, arg0, arg1, true);
if (tem)
return fold_build2_loc (loc, code, type, tem, arg1);
}
if ((code == TRUTH_ANDIF_EXPR && TREE_CODE (arg1) == TRUTH_ORIF_EXPR)
|| (code == TRUTH_ORIF_EXPR && TREE_CODE (arg1) == TRUTH_ANDIF_EXPR))
{
tem = merge_truthop_with_opposite_arm (loc, arg1, arg0, false);
if (tem)
return fold_build2_loc (loc, code, type, arg0, tem);
}
if (TREE_CODE (arg0) == code
&& (tem = fold_truth_andor_1 (loc, code, type,
TREE_OPERAND (arg0, 1), arg1)) != 0)
return fold_build2_loc (loc, code, type, TREE_OPERAND (arg0, 0), tem);
if ((tem = fold_truth_andor_1 (loc, code, type, arg0, arg1)) != 0)
return tem;
bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT;
if (PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT) != -1)
logical_op_non_short_circuit
= PARAM_VALUE (PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT);
if (logical_op_non_short_circuit
&& !flag_sanitize_coverage
&& (code == TRUTH_AND_EXPR
|| code == TRUTH_ANDIF_EXPR
|| code == TRUTH_OR_EXPR
|| code == TRUTH_ORIF_EXPR))
{
enum tree_code ncode, icode;
ncode = (code == TRUTH_ANDIF_EXPR || code == TRUTH_AND_EXPR)
? TRUTH_AND_EXPR : TRUTH_OR_EXPR;
icode = ncode == TRUTH_AND_EXPR ? TRUTH_ANDIF_EXPR : TRUTH_ORIF_EXPR;
if (TREE_CODE (arg0) == icode
&& simple_operand_p_2 (arg1)
&& simple_operand_p_2 (TREE_OPERAND (arg0, 1)))
{
tem = fold_build2_loc (loc, ncode, type, TREE_OPERAND (arg0, 1),
arg1);
return fold_build2_loc (loc, icode, type, TREE_OPERAND (arg0, 0),
tem);
}
else if (TREE_CODE (arg1) == icode
&& simple_operand_p_2 (arg0)
&& simple_operand_p_2 (TREE_OPERAND (arg1, 0)))
{
tem = fold_build2_loc (loc, ncode, type,
arg0, TREE_OPERAND (arg1, 0));
return fold_build2_loc (loc, icode, type, tem,
TREE_OPERAND (arg1, 1));
}
else if (code == icode && simple_operand_p_2 (arg0)
&& simple_operand_p_2 (arg1))
return fold_build2_loc (loc, ncode, type, arg0, arg1);
}
return NULL_TREE;
} | [
"static",
"tree",
"fold_truth_andor",
"(",
"location_t",
"loc",
",",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"arg0",
",",
"tree",
"arg1",
",",
"tree",
"op0",
",",
"tree",
"op1",
")",
"{",
"tree",
"tem",
";",
"if",
"(",
"!",
"optimize",
")",
"return",
"NULL_TREE",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"TREE_CODE",
"(",
"arg1",
")",
"&&",
"(",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"TRUTH_ANDIF_EXPR",
"||",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"TRUTH_ORIF_EXPR",
"||",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"TRUTH_AND_EXPR",
"||",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"TRUTH_OR_EXPR",
")",
"&&",
"!",
"TREE_SIDE_EFFECTS",
"(",
"TREE_OPERAND",
"(",
"arg0",
",",
"1",
")",
")",
")",
"{",
"tree",
"a00",
"=",
"TREE_OPERAND",
"(",
"arg0",
",",
"0",
")",
";",
"tree",
"a01",
"=",
"TREE_OPERAND",
"(",
"arg0",
",",
"1",
")",
";",
"tree",
"a10",
"=",
"TREE_OPERAND",
"(",
"arg1",
",",
"0",
")",
";",
"tree",
"a11",
"=",
"TREE_OPERAND",
"(",
"arg1",
",",
"1",
")",
";",
"int",
"commutative",
"=",
"(",
"(",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"TRUTH_OR_EXPR",
"||",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"TRUTH_AND_EXPR",
")",
"&&",
"(",
"code",
"==",
"TRUTH_AND_EXPR",
"||",
"code",
"==",
"TRUTH_OR_EXPR",
")",
")",
";",
"if",
"(",
"operand_equal_p",
"(",
"a00",
",",
"a10",
",",
"0",
")",
")",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"TREE_CODE",
"(",
"arg0",
")",
",",
"type",
",",
"a00",
",",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"a01",
",",
"a11",
")",
")",
";",
"else",
"if",
"(",
"commutative",
"&&",
"operand_equal_p",
"(",
"a00",
",",
"a11",
",",
"0",
")",
")",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"TREE_CODE",
"(",
"arg0",
")",
",",
"type",
",",
"a00",
",",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"a01",
",",
"a10",
")",
")",
";",
"else",
"if",
"(",
"commutative",
"&&",
"operand_equal_p",
"(",
"a01",
",",
"a10",
",",
"0",
")",
")",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"TREE_CODE",
"(",
"arg0",
")",
",",
"type",
",",
"a01",
",",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"a00",
",",
"a11",
")",
")",
";",
"else",
"if",
"(",
"(",
"commutative",
"||",
"!",
"TREE_SIDE_EFFECTS",
"(",
"a10",
")",
")",
"&&",
"operand_equal_p",
"(",
"a01",
",",
"a11",
",",
"0",
")",
")",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"TREE_CODE",
"(",
"arg0",
")",
",",
"type",
",",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"a00",
",",
"a10",
")",
",",
"a01",
")",
";",
"}",
"if",
"(",
"(",
"tem",
"=",
"fold_range_test",
"(",
"loc",
",",
"code",
",",
"type",
",",
"op0",
",",
"op1",
")",
")",
"!=",
"0",
")",
"return",
"tem",
";",
"if",
"(",
"(",
"code",
"==",
"TRUTH_ANDIF_EXPR",
"&&",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"TRUTH_ORIF_EXPR",
")",
"||",
"(",
"code",
"==",
"TRUTH_ORIF_EXPR",
"&&",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"TRUTH_ANDIF_EXPR",
")",
")",
"{",
"tem",
"=",
"merge_truthop_with_opposite_arm",
"(",
"loc",
",",
"arg0",
",",
"arg1",
",",
"true",
")",
";",
"if",
"(",
"tem",
")",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"tem",
",",
"arg1",
")",
";",
"}",
"if",
"(",
"(",
"code",
"==",
"TRUTH_ANDIF_EXPR",
"&&",
"TREE_CODE",
"(",
"arg1",
")",
"==",
"TRUTH_ORIF_EXPR",
")",
"||",
"(",
"code",
"==",
"TRUTH_ORIF_EXPR",
"&&",
"TREE_CODE",
"(",
"arg1",
")",
"==",
"TRUTH_ANDIF_EXPR",
")",
")",
"{",
"tem",
"=",
"merge_truthop_with_opposite_arm",
"(",
"loc",
",",
"arg1",
",",
"arg0",
",",
"false",
")",
";",
"if",
"(",
"tem",
")",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"arg0",
",",
"tem",
")",
";",
"}",
"if",
"(",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"code",
"&&",
"(",
"tem",
"=",
"fold_truth_andor_1",
"(",
"loc",
",",
"code",
",",
"type",
",",
"TREE_OPERAND",
"(",
"arg0",
",",
"1",
")",
",",
"arg1",
")",
")",
"!=",
"0",
")",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"TREE_OPERAND",
"(",
"arg0",
",",
"0",
")",
",",
"tem",
")",
";",
"if",
"(",
"(",
"tem",
"=",
"fold_truth_andor_1",
"(",
"loc",
",",
"code",
",",
"type",
",",
"arg0",
",",
"arg1",
")",
")",
"!=",
"0",
")",
"return",
"tem",
";",
"bool",
"logical_op_non_short_circuit",
"=",
"LOGICAL_OP_NON_SHORT_CIRCUIT",
";",
"if",
"(",
"PARAM_VALUE",
"(",
"PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT",
")",
"!=",
"-1",
")",
"logical_op_non_short_circuit",
"=",
"PARAM_VALUE",
"(",
"PARAM_LOGICAL_OP_NON_SHORT_CIRCUIT",
")",
";",
"if",
"(",
"logical_op_non_short_circuit",
"&&",
"!",
"flag_sanitize_coverage",
"&&",
"(",
"code",
"==",
"TRUTH_AND_EXPR",
"||",
"code",
"==",
"TRUTH_ANDIF_EXPR",
"||",
"code",
"==",
"TRUTH_OR_EXPR",
"||",
"code",
"==",
"TRUTH_ORIF_EXPR",
")",
")",
"{",
"enum",
"tree_code",
"ncode",
",",
"icode",
";",
"ncode",
"=",
"(",
"code",
"==",
"TRUTH_ANDIF_EXPR",
"||",
"code",
"==",
"TRUTH_AND_EXPR",
")",
"?",
"TRUTH_AND_EXPR",
":",
"TRUTH_OR_EXPR",
";",
"icode",
"=",
"ncode",
"==",
"TRUTH_AND_EXPR",
"?",
"TRUTH_ANDIF_EXPR",
":",
"TRUTH_ORIF_EXPR",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg0",
")",
"==",
"icode",
"&&",
"simple_operand_p_2",
"(",
"arg1",
")",
"&&",
"simple_operand_p_2",
"(",
"TREE_OPERAND",
"(",
"arg0",
",",
"1",
")",
")",
")",
"{",
"tem",
"=",
"fold_build2_loc",
"(",
"loc",
",",
"ncode",
",",
"type",
",",
"TREE_OPERAND",
"(",
"arg0",
",",
"1",
")",
",",
"arg1",
")",
";",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"icode",
",",
"type",
",",
"TREE_OPERAND",
"(",
"arg0",
",",
"0",
")",
",",
"tem",
")",
";",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"arg1",
")",
"==",
"icode",
"&&",
"simple_operand_p_2",
"(",
"arg0",
")",
"&&",
"simple_operand_p_2",
"(",
"TREE_OPERAND",
"(",
"arg1",
",",
"0",
")",
")",
")",
"{",
"tem",
"=",
"fold_build2_loc",
"(",
"loc",
",",
"ncode",
",",
"type",
",",
"arg0",
",",
"TREE_OPERAND",
"(",
"arg1",
",",
"0",
")",
")",
";",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"icode",
",",
"type",
",",
"tem",
",",
"TREE_OPERAND",
"(",
"arg1",
",",
"1",
")",
")",
";",
"}",
"else",
"if",
"(",
"code",
"==",
"icode",
"&&",
"simple_operand_p_2",
"(",
"arg0",
")",
"&&",
"simple_operand_p_2",
"(",
"arg1",
")",
")",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"ncode",
",",
"type",
",",
"arg0",
",",
"arg1",
")",
";",
"}",
"return",
"NULL_TREE",
";",
"}"
] | Fold a binary bitwise/truth expression of code CODE and type TYPE with
operands OP0 and OP1. | [
"Fold",
"a",
"binary",
"bitwise",
"/",
"truth",
"expression",
"of",
"code",
"CODE",
"and",
"type",
"TYPE",
"with",
"operands",
"OP0",
"and",
"OP1",
"."
] | [
"/* We only do these simplifications if we are optimizing. */",
"/* Check for things like (A || B) && (A || C). We can convert this\n to A || (B && C). Note that either operator can be any of the four\n truth and/or operations and the transformation will still be\n valid. Also note that we only care about order for the\n ANDIF and ORIF operators. If B contains side effects, this\n might change the truth-value of A. */",
"/* This case if tricky because we must either have commutative\n\t operators or else A10 must not have side-effects. */",
"/* See if we can build a range comparison. */",
"/* Check for the possibility of merging component references. If our\n lhs is another similar operation, try to merge its rhs with our\n rhs. Then try to merge our lhs and rhs. */",
"/* Transform ((A AND-IF B) AND[-IF] C) into (A AND-IF (B AND C)),\n\t or ((A OR-IF B) OR[-IF] C) into (A OR-IF (B OR C))\n\t We don't want to pack more than two leafs to a non-IF AND/OR\n\t expression.\n\t If tree-code of left-hand operand isn't an AND/OR-IF code and not\n\t equal to IF-CODE, then we don't want to add right-hand operand.\n\t If the inner right-hand side of left-hand operand has\n\t side-effects, or isn't simple, then we can't add to it,\n\t as otherwise we might destroy if-sequence. */",
"/* Needed for sequence points to handle trappings, and\n\t side-effects. */",
"/* Same as above but for (A AND[-IF] (B AND-IF C)) -> ((A AND B) AND-IF C),\n\t or (A OR[-IF] (B OR-IF C) -> ((A OR B) OR-IF C). */",
"/* Needed for sequence points to handle trappings, and\n\t side-effects. */",
"/* Transform (A AND-IF B) into (A AND B), or (A OR-IF B)\n\t into (A OR B).\n\t For sequence point consistancy, we need to check for trapping,\n\t and side-effects. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "arg0",
"type": "tree"
},
{
"param": "arg1",
"type": "tree"
},
{
"param": "op0",
"type": "tree"
},
{
"param": "op1",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "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": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | maybe_canonicalize_comparison_1 | tree | static tree
maybe_canonicalize_comparison_1 (location_t loc, enum tree_code code, tree type,
tree arg0, tree arg1,
bool *strict_overflow_p)
{
enum tree_code code0 = TREE_CODE (arg0);
tree t, cst0 = NULL_TREE;
int sgn0;
/* Match A +- CST code arg1. We can change this only if overflow
is undefined. */
if (!((ANY_INTEGRAL_TYPE_P (TREE_TYPE (arg0))
&& TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg0)))
/* In principle pointers also have undefined overflow behavior,
but that causes problems elsewhere. */
&& !POINTER_TYPE_P (TREE_TYPE (arg0))
&& (code0 == MINUS_EXPR
|| code0 == PLUS_EXPR)
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST))
return NULL_TREE;
/* Identify the constant in arg0 and its sign. */
cst0 = TREE_OPERAND (arg0, 1);
sgn0 = tree_int_cst_sgn (cst0);
/* Overflowed constants and zero will cause problems. */
if (integer_zerop (cst0)
|| TREE_OVERFLOW (cst0))
return NULL_TREE;
/* See if we can reduce the magnitude of the constant in
arg0 by changing the comparison code. */
/* A - CST < arg1 -> A - CST-1 <= arg1. */
if (code == LT_EXPR
&& code0 == ((sgn0 == -1) ? PLUS_EXPR : MINUS_EXPR))
code = LE_EXPR;
/* A + CST > arg1 -> A + CST-1 >= arg1. */
else if (code == GT_EXPR
&& code0 == ((sgn0 == -1) ? MINUS_EXPR : PLUS_EXPR))
code = GE_EXPR;
/* A + CST <= arg1 -> A + CST-1 < arg1. */
else if (code == LE_EXPR
&& code0 == ((sgn0 == -1) ? MINUS_EXPR : PLUS_EXPR))
code = LT_EXPR;
/* A - CST >= arg1 -> A - CST-1 > arg1. */
else if (code == GE_EXPR
&& code0 == ((sgn0 == -1) ? PLUS_EXPR : MINUS_EXPR))
code = GT_EXPR;
else
return NULL_TREE;
*strict_overflow_p = true;
/* Now build the constant reduced in magnitude. But not if that
would produce one outside of its types range. */
if (INTEGRAL_TYPE_P (TREE_TYPE (cst0))
&& ((sgn0 == 1
&& TYPE_MIN_VALUE (TREE_TYPE (cst0))
&& tree_int_cst_equal (cst0, TYPE_MIN_VALUE (TREE_TYPE (cst0))))
|| (sgn0 == -1
&& TYPE_MAX_VALUE (TREE_TYPE (cst0))
&& tree_int_cst_equal (cst0, TYPE_MAX_VALUE (TREE_TYPE (cst0))))))
return NULL_TREE;
t = int_const_binop (sgn0 == -1 ? PLUS_EXPR : MINUS_EXPR,
cst0, build_int_cst (TREE_TYPE (cst0), 1));
t = fold_build2_loc (loc, code0, TREE_TYPE (arg0), TREE_OPERAND (arg0, 0), t);
t = fold_convert (TREE_TYPE (arg1), t);
return fold_build2_loc (loc, code, type, t, arg1);
} | /* Helper that tries to canonicalize the comparison ARG0 CODE ARG1
by changing CODE to reduce the magnitude of constants involved in
ARG0 of the comparison.
Returns a canonicalized comparison tree if a simplification was
possible, otherwise returns NULL_TREE.
Set *STRICT_OVERFLOW_P to true if the canonicalization is only
valid if signed overflow is undefined. */ | Helper that tries to canonicalize the comparison ARG0 CODE ARG1
by changing CODE to reduce the magnitude of constants involved in
ARG0 of the comparison.
Returns a canonicalized comparison tree if a simplification was
possible, otherwise returns NULL_TREE.
Set *STRICT_OVERFLOW_P to true if the canonicalization is only
valid if signed overflow is undefined. | [
"Helper",
"that",
"tries",
"to",
"canonicalize",
"the",
"comparison",
"ARG0",
"CODE",
"ARG1",
"by",
"changing",
"CODE",
"to",
"reduce",
"the",
"magnitude",
"of",
"constants",
"involved",
"in",
"ARG0",
"of",
"the",
"comparison",
".",
"Returns",
"a",
"canonicalized",
"comparison",
"tree",
"if",
"a",
"simplification",
"was",
"possible",
"otherwise",
"returns",
"NULL_TREE",
".",
"Set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
"if",
"the",
"canonicalization",
"is",
"only",
"valid",
"if",
"signed",
"overflow",
"is",
"undefined",
"."
] | static tree
maybe_canonicalize_comparison_1 (location_t loc, enum tree_code code, tree type,
tree arg0, tree arg1,
bool *strict_overflow_p)
{
enum tree_code code0 = TREE_CODE (arg0);
tree t, cst0 = NULL_TREE;
int sgn0;
if (!((ANY_INTEGRAL_TYPE_P (TREE_TYPE (arg0))
&& TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (arg0)))
&& !POINTER_TYPE_P (TREE_TYPE (arg0))
&& (code0 == MINUS_EXPR
|| code0 == PLUS_EXPR)
&& TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST))
return NULL_TREE;
cst0 = TREE_OPERAND (arg0, 1);
sgn0 = tree_int_cst_sgn (cst0);
if (integer_zerop (cst0)
|| TREE_OVERFLOW (cst0))
return NULL_TREE;
if (code == LT_EXPR
&& code0 == ((sgn0 == -1) ? PLUS_EXPR : MINUS_EXPR))
code = LE_EXPR;
else if (code == GT_EXPR
&& code0 == ((sgn0 == -1) ? MINUS_EXPR : PLUS_EXPR))
code = GE_EXPR;
else if (code == LE_EXPR
&& code0 == ((sgn0 == -1) ? MINUS_EXPR : PLUS_EXPR))
code = LT_EXPR;
else if (code == GE_EXPR
&& code0 == ((sgn0 == -1) ? PLUS_EXPR : MINUS_EXPR))
code = GT_EXPR;
else
return NULL_TREE;
*strict_overflow_p = true;
if (INTEGRAL_TYPE_P (TREE_TYPE (cst0))
&& ((sgn0 == 1
&& TYPE_MIN_VALUE (TREE_TYPE (cst0))
&& tree_int_cst_equal (cst0, TYPE_MIN_VALUE (TREE_TYPE (cst0))))
|| (sgn0 == -1
&& TYPE_MAX_VALUE (TREE_TYPE (cst0))
&& tree_int_cst_equal (cst0, TYPE_MAX_VALUE (TREE_TYPE (cst0))))))
return NULL_TREE;
t = int_const_binop (sgn0 == -1 ? PLUS_EXPR : MINUS_EXPR,
cst0, build_int_cst (TREE_TYPE (cst0), 1));
t = fold_build2_loc (loc, code0, TREE_TYPE (arg0), TREE_OPERAND (arg0, 0), t);
t = fold_convert (TREE_TYPE (arg1), t);
return fold_build2_loc (loc, code, type, t, arg1);
} | [
"static",
"tree",
"maybe_canonicalize_comparison_1",
"(",
"location_t",
"loc",
",",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"arg0",
",",
"tree",
"arg1",
",",
"bool",
"*",
"strict_overflow_p",
")",
"{",
"enum",
"tree_code",
"code0",
"=",
"TREE_CODE",
"(",
"arg0",
")",
";",
"tree",
"t",
",",
"cst0",
"=",
"NULL_TREE",
";",
"int",
"sgn0",
";",
"if",
"(",
"!",
"(",
"(",
"ANY_INTEGRAL_TYPE_P",
"(",
"TREE_TYPE",
"(",
"arg0",
")",
")",
"&&",
"TYPE_OVERFLOW_UNDEFINED",
"(",
"TREE_TYPE",
"(",
"arg0",
")",
")",
")",
"&&",
"!",
"POINTER_TYPE_P",
"(",
"TREE_TYPE",
"(",
"arg0",
")",
")",
"&&",
"(",
"code0",
"==",
"MINUS_EXPR",
"||",
"code0",
"==",
"PLUS_EXPR",
")",
"&&",
"TREE_CODE",
"(",
"TREE_OPERAND",
"(",
"arg0",
",",
"1",
")",
")",
"==",
"INTEGER_CST",
")",
")",
"return",
"NULL_TREE",
";",
"cst0",
"=",
"TREE_OPERAND",
"(",
"arg0",
",",
"1",
")",
";",
"sgn0",
"=",
"tree_int_cst_sgn",
"(",
"cst0",
")",
";",
"if",
"(",
"integer_zerop",
"(",
"cst0",
")",
"||",
"TREE_OVERFLOW",
"(",
"cst0",
")",
")",
"return",
"NULL_TREE",
";",
"if",
"(",
"code",
"==",
"LT_EXPR",
"&&",
"code0",
"==",
"(",
"(",
"sgn0",
"==",
"-1",
")",
"?",
"PLUS_EXPR",
":",
"MINUS_EXPR",
")",
")",
"code",
"=",
"LE_EXPR",
";",
"else",
"if",
"(",
"code",
"==",
"GT_EXPR",
"&&",
"code0",
"==",
"(",
"(",
"sgn0",
"==",
"-1",
")",
"?",
"MINUS_EXPR",
":",
"PLUS_EXPR",
")",
")",
"code",
"=",
"GE_EXPR",
";",
"else",
"if",
"(",
"code",
"==",
"LE_EXPR",
"&&",
"code0",
"==",
"(",
"(",
"sgn0",
"==",
"-1",
")",
"?",
"MINUS_EXPR",
":",
"PLUS_EXPR",
")",
")",
"code",
"=",
"LT_EXPR",
";",
"else",
"if",
"(",
"code",
"==",
"GE_EXPR",
"&&",
"code0",
"==",
"(",
"(",
"sgn0",
"==",
"-1",
")",
"?",
"PLUS_EXPR",
":",
"MINUS_EXPR",
")",
")",
"code",
"=",
"GT_EXPR",
";",
"else",
"return",
"NULL_TREE",
";",
"*",
"strict_overflow_p",
"=",
"true",
";",
"if",
"(",
"INTEGRAL_TYPE_P",
"(",
"TREE_TYPE",
"(",
"cst0",
")",
")",
"&&",
"(",
"(",
"sgn0",
"==",
"1",
"&&",
"TYPE_MIN_VALUE",
"(",
"TREE_TYPE",
"(",
"cst0",
")",
")",
"&&",
"tree_int_cst_equal",
"(",
"cst0",
",",
"TYPE_MIN_VALUE",
"(",
"TREE_TYPE",
"(",
"cst0",
")",
")",
")",
")",
"||",
"(",
"sgn0",
"==",
"-1",
"&&",
"TYPE_MAX_VALUE",
"(",
"TREE_TYPE",
"(",
"cst0",
")",
")",
"&&",
"tree_int_cst_equal",
"(",
"cst0",
",",
"TYPE_MAX_VALUE",
"(",
"TREE_TYPE",
"(",
"cst0",
")",
")",
")",
")",
")",
")",
"return",
"NULL_TREE",
";",
"t",
"=",
"int_const_binop",
"(",
"sgn0",
"==",
"-1",
"?",
"PLUS_EXPR",
":",
"MINUS_EXPR",
",",
"cst0",
",",
"build_int_cst",
"(",
"TREE_TYPE",
"(",
"cst0",
")",
",",
"1",
")",
")",
";",
"t",
"=",
"fold_build2_loc",
"(",
"loc",
",",
"code0",
",",
"TREE_TYPE",
"(",
"arg0",
")",
",",
"TREE_OPERAND",
"(",
"arg0",
",",
"0",
")",
",",
"t",
")",
";",
"t",
"=",
"fold_convert",
"(",
"TREE_TYPE",
"(",
"arg1",
")",
",",
"t",
")",
";",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"code",
",",
"type",
",",
"t",
",",
"arg1",
")",
";",
"}"
] | Helper that tries to canonicalize the comparison ARG0 CODE ARG1
by changing CODE to reduce the magnitude of constants involved in
ARG0 of the comparison. | [
"Helper",
"that",
"tries",
"to",
"canonicalize",
"the",
"comparison",
"ARG0",
"CODE",
"ARG1",
"by",
"changing",
"CODE",
"to",
"reduce",
"the",
"magnitude",
"of",
"constants",
"involved",
"in",
"ARG0",
"of",
"the",
"comparison",
"."
] | [
"/* Match A +- CST code arg1. We can change this only if overflow\n is undefined. */",
"/* In principle pointers also have undefined overflow behavior,\n\t but that causes problems elsewhere. */",
"/* Identify the constant in arg0 and its sign. */",
"/* Overflowed constants and zero will cause problems. */",
"/* See if we can reduce the magnitude of the constant in\n arg0 by changing the comparison code. */",
"/* A - CST < arg1 -> A - CST-1 <= arg1. */",
"/* A + CST > arg1 -> A + CST-1 >= arg1. */",
"/* A + CST <= arg1 -> A + CST-1 < arg1. */",
"/* A - CST >= arg1 -> A - CST-1 > arg1. */",
"/* Now build the constant reduced in magnitude. But not if that\n would produce one outside of its types range. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "arg0",
"type": "tree"
},
{
"param": "arg1",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "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": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | vec_cst_ctor_to_array | bool | static bool
vec_cst_ctor_to_array (tree arg, unsigned int nelts, tree *elts)
{
unsigned HOST_WIDE_INT i, nunits;
if (TREE_CODE (arg) == VECTOR_CST
&& VECTOR_CST_NELTS (arg).is_constant (&nunits))
{
for (i = 0; i < nunits; ++i)
elts[i] = VECTOR_CST_ELT (arg, i);
}
else if (TREE_CODE (arg) == CONSTRUCTOR)
{
constructor_elt *elt;
FOR_EACH_VEC_SAFE_ELT (CONSTRUCTOR_ELTS (arg), i, elt)
if (i >= nelts || TREE_CODE (TREE_TYPE (elt->value)) == VECTOR_TYPE)
return false;
else
elts[i] = elt->value;
}
else
return false;
for (; i < nelts; i++)
elts[i]
= fold_convert (TREE_TYPE (TREE_TYPE (arg)), integer_zero_node);
return true;
} | /* Helper function for fold_vec_perm. Store elements of VECTOR_CST or
CONSTRUCTOR ARG into array ELTS, which has NELTS elements, and return
true if successful. */ | Helper function for fold_vec_perm. Store elements of VECTOR_CST or
CONSTRUCTOR ARG into array ELTS, which has NELTS elements, and return
true if successful. | [
"Helper",
"function",
"for",
"fold_vec_perm",
".",
"Store",
"elements",
"of",
"VECTOR_CST",
"or",
"CONSTRUCTOR",
"ARG",
"into",
"array",
"ELTS",
"which",
"has",
"NELTS",
"elements",
"and",
"return",
"true",
"if",
"successful",
"."
] | static bool
vec_cst_ctor_to_array (tree arg, unsigned int nelts, tree *elts)
{
unsigned HOST_WIDE_INT i, nunits;
if (TREE_CODE (arg) == VECTOR_CST
&& VECTOR_CST_NELTS (arg).is_constant (&nunits))
{
for (i = 0; i < nunits; ++i)
elts[i] = VECTOR_CST_ELT (arg, i);
}
else if (TREE_CODE (arg) == CONSTRUCTOR)
{
constructor_elt *elt;
FOR_EACH_VEC_SAFE_ELT (CONSTRUCTOR_ELTS (arg), i, elt)
if (i >= nelts || TREE_CODE (TREE_TYPE (elt->value)) == VECTOR_TYPE)
return false;
else
elts[i] = elt->value;
}
else
return false;
for (; i < nelts; i++)
elts[i]
= fold_convert (TREE_TYPE (TREE_TYPE (arg)), integer_zero_node);
return true;
} | [
"static",
"bool",
"vec_cst_ctor_to_array",
"(",
"tree",
"arg",
",",
"unsigned",
"int",
"nelts",
",",
"tree",
"*",
"elts",
")",
"{",
"unsigned",
"HOST_WIDE_INT",
"i",
",",
"nunits",
";",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"VECTOR_CST",
"&&",
"VECTOR_CST_NELTS",
"(",
"arg",
")",
".",
"is_constant",
"(",
"&",
"nunits",
")",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nunits",
";",
"++",
"i",
")",
"elts",
"[",
"i",
"]",
"=",
"VECTOR_CST_ELT",
"(",
"arg",
",",
"i",
")",
";",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"arg",
")",
"==",
"CONSTRUCTOR",
")",
"{",
"constructor_elt",
"*",
"elt",
";",
"FOR_EACH_VEC_SAFE_ELT",
"(",
"CONSTRUCTOR_ELTS",
"(",
"arg",
")",
",",
"i",
",",
"elt",
")",
"",
"if",
"(",
"i",
">=",
"nelts",
"||",
"TREE_CODE",
"(",
"TREE_TYPE",
"(",
"elt",
"->",
"value",
")",
")",
"==",
"VECTOR_TYPE",
")",
"return",
"false",
";",
"else",
"elts",
"[",
"i",
"]",
"=",
"elt",
"->",
"value",
";",
"}",
"else",
"return",
"false",
";",
"for",
"(",
";",
"i",
"<",
"nelts",
";",
"i",
"++",
")",
"elts",
"[",
"i",
"]",
"=",
"fold_convert",
"(",
"TREE_TYPE",
"(",
"TREE_TYPE",
"(",
"arg",
")",
")",
",",
"integer_zero_node",
")",
";",
"return",
"true",
";",
"}"
] | Helper function for fold_vec_perm. | [
"Helper",
"function",
"for",
"fold_vec_perm",
"."
] | [] | [
{
"param": "arg",
"type": "tree"
},
{
"param": "nelts",
"type": "unsigned int"
},
{
"param": "elts",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arg",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nelts",
"type": "unsigned int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "elts",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_addr_of_array_ref_difference | tree | static tree
fold_addr_of_array_ref_difference (location_t loc, tree type,
tree aref0, tree aref1,
bool use_pointer_diff)
{
tree base0 = TREE_OPERAND (aref0, 0);
tree base1 = TREE_OPERAND (aref1, 0);
tree base_offset = build_int_cst (type, 0);
/* If the bases are array references as well, recurse. If the bases
are pointer indirections compute the difference of the pointers.
If the bases are equal, we are set. */
if ((TREE_CODE (base0) == ARRAY_REF
&& TREE_CODE (base1) == ARRAY_REF
&& (base_offset
= fold_addr_of_array_ref_difference (loc, type, base0, base1,
use_pointer_diff)))
|| (INDIRECT_REF_P (base0)
&& INDIRECT_REF_P (base1)
&& (base_offset
= use_pointer_diff
? fold_binary_loc (loc, POINTER_DIFF_EXPR, type,
TREE_OPERAND (base0, 0),
TREE_OPERAND (base1, 0))
: fold_binary_loc (loc, MINUS_EXPR, type,
fold_convert (type,
TREE_OPERAND (base0, 0)),
fold_convert (type,
TREE_OPERAND (base1, 0)))))
|| operand_equal_p (base0, base1, OEP_ADDRESS_OF))
{
tree op0 = fold_convert_loc (loc, type, TREE_OPERAND (aref0, 1));
tree op1 = fold_convert_loc (loc, type, TREE_OPERAND (aref1, 1));
tree esz = fold_convert_loc (loc, type, array_ref_element_size (aref0));
tree diff = fold_build2_loc (loc, MINUS_EXPR, type, op0, op1);
return fold_build2_loc (loc, PLUS_EXPR, type,
base_offset,
fold_build2_loc (loc, MULT_EXPR, type,
diff, esz));
}
return NULL_TREE;
} | /* Try to fold a pointer difference of type TYPE two address expressions of
array references AREF0 and AREF1 using location LOC. Return a
simplified expression for the difference or NULL_TREE. */ | Try to fold a pointer difference of type TYPE two address expressions of
array references AREF0 and AREF1 using location LOC. Return a
simplified expression for the difference or NULL_TREE. | [
"Try",
"to",
"fold",
"a",
"pointer",
"difference",
"of",
"type",
"TYPE",
"two",
"address",
"expressions",
"of",
"array",
"references",
"AREF0",
"and",
"AREF1",
"using",
"location",
"LOC",
".",
"Return",
"a",
"simplified",
"expression",
"for",
"the",
"difference",
"or",
"NULL_TREE",
"."
] | static tree
fold_addr_of_array_ref_difference (location_t loc, tree type,
tree aref0, tree aref1,
bool use_pointer_diff)
{
tree base0 = TREE_OPERAND (aref0, 0);
tree base1 = TREE_OPERAND (aref1, 0);
tree base_offset = build_int_cst (type, 0);
if ((TREE_CODE (base0) == ARRAY_REF
&& TREE_CODE (base1) == ARRAY_REF
&& (base_offset
= fold_addr_of_array_ref_difference (loc, type, base0, base1,
use_pointer_diff)))
|| (INDIRECT_REF_P (base0)
&& INDIRECT_REF_P (base1)
&& (base_offset
= use_pointer_diff
? fold_binary_loc (loc, POINTER_DIFF_EXPR, type,
TREE_OPERAND (base0, 0),
TREE_OPERAND (base1, 0))
: fold_binary_loc (loc, MINUS_EXPR, type,
fold_convert (type,
TREE_OPERAND (base0, 0)),
fold_convert (type,
TREE_OPERAND (base1, 0)))))
|| operand_equal_p (base0, base1, OEP_ADDRESS_OF))
{
tree op0 = fold_convert_loc (loc, type, TREE_OPERAND (aref0, 1));
tree op1 = fold_convert_loc (loc, type, TREE_OPERAND (aref1, 1));
tree esz = fold_convert_loc (loc, type, array_ref_element_size (aref0));
tree diff = fold_build2_loc (loc, MINUS_EXPR, type, op0, op1);
return fold_build2_loc (loc, PLUS_EXPR, type,
base_offset,
fold_build2_loc (loc, MULT_EXPR, type,
diff, esz));
}
return NULL_TREE;
} | [
"static",
"tree",
"fold_addr_of_array_ref_difference",
"(",
"location_t",
"loc",
",",
"tree",
"type",
",",
"tree",
"aref0",
",",
"tree",
"aref1",
",",
"bool",
"use_pointer_diff",
")",
"{",
"tree",
"base0",
"=",
"TREE_OPERAND",
"(",
"aref0",
",",
"0",
")",
";",
"tree",
"base1",
"=",
"TREE_OPERAND",
"(",
"aref1",
",",
"0",
")",
";",
"tree",
"base_offset",
"=",
"build_int_cst",
"(",
"type",
",",
"0",
")",
";",
"if",
"(",
"(",
"TREE_CODE",
"(",
"base0",
")",
"==",
"ARRAY_REF",
"&&",
"TREE_CODE",
"(",
"base1",
")",
"==",
"ARRAY_REF",
"&&",
"(",
"base_offset",
"=",
"fold_addr_of_array_ref_difference",
"(",
"loc",
",",
"type",
",",
"base0",
",",
"base1",
",",
"use_pointer_diff",
")",
")",
")",
"||",
"(",
"INDIRECT_REF_P",
"(",
"base0",
")",
"&&",
"INDIRECT_REF_P",
"(",
"base1",
")",
"&&",
"(",
"base_offset",
"=",
"use_pointer_diff",
"?",
"fold_binary_loc",
"(",
"loc",
",",
"POINTER_DIFF_EXPR",
",",
"type",
",",
"TREE_OPERAND",
"(",
"base0",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"base1",
",",
"0",
")",
")",
":",
"fold_binary_loc",
"(",
"loc",
",",
"MINUS_EXPR",
",",
"type",
",",
"fold_convert",
"(",
"type",
",",
"TREE_OPERAND",
"(",
"base0",
",",
"0",
")",
")",
",",
"fold_convert",
"(",
"type",
",",
"TREE_OPERAND",
"(",
"base1",
",",
"0",
")",
")",
")",
")",
")",
"||",
"operand_equal_p",
"(",
"base0",
",",
"base1",
",",
"OEP_ADDRESS_OF",
")",
")",
"{",
"tree",
"op0",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"TREE_OPERAND",
"(",
"aref0",
",",
"1",
")",
")",
";",
"tree",
"op1",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"TREE_OPERAND",
"(",
"aref1",
",",
"1",
")",
")",
";",
"tree",
"esz",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"type",
",",
"array_ref_element_size",
"(",
"aref0",
")",
")",
";",
"tree",
"diff",
"=",
"fold_build2_loc",
"(",
"loc",
",",
"MINUS_EXPR",
",",
"type",
",",
"op0",
",",
"op1",
")",
";",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"PLUS_EXPR",
",",
"type",
",",
"base_offset",
",",
"fold_build2_loc",
"(",
"loc",
",",
"MULT_EXPR",
",",
"type",
",",
"diff",
",",
"esz",
")",
")",
";",
"}",
"return",
"NULL_TREE",
";",
"}"
] | Try to fold a pointer difference of type TYPE two address expressions of
array references AREF0 and AREF1 using location LOC. | [
"Try",
"to",
"fold",
"a",
"pointer",
"difference",
"of",
"type",
"TYPE",
"two",
"address",
"expressions",
"of",
"array",
"references",
"AREF0",
"and",
"AREF1",
"using",
"location",
"LOC",
"."
] | [
"/* If the bases are array references as well, recurse. If the bases\n are pointer indirections compute the difference of the pointers.\n If the bases are equal, we are set. */"
] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "type",
"type": "tree"
},
{
"param": "aref0",
"type": "tree"
},
{
"param": "aref1",
"type": "tree"
},
{
"param": "use_pointer_diff",
"type": "bool"
}
] | {
"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
},
{
"identifier": "aref0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aref1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "use_pointer_diff",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | exact_inverse | tree | tree
exact_inverse (tree type, tree cst)
{
REAL_VALUE_TYPE r;
tree unit_type;
machine_mode mode;
switch (TREE_CODE (cst))
{
case REAL_CST:
r = TREE_REAL_CST (cst);
if (exact_real_inverse (TYPE_MODE (type), &r))
return build_real (type, r);
return NULL_TREE;
case VECTOR_CST:
{
unit_type = TREE_TYPE (type);
mode = TYPE_MODE (unit_type);
tree_vector_builder elts;
if (!elts.new_unary_operation (type, cst, false))
return NULL_TREE;
unsigned int count = elts.encoded_nelts ();
for (unsigned int i = 0; i < count; ++i)
{
r = TREE_REAL_CST (VECTOR_CST_ELT (cst, i));
if (!exact_real_inverse (mode, &r))
return NULL_TREE;
elts.quick_push (build_real (unit_type, r));
}
return elts.build ();
}
default:
return NULL_TREE;
}
} | /* If the real or vector real constant CST of type TYPE has an exact
inverse, return it, else return NULL. */ | If the real or vector real constant CST of type TYPE has an exact
inverse, return it, else return NULL. | [
"If",
"the",
"real",
"or",
"vector",
"real",
"constant",
"CST",
"of",
"type",
"TYPE",
"has",
"an",
"exact",
"inverse",
"return",
"it",
"else",
"return",
"NULL",
"."
] | tree
exact_inverse (tree type, tree cst)
{
REAL_VALUE_TYPE r;
tree unit_type;
machine_mode mode;
switch (TREE_CODE (cst))
{
case REAL_CST:
r = TREE_REAL_CST (cst);
if (exact_real_inverse (TYPE_MODE (type), &r))
return build_real (type, r);
return NULL_TREE;
case VECTOR_CST:
{
unit_type = TREE_TYPE (type);
mode = TYPE_MODE (unit_type);
tree_vector_builder elts;
if (!elts.new_unary_operation (type, cst, false))
return NULL_TREE;
unsigned int count = elts.encoded_nelts ();
for (unsigned int i = 0; i < count; ++i)
{
r = TREE_REAL_CST (VECTOR_CST_ELT (cst, i));
if (!exact_real_inverse (mode, &r))
return NULL_TREE;
elts.quick_push (build_real (unit_type, r));
}
return elts.build ();
}
default:
return NULL_TREE;
}
} | [
"tree",
"exact_inverse",
"(",
"tree",
"type",
",",
"tree",
"cst",
")",
"{",
"REAL_VALUE_TYPE",
"r",
";",
"tree",
"unit_type",
";",
"machine_mode",
"mode",
";",
"switch",
"(",
"TREE_CODE",
"(",
"cst",
")",
")",
"{",
"case",
"REAL_CST",
":",
"r",
"=",
"TREE_REAL_CST",
"(",
"cst",
")",
";",
"if",
"(",
"exact_real_inverse",
"(",
"TYPE_MODE",
"(",
"type",
")",
",",
"&",
"r",
")",
")",
"return",
"build_real",
"(",
"type",
",",
"r",
")",
";",
"return",
"NULL_TREE",
";",
"case",
"VECTOR_CST",
":",
"{",
"unit_type",
"=",
"TREE_TYPE",
"(",
"type",
")",
";",
"mode",
"=",
"TYPE_MODE",
"(",
"unit_type",
")",
";",
"tree_vector_builder",
"elts",
";",
"if",
"(",
"!",
"elts",
".",
"new_unary_operation",
"(",
"type",
",",
"cst",
",",
"false",
")",
")",
"return",
"NULL_TREE",
";",
"unsigned",
"int",
"count",
"=",
"elts",
".",
"encoded_nelts",
"(",
")",
";",
"for",
"(",
"unsigned",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"++",
"i",
")",
"{",
"r",
"=",
"TREE_REAL_CST",
"(",
"VECTOR_CST_ELT",
"(",
"cst",
",",
"i",
")",
")",
";",
"if",
"(",
"!",
"exact_real_inverse",
"(",
"mode",
",",
"&",
"r",
")",
")",
"return",
"NULL_TREE",
";",
"elts",
".",
"quick_push",
"(",
"build_real",
"(",
"unit_type",
",",
"r",
")",
")",
";",
"}",
"return",
"elts",
".",
"build",
"(",
")",
";",
"}",
"default",
":",
"return",
"NULL_TREE",
";",
"}",
"}"
] | If the real or vector real constant CST of type TYPE has an exact
inverse, return it, else return NULL. | [
"If",
"the",
"real",
"or",
"vector",
"real",
"constant",
"CST",
"of",
"type",
"TYPE",
"has",
"an",
"exact",
"inverse",
"return",
"it",
"else",
"return",
"NULL",
"."
] | [] | [
{
"param": "type",
"type": "tree"
},
{
"param": "cst",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cst",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_expr_nonzero_warnv_p | bool | static bool
tree_expr_nonzero_warnv_p (tree t, bool *strict_overflow_p)
{
tree type = TREE_TYPE (t);
enum tree_code code;
/* Doing something useful for floating point would need more work. */
if (!INTEGRAL_TYPE_P (type) && !POINTER_TYPE_P (type))
return false;
code = TREE_CODE (t);
switch (TREE_CODE_CLASS (code))
{
case tcc_unary:
return tree_unary_nonzero_warnv_p (code, type, TREE_OPERAND (t, 0),
strict_overflow_p);
case tcc_binary:
case tcc_comparison:
return tree_binary_nonzero_warnv_p (code, type,
TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1),
strict_overflow_p);
case tcc_constant:
case tcc_declaration:
case tcc_reference:
return tree_single_nonzero_warnv_p (t, strict_overflow_p);
default:
break;
}
switch (code)
{
case TRUTH_NOT_EXPR:
return tree_unary_nonzero_warnv_p (code, type, TREE_OPERAND (t, 0),
strict_overflow_p);
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
case TRUTH_XOR_EXPR:
return tree_binary_nonzero_warnv_p (code, type,
TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1),
strict_overflow_p);
case COND_EXPR:
case CONSTRUCTOR:
case OBJ_TYPE_REF:
case ASSERT_EXPR:
case ADDR_EXPR:
case WITH_SIZE_EXPR:
case SSA_NAME:
return tree_single_nonzero_warnv_p (t, strict_overflow_p);
case COMPOUND_EXPR:
case MODIFY_EXPR:
case BIND_EXPR:
return tree_expr_nonzero_warnv_p (TREE_OPERAND (t, 1),
strict_overflow_p);
case SAVE_EXPR:
return tree_expr_nonzero_warnv_p (TREE_OPERAND (t, 0),
strict_overflow_p);
case CALL_EXPR:
{
tree fndecl = get_callee_fndecl (t);
if (!fndecl) return false;
if (flag_delete_null_pointer_checks && !flag_check_new
&& DECL_IS_OPERATOR_NEW (fndecl)
&& !TREE_NOTHROW (fndecl))
return true;
if (flag_delete_null_pointer_checks
&& lookup_attribute ("returns_nonnull",
TYPE_ATTRIBUTES (TREE_TYPE (fndecl))))
return true;
return alloca_call_p (t);
}
default:
break;
}
return false;
} | /* Return true when T is an address and is known to be nonzero.
For floating point we further ensure that T is not denormal.
Similar logic is present in nonzero_address in rtlanal.h.
If the return value is based on the assumption that signed overflow
is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't
change *STRICT_OVERFLOW_P. */ | Return true when T is an address and is known to be nonzero.
For floating point we further ensure that T is not denormal.
Similar logic is present in nonzero_address in rtlanal.h.
If the return value is based on the assumption that signed overflow
is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't
change *STRICT_OVERFLOW_P. | [
"Return",
"true",
"when",
"T",
"is",
"an",
"address",
"and",
"is",
"known",
"to",
"be",
"nonzero",
".",
"For",
"floating",
"point",
"we",
"further",
"ensure",
"that",
"T",
"is",
"not",
"denormal",
".",
"Similar",
"logic",
"is",
"present",
"in",
"nonzero_address",
"in",
"rtlanal",
".",
"h",
".",
"If",
"the",
"return",
"value",
"is",
"based",
"on",
"the",
"assumption",
"that",
"signed",
"overflow",
"is",
"undefined",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
";",
"otherwise",
"don",
"'",
"t",
"change",
"*",
"STRICT_OVERFLOW_P",
"."
] | static bool
tree_expr_nonzero_warnv_p (tree t, bool *strict_overflow_p)
{
tree type = TREE_TYPE (t);
enum tree_code code;
if (!INTEGRAL_TYPE_P (type) && !POINTER_TYPE_P (type))
return false;
code = TREE_CODE (t);
switch (TREE_CODE_CLASS (code))
{
case tcc_unary:
return tree_unary_nonzero_warnv_p (code, type, TREE_OPERAND (t, 0),
strict_overflow_p);
case tcc_binary:
case tcc_comparison:
return tree_binary_nonzero_warnv_p (code, type,
TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1),
strict_overflow_p);
case tcc_constant:
case tcc_declaration:
case tcc_reference:
return tree_single_nonzero_warnv_p (t, strict_overflow_p);
default:
break;
}
switch (code)
{
case TRUTH_NOT_EXPR:
return tree_unary_nonzero_warnv_p (code, type, TREE_OPERAND (t, 0),
strict_overflow_p);
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
case TRUTH_XOR_EXPR:
return tree_binary_nonzero_warnv_p (code, type,
TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1),
strict_overflow_p);
case COND_EXPR:
case CONSTRUCTOR:
case OBJ_TYPE_REF:
case ASSERT_EXPR:
case ADDR_EXPR:
case WITH_SIZE_EXPR:
case SSA_NAME:
return tree_single_nonzero_warnv_p (t, strict_overflow_p);
case COMPOUND_EXPR:
case MODIFY_EXPR:
case BIND_EXPR:
return tree_expr_nonzero_warnv_p (TREE_OPERAND (t, 1),
strict_overflow_p);
case SAVE_EXPR:
return tree_expr_nonzero_warnv_p (TREE_OPERAND (t, 0),
strict_overflow_p);
case CALL_EXPR:
{
tree fndecl = get_callee_fndecl (t);
if (!fndecl) return false;
if (flag_delete_null_pointer_checks && !flag_check_new
&& DECL_IS_OPERATOR_NEW (fndecl)
&& !TREE_NOTHROW (fndecl))
return true;
if (flag_delete_null_pointer_checks
&& lookup_attribute ("returns_nonnull",
TYPE_ATTRIBUTES (TREE_TYPE (fndecl))))
return true;
return alloca_call_p (t);
}
default:
break;
}
return false;
} | [
"static",
"bool",
"tree_expr_nonzero_warnv_p",
"(",
"tree",
"t",
",",
"bool",
"*",
"strict_overflow_p",
")",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"t",
")",
";",
"enum",
"tree_code",
"code",
";",
"if",
"(",
"!",
"INTEGRAL_TYPE_P",
"(",
"type",
")",
"&&",
"!",
"POINTER_TYPE_P",
"(",
"type",
")",
")",
"return",
"false",
";",
"code",
"=",
"TREE_CODE",
"(",
"t",
")",
";",
"switch",
"(",
"TREE_CODE_CLASS",
"(",
"code",
")",
")",
"{",
"case",
"tcc_unary",
":",
"return",
"tree_unary_nonzero_warnv_p",
"(",
"code",
",",
"type",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"strict_overflow_p",
")",
";",
"case",
"tcc_binary",
":",
"case",
"tcc_comparison",
":",
"return",
"tree_binary_nonzero_warnv_p",
"(",
"code",
",",
"type",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
",",
"strict_overflow_p",
")",
";",
"case",
"tcc_constant",
":",
"case",
"tcc_declaration",
":",
"case",
"tcc_reference",
":",
"return",
"tree_single_nonzero_warnv_p",
"(",
"t",
",",
"strict_overflow_p",
")",
";",
"default",
":",
"break",
";",
"}",
"switch",
"(",
"code",
")",
"{",
"case",
"TRUTH_NOT_EXPR",
":",
"return",
"tree_unary_nonzero_warnv_p",
"(",
"code",
",",
"type",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"strict_overflow_p",
")",
";",
"case",
"TRUTH_AND_EXPR",
":",
"case",
"TRUTH_OR_EXPR",
":",
"case",
"TRUTH_XOR_EXPR",
":",
"return",
"tree_binary_nonzero_warnv_p",
"(",
"code",
",",
"type",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
",",
"strict_overflow_p",
")",
";",
"case",
"COND_EXPR",
":",
"case",
"CONSTRUCTOR",
":",
"case",
"OBJ_TYPE_REF",
":",
"case",
"ASSERT_EXPR",
":",
"case",
"ADDR_EXPR",
":",
"case",
"WITH_SIZE_EXPR",
":",
"case",
"SSA_NAME",
":",
"return",
"tree_single_nonzero_warnv_p",
"(",
"t",
",",
"strict_overflow_p",
")",
";",
"case",
"COMPOUND_EXPR",
":",
"case",
"MODIFY_EXPR",
":",
"case",
"BIND_EXPR",
":",
"return",
"tree_expr_nonzero_warnv_p",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
",",
"strict_overflow_p",
")",
";",
"case",
"SAVE_EXPR",
":",
"return",
"tree_expr_nonzero_warnv_p",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"strict_overflow_p",
")",
";",
"case",
"CALL_EXPR",
":",
"{",
"tree",
"fndecl",
"=",
"get_callee_fndecl",
"(",
"t",
")",
";",
"if",
"(",
"!",
"fndecl",
")",
"return",
"false",
";",
"if",
"(",
"flag_delete_null_pointer_checks",
"&&",
"!",
"flag_check_new",
"&&",
"DECL_IS_OPERATOR_NEW",
"(",
"fndecl",
")",
"&&",
"!",
"TREE_NOTHROW",
"(",
"fndecl",
")",
")",
"return",
"true",
";",
"if",
"(",
"flag_delete_null_pointer_checks",
"&&",
"lookup_attribute",
"(",
"\"",
"\"",
",",
"TYPE_ATTRIBUTES",
"(",
"TREE_TYPE",
"(",
"fndecl",
")",
")",
")",
")",
"return",
"true",
";",
"return",
"alloca_call_p",
"(",
"t",
")",
";",
"}",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] | Return true when T is an address and is known to be nonzero. | [
"Return",
"true",
"when",
"T",
"is",
"an",
"address",
"and",
"is",
"known",
"to",
"be",
"nonzero",
"."
] | [
"/* Doing something useful for floating point would need more work. */"
] | [
{
"param": "t",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_expr_nonzero_p | bool | bool
tree_expr_nonzero_p (tree t)
{
bool ret, strict_overflow_p;
strict_overflow_p = false;
ret = tree_expr_nonzero_warnv_p (t, &strict_overflow_p);
if (strict_overflow_p)
fold_overflow_warning (("assuming signed overflow does not occur when "
"determining that expression is always "
"non-zero"),
WARN_STRICT_OVERFLOW_MISC);
return ret;
} | /* Return true when T is an address and is known to be nonzero.
Handle warnings about undefined signed overflow. */ | Return true when T is an address and is known to be nonzero.
Handle warnings about undefined signed overflow. | [
"Return",
"true",
"when",
"T",
"is",
"an",
"address",
"and",
"is",
"known",
"to",
"be",
"nonzero",
".",
"Handle",
"warnings",
"about",
"undefined",
"signed",
"overflow",
"."
] | bool
tree_expr_nonzero_p (tree t)
{
bool ret, strict_overflow_p;
strict_overflow_p = false;
ret = tree_expr_nonzero_warnv_p (t, &strict_overflow_p);
if (strict_overflow_p)
fold_overflow_warning (("assuming signed overflow does not occur when "
"determining that expression is always "
"non-zero"),
WARN_STRICT_OVERFLOW_MISC);
return ret;
} | [
"bool",
"tree_expr_nonzero_p",
"(",
"tree",
"t",
")",
"{",
"bool",
"ret",
",",
"strict_overflow_p",
";",
"strict_overflow_p",
"=",
"false",
";",
"ret",
"=",
"tree_expr_nonzero_warnv_p",
"(",
"t",
",",
"&",
"strict_overflow_p",
")",
";",
"if",
"(",
"strict_overflow_p",
")",
"fold_overflow_warning",
"(",
"(",
"\"",
"\"",
"\"",
"\"",
"\"",
"\"",
")",
",",
"WARN_STRICT_OVERFLOW_MISC",
")",
";",
"return",
"ret",
";",
"}"
] | Return true when T is an address and is known to be nonzero. | [
"Return",
"true",
"when",
"T",
"is",
"an",
"address",
"and",
"is",
"known",
"to",
"be",
"nonzero",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | contains_label_p | bool | static bool
contains_label_p (tree st)
{
hash_set<tree> pset;
contains_label_data data = { &pset, false };
return walk_tree (&st, contains_label_1, &data, &pset) != NULL_TREE;
} | /* Return whether the sub-tree ST contains a label which is accessible from
outside the sub-tree. */ | Return whether the sub-tree ST contains a label which is accessible from
outside the sub-tree. | [
"Return",
"whether",
"the",
"sub",
"-",
"tree",
"ST",
"contains",
"a",
"label",
"which",
"is",
"accessible",
"from",
"outside",
"the",
"sub",
"-",
"tree",
"."
] | static bool
contains_label_p (tree st)
{
hash_set<tree> pset;
contains_label_data data = { &pset, false };
return walk_tree (&st, contains_label_1, &data, &pset) != NULL_TREE;
} | [
"static",
"bool",
"contains_label_p",
"(",
"tree",
"st",
")",
"{",
"hash_set",
"<",
"tree",
">",
"pset",
";",
"contains_label_data",
"data",
"=",
"{",
"&",
"pset",
",",
"false",
"}",
";",
"return",
"walk_tree",
"(",
"&",
"st",
",",
"contains_label_1",
",",
"&",
"data",
",",
"&",
"pset",
")",
"!=",
"NULL_TREE",
";",
"}"
] | Return whether the sub-tree ST contains a label which is accessible from
outside the sub-tree. | [
"Return",
"whether",
"the",
"sub",
"-",
"tree",
"ST",
"contains",
"a",
"label",
"which",
"is",
"accessible",
"from",
"outside",
"the",
"sub",
"-",
"tree",
"."
] | [] | [
{
"param": "st",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "st",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_simple_nonnegative_warnv_p | bool | static bool
tree_simple_nonnegative_warnv_p (enum tree_code code, tree type)
{
if ((TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type))
&& truth_value_p (code))
/* Truth values evaluate to 0 or 1, which is nonnegative unless we
have a signed:1 type (where the value is -1 and 0). */
return true;
return false;
} | /* Return true if CODE or TYPE is known to be non-negative. */ | Return true if CODE or TYPE is known to be non-negative. | [
"Return",
"true",
"if",
"CODE",
"or",
"TYPE",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
"."
] | static bool
tree_simple_nonnegative_warnv_p (enum tree_code code, tree type)
{
if ((TYPE_PRECISION (type) != 1 || TYPE_UNSIGNED (type))
&& truth_value_p (code))
return true;
return false;
} | [
"static",
"bool",
"tree_simple_nonnegative_warnv_p",
"(",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
")",
"{",
"if",
"(",
"(",
"TYPE_PRECISION",
"(",
"type",
")",
"!=",
"1",
"||",
"TYPE_UNSIGNED",
"(",
"type",
")",
")",
"&&",
"truth_value_p",
"(",
"code",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | Return true if CODE or TYPE is known to be non-negative. | [
"Return",
"true",
"if",
"CODE",
"or",
"TYPE",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
"."
] | [
"/* Truth values evaluate to 0 or 1, which is nonnegative unless we\n have a signed:1 type (where the value is -1 and 0). */"
] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_unary_nonnegative_warnv_p | bool | bool
tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0,
bool *strict_overflow_p, int depth)
{
if (TYPE_UNSIGNED (type))
return true;
switch (code)
{
case ABS_EXPR:
/* We can't return 1 if flag_wrapv is set because
ABS_EXPR<INT_MIN> = INT_MIN. */
if (!ANY_INTEGRAL_TYPE_P (type))
return true;
if (TYPE_OVERFLOW_UNDEFINED (type))
{
*strict_overflow_p = true;
return true;
}
break;
case NON_LVALUE_EXPR:
case FLOAT_EXPR:
case FIX_TRUNC_EXPR:
return RECURSE (op0);
CASE_CONVERT:
{
tree inner_type = TREE_TYPE (op0);
tree outer_type = type;
if (TREE_CODE (outer_type) == REAL_TYPE)
{
if (TREE_CODE (inner_type) == REAL_TYPE)
return RECURSE (op0);
if (INTEGRAL_TYPE_P (inner_type))
{
if (TYPE_UNSIGNED (inner_type))
return true;
return RECURSE (op0);
}
}
else if (INTEGRAL_TYPE_P (outer_type))
{
if (TREE_CODE (inner_type) == REAL_TYPE)
return RECURSE (op0);
if (INTEGRAL_TYPE_P (inner_type))
return TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type)
&& TYPE_UNSIGNED (inner_type);
}
}
break;
default:
return tree_simple_nonnegative_warnv_p (code, type);
}
/* We don't know sign of `t', so be conservative and return false. */
return false;
} | /* Return true if (CODE OP0) is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */ | Return true if (CODE OP0) is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"(",
"CODE",
"OP0",
")",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
".",
"If",
"the",
"return",
"value",
"is",
"based",
"on",
"the",
"assumption",
"that",
"signed",
"overflow",
"is",
"undefined",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
";",
"otherwise",
"don",
"'",
"t",
"change",
"STRICT_OVERFLOW_P",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
tree_unary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0,
bool *strict_overflow_p, int depth)
{
if (TYPE_UNSIGNED (type))
return true;
switch (code)
{
case ABS_EXPR:
if (!ANY_INTEGRAL_TYPE_P (type))
return true;
if (TYPE_OVERFLOW_UNDEFINED (type))
{
*strict_overflow_p = true;
return true;
}
break;
case NON_LVALUE_EXPR:
case FLOAT_EXPR:
case FIX_TRUNC_EXPR:
return RECURSE (op0);
CASE_CONVERT:
{
tree inner_type = TREE_TYPE (op0);
tree outer_type = type;
if (TREE_CODE (outer_type) == REAL_TYPE)
{
if (TREE_CODE (inner_type) == REAL_TYPE)
return RECURSE (op0);
if (INTEGRAL_TYPE_P (inner_type))
{
if (TYPE_UNSIGNED (inner_type))
return true;
return RECURSE (op0);
}
}
else if (INTEGRAL_TYPE_P (outer_type))
{
if (TREE_CODE (inner_type) == REAL_TYPE)
return RECURSE (op0);
if (INTEGRAL_TYPE_P (inner_type))
return TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type)
&& TYPE_UNSIGNED (inner_type);
}
}
break;
default:
return tree_simple_nonnegative_warnv_p (code, type);
}
return false;
} | [
"bool",
"tree_unary_nonnegative_warnv_p",
"(",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"op0",
",",
"bool",
"*",
"strict_overflow_p",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"TYPE_UNSIGNED",
"(",
"type",
")",
")",
"return",
"true",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"ABS_EXPR",
":",
"if",
"(",
"!",
"ANY_INTEGRAL_TYPE_P",
"(",
"type",
")",
")",
"return",
"true",
";",
"if",
"(",
"TYPE_OVERFLOW_UNDEFINED",
"(",
"type",
")",
")",
"{",
"*",
"strict_overflow_p",
"=",
"true",
";",
"return",
"true",
";",
"}",
"break",
";",
"case",
"NON_LVALUE_EXPR",
":",
"case",
"FLOAT_EXPR",
":",
"case",
"FIX_TRUNC_EXPR",
":",
"return",
"RECURSE",
"(",
"op0",
")",
";",
"CASE_CONVERT",
":",
"{",
"tree",
"inner_type",
"=",
"TREE_TYPE",
"(",
"op0",
")",
";",
"tree",
"outer_type",
"=",
"type",
";",
"if",
"(",
"TREE_CODE",
"(",
"outer_type",
")",
"==",
"REAL_TYPE",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"inner_type",
")",
"==",
"REAL_TYPE",
")",
"return",
"RECURSE",
"(",
"op0",
")",
";",
"if",
"(",
"INTEGRAL_TYPE_P",
"(",
"inner_type",
")",
")",
"{",
"if",
"(",
"TYPE_UNSIGNED",
"(",
"inner_type",
")",
")",
"return",
"true",
";",
"return",
"RECURSE",
"(",
"op0",
")",
";",
"}",
"}",
"else",
"if",
"(",
"INTEGRAL_TYPE_P",
"(",
"outer_type",
")",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"inner_type",
")",
"==",
"REAL_TYPE",
")",
"return",
"RECURSE",
"(",
"op0",
")",
";",
"if",
"(",
"INTEGRAL_TYPE_P",
"(",
"inner_type",
")",
")",
"return",
"TYPE_PRECISION",
"(",
"inner_type",
")",
"<",
"TYPE_PRECISION",
"(",
"outer_type",
")",
"&&",
"TYPE_UNSIGNED",
"(",
"inner_type",
")",
";",
"}",
"}",
"break",
";",
"default",
":",
"return",
"tree_simple_nonnegative_warnv_p",
"(",
"code",
",",
"type",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Return true if (CODE OP0) is known to be non-negative. | [
"Return",
"true",
"if",
"(",
"CODE",
"OP0",
")",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
"."
] | [
"/* We can't return 1 if flag_wrapv is set because\n\t ABS_EXPR<INT_MIN> = INT_MIN. */",
"/* We don't know sign of `t', so be conservative and return false. */"
] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "op0",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_binary_nonnegative_warnv_p | bool | bool
tree_binary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0,
tree op1, bool *strict_overflow_p,
int depth)
{
if (TYPE_UNSIGNED (type))
return true;
switch (code)
{
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
if (FLOAT_TYPE_P (type))
return RECURSE (op0) && RECURSE (op1);
/* zero_extend(x) + zero_extend(y) is non-negative if x and y are
both unsigned and at least 2 bits shorter than the result. */
if (TREE_CODE (type) == INTEGER_TYPE
&& TREE_CODE (op0) == NOP_EXPR
&& TREE_CODE (op1) == NOP_EXPR)
{
tree inner1 = TREE_TYPE (TREE_OPERAND (op0, 0));
tree inner2 = TREE_TYPE (TREE_OPERAND (op1, 0));
if (TREE_CODE (inner1) == INTEGER_TYPE && TYPE_UNSIGNED (inner1)
&& TREE_CODE (inner2) == INTEGER_TYPE && TYPE_UNSIGNED (inner2))
{
unsigned int prec = MAX (TYPE_PRECISION (inner1),
TYPE_PRECISION (inner2)) + 1;
return prec < TYPE_PRECISION (type);
}
}
break;
case MULT_EXPR:
if (FLOAT_TYPE_P (type) || TYPE_OVERFLOW_UNDEFINED (type))
{
/* x * x is always non-negative for floating point x
or without overflow. */
if (operand_equal_p (op0, op1, 0)
|| (RECURSE (op0) && RECURSE (op1)))
{
if (ANY_INTEGRAL_TYPE_P (type)
&& TYPE_OVERFLOW_UNDEFINED (type))
*strict_overflow_p = true;
return true;
}
}
/* zero_extend(x) * zero_extend(y) is non-negative if x and y are
both unsigned and their total bits is shorter than the result. */
if (TREE_CODE (type) == INTEGER_TYPE
&& (TREE_CODE (op0) == NOP_EXPR || TREE_CODE (op0) == INTEGER_CST)
&& (TREE_CODE (op1) == NOP_EXPR || TREE_CODE (op1) == INTEGER_CST))
{
tree inner0 = (TREE_CODE (op0) == NOP_EXPR)
? TREE_TYPE (TREE_OPERAND (op0, 0))
: TREE_TYPE (op0);
tree inner1 = (TREE_CODE (op1) == NOP_EXPR)
? TREE_TYPE (TREE_OPERAND (op1, 0))
: TREE_TYPE (op1);
bool unsigned0 = TYPE_UNSIGNED (inner0);
bool unsigned1 = TYPE_UNSIGNED (inner1);
if (TREE_CODE (op0) == INTEGER_CST)
unsigned0 = unsigned0 || tree_int_cst_sgn (op0) >= 0;
if (TREE_CODE (op1) == INTEGER_CST)
unsigned1 = unsigned1 || tree_int_cst_sgn (op1) >= 0;
if (TREE_CODE (inner0) == INTEGER_TYPE && unsigned0
&& TREE_CODE (inner1) == INTEGER_TYPE && unsigned1)
{
unsigned int precision0 = (TREE_CODE (op0) == INTEGER_CST)
? tree_int_cst_min_precision (op0, UNSIGNED)
: TYPE_PRECISION (inner0);
unsigned int precision1 = (TREE_CODE (op1) == INTEGER_CST)
? tree_int_cst_min_precision (op1, UNSIGNED)
: TYPE_PRECISION (inner1);
return precision0 + precision1 < TYPE_PRECISION (type);
}
}
return false;
case BIT_AND_EXPR:
case MAX_EXPR:
return RECURSE (op0) || RECURSE (op1);
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case MIN_EXPR:
case RDIV_EXPR:
case TRUNC_DIV_EXPR:
case CEIL_DIV_EXPR:
case FLOOR_DIV_EXPR:
case ROUND_DIV_EXPR:
return RECURSE (op0) && RECURSE (op1);
case TRUNC_MOD_EXPR:
return RECURSE (op0);
case FLOOR_MOD_EXPR:
return RECURSE (op1);
case CEIL_MOD_EXPR:
case ROUND_MOD_EXPR:
default:
return tree_simple_nonnegative_warnv_p (code, type);
}
/* We don't know sign of `t', so be conservative and return false. */
return false;
} | /* Return true if (CODE OP0 OP1) is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */ | Return true if (CODE OP0 OP1) is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"(",
"CODE",
"OP0",
"OP1",
")",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
".",
"If",
"the",
"return",
"value",
"is",
"based",
"on",
"the",
"assumption",
"that",
"signed",
"overflow",
"is",
"undefined",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
";",
"otherwise",
"don",
"'",
"t",
"change",
"STRICT_OVERFLOW_P",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
tree_binary_nonnegative_warnv_p (enum tree_code code, tree type, tree op0,
tree op1, bool *strict_overflow_p,
int depth)
{
if (TYPE_UNSIGNED (type))
return true;
switch (code)
{
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
if (FLOAT_TYPE_P (type))
return RECURSE (op0) && RECURSE (op1);
if (TREE_CODE (type) == INTEGER_TYPE
&& TREE_CODE (op0) == NOP_EXPR
&& TREE_CODE (op1) == NOP_EXPR)
{
tree inner1 = TREE_TYPE (TREE_OPERAND (op0, 0));
tree inner2 = TREE_TYPE (TREE_OPERAND (op1, 0));
if (TREE_CODE (inner1) == INTEGER_TYPE && TYPE_UNSIGNED (inner1)
&& TREE_CODE (inner2) == INTEGER_TYPE && TYPE_UNSIGNED (inner2))
{
unsigned int prec = MAX (TYPE_PRECISION (inner1),
TYPE_PRECISION (inner2)) + 1;
return prec < TYPE_PRECISION (type);
}
}
break;
case MULT_EXPR:
if (FLOAT_TYPE_P (type) || TYPE_OVERFLOW_UNDEFINED (type))
{
if (operand_equal_p (op0, op1, 0)
|| (RECURSE (op0) && RECURSE (op1)))
{
if (ANY_INTEGRAL_TYPE_P (type)
&& TYPE_OVERFLOW_UNDEFINED (type))
*strict_overflow_p = true;
return true;
}
}
if (TREE_CODE (type) == INTEGER_TYPE
&& (TREE_CODE (op0) == NOP_EXPR || TREE_CODE (op0) == INTEGER_CST)
&& (TREE_CODE (op1) == NOP_EXPR || TREE_CODE (op1) == INTEGER_CST))
{
tree inner0 = (TREE_CODE (op0) == NOP_EXPR)
? TREE_TYPE (TREE_OPERAND (op0, 0))
: TREE_TYPE (op0);
tree inner1 = (TREE_CODE (op1) == NOP_EXPR)
? TREE_TYPE (TREE_OPERAND (op1, 0))
: TREE_TYPE (op1);
bool unsigned0 = TYPE_UNSIGNED (inner0);
bool unsigned1 = TYPE_UNSIGNED (inner1);
if (TREE_CODE (op0) == INTEGER_CST)
unsigned0 = unsigned0 || tree_int_cst_sgn (op0) >= 0;
if (TREE_CODE (op1) == INTEGER_CST)
unsigned1 = unsigned1 || tree_int_cst_sgn (op1) >= 0;
if (TREE_CODE (inner0) == INTEGER_TYPE && unsigned0
&& TREE_CODE (inner1) == INTEGER_TYPE && unsigned1)
{
unsigned int precision0 = (TREE_CODE (op0) == INTEGER_CST)
? tree_int_cst_min_precision (op0, UNSIGNED)
: TYPE_PRECISION (inner0);
unsigned int precision1 = (TREE_CODE (op1) == INTEGER_CST)
? tree_int_cst_min_precision (op1, UNSIGNED)
: TYPE_PRECISION (inner1);
return precision0 + precision1 < TYPE_PRECISION (type);
}
}
return false;
case BIT_AND_EXPR:
case MAX_EXPR:
return RECURSE (op0) || RECURSE (op1);
case BIT_IOR_EXPR:
case BIT_XOR_EXPR:
case MIN_EXPR:
case RDIV_EXPR:
case TRUNC_DIV_EXPR:
case CEIL_DIV_EXPR:
case FLOOR_DIV_EXPR:
case ROUND_DIV_EXPR:
return RECURSE (op0) && RECURSE (op1);
case TRUNC_MOD_EXPR:
return RECURSE (op0);
case FLOOR_MOD_EXPR:
return RECURSE (op1);
case CEIL_MOD_EXPR:
case ROUND_MOD_EXPR:
default:
return tree_simple_nonnegative_warnv_p (code, type);
}
return false;
} | [
"bool",
"tree_binary_nonnegative_warnv_p",
"(",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"op0",
",",
"tree",
"op1",
",",
"bool",
"*",
"strict_overflow_p",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"TYPE_UNSIGNED",
"(",
"type",
")",
")",
"return",
"true",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"POINTER_PLUS_EXPR",
":",
"case",
"PLUS_EXPR",
":",
"if",
"(",
"FLOAT_TYPE_P",
"(",
"type",
")",
")",
"return",
"RECURSE",
"(",
"op0",
")",
"&&",
"RECURSE",
"(",
"op1",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"type",
")",
"==",
"INTEGER_TYPE",
"&&",
"TREE_CODE",
"(",
"op0",
")",
"==",
"NOP_EXPR",
"&&",
"TREE_CODE",
"(",
"op1",
")",
"==",
"NOP_EXPR",
")",
"{",
"tree",
"inner1",
"=",
"TREE_TYPE",
"(",
"TREE_OPERAND",
"(",
"op0",
",",
"0",
")",
")",
";",
"tree",
"inner2",
"=",
"TREE_TYPE",
"(",
"TREE_OPERAND",
"(",
"op1",
",",
"0",
")",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"inner1",
")",
"==",
"INTEGER_TYPE",
"&&",
"TYPE_UNSIGNED",
"(",
"inner1",
")",
"&&",
"TREE_CODE",
"(",
"inner2",
")",
"==",
"INTEGER_TYPE",
"&&",
"TYPE_UNSIGNED",
"(",
"inner2",
")",
")",
"{",
"unsigned",
"int",
"prec",
"=",
"MAX",
"(",
"TYPE_PRECISION",
"(",
"inner1",
")",
",",
"TYPE_PRECISION",
"(",
"inner2",
")",
")",
"+",
"1",
";",
"return",
"prec",
"<",
"TYPE_PRECISION",
"(",
"type",
")",
";",
"}",
"}",
"break",
";",
"case",
"MULT_EXPR",
":",
"if",
"(",
"FLOAT_TYPE_P",
"(",
"type",
")",
"||",
"TYPE_OVERFLOW_UNDEFINED",
"(",
"type",
")",
")",
"{",
"if",
"(",
"operand_equal_p",
"(",
"op0",
",",
"op1",
",",
"0",
")",
"||",
"(",
"RECURSE",
"(",
"op0",
")",
"&&",
"RECURSE",
"(",
"op1",
")",
")",
")",
"{",
"if",
"(",
"ANY_INTEGRAL_TYPE_P",
"(",
"type",
")",
"&&",
"TYPE_OVERFLOW_UNDEFINED",
"(",
"type",
")",
")",
"*",
"strict_overflow_p",
"=",
"true",
";",
"return",
"true",
";",
"}",
"}",
"if",
"(",
"TREE_CODE",
"(",
"type",
")",
"==",
"INTEGER_TYPE",
"&&",
"(",
"TREE_CODE",
"(",
"op0",
")",
"==",
"NOP_EXPR",
"||",
"TREE_CODE",
"(",
"op0",
")",
"==",
"INTEGER_CST",
")",
"&&",
"(",
"TREE_CODE",
"(",
"op1",
")",
"==",
"NOP_EXPR",
"||",
"TREE_CODE",
"(",
"op1",
")",
"==",
"INTEGER_CST",
")",
")",
"{",
"tree",
"inner0",
"=",
"(",
"TREE_CODE",
"(",
"op0",
")",
"==",
"NOP_EXPR",
")",
"?",
"TREE_TYPE",
"(",
"TREE_OPERAND",
"(",
"op0",
",",
"0",
")",
")",
":",
"TREE_TYPE",
"(",
"op0",
")",
";",
"tree",
"inner1",
"=",
"(",
"TREE_CODE",
"(",
"op1",
")",
"==",
"NOP_EXPR",
")",
"?",
"TREE_TYPE",
"(",
"TREE_OPERAND",
"(",
"op1",
",",
"0",
")",
")",
":",
"TREE_TYPE",
"(",
"op1",
")",
";",
"bool",
"unsigned0",
"=",
"TYPE_UNSIGNED",
"(",
"inner0",
")",
";",
"bool",
"unsigned1",
"=",
"TYPE_UNSIGNED",
"(",
"inner1",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"op0",
")",
"==",
"INTEGER_CST",
")",
"unsigned0",
"=",
"unsigned0",
"||",
"tree_int_cst_sgn",
"(",
"op0",
")",
">=",
"0",
";",
"if",
"(",
"TREE_CODE",
"(",
"op1",
")",
"==",
"INTEGER_CST",
")",
"unsigned1",
"=",
"unsigned1",
"||",
"tree_int_cst_sgn",
"(",
"op1",
")",
">=",
"0",
";",
"if",
"(",
"TREE_CODE",
"(",
"inner0",
")",
"==",
"INTEGER_TYPE",
"&&",
"unsigned0",
"&&",
"TREE_CODE",
"(",
"inner1",
")",
"==",
"INTEGER_TYPE",
"&&",
"unsigned1",
")",
"{",
"unsigned",
"int",
"precision0",
"=",
"(",
"TREE_CODE",
"(",
"op0",
")",
"==",
"INTEGER_CST",
")",
"?",
"tree_int_cst_min_precision",
"(",
"op0",
",",
"UNSIGNED",
")",
":",
"TYPE_PRECISION",
"(",
"inner0",
")",
";",
"unsigned",
"int",
"precision1",
"=",
"(",
"TREE_CODE",
"(",
"op1",
")",
"==",
"INTEGER_CST",
")",
"?",
"tree_int_cst_min_precision",
"(",
"op1",
",",
"UNSIGNED",
")",
":",
"TYPE_PRECISION",
"(",
"inner1",
")",
";",
"return",
"precision0",
"+",
"precision1",
"<",
"TYPE_PRECISION",
"(",
"type",
")",
";",
"}",
"}",
"return",
"false",
";",
"case",
"BIT_AND_EXPR",
":",
"case",
"MAX_EXPR",
":",
"return",
"RECURSE",
"(",
"op0",
")",
"||",
"RECURSE",
"(",
"op1",
")",
";",
"case",
"BIT_IOR_EXPR",
":",
"case",
"BIT_XOR_EXPR",
":",
"case",
"MIN_EXPR",
":",
"case",
"RDIV_EXPR",
":",
"case",
"TRUNC_DIV_EXPR",
":",
"case",
"CEIL_DIV_EXPR",
":",
"case",
"FLOOR_DIV_EXPR",
":",
"case",
"ROUND_DIV_EXPR",
":",
"return",
"RECURSE",
"(",
"op0",
")",
"&&",
"RECURSE",
"(",
"op1",
")",
";",
"case",
"TRUNC_MOD_EXPR",
":",
"return",
"RECURSE",
"(",
"op0",
")",
";",
"case",
"FLOOR_MOD_EXPR",
":",
"return",
"RECURSE",
"(",
"op1",
")",
";",
"case",
"CEIL_MOD_EXPR",
":",
"case",
"ROUND_MOD_EXPR",
":",
"default",
":",
"return",
"tree_simple_nonnegative_warnv_p",
"(",
"code",
",",
"type",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Return true if (CODE OP0 OP1) is known to be non-negative. | [
"Return",
"true",
"if",
"(",
"CODE",
"OP0",
"OP1",
")",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
"."
] | [
"/* zero_extend(x) + zero_extend(y) is non-negative if x and y are\n\t both unsigned and at least 2 bits shorter than the result. */",
"/* x * x is always non-negative for floating point x\n\t or without overflow. */",
"/* zero_extend(x) * zero_extend(y) is non-negative if x and y are\n\t both unsigned and their total bits is shorter than the result. */",
"/* We don't know sign of `t', so be conservative and return false. */"
] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "op0",
"type": "tree"
},
{
"param": "op1",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_single_nonnegative_warnv_p | bool | bool
tree_single_nonnegative_warnv_p (tree t, bool *strict_overflow_p, int depth)
{
if (TYPE_UNSIGNED (TREE_TYPE (t)))
return true;
switch (TREE_CODE (t))
{
case INTEGER_CST:
return tree_int_cst_sgn (t) >= 0;
case REAL_CST:
return ! REAL_VALUE_NEGATIVE (TREE_REAL_CST (t));
case FIXED_CST:
return ! FIXED_VALUE_NEGATIVE (TREE_FIXED_CST (t));
case COND_EXPR:
return RECURSE (TREE_OPERAND (t, 1)) && RECURSE (TREE_OPERAND (t, 2));
case SSA_NAME:
/* Limit the depth of recursion to avoid quadratic behavior.
This is expected to catch almost all occurrences in practice.
If this code misses important cases that unbounded recursion
would not, passes that need this information could be revised
to provide it through dataflow propagation. */
return (!name_registered_for_update_p (t)
&& depth < PARAM_VALUE (PARAM_MAX_SSA_NAME_QUERY_DEPTH)
&& gimple_stmt_nonnegative_warnv_p (SSA_NAME_DEF_STMT (t),
strict_overflow_p, depth));
default:
return tree_simple_nonnegative_warnv_p (TREE_CODE (t), TREE_TYPE (t));
}
} | /* Return true if T is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */ | Return true if T is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"T",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
".",
"If",
"the",
"return",
"value",
"is",
"based",
"on",
"the",
"assumption",
"that",
"signed",
"overflow",
"is",
"undefined",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
";",
"otherwise",
"don",
"'",
"t",
"change",
"STRICT_OVERFLOW_P",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
tree_single_nonnegative_warnv_p (tree t, bool *strict_overflow_p, int depth)
{
if (TYPE_UNSIGNED (TREE_TYPE (t)))
return true;
switch (TREE_CODE (t))
{
case INTEGER_CST:
return tree_int_cst_sgn (t) >= 0;
case REAL_CST:
return ! REAL_VALUE_NEGATIVE (TREE_REAL_CST (t));
case FIXED_CST:
return ! FIXED_VALUE_NEGATIVE (TREE_FIXED_CST (t));
case COND_EXPR:
return RECURSE (TREE_OPERAND (t, 1)) && RECURSE (TREE_OPERAND (t, 2));
case SSA_NAME:
return (!name_registered_for_update_p (t)
&& depth < PARAM_VALUE (PARAM_MAX_SSA_NAME_QUERY_DEPTH)
&& gimple_stmt_nonnegative_warnv_p (SSA_NAME_DEF_STMT (t),
strict_overflow_p, depth));
default:
return tree_simple_nonnegative_warnv_p (TREE_CODE (t), TREE_TYPE (t));
}
} | [
"bool",
"tree_single_nonnegative_warnv_p",
"(",
"tree",
"t",
",",
"bool",
"*",
"strict_overflow_p",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"TYPE_UNSIGNED",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
")",
"return",
"true",
";",
"switch",
"(",
"TREE_CODE",
"(",
"t",
")",
")",
"{",
"case",
"INTEGER_CST",
":",
"return",
"tree_int_cst_sgn",
"(",
"t",
")",
">=",
"0",
";",
"case",
"REAL_CST",
":",
"return",
"!",
"REAL_VALUE_NEGATIVE",
"(",
"TREE_REAL_CST",
"(",
"t",
")",
")",
";",
"case",
"FIXED_CST",
":",
"return",
"!",
"FIXED_VALUE_NEGATIVE",
"(",
"TREE_FIXED_CST",
"(",
"t",
")",
")",
";",
"case",
"COND_EXPR",
":",
"return",
"RECURSE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
"&&",
"RECURSE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"2",
")",
")",
";",
"case",
"SSA_NAME",
":",
"return",
"(",
"!",
"name_registered_for_update_p",
"(",
"t",
")",
"&&",
"depth",
"<",
"PARAM_VALUE",
"(",
"PARAM_MAX_SSA_NAME_QUERY_DEPTH",
")",
"&&",
"gimple_stmt_nonnegative_warnv_p",
"(",
"SSA_NAME_DEF_STMT",
"(",
"t",
")",
",",
"strict_overflow_p",
",",
"depth",
")",
")",
";",
"default",
":",
"return",
"tree_simple_nonnegative_warnv_p",
"(",
"TREE_CODE",
"(",
"t",
")",
",",
"TREE_TYPE",
"(",
"t",
")",
")",
";",
"}",
"}"
] | Return true if T is known to be non-negative. | [
"Return",
"true",
"if",
"T",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
"."
] | [
"/* Limit the depth of recursion to avoid quadratic behavior.\n\t This is expected to catch almost all occurrences in practice.\n\t If this code misses important cases that unbounded recursion\n\t would not, passes that need this information could be revised\n\t to provide it through dataflow propagation. */"
] | [
{
"param": "t",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_call_nonnegative_warnv_p | bool | bool
tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1,
bool *strict_overflow_p, int depth)
{
switch (fn)
{
CASE_CFN_ACOS:
CASE_CFN_ACOSH:
CASE_CFN_CABS:
CASE_CFN_COSH:
CASE_CFN_ERFC:
CASE_CFN_EXP:
CASE_CFN_EXP10:
CASE_CFN_EXP2:
CASE_CFN_FABS:
CASE_CFN_FDIM:
CASE_CFN_HYPOT:
CASE_CFN_POW10:
CASE_CFN_FFS:
CASE_CFN_PARITY:
CASE_CFN_POPCOUNT:
CASE_CFN_CLZ:
CASE_CFN_CLRSB:
case CFN_BUILT_IN_BSWAP32:
case CFN_BUILT_IN_BSWAP64:
/* Always true. */
return true;
CASE_CFN_SQRT:
CASE_CFN_SQRT_FN:
/* sqrt(-0.0) is -0.0. */
if (!HONOR_SIGNED_ZEROS (element_mode (type)))
return true;
return RECURSE (arg0);
CASE_CFN_ASINH:
CASE_CFN_ATAN:
CASE_CFN_ATANH:
CASE_CFN_CBRT:
CASE_CFN_CEIL:
CASE_CFN_CEIL_FN:
CASE_CFN_ERF:
CASE_CFN_EXPM1:
CASE_CFN_FLOOR:
CASE_CFN_FLOOR_FN:
CASE_CFN_FMOD:
CASE_CFN_FREXP:
CASE_CFN_ICEIL:
CASE_CFN_IFLOOR:
CASE_CFN_IRINT:
CASE_CFN_IROUND:
CASE_CFN_LCEIL:
CASE_CFN_LDEXP:
CASE_CFN_LFLOOR:
CASE_CFN_LLCEIL:
CASE_CFN_LLFLOOR:
CASE_CFN_LLRINT:
CASE_CFN_LLROUND:
CASE_CFN_LRINT:
CASE_CFN_LROUND:
CASE_CFN_MODF:
CASE_CFN_NEARBYINT:
CASE_CFN_NEARBYINT_FN:
CASE_CFN_RINT:
CASE_CFN_RINT_FN:
CASE_CFN_ROUND:
CASE_CFN_ROUND_FN:
CASE_CFN_SCALB:
CASE_CFN_SCALBLN:
CASE_CFN_SCALBN:
CASE_CFN_SIGNBIT:
CASE_CFN_SIGNIFICAND:
CASE_CFN_SINH:
CASE_CFN_TANH:
CASE_CFN_TRUNC:
CASE_CFN_TRUNC_FN:
/* True if the 1st argument is nonnegative. */
return RECURSE (arg0);
CASE_CFN_FMAX:
CASE_CFN_FMAX_FN:
/* True if the 1st OR 2nd arguments are nonnegative. */
return RECURSE (arg0) || RECURSE (arg1);
CASE_CFN_FMIN:
CASE_CFN_FMIN_FN:
/* True if the 1st AND 2nd arguments are nonnegative. */
return RECURSE (arg0) && RECURSE (arg1);
CASE_CFN_COPYSIGN:
CASE_CFN_COPYSIGN_FN:
/* True if the 2nd argument is nonnegative. */
return RECURSE (arg1);
CASE_CFN_POWI:
/* True if the 1st argument is nonnegative or the second
argument is an even integer. */
if (TREE_CODE (arg1) == INTEGER_CST
&& (TREE_INT_CST_LOW (arg1) & 1) == 0)
return true;
return RECURSE (arg0);
CASE_CFN_POW:
/* True if the 1st argument is nonnegative or the second
argument is an even integer valued real. */
if (TREE_CODE (arg1) == REAL_CST)
{
REAL_VALUE_TYPE c;
HOST_WIDE_INT n;
c = TREE_REAL_CST (arg1);
n = real_to_integer (&c);
if ((n & 1) == 0)
{
REAL_VALUE_TYPE cint;
real_from_integer (&cint, VOIDmode, n, SIGNED);
if (real_identical (&c, &cint))
return true;
}
}
return RECURSE (arg0);
default:
break;
}
return tree_simple_nonnegative_warnv_p (CALL_EXPR, type);
} | /* Return true if T is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */ | Return true if T is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"T",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
".",
"If",
"the",
"return",
"value",
"is",
"based",
"on",
"the",
"assumption",
"that",
"signed",
"overflow",
"is",
"undefined",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
";",
"otherwise",
"don",
"'",
"t",
"change",
"STRICT_OVERFLOW_P",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
tree_call_nonnegative_warnv_p (tree type, combined_fn fn, tree arg0, tree arg1,
bool *strict_overflow_p, int depth)
{
switch (fn)
{
CASE_CFN_ACOS:
CASE_CFN_ACOSH:
CASE_CFN_CABS:
CASE_CFN_COSH:
CASE_CFN_ERFC:
CASE_CFN_EXP:
CASE_CFN_EXP10:
CASE_CFN_EXP2:
CASE_CFN_FABS:
CASE_CFN_FDIM:
CASE_CFN_HYPOT:
CASE_CFN_POW10:
CASE_CFN_FFS:
CASE_CFN_PARITY:
CASE_CFN_POPCOUNT:
CASE_CFN_CLZ:
CASE_CFN_CLRSB:
case CFN_BUILT_IN_BSWAP32:
case CFN_BUILT_IN_BSWAP64:
return true;
CASE_CFN_SQRT:
CASE_CFN_SQRT_FN:
if (!HONOR_SIGNED_ZEROS (element_mode (type)))
return true;
return RECURSE (arg0);
CASE_CFN_ASINH:
CASE_CFN_ATAN:
CASE_CFN_ATANH:
CASE_CFN_CBRT:
CASE_CFN_CEIL:
CASE_CFN_CEIL_FN:
CASE_CFN_ERF:
CASE_CFN_EXPM1:
CASE_CFN_FLOOR:
CASE_CFN_FLOOR_FN:
CASE_CFN_FMOD:
CASE_CFN_FREXP:
CASE_CFN_ICEIL:
CASE_CFN_IFLOOR:
CASE_CFN_IRINT:
CASE_CFN_IROUND:
CASE_CFN_LCEIL:
CASE_CFN_LDEXP:
CASE_CFN_LFLOOR:
CASE_CFN_LLCEIL:
CASE_CFN_LLFLOOR:
CASE_CFN_LLRINT:
CASE_CFN_LLROUND:
CASE_CFN_LRINT:
CASE_CFN_LROUND:
CASE_CFN_MODF:
CASE_CFN_NEARBYINT:
CASE_CFN_NEARBYINT_FN:
CASE_CFN_RINT:
CASE_CFN_RINT_FN:
CASE_CFN_ROUND:
CASE_CFN_ROUND_FN:
CASE_CFN_SCALB:
CASE_CFN_SCALBLN:
CASE_CFN_SCALBN:
CASE_CFN_SIGNBIT:
CASE_CFN_SIGNIFICAND:
CASE_CFN_SINH:
CASE_CFN_TANH:
CASE_CFN_TRUNC:
CASE_CFN_TRUNC_FN:
return RECURSE (arg0);
CASE_CFN_FMAX:
CASE_CFN_FMAX_FN:
return RECURSE (arg0) || RECURSE (arg1);
CASE_CFN_FMIN:
CASE_CFN_FMIN_FN:
return RECURSE (arg0) && RECURSE (arg1);
CASE_CFN_COPYSIGN:
CASE_CFN_COPYSIGN_FN:
return RECURSE (arg1);
CASE_CFN_POWI:
if (TREE_CODE (arg1) == INTEGER_CST
&& (TREE_INT_CST_LOW (arg1) & 1) == 0)
return true;
return RECURSE (arg0);
CASE_CFN_POW:
if (TREE_CODE (arg1) == REAL_CST)
{
REAL_VALUE_TYPE c;
HOST_WIDE_INT n;
c = TREE_REAL_CST (arg1);
n = real_to_integer (&c);
if ((n & 1) == 0)
{
REAL_VALUE_TYPE cint;
real_from_integer (&cint, VOIDmode, n, SIGNED);
if (real_identical (&c, &cint))
return true;
}
}
return RECURSE (arg0);
default:
break;
}
return tree_simple_nonnegative_warnv_p (CALL_EXPR, type);
} | [
"bool",
"tree_call_nonnegative_warnv_p",
"(",
"tree",
"type",
",",
"combined_fn",
"fn",
",",
"tree",
"arg0",
",",
"tree",
"arg1",
",",
"bool",
"*",
"strict_overflow_p",
",",
"int",
"depth",
")",
"{",
"switch",
"(",
"fn",
")",
"{",
"CASE_CFN_ACOS",
":",
"CASE_CFN_ACOSH",
":",
"CASE_CFN_CABS",
":",
"CASE_CFN_COSH",
":",
"CASE_CFN_ERFC",
":",
"CASE_CFN_EXP",
":",
"CASE_CFN_EXP10",
":",
"CASE_CFN_EXP2",
":",
"CASE_CFN_FABS",
":",
"CASE_CFN_FDIM",
":",
"CASE_CFN_HYPOT",
":",
"CASE_CFN_POW10",
":",
"CASE_CFN_FFS",
":",
"CASE_CFN_PARITY",
":",
"CASE_CFN_POPCOUNT",
":",
"CASE_CFN_CLZ",
":",
"CASE_CFN_CLRSB",
":",
"case",
"CFN_BUILT_IN_BSWAP32",
":",
"case",
"CFN_BUILT_IN_BSWAP64",
":",
"return",
"true",
";",
"CASE_CFN_SQRT",
":",
"CASE_CFN_SQRT_FN",
":",
"if",
"(",
"!",
"HONOR_SIGNED_ZEROS",
"(",
"element_mode",
"(",
"type",
")",
")",
")",
"return",
"true",
";",
"return",
"RECURSE",
"(",
"arg0",
")",
";",
"CASE_CFN_ASINH",
":",
"CASE_CFN_ATAN",
":",
"CASE_CFN_ATANH",
":",
"CASE_CFN_CBRT",
":",
"CASE_CFN_CEIL",
":",
"CASE_CFN_CEIL_FN",
":",
"CASE_CFN_ERF",
":",
"CASE_CFN_EXPM1",
":",
"CASE_CFN_FLOOR",
":",
"CASE_CFN_FLOOR_FN",
":",
"CASE_CFN_FMOD",
":",
"CASE_CFN_FREXP",
":",
"CASE_CFN_ICEIL",
":",
"CASE_CFN_IFLOOR",
":",
"CASE_CFN_IRINT",
":",
"CASE_CFN_IROUND",
":",
"CASE_CFN_LCEIL",
":",
"CASE_CFN_LDEXP",
":",
"CASE_CFN_LFLOOR",
":",
"CASE_CFN_LLCEIL",
":",
"CASE_CFN_LLFLOOR",
":",
"CASE_CFN_LLRINT",
":",
"CASE_CFN_LLROUND",
":",
"CASE_CFN_LRINT",
":",
"CASE_CFN_LROUND",
":",
"CASE_CFN_MODF",
":",
"CASE_CFN_NEARBYINT",
":",
"CASE_CFN_NEARBYINT_FN",
":",
"CASE_CFN_RINT",
":",
"CASE_CFN_RINT_FN",
":",
"CASE_CFN_ROUND",
":",
"CASE_CFN_ROUND_FN",
":",
"CASE_CFN_SCALB",
":",
"CASE_CFN_SCALBLN",
":",
"CASE_CFN_SCALBN",
":",
"CASE_CFN_SIGNBIT",
":",
"CASE_CFN_SIGNIFICAND",
":",
"CASE_CFN_SINH",
":",
"CASE_CFN_TANH",
":",
"CASE_CFN_TRUNC",
":",
"CASE_CFN_TRUNC_FN",
":",
"return",
"RECURSE",
"(",
"arg0",
")",
";",
"CASE_CFN_FMAX",
":",
"CASE_CFN_FMAX_FN",
":",
"return",
"RECURSE",
"(",
"arg0",
")",
"||",
"RECURSE",
"(",
"arg1",
")",
";",
"CASE_CFN_FMIN",
":",
"CASE_CFN_FMIN_FN",
":",
"return",
"RECURSE",
"(",
"arg0",
")",
"&&",
"RECURSE",
"(",
"arg1",
")",
";",
"CASE_CFN_COPYSIGN",
":",
"CASE_CFN_COPYSIGN_FN",
":",
"return",
"RECURSE",
"(",
"arg1",
")",
";",
"CASE_CFN_POWI",
":",
"if",
"(",
"TREE_CODE",
"(",
"arg1",
")",
"==",
"INTEGER_CST",
"&&",
"(",
"TREE_INT_CST_LOW",
"(",
"arg1",
")",
"&",
"1",
")",
"==",
"0",
")",
"return",
"true",
";",
"return",
"RECURSE",
"(",
"arg0",
")",
";",
"CASE_CFN_POW",
":",
"if",
"(",
"TREE_CODE",
"(",
"arg1",
")",
"==",
"REAL_CST",
")",
"{",
"REAL_VALUE_TYPE",
"c",
";",
"HOST_WIDE_INT",
"n",
";",
"c",
"=",
"TREE_REAL_CST",
"(",
"arg1",
")",
";",
"n",
"=",
"real_to_integer",
"(",
"&",
"c",
")",
";",
"if",
"(",
"(",
"n",
"&",
"1",
")",
"==",
"0",
")",
"{",
"REAL_VALUE_TYPE",
"cint",
";",
"real_from_integer",
"(",
"&",
"cint",
",",
"VOIDmode",
",",
"n",
",",
"SIGNED",
")",
";",
"if",
"(",
"real_identical",
"(",
"&",
"c",
",",
"&",
"cint",
")",
")",
"return",
"true",
";",
"}",
"}",
"return",
"RECURSE",
"(",
"arg0",
")",
";",
"default",
":",
"break",
";",
"}",
"return",
"tree_simple_nonnegative_warnv_p",
"(",
"CALL_EXPR",
",",
"type",
")",
";",
"}"
] | Return true if T is known to be non-negative. | [
"Return",
"true",
"if",
"T",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
"."
] | [
"/* Always true. */",
"/* sqrt(-0.0) is -0.0. */",
"/* True if the 1st argument is nonnegative. */",
"/* True if the 1st OR 2nd arguments are nonnegative. */",
"/* True if the 1st AND 2nd arguments are nonnegative. */",
"/* True if the 2nd argument is nonnegative. */",
"/* True if the 1st argument is nonnegative or the second\n\t argument is an even integer. */",
"/* True if the 1st argument is nonnegative or the second\n\t argument is an even integer valued real. */"
] | [
{
"param": "type",
"type": "tree"
},
{
"param": "fn",
"type": "combined_fn"
},
{
"param": "arg0",
"type": "tree"
},
{
"param": "arg1",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fn",
"type": "combined_fn",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "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": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_invalid_nonnegative_warnv_p | bool | static bool
tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p, int depth)
{
enum tree_code code = TREE_CODE (t);
if (TYPE_UNSIGNED (TREE_TYPE (t)))
return true;
switch (code)
{
case TARGET_EXPR:
{
tree temp = TARGET_EXPR_SLOT (t);
t = TARGET_EXPR_INITIAL (t);
/* If the initializer is non-void, then it's a normal expression
that will be assigned to the slot. */
if (!VOID_TYPE_P (t))
return RECURSE (t);
/* Otherwise, the initializer sets the slot in some way. One common
way is an assignment statement at the end of the initializer. */
while (1)
{
if (TREE_CODE (t) == BIND_EXPR)
t = expr_last (BIND_EXPR_BODY (t));
else if (TREE_CODE (t) == TRY_FINALLY_EXPR
|| TREE_CODE (t) == TRY_CATCH_EXPR)
t = expr_last (TREE_OPERAND (t, 0));
else if (TREE_CODE (t) == STATEMENT_LIST)
t = expr_last (t);
else
break;
}
if (TREE_CODE (t) == MODIFY_EXPR
&& TREE_OPERAND (t, 0) == temp)
return RECURSE (TREE_OPERAND (t, 1));
return false;
}
case CALL_EXPR:
{
tree arg0 = call_expr_nargs (t) > 0 ? CALL_EXPR_ARG (t, 0) : NULL_TREE;
tree arg1 = call_expr_nargs (t) > 1 ? CALL_EXPR_ARG (t, 1) : NULL_TREE;
return tree_call_nonnegative_warnv_p (TREE_TYPE (t),
get_call_combined_fn (t),
arg0,
arg1,
strict_overflow_p, depth);
}
case COMPOUND_EXPR:
case MODIFY_EXPR:
return RECURSE (TREE_OPERAND (t, 1));
case BIND_EXPR:
return RECURSE (expr_last (TREE_OPERAND (t, 1)));
case SAVE_EXPR:
return RECURSE (TREE_OPERAND (t, 0));
default:
return tree_simple_nonnegative_warnv_p (TREE_CODE (t), TREE_TYPE (t));
}
} | /* Return true if T is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */ | Return true if T is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"T",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
".",
"If",
"the",
"return",
"value",
"is",
"based",
"on",
"the",
"assumption",
"that",
"signed",
"overflow",
"is",
"undefined",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
";",
"otherwise",
"don",
"'",
"t",
"change",
"STRICT_OVERFLOW_P",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | static bool
tree_invalid_nonnegative_warnv_p (tree t, bool *strict_overflow_p, int depth)
{
enum tree_code code = TREE_CODE (t);
if (TYPE_UNSIGNED (TREE_TYPE (t)))
return true;
switch (code)
{
case TARGET_EXPR:
{
tree temp = TARGET_EXPR_SLOT (t);
t = TARGET_EXPR_INITIAL (t);
if (!VOID_TYPE_P (t))
return RECURSE (t);
while (1)
{
if (TREE_CODE (t) == BIND_EXPR)
t = expr_last (BIND_EXPR_BODY (t));
else if (TREE_CODE (t) == TRY_FINALLY_EXPR
|| TREE_CODE (t) == TRY_CATCH_EXPR)
t = expr_last (TREE_OPERAND (t, 0));
else if (TREE_CODE (t) == STATEMENT_LIST)
t = expr_last (t);
else
break;
}
if (TREE_CODE (t) == MODIFY_EXPR
&& TREE_OPERAND (t, 0) == temp)
return RECURSE (TREE_OPERAND (t, 1));
return false;
}
case CALL_EXPR:
{
tree arg0 = call_expr_nargs (t) > 0 ? CALL_EXPR_ARG (t, 0) : NULL_TREE;
tree arg1 = call_expr_nargs (t) > 1 ? CALL_EXPR_ARG (t, 1) : NULL_TREE;
return tree_call_nonnegative_warnv_p (TREE_TYPE (t),
get_call_combined_fn (t),
arg0,
arg1,
strict_overflow_p, depth);
}
case COMPOUND_EXPR:
case MODIFY_EXPR:
return RECURSE (TREE_OPERAND (t, 1));
case BIND_EXPR:
return RECURSE (expr_last (TREE_OPERAND (t, 1)));
case SAVE_EXPR:
return RECURSE (TREE_OPERAND (t, 0));
default:
return tree_simple_nonnegative_warnv_p (TREE_CODE (t), TREE_TYPE (t));
}
} | [
"static",
"bool",
"tree_invalid_nonnegative_warnv_p",
"(",
"tree",
"t",
",",
"bool",
"*",
"strict_overflow_p",
",",
"int",
"depth",
")",
"{",
"enum",
"tree_code",
"code",
"=",
"TREE_CODE",
"(",
"t",
")",
";",
"if",
"(",
"TYPE_UNSIGNED",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
")",
"return",
"true",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"TARGET_EXPR",
":",
"{",
"tree",
"temp",
"=",
"TARGET_EXPR_SLOT",
"(",
"t",
")",
";",
"t",
"=",
"TARGET_EXPR_INITIAL",
"(",
"t",
")",
";",
"if",
"(",
"!",
"VOID_TYPE_P",
"(",
"t",
")",
")",
"return",
"RECURSE",
"(",
"t",
")",
";",
"while",
"(",
"1",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"BIND_EXPR",
")",
"t",
"=",
"expr_last",
"(",
"BIND_EXPR_BODY",
"(",
"t",
")",
")",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"TRY_FINALLY_EXPR",
"||",
"TREE_CODE",
"(",
"t",
")",
"==",
"TRY_CATCH_EXPR",
")",
"t",
"=",
"expr_last",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
")",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"STATEMENT_LIST",
")",
"t",
"=",
"expr_last",
"(",
"t",
")",
";",
"else",
"break",
";",
"}",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"MODIFY_EXPR",
"&&",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
"==",
"temp",
")",
"return",
"RECURSE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
";",
"return",
"false",
";",
"}",
"case",
"CALL_EXPR",
":",
"{",
"tree",
"arg0",
"=",
"call_expr_nargs",
"(",
"t",
")",
">",
"0",
"?",
"CALL_EXPR_ARG",
"(",
"t",
",",
"0",
")",
":",
"NULL_TREE",
";",
"tree",
"arg1",
"=",
"call_expr_nargs",
"(",
"t",
")",
">",
"1",
"?",
"CALL_EXPR_ARG",
"(",
"t",
",",
"1",
")",
":",
"NULL_TREE",
";",
"return",
"tree_call_nonnegative_warnv_p",
"(",
"TREE_TYPE",
"(",
"t",
")",
",",
"get_call_combined_fn",
"(",
"t",
")",
",",
"arg0",
",",
"arg1",
",",
"strict_overflow_p",
",",
"depth",
")",
";",
"}",
"case",
"COMPOUND_EXPR",
":",
"case",
"MODIFY_EXPR",
":",
"return",
"RECURSE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
";",
"case",
"BIND_EXPR",
":",
"return",
"RECURSE",
"(",
"expr_last",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
")",
";",
"case",
"SAVE_EXPR",
":",
"return",
"RECURSE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
")",
";",
"default",
":",
"return",
"tree_simple_nonnegative_warnv_p",
"(",
"TREE_CODE",
"(",
"t",
")",
",",
"TREE_TYPE",
"(",
"t",
")",
")",
";",
"}",
"}"
] | Return true if T is known to be non-negative. | [
"Return",
"true",
"if",
"T",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
"."
] | [
"/* If the initializer is non-void, then it's a normal expression\n\t that will be assigned to the slot. */",
"/* Otherwise, the initializer sets the slot in some way. One common\n\t way is an assignment statement at the end of the initializer. */"
] | [
{
"param": "t",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_expr_nonnegative_warnv_p | bool | bool
tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p, int depth)
{
enum tree_code code;
if (t == error_mark_node)
return false;
code = TREE_CODE (t);
switch (TREE_CODE_CLASS (code))
{
case tcc_binary:
case tcc_comparison:
return tree_binary_nonnegative_warnv_p (TREE_CODE (t),
TREE_TYPE (t),
TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1),
strict_overflow_p, depth);
case tcc_unary:
return tree_unary_nonnegative_warnv_p (TREE_CODE (t),
TREE_TYPE (t),
TREE_OPERAND (t, 0),
strict_overflow_p, depth);
case tcc_constant:
case tcc_declaration:
case tcc_reference:
return tree_single_nonnegative_warnv_p (t, strict_overflow_p, depth);
default:
break;
}
switch (code)
{
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
case TRUTH_XOR_EXPR:
return tree_binary_nonnegative_warnv_p (TREE_CODE (t),
TREE_TYPE (t),
TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1),
strict_overflow_p, depth);
case TRUTH_NOT_EXPR:
return tree_unary_nonnegative_warnv_p (TREE_CODE (t),
TREE_TYPE (t),
TREE_OPERAND (t, 0),
strict_overflow_p, depth);
case COND_EXPR:
case CONSTRUCTOR:
case OBJ_TYPE_REF:
case ASSERT_EXPR:
case ADDR_EXPR:
case WITH_SIZE_EXPR:
case SSA_NAME:
return tree_single_nonnegative_warnv_p (t, strict_overflow_p, depth);
default:
return tree_invalid_nonnegative_warnv_p (t, strict_overflow_p, depth);
}
} | /* Return true if T is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
*STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. */ | Return true if T is known to be non-negative. If the return
value is based on the assumption that signed overflow is undefined,
set *STRICT_OVERFLOW_P to true; otherwise, don't change
STRICT_OVERFLOW_P. DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"T",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
".",
"If",
"the",
"return",
"value",
"is",
"based",
"on",
"the",
"assumption",
"that",
"signed",
"overflow",
"is",
"undefined",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
";",
"otherwise",
"don",
"'",
"t",
"change",
"STRICT_OVERFLOW_P",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p, int depth)
{
enum tree_code code;
if (t == error_mark_node)
return false;
code = TREE_CODE (t);
switch (TREE_CODE_CLASS (code))
{
case tcc_binary:
case tcc_comparison:
return tree_binary_nonnegative_warnv_p (TREE_CODE (t),
TREE_TYPE (t),
TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1),
strict_overflow_p, depth);
case tcc_unary:
return tree_unary_nonnegative_warnv_p (TREE_CODE (t),
TREE_TYPE (t),
TREE_OPERAND (t, 0),
strict_overflow_p, depth);
case tcc_constant:
case tcc_declaration:
case tcc_reference:
return tree_single_nonnegative_warnv_p (t, strict_overflow_p, depth);
default:
break;
}
switch (code)
{
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
case TRUTH_XOR_EXPR:
return tree_binary_nonnegative_warnv_p (TREE_CODE (t),
TREE_TYPE (t),
TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1),
strict_overflow_p, depth);
case TRUTH_NOT_EXPR:
return tree_unary_nonnegative_warnv_p (TREE_CODE (t),
TREE_TYPE (t),
TREE_OPERAND (t, 0),
strict_overflow_p, depth);
case COND_EXPR:
case CONSTRUCTOR:
case OBJ_TYPE_REF:
case ASSERT_EXPR:
case ADDR_EXPR:
case WITH_SIZE_EXPR:
case SSA_NAME:
return tree_single_nonnegative_warnv_p (t, strict_overflow_p, depth);
default:
return tree_invalid_nonnegative_warnv_p (t, strict_overflow_p, depth);
}
} | [
"bool",
"tree_expr_nonnegative_warnv_p",
"(",
"tree",
"t",
",",
"bool",
"*",
"strict_overflow_p",
",",
"int",
"depth",
")",
"{",
"enum",
"tree_code",
"code",
";",
"if",
"(",
"t",
"==",
"error_mark_node",
")",
"return",
"false",
";",
"code",
"=",
"TREE_CODE",
"(",
"t",
")",
";",
"switch",
"(",
"TREE_CODE_CLASS",
"(",
"code",
")",
")",
"{",
"case",
"tcc_binary",
":",
"case",
"tcc_comparison",
":",
"return",
"tree_binary_nonnegative_warnv_p",
"(",
"TREE_CODE",
"(",
"t",
")",
",",
"TREE_TYPE",
"(",
"t",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
",",
"strict_overflow_p",
",",
"depth",
")",
";",
"case",
"tcc_unary",
":",
"return",
"tree_unary_nonnegative_warnv_p",
"(",
"TREE_CODE",
"(",
"t",
")",
",",
"TREE_TYPE",
"(",
"t",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"strict_overflow_p",
",",
"depth",
")",
";",
"case",
"tcc_constant",
":",
"case",
"tcc_declaration",
":",
"case",
"tcc_reference",
":",
"return",
"tree_single_nonnegative_warnv_p",
"(",
"t",
",",
"strict_overflow_p",
",",
"depth",
")",
";",
"default",
":",
"break",
";",
"}",
"switch",
"(",
"code",
")",
"{",
"case",
"TRUTH_AND_EXPR",
":",
"case",
"TRUTH_OR_EXPR",
":",
"case",
"TRUTH_XOR_EXPR",
":",
"return",
"tree_binary_nonnegative_warnv_p",
"(",
"TREE_CODE",
"(",
"t",
")",
",",
"TREE_TYPE",
"(",
"t",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
",",
"strict_overflow_p",
",",
"depth",
")",
";",
"case",
"TRUTH_NOT_EXPR",
":",
"return",
"tree_unary_nonnegative_warnv_p",
"(",
"TREE_CODE",
"(",
"t",
")",
",",
"TREE_TYPE",
"(",
"t",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"strict_overflow_p",
",",
"depth",
")",
";",
"case",
"COND_EXPR",
":",
"case",
"CONSTRUCTOR",
":",
"case",
"OBJ_TYPE_REF",
":",
"case",
"ASSERT_EXPR",
":",
"case",
"ADDR_EXPR",
":",
"case",
"WITH_SIZE_EXPR",
":",
"case",
"SSA_NAME",
":",
"return",
"tree_single_nonnegative_warnv_p",
"(",
"t",
",",
"strict_overflow_p",
",",
"depth",
")",
";",
"default",
":",
"return",
"tree_invalid_nonnegative_warnv_p",
"(",
"t",
",",
"strict_overflow_p",
",",
"depth",
")",
";",
"}",
"}"
] | Return true if T is known to be non-negative. | [
"Return",
"true",
"if",
"T",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
"."
] | [] | [
{
"param": "t",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_expr_nonnegative_p | bool | bool
tree_expr_nonnegative_p (tree t)
{
bool ret, strict_overflow_p;
strict_overflow_p = false;
ret = tree_expr_nonnegative_warnv_p (t, &strict_overflow_p);
if (strict_overflow_p)
fold_overflow_warning (("assuming signed overflow does not occur when "
"determining that expression is always "
"non-negative"),
WARN_STRICT_OVERFLOW_MISC);
return ret;
} | /* Return true if `t' is known to be non-negative. Handle warnings
about undefined signed overflow. */ | Return true if `t' is known to be non-negative. Handle warnings
about undefined signed overflow. | [
"Return",
"true",
"if",
"`",
"t",
"'",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
".",
"Handle",
"warnings",
"about",
"undefined",
"signed",
"overflow",
"."
] | bool
tree_expr_nonnegative_p (tree t)
{
bool ret, strict_overflow_p;
strict_overflow_p = false;
ret = tree_expr_nonnegative_warnv_p (t, &strict_overflow_p);
if (strict_overflow_p)
fold_overflow_warning (("assuming signed overflow does not occur when "
"determining that expression is always "
"non-negative"),
WARN_STRICT_OVERFLOW_MISC);
return ret;
} | [
"bool",
"tree_expr_nonnegative_p",
"(",
"tree",
"t",
")",
"{",
"bool",
"ret",
",",
"strict_overflow_p",
";",
"strict_overflow_p",
"=",
"false",
";",
"ret",
"=",
"tree_expr_nonnegative_warnv_p",
"(",
"t",
",",
"&",
"strict_overflow_p",
")",
";",
"if",
"(",
"strict_overflow_p",
")",
"fold_overflow_warning",
"(",
"(",
"\"",
"\"",
"\"",
"\"",
"\"",
"\"",
")",
",",
"WARN_STRICT_OVERFLOW_MISC",
")",
";",
"return",
"ret",
";",
"}"
] | Return true if `t' is known to be non-negative. | [
"Return",
"true",
"if",
"`",
"t",
"'",
"is",
"known",
"to",
"be",
"non",
"-",
"negative",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_unary_nonzero_warnv_p | bool | bool
tree_unary_nonzero_warnv_p (enum tree_code code, tree type, tree op0,
bool *strict_overflow_p)
{
switch (code)
{
case ABS_EXPR:
return tree_expr_nonzero_warnv_p (op0,
strict_overflow_p);
case NOP_EXPR:
{
tree inner_type = TREE_TYPE (op0);
tree outer_type = type;
return (TYPE_PRECISION (outer_type) >= TYPE_PRECISION (inner_type)
&& tree_expr_nonzero_warnv_p (op0,
strict_overflow_p));
}
break;
case NON_LVALUE_EXPR:
return tree_expr_nonzero_warnv_p (op0,
strict_overflow_p);
default:
break;
}
return false;
} | /* Return true when (CODE OP0) is an address and is known to be nonzero.
For floating point we further ensure that T is not denormal.
Similar logic is present in nonzero_address in rtlanal.h.
If the return value is based on the assumption that signed overflow
is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't
change *STRICT_OVERFLOW_P. */ | Return true when (CODE OP0) is an address and is known to be nonzero.
For floating point we further ensure that T is not denormal.
Similar logic is present in nonzero_address in rtlanal.h.
If the return value is based on the assumption that signed overflow
is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't
change *STRICT_OVERFLOW_P. | [
"Return",
"true",
"when",
"(",
"CODE",
"OP0",
")",
"is",
"an",
"address",
"and",
"is",
"known",
"to",
"be",
"nonzero",
".",
"For",
"floating",
"point",
"we",
"further",
"ensure",
"that",
"T",
"is",
"not",
"denormal",
".",
"Similar",
"logic",
"is",
"present",
"in",
"nonzero_address",
"in",
"rtlanal",
".",
"h",
".",
"If",
"the",
"return",
"value",
"is",
"based",
"on",
"the",
"assumption",
"that",
"signed",
"overflow",
"is",
"undefined",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
";",
"otherwise",
"don",
"'",
"t",
"change",
"*",
"STRICT_OVERFLOW_P",
"."
] | bool
tree_unary_nonzero_warnv_p (enum tree_code code, tree type, tree op0,
bool *strict_overflow_p)
{
switch (code)
{
case ABS_EXPR:
return tree_expr_nonzero_warnv_p (op0,
strict_overflow_p);
case NOP_EXPR:
{
tree inner_type = TREE_TYPE (op0);
tree outer_type = type;
return (TYPE_PRECISION (outer_type) >= TYPE_PRECISION (inner_type)
&& tree_expr_nonzero_warnv_p (op0,
strict_overflow_p));
}
break;
case NON_LVALUE_EXPR:
return tree_expr_nonzero_warnv_p (op0,
strict_overflow_p);
default:
break;
}
return false;
} | [
"bool",
"tree_unary_nonzero_warnv_p",
"(",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"op0",
",",
"bool",
"*",
"strict_overflow_p",
")",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"ABS_EXPR",
":",
"return",
"tree_expr_nonzero_warnv_p",
"(",
"op0",
",",
"strict_overflow_p",
")",
";",
"case",
"NOP_EXPR",
":",
"{",
"tree",
"inner_type",
"=",
"TREE_TYPE",
"(",
"op0",
")",
";",
"tree",
"outer_type",
"=",
"type",
";",
"return",
"(",
"TYPE_PRECISION",
"(",
"outer_type",
")",
">=",
"TYPE_PRECISION",
"(",
"inner_type",
")",
"&&",
"tree_expr_nonzero_warnv_p",
"(",
"op0",
",",
"strict_overflow_p",
")",
")",
";",
"}",
"break",
";",
"case",
"NON_LVALUE_EXPR",
":",
"return",
"tree_expr_nonzero_warnv_p",
"(",
"op0",
",",
"strict_overflow_p",
")",
";",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] | Return true when (CODE OP0) is an address and is known to be nonzero. | [
"Return",
"true",
"when",
"(",
"CODE",
"OP0",
")",
"is",
"an",
"address",
"and",
"is",
"known",
"to",
"be",
"nonzero",
"."
] | [] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "op0",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | tree_binary_nonzero_warnv_p | bool | bool
tree_binary_nonzero_warnv_p (enum tree_code code,
tree type,
tree op0,
tree op1, bool *strict_overflow_p)
{
bool sub_strict_overflow_p;
switch (code)
{
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
if (ANY_INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_UNDEFINED (type))
{
/* With the presence of negative values it is hard
to say something. */
sub_strict_overflow_p = false;
if (!tree_expr_nonnegative_warnv_p (op0,
&sub_strict_overflow_p)
|| !tree_expr_nonnegative_warnv_p (op1,
&sub_strict_overflow_p))
return false;
/* One of operands must be positive and the other non-negative. */
/* We don't set *STRICT_OVERFLOW_P here: even if this value
overflows, on a twos-complement machine the sum of two
nonnegative numbers can never be zero. */
return (tree_expr_nonzero_warnv_p (op0,
strict_overflow_p)
|| tree_expr_nonzero_warnv_p (op1,
strict_overflow_p));
}
break;
case MULT_EXPR:
if (TYPE_OVERFLOW_UNDEFINED (type))
{
if (tree_expr_nonzero_warnv_p (op0,
strict_overflow_p)
&& tree_expr_nonzero_warnv_p (op1,
strict_overflow_p))
{
*strict_overflow_p = true;
return true;
}
}
break;
case MIN_EXPR:
sub_strict_overflow_p = false;
if (tree_expr_nonzero_warnv_p (op0,
&sub_strict_overflow_p)
&& tree_expr_nonzero_warnv_p (op1,
&sub_strict_overflow_p))
{
if (sub_strict_overflow_p)
*strict_overflow_p = true;
}
break;
case MAX_EXPR:
sub_strict_overflow_p = false;
if (tree_expr_nonzero_warnv_p (op0,
&sub_strict_overflow_p))
{
if (sub_strict_overflow_p)
*strict_overflow_p = true;
/* When both operands are nonzero, then MAX must be too. */
if (tree_expr_nonzero_warnv_p (op1,
strict_overflow_p))
return true;
/* MAX where operand 0 is positive is positive. */
return tree_expr_nonnegative_warnv_p (op0,
strict_overflow_p);
}
/* MAX where operand 1 is positive is positive. */
else if (tree_expr_nonzero_warnv_p (op1,
&sub_strict_overflow_p)
&& tree_expr_nonnegative_warnv_p (op1,
&sub_strict_overflow_p))
{
if (sub_strict_overflow_p)
*strict_overflow_p = true;
return true;
}
break;
case BIT_IOR_EXPR:
return (tree_expr_nonzero_warnv_p (op1,
strict_overflow_p)
|| tree_expr_nonzero_warnv_p (op0,
strict_overflow_p));
default:
break;
}
return false;
} | /* Return true when (CODE OP0 OP1) is an address and is known to be nonzero.
For floating point we further ensure that T is not denormal.
Similar logic is present in nonzero_address in rtlanal.h.
If the return value is based on the assumption that signed overflow
is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't
change *STRICT_OVERFLOW_P. */ | Return true when (CODE OP0 OP1) is an address and is known to be nonzero.
For floating point we further ensure that T is not denormal.
Similar logic is present in nonzero_address in rtlanal.h.
If the return value is based on the assumption that signed overflow
is undefined, set *STRICT_OVERFLOW_P to true; otherwise, don't
change *STRICT_OVERFLOW_P. | [
"Return",
"true",
"when",
"(",
"CODE",
"OP0",
"OP1",
")",
"is",
"an",
"address",
"and",
"is",
"known",
"to",
"be",
"nonzero",
".",
"For",
"floating",
"point",
"we",
"further",
"ensure",
"that",
"T",
"is",
"not",
"denormal",
".",
"Similar",
"logic",
"is",
"present",
"in",
"nonzero_address",
"in",
"rtlanal",
".",
"h",
".",
"If",
"the",
"return",
"value",
"is",
"based",
"on",
"the",
"assumption",
"that",
"signed",
"overflow",
"is",
"undefined",
"set",
"*",
"STRICT_OVERFLOW_P",
"to",
"true",
";",
"otherwise",
"don",
"'",
"t",
"change",
"*",
"STRICT_OVERFLOW_P",
"."
] | bool
tree_binary_nonzero_warnv_p (enum tree_code code,
tree type,
tree op0,
tree op1, bool *strict_overflow_p)
{
bool sub_strict_overflow_p;
switch (code)
{
case POINTER_PLUS_EXPR:
case PLUS_EXPR:
if (ANY_INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_UNDEFINED (type))
{
sub_strict_overflow_p = false;
if (!tree_expr_nonnegative_warnv_p (op0,
&sub_strict_overflow_p)
|| !tree_expr_nonnegative_warnv_p (op1,
&sub_strict_overflow_p))
return false;
return (tree_expr_nonzero_warnv_p (op0,
strict_overflow_p)
|| tree_expr_nonzero_warnv_p (op1,
strict_overflow_p));
}
break;
case MULT_EXPR:
if (TYPE_OVERFLOW_UNDEFINED (type))
{
if (tree_expr_nonzero_warnv_p (op0,
strict_overflow_p)
&& tree_expr_nonzero_warnv_p (op1,
strict_overflow_p))
{
*strict_overflow_p = true;
return true;
}
}
break;
case MIN_EXPR:
sub_strict_overflow_p = false;
if (tree_expr_nonzero_warnv_p (op0,
&sub_strict_overflow_p)
&& tree_expr_nonzero_warnv_p (op1,
&sub_strict_overflow_p))
{
if (sub_strict_overflow_p)
*strict_overflow_p = true;
}
break;
case MAX_EXPR:
sub_strict_overflow_p = false;
if (tree_expr_nonzero_warnv_p (op0,
&sub_strict_overflow_p))
{
if (sub_strict_overflow_p)
*strict_overflow_p = true;
if (tree_expr_nonzero_warnv_p (op1,
strict_overflow_p))
return true;
return tree_expr_nonnegative_warnv_p (op0,
strict_overflow_p);
}
else if (tree_expr_nonzero_warnv_p (op1,
&sub_strict_overflow_p)
&& tree_expr_nonnegative_warnv_p (op1,
&sub_strict_overflow_p))
{
if (sub_strict_overflow_p)
*strict_overflow_p = true;
return true;
}
break;
case BIT_IOR_EXPR:
return (tree_expr_nonzero_warnv_p (op1,
strict_overflow_p)
|| tree_expr_nonzero_warnv_p (op0,
strict_overflow_p));
default:
break;
}
return false;
} | [
"bool",
"tree_binary_nonzero_warnv_p",
"(",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"op0",
",",
"tree",
"op1",
",",
"bool",
"*",
"strict_overflow_p",
")",
"{",
"bool",
"sub_strict_overflow_p",
";",
"switch",
"(",
"code",
")",
"{",
"case",
"POINTER_PLUS_EXPR",
":",
"case",
"PLUS_EXPR",
":",
"if",
"(",
"ANY_INTEGRAL_TYPE_P",
"(",
"type",
")",
"&&",
"TYPE_OVERFLOW_UNDEFINED",
"(",
"type",
")",
")",
"{",
"sub_strict_overflow_p",
"=",
"false",
";",
"if",
"(",
"!",
"tree_expr_nonnegative_warnv_p",
"(",
"op0",
",",
"&",
"sub_strict_overflow_p",
")",
"||",
"!",
"tree_expr_nonnegative_warnv_p",
"(",
"op1",
",",
"&",
"sub_strict_overflow_p",
")",
")",
"return",
"false",
";",
"return",
"(",
"tree_expr_nonzero_warnv_p",
"(",
"op0",
",",
"strict_overflow_p",
")",
"||",
"tree_expr_nonzero_warnv_p",
"(",
"op1",
",",
"strict_overflow_p",
")",
")",
";",
"}",
"break",
";",
"case",
"MULT_EXPR",
":",
"if",
"(",
"TYPE_OVERFLOW_UNDEFINED",
"(",
"type",
")",
")",
"{",
"if",
"(",
"tree_expr_nonzero_warnv_p",
"(",
"op0",
",",
"strict_overflow_p",
")",
"&&",
"tree_expr_nonzero_warnv_p",
"(",
"op1",
",",
"strict_overflow_p",
")",
")",
"{",
"*",
"strict_overflow_p",
"=",
"true",
";",
"return",
"true",
";",
"}",
"}",
"break",
";",
"case",
"MIN_EXPR",
":",
"sub_strict_overflow_p",
"=",
"false",
";",
"if",
"(",
"tree_expr_nonzero_warnv_p",
"(",
"op0",
",",
"&",
"sub_strict_overflow_p",
")",
"&&",
"tree_expr_nonzero_warnv_p",
"(",
"op1",
",",
"&",
"sub_strict_overflow_p",
")",
")",
"{",
"if",
"(",
"sub_strict_overflow_p",
")",
"*",
"strict_overflow_p",
"=",
"true",
";",
"}",
"break",
";",
"case",
"MAX_EXPR",
":",
"sub_strict_overflow_p",
"=",
"false",
";",
"if",
"(",
"tree_expr_nonzero_warnv_p",
"(",
"op0",
",",
"&",
"sub_strict_overflow_p",
")",
")",
"{",
"if",
"(",
"sub_strict_overflow_p",
")",
"*",
"strict_overflow_p",
"=",
"true",
";",
"if",
"(",
"tree_expr_nonzero_warnv_p",
"(",
"op1",
",",
"strict_overflow_p",
")",
")",
"return",
"true",
";",
"return",
"tree_expr_nonnegative_warnv_p",
"(",
"op0",
",",
"strict_overflow_p",
")",
";",
"}",
"else",
"if",
"(",
"tree_expr_nonzero_warnv_p",
"(",
"op1",
",",
"&",
"sub_strict_overflow_p",
")",
"&&",
"tree_expr_nonnegative_warnv_p",
"(",
"op1",
",",
"&",
"sub_strict_overflow_p",
")",
")",
"{",
"if",
"(",
"sub_strict_overflow_p",
")",
"*",
"strict_overflow_p",
"=",
"true",
";",
"return",
"true",
";",
"}",
"break",
";",
"case",
"BIT_IOR_EXPR",
":",
"return",
"(",
"tree_expr_nonzero_warnv_p",
"(",
"op1",
",",
"strict_overflow_p",
")",
"||",
"tree_expr_nonzero_warnv_p",
"(",
"op0",
",",
"strict_overflow_p",
")",
")",
";",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] | Return true when (CODE OP0 OP1) is an address and is known to be nonzero. | [
"Return",
"true",
"when",
"(",
"CODE",
"OP0",
"OP1",
")",
"is",
"an",
"address",
"and",
"is",
"known",
"to",
"be",
"nonzero",
"."
] | [
"/* With the presence of negative values it is hard\n\t to say something. */",
"/* One of operands must be positive and the other non-negative. */",
"/* We don't set *STRICT_OVERFLOW_P here: even if this value\n\t overflows, on a twos-complement machine the sum of two\n\t nonnegative numbers can never be zero. */",
"/* When both operands are nonzero, then MAX must be too. */",
"/* MAX where operand 0 is positive is positive. */",
"/* MAX where operand 1 is positive is positive. */"
] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "op0",
"type": "tree"
},
{
"param": "op1",
"type": "tree"
},
{
"param": "strict_overflow_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strict_overflow_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | integer_valued_real_unary_p | bool | bool
integer_valued_real_unary_p (tree_code code, tree op0, int depth)
{
switch (code)
{
case FLOAT_EXPR:
return true;
case ABS_EXPR:
return RECURSE (op0);
CASE_CONVERT:
{
tree type = TREE_TYPE (op0);
if (TREE_CODE (type) == INTEGER_TYPE)
return true;
if (TREE_CODE (type) == REAL_TYPE)
return RECURSE (op0);
break;
}
default:
break;
}
return false;
} | /* Return true if the floating point result of (CODE OP0) has an
integer value. We also allow +Inf, -Inf and NaN to be considered
integer values. Return false for signaling NaN.
DEPTH is the current nesting depth of the query. */ | Return true if the floating point result of (CODE OP0) has an
integer value. We also allow +Inf, -Inf and NaN to be considered
integer values. Return false for signaling NaN.
DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"result",
"of",
"(",
"CODE",
"OP0",
")",
"has",
"an",
"integer",
"value",
".",
"We",
"also",
"allow",
"+",
"Inf",
"-",
"Inf",
"and",
"NaN",
"to",
"be",
"considered",
"integer",
"values",
".",
"Return",
"false",
"for",
"signaling",
"NaN",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
integer_valued_real_unary_p (tree_code code, tree op0, int depth)
{
switch (code)
{
case FLOAT_EXPR:
return true;
case ABS_EXPR:
return RECURSE (op0);
CASE_CONVERT:
{
tree type = TREE_TYPE (op0);
if (TREE_CODE (type) == INTEGER_TYPE)
return true;
if (TREE_CODE (type) == REAL_TYPE)
return RECURSE (op0);
break;
}
default:
break;
}
return false;
} | [
"bool",
"integer_valued_real_unary_p",
"(",
"tree_code",
"code",
",",
"tree",
"op0",
",",
"int",
"depth",
")",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"FLOAT_EXPR",
":",
"return",
"true",
";",
"case",
"ABS_EXPR",
":",
"return",
"RECURSE",
"(",
"op0",
")",
";",
"CASE_CONVERT",
":",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"op0",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"type",
")",
"==",
"INTEGER_TYPE",
")",
"return",
"true",
";",
"if",
"(",
"TREE_CODE",
"(",
"type",
")",
"==",
"REAL_TYPE",
")",
"return",
"RECURSE",
"(",
"op0",
")",
";",
"break",
";",
"}",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] | Return true if the floating point result of (CODE OP0) has an
integer value. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"result",
"of",
"(",
"CODE",
"OP0",
")",
"has",
"an",
"integer",
"value",
"."
] | [] | [
{
"param": "code",
"type": "tree_code"
},
{
"param": "op0",
"type": "tree"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | integer_valued_real_binary_p | bool | bool
integer_valued_real_binary_p (tree_code code, tree op0, tree op1, int depth)
{
switch (code)
{
case PLUS_EXPR:
case MINUS_EXPR:
case MULT_EXPR:
case MIN_EXPR:
case MAX_EXPR:
return RECURSE (op0) && RECURSE (op1);
default:
break;
}
return false;
} | /* Return true if the floating point result of (CODE OP0 OP1) has an
integer value. We also allow +Inf, -Inf and NaN to be considered
integer values. Return false for signaling NaN.
DEPTH is the current nesting depth of the query. */ | Return true if the floating point result of (CODE OP0 OP1) has an
integer value. We also allow +Inf, -Inf and NaN to be considered
integer values. Return false for signaling NaN.
DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"result",
"of",
"(",
"CODE",
"OP0",
"OP1",
")",
"has",
"an",
"integer",
"value",
".",
"We",
"also",
"allow",
"+",
"Inf",
"-",
"Inf",
"and",
"NaN",
"to",
"be",
"considered",
"integer",
"values",
".",
"Return",
"false",
"for",
"signaling",
"NaN",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
integer_valued_real_binary_p (tree_code code, tree op0, tree op1, int depth)
{
switch (code)
{
case PLUS_EXPR:
case MINUS_EXPR:
case MULT_EXPR:
case MIN_EXPR:
case MAX_EXPR:
return RECURSE (op0) && RECURSE (op1);
default:
break;
}
return false;
} | [
"bool",
"integer_valued_real_binary_p",
"(",
"tree_code",
"code",
",",
"tree",
"op0",
",",
"tree",
"op1",
",",
"int",
"depth",
")",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"PLUS_EXPR",
":",
"case",
"MINUS_EXPR",
":",
"case",
"MULT_EXPR",
":",
"case",
"MIN_EXPR",
":",
"case",
"MAX_EXPR",
":",
"return",
"RECURSE",
"(",
"op0",
")",
"&&",
"RECURSE",
"(",
"op1",
")",
";",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] | Return true if the floating point result of (CODE OP0 OP1) has an
integer value. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"result",
"of",
"(",
"CODE",
"OP0",
"OP1",
")",
"has",
"an",
"integer",
"value",
"."
] | [] | [
{
"param": "code",
"type": "tree_code"
},
{
"param": "op0",
"type": "tree"
},
{
"param": "op1",
"type": "tree"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | integer_valued_real_call_p | bool | bool
integer_valued_real_call_p (combined_fn fn, tree arg0, tree arg1, int depth)
{
switch (fn)
{
CASE_CFN_CEIL:
CASE_CFN_CEIL_FN:
CASE_CFN_FLOOR:
CASE_CFN_FLOOR_FN:
CASE_CFN_NEARBYINT:
CASE_CFN_NEARBYINT_FN:
CASE_CFN_RINT:
CASE_CFN_RINT_FN:
CASE_CFN_ROUND:
CASE_CFN_ROUND_FN:
CASE_CFN_TRUNC:
CASE_CFN_TRUNC_FN:
return true;
CASE_CFN_FMIN:
CASE_CFN_FMIN_FN:
CASE_CFN_FMAX:
CASE_CFN_FMAX_FN:
return RECURSE (arg0) && RECURSE (arg1);
default:
break;
}
return false;
} | /* Return true if the floating point result of calling FNDECL with arguments
ARG0 and ARG1 has an integer value. We also allow +Inf, -Inf and NaN to be
considered integer values. Return false for signaling NaN. If FNDECL
takes fewer than 2 arguments, the remaining ARGn are null.
DEPTH is the current nesting depth of the query. */ | Return true if the floating point result of calling FNDECL with arguments
ARG0 and ARG1 has an integer value. We also allow +Inf, -Inf and NaN to be
considered integer values. Return false for signaling NaN. If FNDECL
takes fewer than 2 arguments, the remaining ARGn are null.
DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"result",
"of",
"calling",
"FNDECL",
"with",
"arguments",
"ARG0",
"and",
"ARG1",
"has",
"an",
"integer",
"value",
".",
"We",
"also",
"allow",
"+",
"Inf",
"-",
"Inf",
"and",
"NaN",
"to",
"be",
"considered",
"integer",
"values",
".",
"Return",
"false",
"for",
"signaling",
"NaN",
".",
"If",
"FNDECL",
"takes",
"fewer",
"than",
"2",
"arguments",
"the",
"remaining",
"ARGn",
"are",
"null",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
integer_valued_real_call_p (combined_fn fn, tree arg0, tree arg1, int depth)
{
switch (fn)
{
CASE_CFN_CEIL:
CASE_CFN_CEIL_FN:
CASE_CFN_FLOOR:
CASE_CFN_FLOOR_FN:
CASE_CFN_NEARBYINT:
CASE_CFN_NEARBYINT_FN:
CASE_CFN_RINT:
CASE_CFN_RINT_FN:
CASE_CFN_ROUND:
CASE_CFN_ROUND_FN:
CASE_CFN_TRUNC:
CASE_CFN_TRUNC_FN:
return true;
CASE_CFN_FMIN:
CASE_CFN_FMIN_FN:
CASE_CFN_FMAX:
CASE_CFN_FMAX_FN:
return RECURSE (arg0) && RECURSE (arg1);
default:
break;
}
return false;
} | [
"bool",
"integer_valued_real_call_p",
"(",
"combined_fn",
"fn",
",",
"tree",
"arg0",
",",
"tree",
"arg1",
",",
"int",
"depth",
")",
"{",
"switch",
"(",
"fn",
")",
"{",
"CASE_CFN_CEIL",
":",
"CASE_CFN_CEIL_FN",
":",
"CASE_CFN_FLOOR",
":",
"CASE_CFN_FLOOR_FN",
":",
"CASE_CFN_NEARBYINT",
":",
"CASE_CFN_NEARBYINT_FN",
":",
"CASE_CFN_RINT",
":",
"CASE_CFN_RINT_FN",
":",
"CASE_CFN_ROUND",
":",
"CASE_CFN_ROUND_FN",
":",
"CASE_CFN_TRUNC",
":",
"CASE_CFN_TRUNC_FN",
":",
"return",
"true",
";",
"CASE_CFN_FMIN",
":",
"CASE_CFN_FMIN_FN",
":",
"CASE_CFN_FMAX",
":",
"CASE_CFN_FMAX_FN",
":",
"return",
"RECURSE",
"(",
"arg0",
")",
"&&",
"RECURSE",
"(",
"arg1",
")",
";",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] | Return true if the floating point result of calling FNDECL with arguments
ARG0 and ARG1 has an integer value. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"result",
"of",
"calling",
"FNDECL",
"with",
"arguments",
"ARG0",
"and",
"ARG1",
"has",
"an",
"integer",
"value",
"."
] | [] | [
{
"param": "fn",
"type": "combined_fn"
},
{
"param": "arg0",
"type": "tree"
},
{
"param": "arg1",
"type": "tree"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fn",
"type": "combined_fn",
"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": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | integer_valued_real_single_p | bool | bool
integer_valued_real_single_p (tree t, int depth)
{
switch (TREE_CODE (t))
{
case REAL_CST:
return real_isinteger (TREE_REAL_CST_PTR (t), TYPE_MODE (TREE_TYPE (t)));
case COND_EXPR:
return RECURSE (TREE_OPERAND (t, 1)) && RECURSE (TREE_OPERAND (t, 2));
case SSA_NAME:
/* Limit the depth of recursion to avoid quadratic behavior.
This is expected to catch almost all occurrences in practice.
If this code misses important cases that unbounded recursion
would not, passes that need this information could be revised
to provide it through dataflow propagation. */
return (!name_registered_for_update_p (t)
&& depth < PARAM_VALUE (PARAM_MAX_SSA_NAME_QUERY_DEPTH)
&& gimple_stmt_integer_valued_real_p (SSA_NAME_DEF_STMT (t),
depth));
default:
break;
}
return false;
} | /* Return true if the floating point expression T (a GIMPLE_SINGLE_RHS)
has an integer value. We also allow +Inf, -Inf and NaN to be
considered integer values. Return false for signaling NaN.
DEPTH is the current nesting depth of the query. */ | Return true if the floating point expression T (a GIMPLE_SINGLE_RHS)
has an integer value. We also allow +Inf, -Inf and NaN to be
considered integer values. Return false for signaling NaN.
DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"expression",
"T",
"(",
"a",
"GIMPLE_SINGLE_RHS",
")",
"has",
"an",
"integer",
"value",
".",
"We",
"also",
"allow",
"+",
"Inf",
"-",
"Inf",
"and",
"NaN",
"to",
"be",
"considered",
"integer",
"values",
".",
"Return",
"false",
"for",
"signaling",
"NaN",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
integer_valued_real_single_p (tree t, int depth)
{
switch (TREE_CODE (t))
{
case REAL_CST:
return real_isinteger (TREE_REAL_CST_PTR (t), TYPE_MODE (TREE_TYPE (t)));
case COND_EXPR:
return RECURSE (TREE_OPERAND (t, 1)) && RECURSE (TREE_OPERAND (t, 2));
case SSA_NAME:
return (!name_registered_for_update_p (t)
&& depth < PARAM_VALUE (PARAM_MAX_SSA_NAME_QUERY_DEPTH)
&& gimple_stmt_integer_valued_real_p (SSA_NAME_DEF_STMT (t),
depth));
default:
break;
}
return false;
} | [
"bool",
"integer_valued_real_single_p",
"(",
"tree",
"t",
",",
"int",
"depth",
")",
"{",
"switch",
"(",
"TREE_CODE",
"(",
"t",
")",
")",
"{",
"case",
"REAL_CST",
":",
"return",
"real_isinteger",
"(",
"TREE_REAL_CST_PTR",
"(",
"t",
")",
",",
"TYPE_MODE",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
")",
";",
"case",
"COND_EXPR",
":",
"return",
"RECURSE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
"&&",
"RECURSE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"2",
")",
")",
";",
"case",
"SSA_NAME",
":",
"return",
"(",
"!",
"name_registered_for_update_p",
"(",
"t",
")",
"&&",
"depth",
"<",
"PARAM_VALUE",
"(",
"PARAM_MAX_SSA_NAME_QUERY_DEPTH",
")",
"&&",
"gimple_stmt_integer_valued_real_p",
"(",
"SSA_NAME_DEF_STMT",
"(",
"t",
")",
",",
"depth",
")",
")",
";",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] | Return true if the floating point expression T (a GIMPLE_SINGLE_RHS)
has an integer value. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"expression",
"T",
"(",
"a",
"GIMPLE_SINGLE_RHS",
")",
"has",
"an",
"integer",
"value",
"."
] | [
"/* Limit the depth of recursion to avoid quadratic behavior.\n\t This is expected to catch almost all occurrences in practice.\n\t If this code misses important cases that unbounded recursion\n\t would not, passes that need this information could be revised\n\t to provide it through dataflow propagation. */"
] | [
{
"param": "t",
"type": "tree"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | integer_valued_real_invalid_p | bool | static bool
integer_valued_real_invalid_p (tree t, int depth)
{
switch (TREE_CODE (t))
{
case COMPOUND_EXPR:
case MODIFY_EXPR:
case BIND_EXPR:
return RECURSE (TREE_OPERAND (t, 1));
case SAVE_EXPR:
return RECURSE (TREE_OPERAND (t, 0));
default:
break;
}
return false;
} | /* Return true if the floating point expression T (a GIMPLE_INVALID_RHS)
has an integer value. We also allow +Inf, -Inf and NaN to be
considered integer values. Return false for signaling NaN.
DEPTH is the current nesting depth of the query. */ | Return true if the floating point expression T (a GIMPLE_INVALID_RHS)
has an integer value. We also allow +Inf, -Inf and NaN to be
considered integer values. Return false for signaling NaN.
DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"expression",
"T",
"(",
"a",
"GIMPLE_INVALID_RHS",
")",
"has",
"an",
"integer",
"value",
".",
"We",
"also",
"allow",
"+",
"Inf",
"-",
"Inf",
"and",
"NaN",
"to",
"be",
"considered",
"integer",
"values",
".",
"Return",
"false",
"for",
"signaling",
"NaN",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | static bool
integer_valued_real_invalid_p (tree t, int depth)
{
switch (TREE_CODE (t))
{
case COMPOUND_EXPR:
case MODIFY_EXPR:
case BIND_EXPR:
return RECURSE (TREE_OPERAND (t, 1));
case SAVE_EXPR:
return RECURSE (TREE_OPERAND (t, 0));
default:
break;
}
return false;
} | [
"static",
"bool",
"integer_valued_real_invalid_p",
"(",
"tree",
"t",
",",
"int",
"depth",
")",
"{",
"switch",
"(",
"TREE_CODE",
"(",
"t",
")",
")",
"{",
"case",
"COMPOUND_EXPR",
":",
"case",
"MODIFY_EXPR",
":",
"case",
"BIND_EXPR",
":",
"return",
"RECURSE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
";",
"case",
"SAVE_EXPR",
":",
"return",
"RECURSE",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
")",
";",
"default",
":",
"break",
";",
"}",
"return",
"false",
";",
"}"
] | Return true if the floating point expression T (a GIMPLE_INVALID_RHS)
has an integer value. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"expression",
"T",
"(",
"a",
"GIMPLE_INVALID_RHS",
")",
"has",
"an",
"integer",
"value",
"."
] | [] | [
{
"param": "t",
"type": "tree"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | integer_valued_real_p | bool | bool
integer_valued_real_p (tree t, int depth)
{
if (t == error_mark_node)
return false;
tree_code code = TREE_CODE (t);
switch (TREE_CODE_CLASS (code))
{
case tcc_binary:
case tcc_comparison:
return integer_valued_real_binary_p (code, TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1), depth);
case tcc_unary:
return integer_valued_real_unary_p (code, TREE_OPERAND (t, 0), depth);
case tcc_constant:
case tcc_declaration:
case tcc_reference:
return integer_valued_real_single_p (t, depth);
default:
break;
}
switch (code)
{
case COND_EXPR:
case SSA_NAME:
return integer_valued_real_single_p (t, depth);
case CALL_EXPR:
{
tree arg0 = (call_expr_nargs (t) > 0
? CALL_EXPR_ARG (t, 0)
: NULL_TREE);
tree arg1 = (call_expr_nargs (t) > 1
? CALL_EXPR_ARG (t, 1)
: NULL_TREE);
return integer_valued_real_call_p (get_call_combined_fn (t),
arg0, arg1, depth);
}
default:
return integer_valued_real_invalid_p (t, depth);
}
} | /* Return true if the floating point expression T has an integer value.
We also allow +Inf, -Inf and NaN to be considered integer values.
Return false for signaling NaN.
DEPTH is the current nesting depth of the query. */ | Return true if the floating point expression T has an integer value.
We also allow +Inf, -Inf and NaN to be considered integer values.
Return false for signaling NaN.
DEPTH is the current nesting depth of the query. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"expression",
"T",
"has",
"an",
"integer",
"value",
".",
"We",
"also",
"allow",
"+",
"Inf",
"-",
"Inf",
"and",
"NaN",
"to",
"be",
"considered",
"integer",
"values",
".",
"Return",
"false",
"for",
"signaling",
"NaN",
".",
"DEPTH",
"is",
"the",
"current",
"nesting",
"depth",
"of",
"the",
"query",
"."
] | bool
integer_valued_real_p (tree t, int depth)
{
if (t == error_mark_node)
return false;
tree_code code = TREE_CODE (t);
switch (TREE_CODE_CLASS (code))
{
case tcc_binary:
case tcc_comparison:
return integer_valued_real_binary_p (code, TREE_OPERAND (t, 0),
TREE_OPERAND (t, 1), depth);
case tcc_unary:
return integer_valued_real_unary_p (code, TREE_OPERAND (t, 0), depth);
case tcc_constant:
case tcc_declaration:
case tcc_reference:
return integer_valued_real_single_p (t, depth);
default:
break;
}
switch (code)
{
case COND_EXPR:
case SSA_NAME:
return integer_valued_real_single_p (t, depth);
case CALL_EXPR:
{
tree arg0 = (call_expr_nargs (t) > 0
? CALL_EXPR_ARG (t, 0)
: NULL_TREE);
tree arg1 = (call_expr_nargs (t) > 1
? CALL_EXPR_ARG (t, 1)
: NULL_TREE);
return integer_valued_real_call_p (get_call_combined_fn (t),
arg0, arg1, depth);
}
default:
return integer_valued_real_invalid_p (t, depth);
}
} | [
"bool",
"integer_valued_real_p",
"(",
"tree",
"t",
",",
"int",
"depth",
")",
"{",
"if",
"(",
"t",
"==",
"error_mark_node",
")",
"return",
"false",
";",
"tree_code",
"code",
"=",
"TREE_CODE",
"(",
"t",
")",
";",
"switch",
"(",
"TREE_CODE_CLASS",
"(",
"code",
")",
")",
"{",
"case",
"tcc_binary",
":",
"case",
"tcc_comparison",
":",
"return",
"integer_valued_real_binary_p",
"(",
"code",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
",",
"depth",
")",
";",
"case",
"tcc_unary",
":",
"return",
"integer_valued_real_unary_p",
"(",
"code",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
",",
"depth",
")",
";",
"case",
"tcc_constant",
":",
"case",
"tcc_declaration",
":",
"case",
"tcc_reference",
":",
"return",
"integer_valued_real_single_p",
"(",
"t",
",",
"depth",
")",
";",
"default",
":",
"break",
";",
"}",
"switch",
"(",
"code",
")",
"{",
"case",
"COND_EXPR",
":",
"case",
"SSA_NAME",
":",
"return",
"integer_valued_real_single_p",
"(",
"t",
",",
"depth",
")",
";",
"case",
"CALL_EXPR",
":",
"{",
"tree",
"arg0",
"=",
"(",
"call_expr_nargs",
"(",
"t",
")",
">",
"0",
"?",
"CALL_EXPR_ARG",
"(",
"t",
",",
"0",
")",
":",
"NULL_TREE",
")",
";",
"tree",
"arg1",
"=",
"(",
"call_expr_nargs",
"(",
"t",
")",
">",
"1",
"?",
"CALL_EXPR_ARG",
"(",
"t",
",",
"1",
")",
":",
"NULL_TREE",
")",
";",
"return",
"integer_valued_real_call_p",
"(",
"get_call_combined_fn",
"(",
"t",
")",
",",
"arg0",
",",
"arg1",
",",
"depth",
")",
";",
"}",
"default",
":",
"return",
"integer_valued_real_invalid_p",
"(",
"t",
",",
"depth",
")",
";",
"}",
"}"
] | Return true if the floating point expression T has an integer value. | [
"Return",
"true",
"if",
"the",
"floating",
"point",
"expression",
"T",
"has",
"an",
"integer",
"value",
"."
] | [] | [
{
"param": "t",
"type": "tree"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_binary_to_constant | tree | tree
fold_binary_to_constant (enum tree_code code, tree type, tree op0, tree op1)
{
tree tem = fold_binary (code, type, op0, op1);
return (tem && TREE_CONSTANT (tem)) ? tem : NULL_TREE;
} | /* Given the components of a binary expression CODE, TYPE, OP0 and OP1,
attempt to fold the expression to a constant without modifying TYPE,
OP0 or OP1.
If the expression could be simplified to a constant, then return
the constant. If the expression would not be simplified to a
constant, then return NULL_TREE. */ | Given the components of a binary expression CODE, TYPE, OP0 and OP1,
attempt to fold the expression to a constant without modifying TYPE,
OP0 or OP1.
If the expression could be simplified to a constant, then return
the constant. If the expression would not be simplified to a
constant, then return NULL_TREE. | [
"Given",
"the",
"components",
"of",
"a",
"binary",
"expression",
"CODE",
"TYPE",
"OP0",
"and",
"OP1",
"attempt",
"to",
"fold",
"the",
"expression",
"to",
"a",
"constant",
"without",
"modifying",
"TYPE",
"OP0",
"or",
"OP1",
".",
"If",
"the",
"expression",
"could",
"be",
"simplified",
"to",
"a",
"constant",
"then",
"return",
"the",
"constant",
".",
"If",
"the",
"expression",
"would",
"not",
"be",
"simplified",
"to",
"a",
"constant",
"then",
"return",
"NULL_TREE",
"."
] | tree
fold_binary_to_constant (enum tree_code code, tree type, tree op0, tree op1)
{
tree tem = fold_binary (code, type, op0, op1);
return (tem && TREE_CONSTANT (tem)) ? tem : NULL_TREE;
} | [
"tree",
"fold_binary_to_constant",
"(",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"op0",
",",
"tree",
"op1",
")",
"{",
"tree",
"tem",
"=",
"fold_binary",
"(",
"code",
",",
"type",
",",
"op0",
",",
"op1",
")",
";",
"return",
"(",
"tem",
"&&",
"TREE_CONSTANT",
"(",
"tem",
")",
")",
"?",
"tem",
":",
"NULL_TREE",
";",
"}"
] | Given the components of a binary expression CODE, TYPE, OP0 and OP1,
attempt to fold the expression to a constant without modifying TYPE,
OP0 or OP1. | [
"Given",
"the",
"components",
"of",
"a",
"binary",
"expression",
"CODE",
"TYPE",
"OP0",
"and",
"OP1",
"attempt",
"to",
"fold",
"the",
"expression",
"to",
"a",
"constant",
"without",
"modifying",
"TYPE",
"OP0",
"or",
"OP1",
"."
] | [] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "op0",
"type": "tree"
},
{
"param": "op1",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_unary_to_constant | tree | tree
fold_unary_to_constant (enum tree_code code, tree type, tree op0)
{
tree tem = fold_unary (code, type, op0);
return (tem && TREE_CONSTANT (tem)) ? tem : NULL_TREE;
} | /* Given the components of a unary expression CODE, TYPE and OP0,
attempt to fold the expression to a constant without modifying
TYPE or OP0.
If the expression could be simplified to a constant, then return
the constant. If the expression would not be simplified to a
constant, then return NULL_TREE. */ | Given the components of a unary expression CODE, TYPE and OP0,
attempt to fold the expression to a constant without modifying
TYPE or OP0.
If the expression could be simplified to a constant, then return
the constant. If the expression would not be simplified to a
constant, then return NULL_TREE. | [
"Given",
"the",
"components",
"of",
"a",
"unary",
"expression",
"CODE",
"TYPE",
"and",
"OP0",
"attempt",
"to",
"fold",
"the",
"expression",
"to",
"a",
"constant",
"without",
"modifying",
"TYPE",
"or",
"OP0",
".",
"If",
"the",
"expression",
"could",
"be",
"simplified",
"to",
"a",
"constant",
"then",
"return",
"the",
"constant",
".",
"If",
"the",
"expression",
"would",
"not",
"be",
"simplified",
"to",
"a",
"constant",
"then",
"return",
"NULL_TREE",
"."
] | tree
fold_unary_to_constant (enum tree_code code, tree type, tree op0)
{
tree tem = fold_unary (code, type, op0);
return (tem && TREE_CONSTANT (tem)) ? tem : NULL_TREE;
} | [
"tree",
"fold_unary_to_constant",
"(",
"enum",
"tree_code",
"code",
",",
"tree",
"type",
",",
"tree",
"op0",
")",
"{",
"tree",
"tem",
"=",
"fold_unary",
"(",
"code",
",",
"type",
",",
"op0",
")",
";",
"return",
"(",
"tem",
"&&",
"TREE_CONSTANT",
"(",
"tem",
")",
")",
"?",
"tem",
":",
"NULL_TREE",
";",
"}"
] | Given the components of a unary expression CODE, TYPE and OP0,
attempt to fold the expression to a constant without modifying
TYPE or OP0. | [
"Given",
"the",
"components",
"of",
"a",
"unary",
"expression",
"CODE",
"TYPE",
"and",
"OP0",
"attempt",
"to",
"fold",
"the",
"expression",
"to",
"a",
"constant",
"without",
"modifying",
"TYPE",
"or",
"OP0",
"."
] | [] | [
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "type",
"type": "tree"
},
{
"param": "op0",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "op0",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_read_from_constant_string | tree | tree
fold_read_from_constant_string (tree exp)
{
if ((TREE_CODE (exp) == INDIRECT_REF
|| TREE_CODE (exp) == ARRAY_REF)
&& TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE)
{
tree exp1 = TREE_OPERAND (exp, 0);
tree index;
tree string;
location_t loc = EXPR_LOCATION (exp);
if (TREE_CODE (exp) == INDIRECT_REF)
string = string_constant (exp1, &index);
else
{
tree low_bound = array_ref_low_bound (exp);
index = fold_convert_loc (loc, sizetype, TREE_OPERAND (exp, 1));
/* Optimize the special-case of a zero lower bound.
We convert the low_bound to sizetype to avoid some problems
with constant folding. (E.g. suppose the lower bound is 1,
and its mode is QI. Without the conversion,l (ARRAY
+(INDEX-(unsigned char)1)) becomes ((ARRAY+(-(unsigned char)1))
+INDEX), which becomes (ARRAY+255+INDEX). Oops!) */
if (! integer_zerop (low_bound))
index = size_diffop_loc (loc, index,
fold_convert_loc (loc, sizetype, low_bound));
string = exp1;
}
scalar_int_mode char_mode;
if (string
&& TYPE_MODE (TREE_TYPE (exp)) == TYPE_MODE (TREE_TYPE (TREE_TYPE (string)))
&& TREE_CODE (string) == STRING_CST
&& TREE_CODE (index) == INTEGER_CST
&& compare_tree_int (index, TREE_STRING_LENGTH (string)) < 0
&& is_int_mode (TYPE_MODE (TREE_TYPE (TREE_TYPE (string))),
&char_mode)
&& GET_MODE_SIZE (char_mode) == 1)
return build_int_cst_type (TREE_TYPE (exp),
(TREE_STRING_POINTER (string)
[TREE_INT_CST_LOW (index)]));
}
return NULL;
} | /* If EXP represents referencing an element in a constant string
(either via pointer arithmetic or array indexing), return the
tree representing the value accessed, otherwise return NULL. */ | If EXP represents referencing an element in a constant string
(either via pointer arithmetic or array indexing), return the
tree representing the value accessed, otherwise return NULL. | [
"If",
"EXP",
"represents",
"referencing",
"an",
"element",
"in",
"a",
"constant",
"string",
"(",
"either",
"via",
"pointer",
"arithmetic",
"or",
"array",
"indexing",
")",
"return",
"the",
"tree",
"representing",
"the",
"value",
"accessed",
"otherwise",
"return",
"NULL",
"."
] | tree
fold_read_from_constant_string (tree exp)
{
if ((TREE_CODE (exp) == INDIRECT_REF
|| TREE_CODE (exp) == ARRAY_REF)
&& TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE)
{
tree exp1 = TREE_OPERAND (exp, 0);
tree index;
tree string;
location_t loc = EXPR_LOCATION (exp);
if (TREE_CODE (exp) == INDIRECT_REF)
string = string_constant (exp1, &index);
else
{
tree low_bound = array_ref_low_bound (exp);
index = fold_convert_loc (loc, sizetype, TREE_OPERAND (exp, 1));
if (! integer_zerop (low_bound))
index = size_diffop_loc (loc, index,
fold_convert_loc (loc, sizetype, low_bound));
string = exp1;
}
scalar_int_mode char_mode;
if (string
&& TYPE_MODE (TREE_TYPE (exp)) == TYPE_MODE (TREE_TYPE (TREE_TYPE (string)))
&& TREE_CODE (string) == STRING_CST
&& TREE_CODE (index) == INTEGER_CST
&& compare_tree_int (index, TREE_STRING_LENGTH (string)) < 0
&& is_int_mode (TYPE_MODE (TREE_TYPE (TREE_TYPE (string))),
&char_mode)
&& GET_MODE_SIZE (char_mode) == 1)
return build_int_cst_type (TREE_TYPE (exp),
(TREE_STRING_POINTER (string)
[TREE_INT_CST_LOW (index)]));
}
return NULL;
} | [
"tree",
"fold_read_from_constant_string",
"(",
"tree",
"exp",
")",
"{",
"if",
"(",
"(",
"TREE_CODE",
"(",
"exp",
")",
"==",
"INDIRECT_REF",
"||",
"TREE_CODE",
"(",
"exp",
")",
"==",
"ARRAY_REF",
")",
"&&",
"TREE_CODE",
"(",
"TREE_TYPE",
"(",
"exp",
")",
")",
"==",
"INTEGER_TYPE",
")",
"{",
"tree",
"exp1",
"=",
"TREE_OPERAND",
"(",
"exp",
",",
"0",
")",
";",
"tree",
"index",
";",
"tree",
"string",
";",
"location_t",
"loc",
"=",
"EXPR_LOCATION",
"(",
"exp",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"exp",
")",
"==",
"INDIRECT_REF",
")",
"string",
"=",
"string_constant",
"(",
"exp1",
",",
"&",
"index",
")",
";",
"else",
"{",
"tree",
"low_bound",
"=",
"array_ref_low_bound",
"(",
"exp",
")",
";",
"index",
"=",
"fold_convert_loc",
"(",
"loc",
",",
"sizetype",
",",
"TREE_OPERAND",
"(",
"exp",
",",
"1",
")",
")",
";",
"if",
"(",
"!",
"integer_zerop",
"(",
"low_bound",
")",
")",
"index",
"=",
"size_diffop_loc",
"(",
"loc",
",",
"index",
",",
"fold_convert_loc",
"(",
"loc",
",",
"sizetype",
",",
"low_bound",
")",
")",
";",
"string",
"=",
"exp1",
";",
"}",
"scalar_int_mode",
"char_mode",
";",
"if",
"(",
"string",
"&&",
"TYPE_MODE",
"(",
"TREE_TYPE",
"(",
"exp",
")",
")",
"==",
"TYPE_MODE",
"(",
"TREE_TYPE",
"(",
"TREE_TYPE",
"(",
"string",
")",
")",
")",
"&&",
"TREE_CODE",
"(",
"string",
")",
"==",
"STRING_CST",
"&&",
"TREE_CODE",
"(",
"index",
")",
"==",
"INTEGER_CST",
"&&",
"compare_tree_int",
"(",
"index",
",",
"TREE_STRING_LENGTH",
"(",
"string",
")",
")",
"<",
"0",
"&&",
"is_int_mode",
"(",
"TYPE_MODE",
"(",
"TREE_TYPE",
"(",
"TREE_TYPE",
"(",
"string",
")",
")",
")",
",",
"&",
"char_mode",
")",
"&&",
"GET_MODE_SIZE",
"(",
"char_mode",
")",
"==",
"1",
")",
"return",
"build_int_cst_type",
"(",
"TREE_TYPE",
"(",
"exp",
")",
",",
"(",
"TREE_STRING_POINTER",
"(",
"string",
")",
"[",
"TREE_INT_CST_LOW",
"(",
"index",
")",
"]",
")",
")",
";",
"}",
"return",
"NULL",
";",
"}"
] | If EXP represents referencing an element in a constant string
(either via pointer arithmetic or array indexing), return the
tree representing the value accessed, otherwise return NULL. | [
"If",
"EXP",
"represents",
"referencing",
"an",
"element",
"in",
"a",
"constant",
"string",
"(",
"either",
"via",
"pointer",
"arithmetic",
"or",
"array",
"indexing",
")",
"return",
"the",
"tree",
"representing",
"the",
"value",
"accessed",
"otherwise",
"return",
"NULL",
"."
] | [
"/* Optimize the special-case of a zero lower bound.\n\n\t We convert the low_bound to sizetype to avoid some problems\n\t with constant folding. (E.g. suppose the lower bound is 1,\n\t and its mode is QI. Without the conversion,l (ARRAY\n\t +(INDEX-(unsigned char)1)) becomes ((ARRAY+(-(unsigned char)1))\n\t +INDEX), which becomes (ARRAY+255+INDEX). Oops!) */"
] | [
{
"param": "exp",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "exp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_build_cleanup_point_expr | tree | tree
fold_build_cleanup_point_expr (tree type, tree expr)
{
/* If the expression does not have side effects then we don't have to wrap
it with a cleanup point expression. */
if (!TREE_SIDE_EFFECTS (expr))
return expr;
/* If the expression is a return, check to see if the expression inside the
return has no side effects or the right hand side of the modify expression
inside the return. If either don't have side effects set we don't need to
wrap the expression in a cleanup point expression. Note we don't check the
left hand side of the modify because it should always be a return decl. */
if (TREE_CODE (expr) == RETURN_EXPR)
{
tree op = TREE_OPERAND (expr, 0);
if (!op || !TREE_SIDE_EFFECTS (op))
return expr;
op = TREE_OPERAND (op, 1);
if (!TREE_SIDE_EFFECTS (op))
return expr;
}
return build1_loc (EXPR_LOCATION (expr), CLEANUP_POINT_EXPR, type, expr);
} | /* If necessary, return a CLEANUP_POINT_EXPR for EXPR with the
indicated TYPE. If no CLEANUP_POINT_EXPR is necessary, return EXPR
itself. */ | If necessary, return a CLEANUP_POINT_EXPR for EXPR with the
indicated TYPE. If no CLEANUP_POINT_EXPR is necessary, return EXPR
itself. | [
"If",
"necessary",
"return",
"a",
"CLEANUP_POINT_EXPR",
"for",
"EXPR",
"with",
"the",
"indicated",
"TYPE",
".",
"If",
"no",
"CLEANUP_POINT_EXPR",
"is",
"necessary",
"return",
"EXPR",
"itself",
"."
] | tree
fold_build_cleanup_point_expr (tree type, tree expr)
{
if (!TREE_SIDE_EFFECTS (expr))
return expr;
if (TREE_CODE (expr) == RETURN_EXPR)
{
tree op = TREE_OPERAND (expr, 0);
if (!op || !TREE_SIDE_EFFECTS (op))
return expr;
op = TREE_OPERAND (op, 1);
if (!TREE_SIDE_EFFECTS (op))
return expr;
}
return build1_loc (EXPR_LOCATION (expr), CLEANUP_POINT_EXPR, type, expr);
} | [
"tree",
"fold_build_cleanup_point_expr",
"(",
"tree",
"type",
",",
"tree",
"expr",
")",
"{",
"if",
"(",
"!",
"TREE_SIDE_EFFECTS",
"(",
"expr",
")",
")",
"return",
"expr",
";",
"if",
"(",
"TREE_CODE",
"(",
"expr",
")",
"==",
"RETURN_EXPR",
")",
"{",
"tree",
"op",
"=",
"TREE_OPERAND",
"(",
"expr",
",",
"0",
")",
";",
"if",
"(",
"!",
"op",
"||",
"!",
"TREE_SIDE_EFFECTS",
"(",
"op",
")",
")",
"return",
"expr",
";",
"op",
"=",
"TREE_OPERAND",
"(",
"op",
",",
"1",
")",
";",
"if",
"(",
"!",
"TREE_SIDE_EFFECTS",
"(",
"op",
")",
")",
"return",
"expr",
";",
"}",
"return",
"build1_loc",
"(",
"EXPR_LOCATION",
"(",
"expr",
")",
",",
"CLEANUP_POINT_EXPR",
",",
"type",
",",
"expr",
")",
";",
"}"
] | If necessary, return a CLEANUP_POINT_EXPR for EXPR with the
indicated TYPE. | [
"If",
"necessary",
"return",
"a",
"CLEANUP_POINT_EXPR",
"for",
"EXPR",
"with",
"the",
"indicated",
"TYPE",
"."
] | [
"/* If the expression does not have side effects then we don't have to wrap\n it with a cleanup point expression. */",
"/* If the expression is a return, check to see if the expression inside the\n return has no side effects or the right hand side of the modify expression\n inside the return. If either don't have side effects set we don't need to\n wrap the expression in a cleanup point expression. Note we don't check the\n left hand side of the modify because it should always be a return decl. */"
] | [
{
"param": "type",
"type": "tree"
},
{
"param": "expr",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "expr",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | build_fold_indirect_ref_loc | tree | tree
build_fold_indirect_ref_loc (location_t loc, tree t)
{
tree type = TREE_TYPE (TREE_TYPE (t));
tree sub = fold_indirect_ref_1 (loc, type, t);
if (sub)
return sub;
return build1_loc (loc, INDIRECT_REF, type, t);
} | /* Builds an expression for an indirection through T, simplifying some
cases. */ | Builds an expression for an indirection through T, simplifying some
cases. | [
"Builds",
"an",
"expression",
"for",
"an",
"indirection",
"through",
"T",
"simplifying",
"some",
"cases",
"."
] | tree
build_fold_indirect_ref_loc (location_t loc, tree t)
{
tree type = TREE_TYPE (TREE_TYPE (t));
tree sub = fold_indirect_ref_1 (loc, type, t);
if (sub)
return sub;
return build1_loc (loc, INDIRECT_REF, type, t);
} | [
"tree",
"build_fold_indirect_ref_loc",
"(",
"location_t",
"loc",
",",
"tree",
"t",
")",
"{",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
";",
"tree",
"sub",
"=",
"fold_indirect_ref_1",
"(",
"loc",
",",
"type",
",",
"t",
")",
";",
"if",
"(",
"sub",
")",
"return",
"sub",
";",
"return",
"build1_loc",
"(",
"loc",
",",
"INDIRECT_REF",
",",
"type",
",",
"t",
")",
";",
"}"
] | Builds an expression for an indirection through T, simplifying some
cases. | [
"Builds",
"an",
"expression",
"for",
"an",
"indirection",
"through",
"T",
"simplifying",
"some",
"cases",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_indirect_ref_loc | tree | tree
fold_indirect_ref_loc (location_t loc, tree t)
{
tree sub = fold_indirect_ref_1 (loc, TREE_TYPE (t), TREE_OPERAND (t, 0));
if (sub)
return sub;
else
return t;
} | /* Given an INDIRECT_REF T, return either T or a simplified version. */ | Given an INDIRECT_REF T, return either T or a simplified version. | [
"Given",
"an",
"INDIRECT_REF",
"T",
"return",
"either",
"T",
"or",
"a",
"simplified",
"version",
"."
] | tree
fold_indirect_ref_loc (location_t loc, tree t)
{
tree sub = fold_indirect_ref_1 (loc, TREE_TYPE (t), TREE_OPERAND (t, 0));
if (sub)
return sub;
else
return t;
} | [
"tree",
"fold_indirect_ref_loc",
"(",
"location_t",
"loc",
",",
"tree",
"t",
")",
"{",
"tree",
"sub",
"=",
"fold_indirect_ref_1",
"(",
"loc",
",",
"TREE_TYPE",
"(",
"t",
")",
",",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
")",
";",
"if",
"(",
"sub",
")",
"return",
"sub",
";",
"else",
"return",
"t",
";",
"}"
] | Given an INDIRECT_REF T, return either T or a simplified version. | [
"Given",
"an",
"INDIRECT_REF",
"T",
"return",
"either",
"T",
"or",
"a",
"simplified",
"version",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_ignored_result | tree | tree
fold_ignored_result (tree t)
{
if (!TREE_SIDE_EFFECTS (t))
return integer_zero_node;
for (;;)
switch (TREE_CODE_CLASS (TREE_CODE (t)))
{
case tcc_unary:
t = TREE_OPERAND (t, 0);
break;
case tcc_binary:
case tcc_comparison:
if (!TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1)))
t = TREE_OPERAND (t, 0);
else if (!TREE_SIDE_EFFECTS (TREE_OPERAND (t, 0)))
t = TREE_OPERAND (t, 1);
else
return t;
break;
case tcc_expression:
switch (TREE_CODE (t))
{
case COMPOUND_EXPR:
if (TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1)))
return t;
t = TREE_OPERAND (t, 0);
break;
case COND_EXPR:
if (TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1))
|| TREE_SIDE_EFFECTS (TREE_OPERAND (t, 2)))
return t;
t = TREE_OPERAND (t, 0);
break;
default:
return t;
}
break;
default:
return t;
}
} | /* Strip non-trapping, non-side-effecting tree nodes from an expression
whose result is ignored. The type of the returned tree need not be
the same as the original expression. */ | Strip non-trapping, non-side-effecting tree nodes from an expression
whose result is ignored. The type of the returned tree need not be
the same as the original expression. | [
"Strip",
"non",
"-",
"trapping",
"non",
"-",
"side",
"-",
"effecting",
"tree",
"nodes",
"from",
"an",
"expression",
"whose",
"result",
"is",
"ignored",
".",
"The",
"type",
"of",
"the",
"returned",
"tree",
"need",
"not",
"be",
"the",
"same",
"as",
"the",
"original",
"expression",
"."
] | tree
fold_ignored_result (tree t)
{
if (!TREE_SIDE_EFFECTS (t))
return integer_zero_node;
for (;;)
switch (TREE_CODE_CLASS (TREE_CODE (t)))
{
case tcc_unary:
t = TREE_OPERAND (t, 0);
break;
case tcc_binary:
case tcc_comparison:
if (!TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1)))
t = TREE_OPERAND (t, 0);
else if (!TREE_SIDE_EFFECTS (TREE_OPERAND (t, 0)))
t = TREE_OPERAND (t, 1);
else
return t;
break;
case tcc_expression:
switch (TREE_CODE (t))
{
case COMPOUND_EXPR:
if (TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1)))
return t;
t = TREE_OPERAND (t, 0);
break;
case COND_EXPR:
if (TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1))
|| TREE_SIDE_EFFECTS (TREE_OPERAND (t, 2)))
return t;
t = TREE_OPERAND (t, 0);
break;
default:
return t;
}
break;
default:
return t;
}
} | [
"tree",
"fold_ignored_result",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"!",
"TREE_SIDE_EFFECTS",
"(",
"t",
")",
")",
"return",
"integer_zero_node",
";",
"for",
"(",
";",
";",
")",
"switch",
"(",
"TREE_CODE_CLASS",
"(",
"TREE_CODE",
"(",
"t",
")",
")",
")",
"{",
"case",
"tcc_unary",
":",
"t",
"=",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
";",
"break",
";",
"case",
"tcc_binary",
":",
"case",
"tcc_comparison",
":",
"if",
"(",
"!",
"TREE_SIDE_EFFECTS",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
")",
"t",
"=",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
";",
"else",
"if",
"(",
"!",
"TREE_SIDE_EFFECTS",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
")",
")",
"t",
"=",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
";",
"else",
"return",
"t",
";",
"break",
";",
"case",
"tcc_expression",
":",
"switch",
"(",
"TREE_CODE",
"(",
"t",
")",
")",
"{",
"case",
"COMPOUND_EXPR",
":",
"if",
"(",
"TREE_SIDE_EFFECTS",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
")",
"return",
"t",
";",
"t",
"=",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
";",
"break",
";",
"case",
"COND_EXPR",
":",
"if",
"(",
"TREE_SIDE_EFFECTS",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"1",
")",
")",
"||",
"TREE_SIDE_EFFECTS",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"2",
")",
")",
")",
"return",
"t",
";",
"t",
"=",
"TREE_OPERAND",
"(",
"t",
",",
"0",
")",
";",
"break",
";",
"default",
":",
"return",
"t",
";",
"}",
"break",
";",
"default",
":",
"return",
"t",
";",
"}",
"}"
] | Strip non-trapping, non-side-effecting tree nodes from an expression
whose result is ignored. | [
"Strip",
"non",
"-",
"trapping",
"non",
"-",
"side",
"-",
"effecting",
"tree",
"nodes",
"from",
"an",
"expression",
"whose",
"result",
"is",
"ignored",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | ptr_difference_const | bool | bool
ptr_difference_const (tree e1, tree e2, poly_int64_pod *diff)
{
tree core1, core2;
poly_int64 bitpos1, bitpos2;
tree toffset1, toffset2, tdiff, type;
core1 = split_address_to_core_and_offset (e1, &bitpos1, &toffset1);
core2 = split_address_to_core_and_offset (e2, &bitpos2, &toffset2);
poly_int64 bytepos1, bytepos2;
if (!multiple_p (bitpos1, BITS_PER_UNIT, &bytepos1)
|| !multiple_p (bitpos2, BITS_PER_UNIT, &bytepos2)
|| !operand_equal_p (core1, core2, 0))
return false;
if (toffset1 && toffset2)
{
type = TREE_TYPE (toffset1);
if (type != TREE_TYPE (toffset2))
toffset2 = fold_convert (type, toffset2);
tdiff = fold_build2 (MINUS_EXPR, type, toffset1, toffset2);
if (!cst_and_fits_in_hwi (tdiff))
return false;
*diff = int_cst_value (tdiff);
}
else if (toffset1 || toffset2)
{
/* If only one of the offsets is non-constant, the difference cannot
be a constant. */
return false;
}
else
*diff = 0;
*diff += bytepos1 - bytepos2;
return true;
} | /* Returns true if addresses of E1 and E2 differ by a constant, false
otherwise. If they do, E1 - E2 is stored in *DIFF. */ | Returns true if addresses of E1 and E2 differ by a constant, false
otherwise. If they do, E1 - E2 is stored in *DIFF. | [
"Returns",
"true",
"if",
"addresses",
"of",
"E1",
"and",
"E2",
"differ",
"by",
"a",
"constant",
"false",
"otherwise",
".",
"If",
"they",
"do",
"E1",
"-",
"E2",
"is",
"stored",
"in",
"*",
"DIFF",
"."
] | bool
ptr_difference_const (tree e1, tree e2, poly_int64_pod *diff)
{
tree core1, core2;
poly_int64 bitpos1, bitpos2;
tree toffset1, toffset2, tdiff, type;
core1 = split_address_to_core_and_offset (e1, &bitpos1, &toffset1);
core2 = split_address_to_core_and_offset (e2, &bitpos2, &toffset2);
poly_int64 bytepos1, bytepos2;
if (!multiple_p (bitpos1, BITS_PER_UNIT, &bytepos1)
|| !multiple_p (bitpos2, BITS_PER_UNIT, &bytepos2)
|| !operand_equal_p (core1, core2, 0))
return false;
if (toffset1 && toffset2)
{
type = TREE_TYPE (toffset1);
if (type != TREE_TYPE (toffset2))
toffset2 = fold_convert (type, toffset2);
tdiff = fold_build2 (MINUS_EXPR, type, toffset1, toffset2);
if (!cst_and_fits_in_hwi (tdiff))
return false;
*diff = int_cst_value (tdiff);
}
else if (toffset1 || toffset2)
{
return false;
}
else
*diff = 0;
*diff += bytepos1 - bytepos2;
return true;
} | [
"bool",
"ptr_difference_const",
"(",
"tree",
"e1",
",",
"tree",
"e2",
",",
"poly_int64_pod",
"*",
"diff",
")",
"{",
"tree",
"core1",
",",
"core2",
";",
"poly_int64",
"bitpos1",
",",
"bitpos2",
";",
"tree",
"toffset1",
",",
"toffset2",
",",
"tdiff",
",",
"type",
";",
"core1",
"=",
"split_address_to_core_and_offset",
"(",
"e1",
",",
"&",
"bitpos1",
",",
"&",
"toffset1",
")",
";",
"core2",
"=",
"split_address_to_core_and_offset",
"(",
"e2",
",",
"&",
"bitpos2",
",",
"&",
"toffset2",
")",
";",
"poly_int64",
"bytepos1",
",",
"bytepos2",
";",
"if",
"(",
"!",
"multiple_p",
"(",
"bitpos1",
",",
"BITS_PER_UNIT",
",",
"&",
"bytepos1",
")",
"||",
"!",
"multiple_p",
"(",
"bitpos2",
",",
"BITS_PER_UNIT",
",",
"&",
"bytepos2",
")",
"||",
"!",
"operand_equal_p",
"(",
"core1",
",",
"core2",
",",
"0",
")",
")",
"return",
"false",
";",
"if",
"(",
"toffset1",
"&&",
"toffset2",
")",
"{",
"type",
"=",
"TREE_TYPE",
"(",
"toffset1",
")",
";",
"if",
"(",
"type",
"!=",
"TREE_TYPE",
"(",
"toffset2",
")",
")",
"toffset2",
"=",
"fold_convert",
"(",
"type",
",",
"toffset2",
")",
";",
"tdiff",
"=",
"fold_build2",
"(",
"MINUS_EXPR",
",",
"type",
",",
"toffset1",
",",
"toffset2",
")",
";",
"if",
"(",
"!",
"cst_and_fits_in_hwi",
"(",
"tdiff",
")",
")",
"return",
"false",
";",
"*",
"diff",
"=",
"int_cst_value",
"(",
"tdiff",
")",
";",
"}",
"else",
"if",
"(",
"toffset1",
"||",
"toffset2",
")",
"{",
"return",
"false",
";",
"}",
"else",
"*",
"diff",
"=",
"0",
";",
"*",
"diff",
"+=",
"bytepos1",
"-",
"bytepos2",
";",
"return",
"true",
";",
"}"
] | Returns true if addresses of E1 and E2 differ by a constant, false
otherwise. | [
"Returns",
"true",
"if",
"addresses",
"of",
"E1",
"and",
"E2",
"differ",
"by",
"a",
"constant",
"false",
"otherwise",
"."
] | [
"/* If only one of the offsets is non-constant, the difference cannot\n\t be a constant. */"
] | [
{
"param": "e1",
"type": "tree"
},
{
"param": "e2",
"type": "tree"
},
{
"param": "diff",
"type": "poly_int64_pod"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "e1",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e2",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "diff",
"type": "poly_int64_pod",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | convert_to_ptrofftype_loc | tree | tree
convert_to_ptrofftype_loc (location_t loc, tree off)
{
return fold_convert_loc (loc, sizetype, off);
} | /* Return OFF converted to a pointer offset type suitable as offset for
POINTER_PLUS_EXPR. Use location LOC for this conversion. */ | Return OFF converted to a pointer offset type suitable as offset for
POINTER_PLUS_EXPR. Use location LOC for this conversion. | [
"Return",
"OFF",
"converted",
"to",
"a",
"pointer",
"offset",
"type",
"suitable",
"as",
"offset",
"for",
"POINTER_PLUS_EXPR",
".",
"Use",
"location",
"LOC",
"for",
"this",
"conversion",
"."
] | tree
convert_to_ptrofftype_loc (location_t loc, tree off)
{
return fold_convert_loc (loc, sizetype, off);
} | [
"tree",
"convert_to_ptrofftype_loc",
"(",
"location_t",
"loc",
",",
"tree",
"off",
")",
"{",
"return",
"fold_convert_loc",
"(",
"loc",
",",
"sizetype",
",",
"off",
")",
";",
"}"
] | Return OFF converted to a pointer offset type suitable as offset for
POINTER_PLUS_EXPR. | [
"Return",
"OFF",
"converted",
"to",
"a",
"pointer",
"offset",
"type",
"suitable",
"as",
"offset",
"for",
"POINTER_PLUS_EXPR",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "off",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "off",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_build_pointer_plus_loc | tree | tree
fold_build_pointer_plus_loc (location_t loc, tree ptr, tree off)
{
return fold_build2_loc (loc, POINTER_PLUS_EXPR, TREE_TYPE (ptr),
ptr, convert_to_ptrofftype_loc (loc, off));
} | /* Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. */ | Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. | [
"Build",
"and",
"fold",
"a",
"POINTER_PLUS_EXPR",
"at",
"LOC",
"offsetting",
"PTR",
"by",
"OFF",
"."
] | tree
fold_build_pointer_plus_loc (location_t loc, tree ptr, tree off)
{
return fold_build2_loc (loc, POINTER_PLUS_EXPR, TREE_TYPE (ptr),
ptr, convert_to_ptrofftype_loc (loc, off));
} | [
"tree",
"fold_build_pointer_plus_loc",
"(",
"location_t",
"loc",
",",
"tree",
"ptr",
",",
"tree",
"off",
")",
"{",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"POINTER_PLUS_EXPR",
",",
"TREE_TYPE",
"(",
"ptr",
")",
",",
"ptr",
",",
"convert_to_ptrofftype_loc",
"(",
"loc",
",",
"off",
")",
")",
";",
"}"
] | Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. | [
"Build",
"and",
"fold",
"a",
"POINTER_PLUS_EXPR",
"at",
"LOC",
"offsetting",
"PTR",
"by",
"OFF",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "ptr",
"type": "tree"
},
{
"param": "off",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ptr",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "off",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | fold_build_pointer_plus_hwi_loc | tree | tree
fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE_INT off)
{
return fold_build2_loc (loc, POINTER_PLUS_EXPR, TREE_TYPE (ptr),
ptr, size_int (off));
} | /* Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. */ | Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. | [
"Build",
"and",
"fold",
"a",
"POINTER_PLUS_EXPR",
"at",
"LOC",
"offsetting",
"PTR",
"by",
"OFF",
"."
] | tree
fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE_INT off)
{
return fold_build2_loc (loc, POINTER_PLUS_EXPR, TREE_TYPE (ptr),
ptr, size_int (off));
} | [
"tree",
"fold_build_pointer_plus_hwi_loc",
"(",
"location_t",
"loc",
",",
"tree",
"ptr",
",",
"HOST_WIDE_INT",
"off",
")",
"{",
"return",
"fold_build2_loc",
"(",
"loc",
",",
"POINTER_PLUS_EXPR",
",",
"TREE_TYPE",
"(",
"ptr",
")",
",",
"ptr",
",",
"size_int",
"(",
"off",
")",
")",
";",
"}"
] | Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. | [
"Build",
"and",
"fold",
"a",
"POINTER_PLUS_EXPR",
"at",
"LOC",
"offsetting",
"PTR",
"by",
"OFF",
"."
] | [] | [
{
"param": "loc",
"type": "location_t"
},
{
"param": "ptr",
"type": "tree"
},
{
"param": "off",
"type": "HOST_WIDE_INT"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ptr",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "off",
"type": "HOST_WIDE_INT",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | c_getstr | char | const char *
c_getstr (tree src, unsigned HOST_WIDE_INT *strlen)
{
tree offset_node;
if (strlen)
*strlen = 0;
src = string_constant (src, &offset_node);
if (src == 0)
return NULL;
unsigned HOST_WIDE_INT offset = 0;
if (offset_node != NULL_TREE)
{
if (!tree_fits_uhwi_p (offset_node))
return NULL;
else
offset = tree_to_uhwi (offset_node);
}
unsigned HOST_WIDE_INT string_length = TREE_STRING_LENGTH (src);
const char *string = TREE_STRING_POINTER (src);
/* Support only properly null-terminated strings. */
if (string_length == 0
|| string[string_length - 1] != '\0'
|| offset >= string_length)
return NULL;
if (strlen)
*strlen = string_length - offset;
return string + offset;
} | /* Return a char pointer for a C string if it is a string constant
or sum of string constant and integer constant. We only support
string constants properly terminated with '\0' character.
If STRLEN is a valid pointer, length (including terminating character)
of returned string is stored to the argument. */ | Return a char pointer for a C string if it is a string constant
or sum of string constant and integer constant. We only support
string constants properly terminated with '\0' character.
If STRLEN is a valid pointer, length (including terminating character)
of returned string is stored to the argument. | [
"Return",
"a",
"char",
"pointer",
"for",
"a",
"C",
"string",
"if",
"it",
"is",
"a",
"string",
"constant",
"or",
"sum",
"of",
"string",
"constant",
"and",
"integer",
"constant",
".",
"We",
"only",
"support",
"string",
"constants",
"properly",
"terminated",
"with",
"'",
"\\",
"0",
"'",
"character",
".",
"If",
"STRLEN",
"is",
"a",
"valid",
"pointer",
"length",
"(",
"including",
"terminating",
"character",
")",
"of",
"returned",
"string",
"is",
"stored",
"to",
"the",
"argument",
"."
] | const char *
c_getstr (tree src, unsigned HOST_WIDE_INT *strlen)
{
tree offset_node;
if (strlen)
*strlen = 0;
src = string_constant (src, &offset_node);
if (src == 0)
return NULL;
unsigned HOST_WIDE_INT offset = 0;
if (offset_node != NULL_TREE)
{
if (!tree_fits_uhwi_p (offset_node))
return NULL;
else
offset = tree_to_uhwi (offset_node);
}
unsigned HOST_WIDE_INT string_length = TREE_STRING_LENGTH (src);
const char *string = TREE_STRING_POINTER (src);
if (string_length == 0
|| string[string_length - 1] != '\0'
|| offset >= string_length)
return NULL;
if (strlen)
*strlen = string_length - offset;
return string + offset;
} | [
"const",
"char",
"*",
"c_getstr",
"(",
"tree",
"src",
",",
"unsigned",
"HOST_WIDE_INT",
"*",
"strlen",
")",
"{",
"tree",
"offset_node",
";",
"if",
"(",
"strlen",
")",
"*",
"strlen",
"=",
"0",
";",
"src",
"=",
"string_constant",
"(",
"src",
",",
"&",
"offset_node",
")",
";",
"if",
"(",
"src",
"==",
"0",
")",
"return",
"NULL",
";",
"unsigned",
"HOST_WIDE_INT",
"offset",
"=",
"0",
";",
"if",
"(",
"offset_node",
"!=",
"NULL_TREE",
")",
"{",
"if",
"(",
"!",
"tree_fits_uhwi_p",
"(",
"offset_node",
")",
")",
"return",
"NULL",
";",
"else",
"offset",
"=",
"tree_to_uhwi",
"(",
"offset_node",
")",
";",
"}",
"unsigned",
"HOST_WIDE_INT",
"string_length",
"=",
"TREE_STRING_LENGTH",
"(",
"src",
")",
";",
"const",
"char",
"*",
"string",
"=",
"TREE_STRING_POINTER",
"(",
"src",
")",
";",
"if",
"(",
"string_length",
"==",
"0",
"||",
"string",
"[",
"string_length",
"-",
"1",
"]",
"!=",
"'",
"\\0",
"'",
"||",
"offset",
">=",
"string_length",
")",
"return",
"NULL",
";",
"if",
"(",
"strlen",
")",
"*",
"strlen",
"=",
"string_length",
"-",
"offset",
";",
"return",
"string",
"+",
"offset",
";",
"}"
] | Return a char pointer for a C string if it is a string constant
or sum of string constant and integer constant. | [
"Return",
"a",
"char",
"pointer",
"for",
"a",
"C",
"string",
"if",
"it",
"is",
"a",
"string",
"constant",
"or",
"sum",
"of",
"string",
"constant",
"and",
"integer",
"constant",
"."
] | [
"/* Support only properly null-terminated strings. */"
] | [
{
"param": "src",
"type": "tree"
},
{
"param": "strlen",
"type": "unsigned HOST_WIDE_INT"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "src",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "strlen",
"type": "unsigned HOST_WIDE_INT",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | assert_binop_folds_to_const | void | static void
assert_binop_folds_to_const (tree lhs, enum tree_code code, tree rhs,
tree constant)
{
ASSERT_EQ (constant, fold_build2 (code, TREE_TYPE (lhs), lhs, rhs));
} | /* Verify that the binary op (LHS CODE RHS) folds to CONSTANT. */ | Verify that the binary op (LHS CODE RHS) folds to CONSTANT. | [
"Verify",
"that",
"the",
"binary",
"op",
"(",
"LHS",
"CODE",
"RHS",
")",
"folds",
"to",
"CONSTANT",
"."
] | static void
assert_binop_folds_to_const (tree lhs, enum tree_code code, tree rhs,
tree constant)
{
ASSERT_EQ (constant, fold_build2 (code, TREE_TYPE (lhs), lhs, rhs));
} | [
"static",
"void",
"assert_binop_folds_to_const",
"(",
"tree",
"lhs",
",",
"enum",
"tree_code",
"code",
",",
"tree",
"rhs",
",",
"tree",
"constant",
")",
"{",
"ASSERT_EQ",
"(",
"constant",
",",
"fold_build2",
"(",
"code",
",",
"TREE_TYPE",
"(",
"lhs",
")",
",",
"lhs",
",",
"rhs",
")",
")",
";",
"}"
] | Verify that the binary op (LHS CODE RHS) folds to CONSTANT. | [
"Verify",
"that",
"the",
"binary",
"op",
"(",
"LHS",
"CODE",
"RHS",
")",
"folds",
"to",
"CONSTANT",
"."
] | [] | [
{
"param": "lhs",
"type": "tree"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "rhs",
"type": "tree"
},
{
"param": "constant",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lhs",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rhs",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "constant",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af67feb5fbc7c8cad8d1b694c07dd549d0c0fa3d | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/fold-const.c | [
"BSD-3-Clause"
] | C | assert_binop_folds_to_nonlvalue | void | static void
assert_binop_folds_to_nonlvalue (tree lhs, enum tree_code code, tree rhs,
tree wrapped_expr)
{
tree result = fold_build2 (code, TREE_TYPE (lhs), lhs, rhs);
ASSERT_NE (wrapped_expr, result);
ASSERT_EQ (NON_LVALUE_EXPR, TREE_CODE (result));
ASSERT_EQ (wrapped_expr, TREE_OPERAND (result, 0));
} | /* Verify that the binary op (LHS CODE RHS) folds to an NON_LVALUE_EXPR
wrapping WRAPPED_EXPR. */ | Verify that the binary op (LHS CODE RHS) folds to an NON_LVALUE_EXPR
wrapping WRAPPED_EXPR. | [
"Verify",
"that",
"the",
"binary",
"op",
"(",
"LHS",
"CODE",
"RHS",
")",
"folds",
"to",
"an",
"NON_LVALUE_EXPR",
"wrapping",
"WRAPPED_EXPR",
"."
] | static void
assert_binop_folds_to_nonlvalue (tree lhs, enum tree_code code, tree rhs,
tree wrapped_expr)
{
tree result = fold_build2 (code, TREE_TYPE (lhs), lhs, rhs);
ASSERT_NE (wrapped_expr, result);
ASSERT_EQ (NON_LVALUE_EXPR, TREE_CODE (result));
ASSERT_EQ (wrapped_expr, TREE_OPERAND (result, 0));
} | [
"static",
"void",
"assert_binop_folds_to_nonlvalue",
"(",
"tree",
"lhs",
",",
"enum",
"tree_code",
"code",
",",
"tree",
"rhs",
",",
"tree",
"wrapped_expr",
")",
"{",
"tree",
"result",
"=",
"fold_build2",
"(",
"code",
",",
"TREE_TYPE",
"(",
"lhs",
")",
",",
"lhs",
",",
"rhs",
")",
";",
"ASSERT_NE",
"(",
"wrapped_expr",
",",
"result",
")",
";",
"ASSERT_EQ",
"(",
"NON_LVALUE_EXPR",
",",
"TREE_CODE",
"(",
"result",
")",
")",
";",
"ASSERT_EQ",
"(",
"wrapped_expr",
",",
"TREE_OPERAND",
"(",
"result",
",",
"0",
")",
")",
";",
"}"
] | Verify that the binary op (LHS CODE RHS) folds to an NON_LVALUE_EXPR
wrapping WRAPPED_EXPR. | [
"Verify",
"that",
"the",
"binary",
"op",
"(",
"LHS",
"CODE",
"RHS",
")",
"folds",
"to",
"an",
"NON_LVALUE_EXPR",
"wrapping",
"WRAPPED_EXPR",
"."
] | [] | [
{
"param": "lhs",
"type": "tree"
},
{
"param": "code",
"type": "enum tree_code"
},
{
"param": "rhs",
"type": "tree"
},
{
"param": "wrapped_expr",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lhs",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rhs",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wrapped_expr",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e0b32fddb8aacc8963d8be2b15fced571aacf4c8 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/coff-x86_64.c | [
"BSD-3-Clause"
] | C | coff_pe_amd64_relocate_section | bfd_boolean | static bfd_boolean
coff_pe_amd64_relocate_section (bfd *output_bfd,
struct bfd_link_info *info,
bfd *input_bfd,
asection *input_section,
bfd_byte *contents,
struct internal_reloc *relocs,
struct internal_syment *syms,
asection **sections)
{
if (bfd_link_relocatable (info))
return TRUE;
return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,input_section, contents,relocs, syms, sections);
} | /* The PE relocate section routine. The only difference between this
and the regular routine is that we don't want to do anything for a
relocatable link. */ | The PE relocate section routine. The only difference between this
and the regular routine is that we don't want to do anything for a
relocatable link. | [
"The",
"PE",
"relocate",
"section",
"routine",
".",
"The",
"only",
"difference",
"between",
"this",
"and",
"the",
"regular",
"routine",
"is",
"that",
"we",
"don",
"'",
"t",
"want",
"to",
"do",
"anything",
"for",
"a",
"relocatable",
"link",
"."
] | static bfd_boolean
coff_pe_amd64_relocate_section (bfd *output_bfd,
struct bfd_link_info *info,
bfd *input_bfd,
asection *input_section,
bfd_byte *contents,
struct internal_reloc *relocs,
struct internal_syment *syms,
asection **sections)
{
if (bfd_link_relocatable (info))
return TRUE;
return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,input_section, contents,relocs, syms, sections);
} | [
"static",
"bfd_boolean",
"coff_pe_amd64_relocate_section",
"(",
"bfd",
"*",
"output_bfd",
",",
"struct",
"bfd_link_info",
"*",
"info",
",",
"bfd",
"*",
"input_bfd",
",",
"asection",
"*",
"input_section",
",",
"bfd_byte",
"*",
"contents",
",",
"struct",
"internal_reloc",
"*",
"relocs",
",",
"struct",
"internal_syment",
"*",
"syms",
",",
"asection",
"*",
"*",
"sections",
")",
"{",
"if",
"(",
"bfd_link_relocatable",
"(",
"info",
")",
")",
"return",
"TRUE",
";",
"return",
"_bfd_coff_generic_relocate_section",
"(",
"output_bfd",
",",
"info",
",",
"input_bfd",
",",
"input_section",
",",
"contents",
",",
"relocs",
",",
"syms",
",",
"sections",
")",
";",
"}"
] | The PE relocate section routine. | [
"The",
"PE",
"relocate",
"section",
"routine",
"."
] | [] | [
{
"param": "output_bfd",
"type": "bfd"
},
{
"param": "info",
"type": "struct bfd_link_info"
},
{
"param": "input_bfd",
"type": "bfd"
},
{
"param": "input_section",
"type": "asection"
},
{
"param": "contents",
"type": "bfd_byte"
},
{
"param": "relocs",
"type": "struct internal_reloc"
},
{
"param": "syms",
"type": "struct internal_syment"
},
{
"param": "sections",
"type": "asection"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output_bfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "info",
"type": "struct bfd_link_info",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_bfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_section",
"type": "asection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "contents",
"type": "bfd_byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "relocs",
"type": "struct internal_reloc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "syms",
"type": "struct internal_syment",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sections",
"type": "asection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e0b32fddb8aacc8963d8be2b15fced571aacf4c8 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/coff-x86_64.c | [
"BSD-3-Clause"
] | C | coff_amd64_is_local_label_name | bfd_boolean | static bfd_boolean
coff_amd64_is_local_label_name (bfd *abfd, const char *name)
{
if (name[0] == 'L')
return TRUE;
return _bfd_coff_is_local_label_name (abfd, name);
} | /* If amd64 gcc uses underscores for symbol names, then it does not use
a leading dot for local labels, so if TARGET_UNDERSCORE is defined
we treat all symbols starting with L as local. */ | If amd64 gcc uses underscores for symbol names, then it does not use
a leading dot for local labels, so if TARGET_UNDERSCORE is defined
we treat all symbols starting with L as local. | [
"If",
"amd64",
"gcc",
"uses",
"underscores",
"for",
"symbol",
"names",
"then",
"it",
"does",
"not",
"use",
"a",
"leading",
"dot",
"for",
"local",
"labels",
"so",
"if",
"TARGET_UNDERSCORE",
"is",
"defined",
"we",
"treat",
"all",
"symbols",
"starting",
"with",
"L",
"as",
"local",
"."
] | static bfd_boolean
coff_amd64_is_local_label_name (bfd *abfd, const char *name)
{
if (name[0] == 'L')
return TRUE;
return _bfd_coff_is_local_label_name (abfd, name);
} | [
"static",
"bfd_boolean",
"coff_amd64_is_local_label_name",
"(",
"bfd",
"*",
"abfd",
",",
"const",
"char",
"*",
"name",
")",
"{",
"if",
"(",
"name",
"[",
"0",
"]",
"==",
"'",
"'",
")",
"return",
"TRUE",
";",
"return",
"_bfd_coff_is_local_label_name",
"(",
"abfd",
",",
"name",
")",
";",
"}"
] | If amd64 gcc uses underscores for symbol names, then it does not use
a leading dot for local labels, so if TARGET_UNDERSCORE is defined
we treat all symbols starting with L as local. | [
"If",
"amd64",
"gcc",
"uses",
"underscores",
"for",
"symbol",
"names",
"then",
"it",
"does",
"not",
"use",
"a",
"leading",
"dot",
"for",
"local",
"labels",
"so",
"if",
"TARGET_UNDERSCORE",
"is",
"defined",
"we",
"treat",
"all",
"symbols",
"starting",
"with",
"L",
"as",
"local",
"."
] | [] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_fn_attrib_level | int | static int
oacc_fn_attrib_level (tree attr)
{
tree pos = TREE_VALUE (attr);
if (!TREE_PURPOSE (pos))
return -1;
int ix = 0;
for (ix = 0; ix != GOMP_DIM_MAX;
ix++, pos = TREE_CHAIN (pos))
if (!integer_zerop (TREE_PURPOSE (pos)))
break;
return ix;
} | /* Return level at which oacc routine may spawn a partitioned loop, or
-1 if it is not a routine (i.e. is an offload fn). */ | Return level at which oacc routine may spawn a partitioned loop, or
1 if it is not a routine . | [
"Return",
"level",
"at",
"which",
"oacc",
"routine",
"may",
"spawn",
"a",
"partitioned",
"loop",
"or",
"1",
"if",
"it",
"is",
"not",
"a",
"routine",
"."
] | static int
oacc_fn_attrib_level (tree attr)
{
tree pos = TREE_VALUE (attr);
if (!TREE_PURPOSE (pos))
return -1;
int ix = 0;
for (ix = 0; ix != GOMP_DIM_MAX;
ix++, pos = TREE_CHAIN (pos))
if (!integer_zerop (TREE_PURPOSE (pos)))
break;
return ix;
} | [
"static",
"int",
"oacc_fn_attrib_level",
"(",
"tree",
"attr",
")",
"{",
"tree",
"pos",
"=",
"TREE_VALUE",
"(",
"attr",
")",
";",
"if",
"(",
"!",
"TREE_PURPOSE",
"(",
"pos",
")",
")",
"return",
"-1",
";",
"int",
"ix",
"=",
"0",
";",
"for",
"(",
"ix",
"=",
"0",
";",
"ix",
"!=",
"GOMP_DIM_MAX",
";",
"ix",
"++",
",",
"pos",
"=",
"TREE_CHAIN",
"(",
"pos",
")",
")",
"if",
"(",
"!",
"integer_zerop",
"(",
"TREE_PURPOSE",
"(",
"pos",
")",
")",
")",
"break",
";",
"return",
"ix",
";",
"}"
] | Return level at which oacc routine may spawn a partitioned loop, or
1 if it is not a routine (i.e. | [
"Return",
"level",
"at",
"which",
"oacc",
"routine",
"may",
"spawn",
"a",
"partitioned",
"loop",
"or",
"1",
"if",
"it",
"is",
"not",
"a",
"routine",
"(",
"i",
".",
"e",
"."
] | [] | [
{
"param": "attr",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "attr",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_thread_numbers | tree | static tree
oacc_thread_numbers (bool pos, int mask, gimple_seq *seq)
{
tree res = pos ? NULL_TREE : build_int_cst (unsigned_type_node, 1);
unsigned ix;
/* Start at gang level, and examine relevant dimension indices. */
for (ix = GOMP_DIM_GANG; ix != GOMP_DIM_MAX; ix++)
if (GOMP_DIM_MASK (ix) & mask)
{
if (res)
{
/* We had an outer index, so scale that by the size of
this dimension. */
tree n = oacc_dim_call (false, ix, seq);
res = fold_build2 (MULT_EXPR, integer_type_node, res, n);
}
if (pos)
{
/* Determine index in this dimension. */
tree id = oacc_dim_call (true, ix, seq);
if (res)
res = fold_build2 (PLUS_EXPR, integer_type_node, res, id);
else
res = id;
}
}
if (res == NULL_TREE)
res = integer_zero_node;
return res;
} | /* Find the number of threads (POS = false), or thread number (POS =
true) for an OpenACC region partitioned as MASK. Setup code
required for the calculation is added to SEQ. */ | Find the number of threads (POS = false), or thread number (POS
true) for an OpenACC region partitioned as MASK. Setup code
required for the calculation is added to SEQ. | [
"Find",
"the",
"number",
"of",
"threads",
"(",
"POS",
"=",
"false",
")",
"or",
"thread",
"number",
"(",
"POS",
"true",
")",
"for",
"an",
"OpenACC",
"region",
"partitioned",
"as",
"MASK",
".",
"Setup",
"code",
"required",
"for",
"the",
"calculation",
"is",
"added",
"to",
"SEQ",
"."
] | static tree
oacc_thread_numbers (bool pos, int mask, gimple_seq *seq)
{
tree res = pos ? NULL_TREE : build_int_cst (unsigned_type_node, 1);
unsigned ix;
for (ix = GOMP_DIM_GANG; ix != GOMP_DIM_MAX; ix++)
if (GOMP_DIM_MASK (ix) & mask)
{
if (res)
{
tree n = oacc_dim_call (false, ix, seq);
res = fold_build2 (MULT_EXPR, integer_type_node, res, n);
}
if (pos)
{
tree id = oacc_dim_call (true, ix, seq);
if (res)
res = fold_build2 (PLUS_EXPR, integer_type_node, res, id);
else
res = id;
}
}
if (res == NULL_TREE)
res = integer_zero_node;
return res;
} | [
"static",
"tree",
"oacc_thread_numbers",
"(",
"bool",
"pos",
",",
"int",
"mask",
",",
"gimple_seq",
"*",
"seq",
")",
"{",
"tree",
"res",
"=",
"pos",
"?",
"NULL_TREE",
":",
"build_int_cst",
"(",
"unsigned_type_node",
",",
"1",
")",
";",
"unsigned",
"ix",
";",
"for",
"(",
"ix",
"=",
"GOMP_DIM_GANG",
";",
"ix",
"!=",
"GOMP_DIM_MAX",
";",
"ix",
"++",
")",
"if",
"(",
"GOMP_DIM_MASK",
"(",
"ix",
")",
"&",
"mask",
")",
"{",
"if",
"(",
"res",
")",
"{",
"tree",
"n",
"=",
"oacc_dim_call",
"(",
"false",
",",
"ix",
",",
"seq",
")",
";",
"res",
"=",
"fold_build2",
"(",
"MULT_EXPR",
",",
"integer_type_node",
",",
"res",
",",
"n",
")",
";",
"}",
"if",
"(",
"pos",
")",
"{",
"tree",
"id",
"=",
"oacc_dim_call",
"(",
"true",
",",
"ix",
",",
"seq",
")",
";",
"if",
"(",
"res",
")",
"res",
"=",
"fold_build2",
"(",
"PLUS_EXPR",
",",
"integer_type_node",
",",
"res",
",",
"id",
")",
";",
"else",
"res",
"=",
"id",
";",
"}",
"}",
"if",
"(",
"res",
"==",
"NULL_TREE",
")",
"res",
"=",
"integer_zero_node",
";",
"return",
"res",
";",
"}"
] | Find the number of threads (POS = false), or thread number (POS
true) for an OpenACC region partitioned as MASK. | [
"Find",
"the",
"number",
"of",
"threads",
"(",
"POS",
"=",
"false",
")",
"or",
"thread",
"number",
"(",
"POS",
"true",
")",
"for",
"an",
"OpenACC",
"region",
"partitioned",
"as",
"MASK",
"."
] | [
"/* Start at gang level, and examine relevant dimension indices. */",
"/* We had an outer index, so scale that by the size of\n\t this dimension. */",
"/* Determine index in this dimension. */"
] | [
{
"param": "pos",
"type": "bool"
},
{
"param": "mask",
"type": "int"
},
{
"param": "seq",
"type": "gimple_seq"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pos",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mask",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seq",
"type": "gimple_seq",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_xform_tile | void | static void
oacc_xform_tile (gcall *call)
{
gimple_stmt_iterator gsi = gsi_for_stmt (call);
unsigned collapse = tree_to_uhwi (gimple_call_arg (call, 0));
/* Inner loops have higher loop_nos. */
unsigned loop_no = tree_to_uhwi (gimple_call_arg (call, 1));
tree tile_size = gimple_call_arg (call, 2);
unsigned e_mask = tree_to_uhwi (gimple_call_arg (call, 4));
tree lhs = gimple_call_lhs (call);
tree type = TREE_TYPE (lhs);
gimple_seq seq = NULL;
tree span = build_int_cst (type, 1);
gcc_assert (!(e_mask
& ~(GOMP_DIM_MASK (GOMP_DIM_VECTOR)
| GOMP_DIM_MASK (GOMP_DIM_WORKER))));
push_gimplify_context (!seen_error ());
#ifndef ACCEL_COMPILER
/* Partitioning disabled on host compilers. */
e_mask = 0;
#endif
if (!e_mask)
/* Not paritioning. */
span = integer_one_node;
else if (!integer_zerop (tile_size))
/* User explicitly specified size. */
span = tile_size;
else
{
/* Pick a size based on the paritioning of the element loop and
the number of loop nests. */
tree first_size = NULL_TREE;
tree second_size = NULL_TREE;
if (e_mask & GOMP_DIM_MASK (GOMP_DIM_VECTOR))
first_size = oacc_dim_call (false, GOMP_DIM_VECTOR, &seq);
if (e_mask & GOMP_DIM_MASK (GOMP_DIM_WORKER))
second_size = oacc_dim_call (false, GOMP_DIM_WORKER, &seq);
if (!first_size)
{
first_size = second_size;
second_size = NULL_TREE;
}
if (loop_no + 1 == collapse)
{
span = first_size;
if (!loop_no && second_size)
span = fold_build2 (MULT_EXPR, TREE_TYPE (span),
span, second_size);
}
else if (loop_no + 2 == collapse)
span = second_size;
else
span = NULL_TREE;
if (!span)
/* There's no obvious element size for this loop. Options
are 1, first_size or some non-unity constant (32 is my
favourite). We should gather some statistics. */
span = first_size;
}
span = fold_convert (type, span);
gimplify_assign (lhs, span, &seq);
pop_gimplify_context (NULL);
gsi_replace_with_seq (&gsi, seq, true);
} | /* Transform a GOACC_TILE call. Determines the element loop span for
the specified loop of the nest. This is 1 if we're not tiling.
GOACC_TILE (collapse_count, loop_no, tile_arg, gwv_tile, gwv_element); */ | Transform a GOACC_TILE call. Determines the element loop span for
the specified loop of the nest. This is 1 if we're not tiling.
| [
"Transform",
"a",
"GOACC_TILE",
"call",
".",
"Determines",
"the",
"element",
"loop",
"span",
"for",
"the",
"specified",
"loop",
"of",
"the",
"nest",
".",
"This",
"is",
"1",
"if",
"we",
"'",
"re",
"not",
"tiling",
"."
] | static void
oacc_xform_tile (gcall *call)
{
gimple_stmt_iterator gsi = gsi_for_stmt (call);
unsigned collapse = tree_to_uhwi (gimple_call_arg (call, 0));
unsigned loop_no = tree_to_uhwi (gimple_call_arg (call, 1));
tree tile_size = gimple_call_arg (call, 2);
unsigned e_mask = tree_to_uhwi (gimple_call_arg (call, 4));
tree lhs = gimple_call_lhs (call);
tree type = TREE_TYPE (lhs);
gimple_seq seq = NULL;
tree span = build_int_cst (type, 1);
gcc_assert (!(e_mask
& ~(GOMP_DIM_MASK (GOMP_DIM_VECTOR)
| GOMP_DIM_MASK (GOMP_DIM_WORKER))));
push_gimplify_context (!seen_error ());
#ifndef ACCEL_COMPILER
e_mask = 0;
#endif
if (!e_mask)
span = integer_one_node;
else if (!integer_zerop (tile_size))
span = tile_size;
else
{
tree first_size = NULL_TREE;
tree second_size = NULL_TREE;
if (e_mask & GOMP_DIM_MASK (GOMP_DIM_VECTOR))
first_size = oacc_dim_call (false, GOMP_DIM_VECTOR, &seq);
if (e_mask & GOMP_DIM_MASK (GOMP_DIM_WORKER))
second_size = oacc_dim_call (false, GOMP_DIM_WORKER, &seq);
if (!first_size)
{
first_size = second_size;
second_size = NULL_TREE;
}
if (loop_no + 1 == collapse)
{
span = first_size;
if (!loop_no && second_size)
span = fold_build2 (MULT_EXPR, TREE_TYPE (span),
span, second_size);
}
else if (loop_no + 2 == collapse)
span = second_size;
else
span = NULL_TREE;
if (!span)
span = first_size;
}
span = fold_convert (type, span);
gimplify_assign (lhs, span, &seq);
pop_gimplify_context (NULL);
gsi_replace_with_seq (&gsi, seq, true);
} | [
"static",
"void",
"oacc_xform_tile",
"(",
"gcall",
"*",
"call",
")",
"{",
"gimple_stmt_iterator",
"gsi",
"=",
"gsi_for_stmt",
"(",
"call",
")",
";",
"unsigned",
"collapse",
"=",
"tree_to_uhwi",
"(",
"gimple_call_arg",
"(",
"call",
",",
"0",
")",
")",
";",
"unsigned",
"loop_no",
"=",
"tree_to_uhwi",
"(",
"gimple_call_arg",
"(",
"call",
",",
"1",
")",
")",
";",
"tree",
"tile_size",
"=",
"gimple_call_arg",
"(",
"call",
",",
"2",
")",
";",
"unsigned",
"e_mask",
"=",
"tree_to_uhwi",
"(",
"gimple_call_arg",
"(",
"call",
",",
"4",
")",
")",
";",
"tree",
"lhs",
"=",
"gimple_call_lhs",
"(",
"call",
")",
";",
"tree",
"type",
"=",
"TREE_TYPE",
"(",
"lhs",
")",
";",
"gimple_seq",
"seq",
"=",
"NULL",
";",
"tree",
"span",
"=",
"build_int_cst",
"(",
"type",
",",
"1",
")",
";",
"gcc_assert",
"(",
"!",
"(",
"e_mask",
"&",
"~",
"(",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_VECTOR",
")",
"|",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_WORKER",
")",
")",
")",
")",
";",
"push_gimplify_context",
"(",
"!",
"seen_error",
"(",
")",
")",
";",
"#ifndef",
"ACCEL_COMPILER",
"e_mask",
"=",
"0",
";",
"#endif",
"if",
"(",
"!",
"e_mask",
")",
"span",
"=",
"integer_one_node",
";",
"else",
"if",
"(",
"!",
"integer_zerop",
"(",
"tile_size",
")",
")",
"span",
"=",
"tile_size",
";",
"else",
"{",
"tree",
"first_size",
"=",
"NULL_TREE",
";",
"tree",
"second_size",
"=",
"NULL_TREE",
";",
"if",
"(",
"e_mask",
"&",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_VECTOR",
")",
")",
"first_size",
"=",
"oacc_dim_call",
"(",
"false",
",",
"GOMP_DIM_VECTOR",
",",
"&",
"seq",
")",
";",
"if",
"(",
"e_mask",
"&",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_WORKER",
")",
")",
"second_size",
"=",
"oacc_dim_call",
"(",
"false",
",",
"GOMP_DIM_WORKER",
",",
"&",
"seq",
")",
";",
"if",
"(",
"!",
"first_size",
")",
"{",
"first_size",
"=",
"second_size",
";",
"second_size",
"=",
"NULL_TREE",
";",
"}",
"if",
"(",
"loop_no",
"+",
"1",
"==",
"collapse",
")",
"{",
"span",
"=",
"first_size",
";",
"if",
"(",
"!",
"loop_no",
"&&",
"second_size",
")",
"span",
"=",
"fold_build2",
"(",
"MULT_EXPR",
",",
"TREE_TYPE",
"(",
"span",
")",
",",
"span",
",",
"second_size",
")",
";",
"}",
"else",
"if",
"(",
"loop_no",
"+",
"2",
"==",
"collapse",
")",
"span",
"=",
"second_size",
";",
"else",
"span",
"=",
"NULL_TREE",
";",
"if",
"(",
"!",
"span",
")",
"span",
"=",
"first_size",
";",
"}",
"span",
"=",
"fold_convert",
"(",
"type",
",",
"span",
")",
";",
"gimplify_assign",
"(",
"lhs",
",",
"span",
",",
"&",
"seq",
")",
";",
"pop_gimplify_context",
"(",
"NULL",
")",
";",
"gsi_replace_with_seq",
"(",
"&",
"gsi",
",",
"seq",
",",
"true",
")",
";",
"}"
] | Transform a GOACC_TILE call. | [
"Transform",
"a",
"GOACC_TILE",
"call",
"."
] | [
"/* Inner loops have higher loop_nos. */",
"/* Partitioning disabled on host compilers. */",
"/* Not paritioning. */",
"/* User explicitly specified size. */",
"/* Pick a size based on the paritioning of the element loop and\n\t the number of loop nests. */",
"/* There's no obvious element size for this loop. Options\n\t are 1, first_size or some non-unity constant (32 is my\n\t favourite). We should gather some statistics. */"
] | [
{
"param": "call",
"type": "gcall"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "call",
"type": "gcall",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_validate_dims | void | static void
oacc_validate_dims (tree fn, tree attrs, int *dims, int level, unsigned used)
{
tree purpose[GOMP_DIM_MAX];
unsigned ix;
tree pos = TREE_VALUE (attrs);
/* Make sure the attribute creator attached the dimension
information. */
gcc_assert (pos);
for (ix = 0; ix != GOMP_DIM_MAX; ix++)
{
purpose[ix] = TREE_PURPOSE (pos);
tree val = TREE_VALUE (pos);
dims[ix] = val ? TREE_INT_CST_LOW (val) : -1;
pos = TREE_CHAIN (pos);
}
bool changed = targetm.goacc.validate_dims (fn, dims, level);
/* Default anything left to 1 or a partitioned default. */
for (ix = 0; ix != GOMP_DIM_MAX; ix++)
if (dims[ix] < 0)
{
/* The OpenACC spec says 'If the [num_gangs] clause is not
specified, an implementation-defined default will be used;
the default may depend on the code within the construct.'
(2.5.6). Thus an implementation is free to choose
non-unity default for a parallel region that doesn't have
any gang-partitioned loops. However, it appears that there
is a sufficient body of user code that expects non-gang
partitioned regions to not execute in gang-redundant mode.
So we (a) don't warn about the non-portability and (b) pick
the minimum permissible dimension size when there is no
partitioned execution. Otherwise we pick the global
default for the dimension, which the user can control. The
same wording and logic applies to num_workers and
vector_length, however the worker- or vector- single
execution doesn't have the same impact as gang-redundant
execution. (If the minimum gang-level partioning is not 1,
the target is probably too confusing.) */
dims[ix] = (used & GOMP_DIM_MASK (ix)
? oacc_default_dims[ix] : oacc_min_dims[ix]);
changed = true;
}
if (changed)
{
/* Replace the attribute with new values. */
pos = NULL_TREE;
for (ix = GOMP_DIM_MAX; ix--;)
pos = tree_cons (purpose[ix],
build_int_cst (integer_type_node, dims[ix]), pos);
oacc_replace_fn_attrib (fn, pos);
}
} | /* Validate and update the dimensions for offloaded FN. ATTRS is the
raw attribute. DIMS is an array of dimensions, which is filled in.
LEVEL is the partitioning level of a routine, or -1 for an offload
region itself. USED is the mask of partitioned execution in the
function. */ | Validate and update the dimensions for offloaded FN. ATTRS is the
raw attribute. DIMS is an array of dimensions, which is filled in.
LEVEL is the partitioning level of a routine, or -1 for an offload
region itself. USED is the mask of partitioned execution in the
function. | [
"Validate",
"and",
"update",
"the",
"dimensions",
"for",
"offloaded",
"FN",
".",
"ATTRS",
"is",
"the",
"raw",
"attribute",
".",
"DIMS",
"is",
"an",
"array",
"of",
"dimensions",
"which",
"is",
"filled",
"in",
".",
"LEVEL",
"is",
"the",
"partitioning",
"level",
"of",
"a",
"routine",
"or",
"-",
"1",
"for",
"an",
"offload",
"region",
"itself",
".",
"USED",
"is",
"the",
"mask",
"of",
"partitioned",
"execution",
"in",
"the",
"function",
"."
] | static void
oacc_validate_dims (tree fn, tree attrs, int *dims, int level, unsigned used)
{
tree purpose[GOMP_DIM_MAX];
unsigned ix;
tree pos = TREE_VALUE (attrs);
gcc_assert (pos);
for (ix = 0; ix != GOMP_DIM_MAX; ix++)
{
purpose[ix] = TREE_PURPOSE (pos);
tree val = TREE_VALUE (pos);
dims[ix] = val ? TREE_INT_CST_LOW (val) : -1;
pos = TREE_CHAIN (pos);
}
bool changed = targetm.goacc.validate_dims (fn, dims, level);
for (ix = 0; ix != GOMP_DIM_MAX; ix++)
if (dims[ix] < 0)
{
dims[ix] = (used & GOMP_DIM_MASK (ix)
? oacc_default_dims[ix] : oacc_min_dims[ix]);
changed = true;
}
if (changed)
{
pos = NULL_TREE;
for (ix = GOMP_DIM_MAX; ix--;)
pos = tree_cons (purpose[ix],
build_int_cst (integer_type_node, dims[ix]), pos);
oacc_replace_fn_attrib (fn, pos);
}
} | [
"static",
"void",
"oacc_validate_dims",
"(",
"tree",
"fn",
",",
"tree",
"attrs",
",",
"int",
"*",
"dims",
",",
"int",
"level",
",",
"unsigned",
"used",
")",
"{",
"tree",
"purpose",
"[",
"GOMP_DIM_MAX",
"]",
";",
"unsigned",
"ix",
";",
"tree",
"pos",
"=",
"TREE_VALUE",
"(",
"attrs",
")",
";",
"gcc_assert",
"(",
"pos",
")",
";",
"for",
"(",
"ix",
"=",
"0",
";",
"ix",
"!=",
"GOMP_DIM_MAX",
";",
"ix",
"++",
")",
"{",
"purpose",
"[",
"ix",
"]",
"=",
"TREE_PURPOSE",
"(",
"pos",
")",
";",
"tree",
"val",
"=",
"TREE_VALUE",
"(",
"pos",
")",
";",
"dims",
"[",
"ix",
"]",
"=",
"val",
"?",
"TREE_INT_CST_LOW",
"(",
"val",
")",
":",
"-1",
";",
"pos",
"=",
"TREE_CHAIN",
"(",
"pos",
")",
";",
"}",
"bool",
"changed",
"=",
"targetm",
".",
"goacc",
".",
"validate_dims",
"(",
"fn",
",",
"dims",
",",
"level",
")",
";",
"for",
"(",
"ix",
"=",
"0",
";",
"ix",
"!=",
"GOMP_DIM_MAX",
";",
"ix",
"++",
")",
"if",
"(",
"dims",
"[",
"ix",
"]",
"<",
"0",
")",
"{",
"dims",
"[",
"ix",
"]",
"=",
"(",
"used",
"&",
"GOMP_DIM_MASK",
"(",
"ix",
")",
"?",
"oacc_default_dims",
"[",
"ix",
"]",
":",
"oacc_min_dims",
"[",
"ix",
"]",
")",
";",
"changed",
"=",
"true",
";",
"}",
"if",
"(",
"changed",
")",
"{",
"pos",
"=",
"NULL_TREE",
";",
"for",
"(",
"ix",
"=",
"GOMP_DIM_MAX",
";",
"ix",
"--",
";",
")",
"pos",
"=",
"tree_cons",
"(",
"purpose",
"[",
"ix",
"]",
",",
"build_int_cst",
"(",
"integer_type_node",
",",
"dims",
"[",
"ix",
"]",
")",
",",
"pos",
")",
";",
"oacc_replace_fn_attrib",
"(",
"fn",
",",
"pos",
")",
";",
"}",
"}"
] | Validate and update the dimensions for offloaded FN. | [
"Validate",
"and",
"update",
"the",
"dimensions",
"for",
"offloaded",
"FN",
"."
] | [
"/* Make sure the attribute creator attached the dimension\n information. */",
"/* Default anything left to 1 or a partitioned default. */",
"/* The OpenACC spec says 'If the [num_gangs] clause is not\n\t specified, an implementation-defined default will be used;\n\t the default may depend on the code within the construct.'\n\t (2.5.6). Thus an implementation is free to choose\n\t non-unity default for a parallel region that doesn't have\n\t any gang-partitioned loops. However, it appears that there\n\t is a sufficient body of user code that expects non-gang\n\t partitioned regions to not execute in gang-redundant mode.\n\t So we (a) don't warn about the non-portability and (b) pick\n\t the minimum permissible dimension size when there is no\n\t partitioned execution. Otherwise we pick the global\n\t default for the dimension, which the user can control. The\n\t same wording and logic applies to num_workers and\n\t vector_length, however the worker- or vector- single\n\t execution doesn't have the same impact as gang-redundant\n\t execution. (If the minimum gang-level partioning is not 1,\n\t the target is probably too confusing.) */",
"/* Replace the attribute with new values. */"
] | [
{
"param": "fn",
"type": "tree"
},
{
"param": "attrs",
"type": "tree"
},
{
"param": "dims",
"type": "int"
},
{
"param": "level",
"type": "int"
},
{
"param": "used",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fn",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "attrs",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dims",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "level",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "used",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | new_oacc_loop_raw | oacc_loop | static oacc_loop *
new_oacc_loop_raw (oacc_loop *parent, location_t loc)
{
oacc_loop *loop = XCNEW (oacc_loop);
loop->parent = parent;
if (parent)
{
loop->sibling = parent->child;
parent->child = loop;
}
loop->loc = loc;
return loop;
} | /* Create an empty OpenACC loop structure at LOC. */ | Create an empty OpenACC loop structure at LOC. | [
"Create",
"an",
"empty",
"OpenACC",
"loop",
"structure",
"at",
"LOC",
"."
] | static oacc_loop *
new_oacc_loop_raw (oacc_loop *parent, location_t loc)
{
oacc_loop *loop = XCNEW (oacc_loop);
loop->parent = parent;
if (parent)
{
loop->sibling = parent->child;
parent->child = loop;
}
loop->loc = loc;
return loop;
} | [
"static",
"oacc_loop",
"*",
"new_oacc_loop_raw",
"(",
"oacc_loop",
"*",
"parent",
",",
"location_t",
"loc",
")",
"{",
"oacc_loop",
"*",
"loop",
"=",
"XCNEW",
"(",
"oacc_loop",
")",
";",
"loop",
"->",
"parent",
"=",
"parent",
";",
"if",
"(",
"parent",
")",
"{",
"loop",
"->",
"sibling",
"=",
"parent",
"->",
"child",
";",
"parent",
"->",
"child",
"=",
"loop",
";",
"}",
"loop",
"->",
"loc",
"=",
"loc",
";",
"return",
"loop",
";",
"}"
] | Create an empty OpenACC loop structure at LOC. | [
"Create",
"an",
"empty",
"OpenACC",
"loop",
"structure",
"at",
"LOC",
"."
] | [] | [
{
"param": "parent",
"type": "oacc_loop"
},
{
"param": "loc",
"type": "location_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | new_oacc_loop_outer | oacc_loop | static oacc_loop *
new_oacc_loop_outer (tree decl)
{
return new_oacc_loop_raw (NULL, DECL_SOURCE_LOCATION (decl));
} | /* Create an outermost, dummy OpenACC loop for offloaded function
DECL. */ | Create an outermost, dummy OpenACC loop for offloaded function
DECL. | [
"Create",
"an",
"outermost",
"dummy",
"OpenACC",
"loop",
"for",
"offloaded",
"function",
"DECL",
"."
] | static oacc_loop *
new_oacc_loop_outer (tree decl)
{
return new_oacc_loop_raw (NULL, DECL_SOURCE_LOCATION (decl));
} | [
"static",
"oacc_loop",
"*",
"new_oacc_loop_outer",
"(",
"tree",
"decl",
")",
"{",
"return",
"new_oacc_loop_raw",
"(",
"NULL",
",",
"DECL_SOURCE_LOCATION",
"(",
"decl",
")",
")",
";",
"}"
] | Create an outermost, dummy OpenACC loop for offloaded function
DECL. | [
"Create",
"an",
"outermost",
"dummy",
"OpenACC",
"loop",
"for",
"offloaded",
"function",
"DECL",
"."
] | [] | [
{
"param": "decl",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "decl",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.