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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8e866f15bdde090079f813afd569d904f3e672c6 | atrens/DragonFlyBSD-src | usr.sbin/lpr/lpd/printjob.c | [
"BSD-3-Clause"
] | C | openrem | void | static void
openrem(const struct printer *pp)
{
int i;
int resp;
void (*savealrm)(int);
for (i = 1; ; i = i < 256 ? i << 1 : i) {
resp = -1;
savealrm = signal(SIGALRM, alarmhandler);
alarm(pp->conn_timeout);
pfd = getport(pp, pp->remote_host, 0);
alarm(0);
signal(SIGALRM, savealrm);
if (pfd >= 0) {
if ((writel(pfd, "\2", pp->remote_queue, "\n", NULL)
== 2 + strlen(pp->remote_queue))
&& (resp = response(pp)) == 0)
break;
close(pfd);
}
if (i == 1) {
if (resp < 0)
pstatus(pp, "waiting for %s to come up",
pp->remote_host);
else {
pstatus(pp,
"waiting for queue to be enabled on %s",
pp->remote_host);
i = 256;
}
}
sleep(i);
}
pstatus(pp, "sending to %s", pp->remote_host);
} | /*
* Printer is on a remote host
*/ | Printer is on a remote host | [
"Printer",
"is",
"on",
"a",
"remote",
"host"
] | static void
openrem(const struct printer *pp)
{
int i;
int resp;
void (*savealrm)(int);
for (i = 1; ; i = i < 256 ? i << 1 : i) {
resp = -1;
savealrm = signal(SIGALRM, alarmhandler);
alarm(pp->conn_timeout);
pfd = getport(pp, pp->remote_host, 0);
alarm(0);
signal(SIGALRM, savealrm);
if (pfd >= 0) {
if ((writel(pfd, "\2", pp->remote_queue, "\n", NULL)
== 2 + strlen(pp->remote_queue))
&& (resp = response(pp)) == 0)
break;
close(pfd);
}
if (i == 1) {
if (resp < 0)
pstatus(pp, "waiting for %s to come up",
pp->remote_host);
else {
pstatus(pp,
"waiting for queue to be enabled on %s",
pp->remote_host);
i = 256;
}
}
sleep(i);
}
pstatus(pp, "sending to %s", pp->remote_host);
} | [
"static",
"void",
"openrem",
"(",
"const",
"struct",
"printer",
"*",
"pp",
")",
"{",
"int",
"i",
";",
"int",
"resp",
";",
"void",
"(",
"*",
"savealrm",
")",
"(",
"int",
")",
";",
"for",
"(",
"i",
"=",
"1",
";",
";",
"i",
"=",
"i",
"<",
"256",
"?",
"i",
"<<",
"1",
":",
"i",
")",
"{",
"resp",
"=",
"-1",
";",
"savealrm",
"=",
"signal",
"(",
"SIGALRM",
",",
"alarmhandler",
")",
";",
"alarm",
"(",
"pp",
"->",
"conn_timeout",
")",
";",
"pfd",
"=",
"getport",
"(",
"pp",
",",
"pp",
"->",
"remote_host",
",",
"0",
")",
";",
"alarm",
"(",
"0",
")",
";",
"signal",
"(",
"SIGALRM",
",",
"savealrm",
")",
";",
"if",
"(",
"pfd",
">=",
"0",
")",
"{",
"if",
"(",
"(",
"writel",
"(",
"pfd",
",",
"\"",
"\\2",
"\"",
",",
"pp",
"->",
"remote_queue",
",",
"\"",
"\\n",
"\"",
",",
"NULL",
")",
"==",
"2",
"+",
"strlen",
"(",
"pp",
"->",
"remote_queue",
")",
")",
"&&",
"(",
"resp",
"=",
"response",
"(",
"pp",
")",
")",
"==",
"0",
")",
"break",
";",
"close",
"(",
"pfd",
")",
";",
"}",
"if",
"(",
"i",
"==",
"1",
")",
"{",
"if",
"(",
"resp",
"<",
"0",
")",
"pstatus",
"(",
"pp",
",",
"\"",
"\"",
",",
"pp",
"->",
"remote_host",
")",
";",
"else",
"{",
"pstatus",
"(",
"pp",
",",
"\"",
"\"",
",",
"pp",
"->",
"remote_host",
")",
";",
"i",
"=",
"256",
";",
"}",
"}",
"sleep",
"(",
"i",
")",
";",
"}",
"pstatus",
"(",
"pp",
",",
"\"",
"\"",
",",
"pp",
"->",
"remote_host",
")",
";",
"}"
] | Printer is on a remote host | [
"Printer",
"is",
"on",
"a",
"remote",
"host"
] | [] | [
{
"param": "pp",
"type": "struct printer"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pp",
"type": "struct printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d26638693a0b067e3b0969241049ecfc8981e86a | atrens/DragonFlyBSD-src | sys/netinet6/in6_rmx.c | [
"BSD-3-Clause"
] | C | in6_addroute | null | static struct radix_node *
in6_addroute(char *key, char *mask, struct radix_node_head *head,
struct radix_node *treenodes)
{
struct rtentry *rt = (struct rtentry *)treenodes;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt);
struct radix_node *ret;
/*
* For IPv6, all unicast non-host routes are automatically cloning.
*/
if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
rt->rt_flags |= RTF_MULTICAST;
if (!(rt->rt_flags & (RTF_HOST | RTF_CLONING | RTF_MULTICAST))) {
rt->rt_flags |= RTF_PRCLONING;
}
/*
* A little bit of help for both IPv6 output and input:
* For local addresses, we make sure that RTF_LOCAL is set,
* with the thought that this might one day be used to speed up
* ip_input().
*
* We also mark routes to multicast addresses as such, because
* it's easy to do and might be useful (but this is much more
* dubious since it's so easy to inspect the address). (This
* is done above.)
*
* XXX
* should elaborate the code.
*/
if (rt->rt_flags & RTF_HOST) {
if (IN6_ARE_ADDR_EQUAL(&satosin6(rt->rt_ifa->ifa_addr)
->sin6_addr,
&sin6->sin6_addr)) {
rt->rt_flags |= RTF_LOCAL;
}
}
if (!rt->rt_rmx.rmx_mtu && !(rt->rt_rmx.rmx_locks & RTV_MTU) &&
rt->rt_ifp != NULL)
rt->rt_rmx.rmx_mtu = IN6_LINKMTU(rt->rt_ifp);
ret = rn_addroute(key, mask, head, treenodes);
if (ret == NULL && rt->rt_flags & RTF_HOST) {
struct rtentry *rt2;
/*
* We are trying to add a host route, but can't.
* Find out if it is because of an
* ARP entry and delete it if so.
*/
rt2 = rtpurelookup((struct sockaddr *)sin6);
if (rt2 != NULL) {
--rt2->rt_refcnt;
if (rt2->rt_flags & RTF_LLINFO &&
rt2->rt_flags & RTF_HOST &&
rt2->rt_gateway &&
rt2->rt_gateway->sa_family == AF_LINK) {
rtrequest(RTM_DELETE, rt_key(rt2),
rt2->rt_gateway, rt_mask(rt2),
rt2->rt_flags, NULL);
ret = rn_addroute(key, mask, head, treenodes);
}
}
} else if (ret == NULL && rt->rt_flags & RTF_CLONING) {
struct rtentry *rt2;
/*
* We are trying to add a net route, but can't.
* The following case should be allowed, so we'll make a
* special check for this:
* Two IPv6 addresses with the same prefix is assigned
* to a single interrface.
* # ifconfig if0 inet6 3ffe:0501::1 prefix 64 alias (*1)
* # ifconfig if0 inet6 3ffe:0501::2 prefix 64 alias (*2)
* In this case, (*1) and (*2) want to add the same
* net route entry, 3ffe:0501:: -> if0.
* This case should not raise an error.
*/
rt2 = rtpurelookup((struct sockaddr *)sin6);
if (rt2 != NULL) {
if ((rt2->rt_flags & (RTF_CLONING|RTF_HOST|RTF_GATEWAY))
== RTF_CLONING &&
rt2->rt_gateway &&
rt2->rt_gateway->sa_family == AF_LINK &&
rt2->rt_ifp == rt->rt_ifp) {
ret = rt2->rt_nodes;
}
--rt2->rt_refcnt;
}
}
return ret;
} | /*
* Do what we need to do when inserting a route.
*/ | Do what we need to do when inserting a route. | [
"Do",
"what",
"we",
"need",
"to",
"do",
"when",
"inserting",
"a",
"route",
"."
] | static struct radix_node *
in6_addroute(char *key, char *mask, struct radix_node_head *head,
struct radix_node *treenodes)
{
struct rtentry *rt = (struct rtentry *)treenodes;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rt_key(rt);
struct radix_node *ret;
if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
rt->rt_flags |= RTF_MULTICAST;
if (!(rt->rt_flags & (RTF_HOST | RTF_CLONING | RTF_MULTICAST))) {
rt->rt_flags |= RTF_PRCLONING;
}
if (rt->rt_flags & RTF_HOST) {
if (IN6_ARE_ADDR_EQUAL(&satosin6(rt->rt_ifa->ifa_addr)
->sin6_addr,
&sin6->sin6_addr)) {
rt->rt_flags |= RTF_LOCAL;
}
}
if (!rt->rt_rmx.rmx_mtu && !(rt->rt_rmx.rmx_locks & RTV_MTU) &&
rt->rt_ifp != NULL)
rt->rt_rmx.rmx_mtu = IN6_LINKMTU(rt->rt_ifp);
ret = rn_addroute(key, mask, head, treenodes);
if (ret == NULL && rt->rt_flags & RTF_HOST) {
struct rtentry *rt2;
rt2 = rtpurelookup((struct sockaddr *)sin6);
if (rt2 != NULL) {
--rt2->rt_refcnt;
if (rt2->rt_flags & RTF_LLINFO &&
rt2->rt_flags & RTF_HOST &&
rt2->rt_gateway &&
rt2->rt_gateway->sa_family == AF_LINK) {
rtrequest(RTM_DELETE, rt_key(rt2),
rt2->rt_gateway, rt_mask(rt2),
rt2->rt_flags, NULL);
ret = rn_addroute(key, mask, head, treenodes);
}
}
} else if (ret == NULL && rt->rt_flags & RTF_CLONING) {
struct rtentry *rt2;
rt2 = rtpurelookup((struct sockaddr *)sin6);
if (rt2 != NULL) {
if ((rt2->rt_flags & (RTF_CLONING|RTF_HOST|RTF_GATEWAY))
== RTF_CLONING &&
rt2->rt_gateway &&
rt2->rt_gateway->sa_family == AF_LINK &&
rt2->rt_ifp == rt->rt_ifp) {
ret = rt2->rt_nodes;
}
--rt2->rt_refcnt;
}
}
return ret;
} | [
"static",
"struct",
"radix_node",
"*",
"in6_addroute",
"(",
"char",
"*",
"key",
",",
"char",
"*",
"mask",
",",
"struct",
"radix_node_head",
"*",
"head",
",",
"struct",
"radix_node",
"*",
"treenodes",
")",
"{",
"struct",
"rtentry",
"*",
"rt",
"=",
"(",
"struct",
"rtentry",
"*",
")",
"treenodes",
";",
"struct",
"sockaddr_in6",
"*",
"sin6",
"=",
"(",
"struct",
"sockaddr_in6",
"*",
")",
"rt_key",
"(",
"rt",
")",
";",
"struct",
"radix_node",
"*",
"ret",
";",
"if",
"(",
"IN6_IS_ADDR_MULTICAST",
"(",
"&",
"sin6",
"->",
"sin6_addr",
")",
")",
"rt",
"->",
"rt_flags",
"|=",
"RTF_MULTICAST",
";",
"if",
"(",
"!",
"(",
"rt",
"->",
"rt_flags",
"&",
"(",
"RTF_HOST",
"|",
"RTF_CLONING",
"|",
"RTF_MULTICAST",
")",
")",
")",
"{",
"rt",
"->",
"rt_flags",
"|=",
"RTF_PRCLONING",
";",
"}",
"if",
"(",
"rt",
"->",
"rt_flags",
"&",
"RTF_HOST",
")",
"{",
"if",
"(",
"IN6_ARE_ADDR_EQUAL",
"(",
"&",
"satosin6",
"(",
"rt",
"->",
"rt_ifa",
"->",
"ifa_addr",
")",
"->",
"sin6_addr",
",",
"&",
"sin6",
"->",
"sin6_addr",
")",
")",
"{",
"rt",
"->",
"rt_flags",
"|=",
"RTF_LOCAL",
";",
"}",
"}",
"if",
"(",
"!",
"rt",
"->",
"rt_rmx",
".",
"rmx_mtu",
"&&",
"!",
"(",
"rt",
"->",
"rt_rmx",
".",
"rmx_locks",
"&",
"RTV_MTU",
")",
"&&",
"rt",
"->",
"rt_ifp",
"!=",
"NULL",
")",
"rt",
"->",
"rt_rmx",
".",
"rmx_mtu",
"=",
"IN6_LINKMTU",
"(",
"rt",
"->",
"rt_ifp",
")",
";",
"ret",
"=",
"rn_addroute",
"(",
"key",
",",
"mask",
",",
"head",
",",
"treenodes",
")",
";",
"if",
"(",
"ret",
"==",
"NULL",
"&&",
"rt",
"->",
"rt_flags",
"&",
"RTF_HOST",
")",
"{",
"struct",
"rtentry",
"*",
"rt2",
";",
"rt2",
"=",
"rtpurelookup",
"(",
"(",
"struct",
"sockaddr",
"*",
")",
"sin6",
")",
";",
"if",
"(",
"rt2",
"!=",
"NULL",
")",
"{",
"--",
"rt2",
"->",
"rt_refcnt",
";",
"if",
"(",
"rt2",
"->",
"rt_flags",
"&",
"RTF_LLINFO",
"&&",
"rt2",
"->",
"rt_flags",
"&",
"RTF_HOST",
"&&",
"rt2",
"->",
"rt_gateway",
"&&",
"rt2",
"->",
"rt_gateway",
"->",
"sa_family",
"==",
"AF_LINK",
")",
"{",
"rtrequest",
"(",
"RTM_DELETE",
",",
"rt_key",
"(",
"rt2",
")",
",",
"rt2",
"->",
"rt_gateway",
",",
"rt_mask",
"(",
"rt2",
")",
",",
"rt2",
"->",
"rt_flags",
",",
"NULL",
")",
";",
"ret",
"=",
"rn_addroute",
"(",
"key",
",",
"mask",
",",
"head",
",",
"treenodes",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"ret",
"==",
"NULL",
"&&",
"rt",
"->",
"rt_flags",
"&",
"RTF_CLONING",
")",
"{",
"struct",
"rtentry",
"*",
"rt2",
";",
"rt2",
"=",
"rtpurelookup",
"(",
"(",
"struct",
"sockaddr",
"*",
")",
"sin6",
")",
";",
"if",
"(",
"rt2",
"!=",
"NULL",
")",
"{",
"if",
"(",
"(",
"rt2",
"->",
"rt_flags",
"&",
"(",
"RTF_CLONING",
"|",
"RTF_HOST",
"|",
"RTF_GATEWAY",
")",
")",
"==",
"RTF_CLONING",
"&&",
"rt2",
"->",
"rt_gateway",
"&&",
"rt2",
"->",
"rt_gateway",
"->",
"sa_family",
"==",
"AF_LINK",
"&&",
"rt2",
"->",
"rt_ifp",
"==",
"rt",
"->",
"rt_ifp",
")",
"{",
"ret",
"=",
"rt2",
"->",
"rt_nodes",
";",
"}",
"--",
"rt2",
"->",
"rt_refcnt",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] | Do what we need to do when inserting a route. | [
"Do",
"what",
"we",
"need",
"to",
"do",
"when",
"inserting",
"a",
"route",
"."
] | [
"/*\n\t * For IPv6, all unicast non-host routes are automatically cloning.\n\t */",
"/*\n\t * A little bit of help for both IPv6 output and input:\n\t * For local addresses, we make sure that RTF_LOCAL is set,\n\t * with the thought that this might one day be used to speed up\n\t * ip_input().\n\t *\n\t * We also mark routes to multicast addresses as such, because\n\t * it's easy to do and might be useful (but this is much more\n\t * dubious since it's so easy to inspect the address). (This\n\t * is done above.)\n\t *\n\t * XXX\n\t * should elaborate the code.\n\t */",
"/*\n\t\t * We are trying to add a host route, but can't.\n\t\t * Find out if it is because of an\n\t\t * ARP entry and delete it if so.\n\t\t */",
"/*\n\t\t * We are trying to add a net route, but can't.\n\t\t * The following case should be allowed, so we'll make a\n\t\t * special check for this:\n\t\t *\tTwo IPv6 addresses with the same prefix is assigned\n\t\t *\tto a single interrface.\n\t\t *\t# ifconfig if0 inet6 3ffe:0501::1 prefix 64 alias (*1)\n\t\t *\t# ifconfig if0 inet6 3ffe:0501::2 prefix 64 alias (*2)\n\t\t *\tIn this case, (*1) and (*2) want to add the same\n\t\t *\tnet route entry, 3ffe:0501:: -> if0.\n\t\t *\tThis case should not raise an error.\n\t\t */"
] | [
{
"param": "key",
"type": "char"
},
{
"param": "mask",
"type": "char"
},
{
"param": "head",
"type": "struct radix_node_head"
},
{
"param": "treenodes",
"type": "struct radix_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mask",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "head",
"type": "struct radix_node_head",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "treenodes",
"type": "struct radix_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d26638693a0b067e3b0969241049ecfc8981e86a | atrens/DragonFlyBSD-src | sys/netinet6/in6_rmx.c | [
"BSD-3-Clause"
] | C | in6_matchroute | null | static struct radix_node *
in6_matchroute(char *key, struct radix_node_head *head)
{
struct radix_node *rn = rn_match(key, head);
struct rtentry *rt = (struct rtentry *)rn;
if (rt != NULL && rt->rt_refcnt == 0) { /* this is first reference */
if (rt->rt_flags & RTPRF_OURS) {
rt->rt_flags &= ~RTPRF_OURS;
rt->rt_rmx.rmx_expire = 0;
}
}
return rn;
} | /*
* This code is the inverse of in6_clsroute: on first reference, if we
* were managing the route, stop doing so and set the expiration timer
* back off again.
*/ | This code is the inverse of in6_clsroute: on first reference, if we
were managing the route, stop doing so and set the expiration timer
back off again. | [
"This",
"code",
"is",
"the",
"inverse",
"of",
"in6_clsroute",
":",
"on",
"first",
"reference",
"if",
"we",
"were",
"managing",
"the",
"route",
"stop",
"doing",
"so",
"and",
"set",
"the",
"expiration",
"timer",
"back",
"off",
"again",
"."
] | static struct radix_node *
in6_matchroute(char *key, struct radix_node_head *head)
{
struct radix_node *rn = rn_match(key, head);
struct rtentry *rt = (struct rtentry *)rn;
if (rt != NULL && rt->rt_refcnt == 0) {
if (rt->rt_flags & RTPRF_OURS) {
rt->rt_flags &= ~RTPRF_OURS;
rt->rt_rmx.rmx_expire = 0;
}
}
return rn;
} | [
"static",
"struct",
"radix_node",
"*",
"in6_matchroute",
"(",
"char",
"*",
"key",
",",
"struct",
"radix_node_head",
"*",
"head",
")",
"{",
"struct",
"radix_node",
"*",
"rn",
"=",
"rn_match",
"(",
"key",
",",
"head",
")",
";",
"struct",
"rtentry",
"*",
"rt",
"=",
"(",
"struct",
"rtentry",
"*",
")",
"rn",
";",
"if",
"(",
"rt",
"!=",
"NULL",
"&&",
"rt",
"->",
"rt_refcnt",
"==",
"0",
")",
"{",
"if",
"(",
"rt",
"->",
"rt_flags",
"&",
"RTPRF_OURS",
")",
"{",
"rt",
"->",
"rt_flags",
"&=",
"~",
"RTPRF_OURS",
";",
"rt",
"->",
"rt_rmx",
".",
"rmx_expire",
"=",
"0",
";",
"}",
"}",
"return",
"rn",
";",
"}"
] | This code is the inverse of in6_clsroute: on first reference, if we
were managing the route, stop doing so and set the expiration timer
back off again. | [
"This",
"code",
"is",
"the",
"inverse",
"of",
"in6_clsroute",
":",
"on",
"first",
"reference",
"if",
"we",
"were",
"managing",
"the",
"route",
"stop",
"doing",
"so",
"and",
"set",
"the",
"expiration",
"timer",
"back",
"off",
"again",
"."
] | [
"/* this is first reference */"
] | [
{
"param": "key",
"type": "char"
},
{
"param": "head",
"type": "struct radix_node_head"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "head",
"type": "struct radix_node_head",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d26638693a0b067e3b0969241049ecfc8981e86a | atrens/DragonFlyBSD-src | sys/netinet6/in6_rmx.c | [
"BSD-3-Clause"
] | C | in6_clsroute | void | static void
in6_clsroute(struct radix_node *rn, struct radix_node_head *head)
{
struct rtentry *rt = (struct rtentry *)rn;
if (!(rt->rt_flags & RTF_UP))
return; /* prophylactic measures */
if ((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST)
return;
if ((rt->rt_flags & (RTF_WASCLONED | RTPRF_OURS)) != RTF_WASCLONED)
return;
/*
* As requested by David Greenman:
* If rtq_reallyold is 0, just delete the route without
* waiting for a timeout cycle to kill it.
*/
if (rtq_reallyold != 0) {
rt->rt_flags |= RTPRF_OURS;
rt->rt_rmx.rmx_expire = time_uptime + rtq_reallyold;
} else {
/*
* Remove route from the radix tree, but defer deallocation
* until we return to rtfree().
*/
rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt),
rt->rt_flags, &rt);
}
} | /*
* On last reference drop, mark the route as belong to us so that it can be
* timed out.
*/ | On last reference drop, mark the route as belong to us so that it can be
timed out. | [
"On",
"last",
"reference",
"drop",
"mark",
"the",
"route",
"as",
"belong",
"to",
"us",
"so",
"that",
"it",
"can",
"be",
"timed",
"out",
"."
] | static void
in6_clsroute(struct radix_node *rn, struct radix_node_head *head)
{
struct rtentry *rt = (struct rtentry *)rn;
if (!(rt->rt_flags & RTF_UP))
return;
if ((rt->rt_flags & (RTF_LLINFO | RTF_HOST)) != RTF_HOST)
return;
if ((rt->rt_flags & (RTF_WASCLONED | RTPRF_OURS)) != RTF_WASCLONED)
return;
if (rtq_reallyold != 0) {
rt->rt_flags |= RTPRF_OURS;
rt->rt_rmx.rmx_expire = time_uptime + rtq_reallyold;
} else {
rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt),
rt->rt_flags, &rt);
}
} | [
"static",
"void",
"in6_clsroute",
"(",
"struct",
"radix_node",
"*",
"rn",
",",
"struct",
"radix_node_head",
"*",
"head",
")",
"{",
"struct",
"rtentry",
"*",
"rt",
"=",
"(",
"struct",
"rtentry",
"*",
")",
"rn",
";",
"if",
"(",
"!",
"(",
"rt",
"->",
"rt_flags",
"&",
"RTF_UP",
")",
")",
"return",
";",
"if",
"(",
"(",
"rt",
"->",
"rt_flags",
"&",
"(",
"RTF_LLINFO",
"|",
"RTF_HOST",
")",
")",
"!=",
"RTF_HOST",
")",
"return",
";",
"if",
"(",
"(",
"rt",
"->",
"rt_flags",
"&",
"(",
"RTF_WASCLONED",
"|",
"RTPRF_OURS",
")",
")",
"!=",
"RTF_WASCLONED",
")",
"return",
";",
"if",
"(",
"rtq_reallyold",
"!=",
"0",
")",
"{",
"rt",
"->",
"rt_flags",
"|=",
"RTPRF_OURS",
";",
"rt",
"->",
"rt_rmx",
".",
"rmx_expire",
"=",
"time_uptime",
"+",
"rtq_reallyold",
";",
"}",
"else",
"{",
"rtrequest",
"(",
"RTM_DELETE",
",",
"rt_key",
"(",
"rt",
")",
",",
"rt",
"->",
"rt_gateway",
",",
"rt_mask",
"(",
"rt",
")",
",",
"rt",
"->",
"rt_flags",
",",
"&",
"rt",
")",
";",
"}",
"}"
] | On last reference drop, mark the route as belong to us so that it can be
timed out. | [
"On",
"last",
"reference",
"drop",
"mark",
"the",
"route",
"as",
"belong",
"to",
"us",
"so",
"that",
"it",
"can",
"be",
"timed",
"out",
"."
] | [
"/* prophylactic measures */",
"/*\n\t * As requested by David Greenman:\n\t * If rtq_reallyold is 0, just delete the route without\n\t * waiting for a timeout cycle to kill it.\n\t */",
"/*\n\t\t * Remove route from the radix tree, but defer deallocation\n\t\t * until we return to rtfree().\n\t\t */"
] | [
{
"param": "rn",
"type": "struct radix_node"
},
{
"param": "head",
"type": "struct radix_node_head"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rn",
"type": "struct radix_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "head",
"type": "struct radix_node_head",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d26638693a0b067e3b0969241049ecfc8981e86a | atrens/DragonFlyBSD-src | sys/netinet6/in6_rmx.c | [
"BSD-3-Clause"
] | C | in6_rtqkill | int | static int
in6_rtqkill(struct radix_node *rn, void *rock)
{
struct rtqk_arg *ap = rock;
struct rtentry *rt = (struct rtentry *)rn;
int err;
if (rt->rt_flags & RTPRF_OURS) {
ap->found++;
if (ap->draining || rt->rt_rmx.rmx_expire <= time_uptime) {
if (rt->rt_refcnt > 0)
panic("rtqkill route really not free");
err = rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway,
rt_mask(rt), rt->rt_flags, NULL);
if (err)
log(LOG_WARNING, "in6_rtqkill: error %d", err);
else
ap->killed++;
} else {
if (ap->updating &&
(rt->rt_rmx.rmx_expire - time_uptime >
rtq_reallyold)) {
rt->rt_rmx.rmx_expire =
time_uptime + rtq_reallyold;
}
ap->nextstop = lmin(ap->nextstop,
rt->rt_rmx.rmx_expire);
}
}
return 0;
} | /*
* Get rid of old routes. When draining, this deletes everything, even when
* the timeout is not expired yet. When updating, this makes sure that
* nothing has a timeout longer than the current value of rtq_reallyold.
*/ | Get rid of old routes. When draining, this deletes everything, even when
the timeout is not expired yet. When updating, this makes sure that
nothing has a timeout longer than the current value of rtq_reallyold. | [
"Get",
"rid",
"of",
"old",
"routes",
".",
"When",
"draining",
"this",
"deletes",
"everything",
"even",
"when",
"the",
"timeout",
"is",
"not",
"expired",
"yet",
".",
"When",
"updating",
"this",
"makes",
"sure",
"that",
"nothing",
"has",
"a",
"timeout",
"longer",
"than",
"the",
"current",
"value",
"of",
"rtq_reallyold",
"."
] | static int
in6_rtqkill(struct radix_node *rn, void *rock)
{
struct rtqk_arg *ap = rock;
struct rtentry *rt = (struct rtentry *)rn;
int err;
if (rt->rt_flags & RTPRF_OURS) {
ap->found++;
if (ap->draining || rt->rt_rmx.rmx_expire <= time_uptime) {
if (rt->rt_refcnt > 0)
panic("rtqkill route really not free");
err = rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway,
rt_mask(rt), rt->rt_flags, NULL);
if (err)
log(LOG_WARNING, "in6_rtqkill: error %d", err);
else
ap->killed++;
} else {
if (ap->updating &&
(rt->rt_rmx.rmx_expire - time_uptime >
rtq_reallyold)) {
rt->rt_rmx.rmx_expire =
time_uptime + rtq_reallyold;
}
ap->nextstop = lmin(ap->nextstop,
rt->rt_rmx.rmx_expire);
}
}
return 0;
} | [
"static",
"int",
"in6_rtqkill",
"(",
"struct",
"radix_node",
"*",
"rn",
",",
"void",
"*",
"rock",
")",
"{",
"struct",
"rtqk_arg",
"*",
"ap",
"=",
"rock",
";",
"struct",
"rtentry",
"*",
"rt",
"=",
"(",
"struct",
"rtentry",
"*",
")",
"rn",
";",
"int",
"err",
";",
"if",
"(",
"rt",
"->",
"rt_flags",
"&",
"RTPRF_OURS",
")",
"{",
"ap",
"->",
"found",
"++",
";",
"if",
"(",
"ap",
"->",
"draining",
"||",
"rt",
"->",
"rt_rmx",
".",
"rmx_expire",
"<=",
"time_uptime",
")",
"{",
"if",
"(",
"rt",
"->",
"rt_refcnt",
">",
"0",
")",
"panic",
"(",
"\"",
"\"",
")",
";",
"err",
"=",
"rtrequest",
"(",
"RTM_DELETE",
",",
"rt_key",
"(",
"rt",
")",
",",
"rt",
"->",
"rt_gateway",
",",
"rt_mask",
"(",
"rt",
")",
",",
"rt",
"->",
"rt_flags",
",",
"NULL",
")",
";",
"if",
"(",
"err",
")",
"log",
"(",
"LOG_WARNING",
",",
"\"",
"\"",
",",
"err",
")",
";",
"else",
"ap",
"->",
"killed",
"++",
";",
"}",
"else",
"{",
"if",
"(",
"ap",
"->",
"updating",
"&&",
"(",
"rt",
"->",
"rt_rmx",
".",
"rmx_expire",
"-",
"time_uptime",
">",
"rtq_reallyold",
")",
")",
"{",
"rt",
"->",
"rt_rmx",
".",
"rmx_expire",
"=",
"time_uptime",
"+",
"rtq_reallyold",
";",
"}",
"ap",
"->",
"nextstop",
"=",
"lmin",
"(",
"ap",
"->",
"nextstop",
",",
"rt",
"->",
"rt_rmx",
".",
"rmx_expire",
")",
";",
"}",
"}",
"return",
"0",
";",
"}"
] | Get rid of old routes. | [
"Get",
"rid",
"of",
"old",
"routes",
"."
] | [] | [
{
"param": "rn",
"type": "struct radix_node"
},
{
"param": "rock",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rn",
"type": "struct radix_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rock",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8e0a917f96a3137b9dfc96db538fe5ad42ccd872 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-streamer.c | [
"BSD-3-Clause"
] | C | streamer_check_handled_ts_structures | void | void
streamer_check_handled_ts_structures (void)
{
bool handled_p[LAST_TS_ENUM];
unsigned i;
memset (&handled_p, 0, sizeof (handled_p));
/* These are the TS_* structures that are either handled or
explicitly ignored by the streamer routines. */
handled_p[TS_BASE] = true;
handled_p[TS_TYPED] = true;
handled_p[TS_COMMON] = true;
handled_p[TS_INT_CST] = true;
handled_p[TS_REAL_CST] = true;
handled_p[TS_FIXED_CST] = true;
handled_p[TS_VECTOR] = true;
handled_p[TS_STRING] = true;
handled_p[TS_COMPLEX] = true;
handled_p[TS_IDENTIFIER] = true;
handled_p[TS_DECL_MINIMAL] = true;
handled_p[TS_DECL_COMMON] = true;
handled_p[TS_DECL_WRTL] = true;
handled_p[TS_DECL_NON_COMMON] = true;
handled_p[TS_DECL_WITH_VIS] = true;
handled_p[TS_FIELD_DECL] = true;
handled_p[TS_VAR_DECL] = true;
handled_p[TS_PARM_DECL] = true;
handled_p[TS_LABEL_DECL] = true;
handled_p[TS_RESULT_DECL] = true;
handled_p[TS_CONST_DECL] = true;
handled_p[TS_TYPE_DECL] = true;
handled_p[TS_FUNCTION_DECL] = true;
handled_p[TS_TYPE_COMMON] = true;
handled_p[TS_TYPE_WITH_LANG_SPECIFIC] = true;
handled_p[TS_TYPE_NON_COMMON] = true;
handled_p[TS_LIST] = true;
handled_p[TS_VEC] = true;
handled_p[TS_EXP] = true;
handled_p[TS_SSA_NAME] = true;
handled_p[TS_BLOCK] = true;
handled_p[TS_BINFO] = true;
handled_p[TS_STATEMENT_LIST] = true;
handled_p[TS_CONSTRUCTOR] = true;
handled_p[TS_OMP_CLAUSE] = true;
handled_p[TS_OPTIMIZATION] = true;
handled_p[TS_TARGET_OPTION] = true;
handled_p[TS_TRANSLATION_UNIT_DECL] = true;
/* Anything not marked above will trigger the following assertion.
If this assertion triggers, it means that there is a new TS_*
structure that should be handled by the streamer. */
for (i = 0; i < LAST_TS_ENUM; i++)
gcc_assert (handled_p[i]);
} | /* Check that all the TS_* structures handled by the streamer_write_* and
streamer_read_* routines are exactly ALL the structures defined in
treestruct.def. */ | Check that all the TS_* structures handled by the streamer_write_* and
streamer_read_* routines are exactly ALL the structures defined in
treestruct.def. | [
"Check",
"that",
"all",
"the",
"TS_",
"*",
"structures",
"handled",
"by",
"the",
"streamer_write_",
"*",
"and",
"streamer_read_",
"*",
"routines",
"are",
"exactly",
"ALL",
"the",
"structures",
"defined",
"in",
"treestruct",
".",
"def",
"."
] | void
streamer_check_handled_ts_structures (void)
{
bool handled_p[LAST_TS_ENUM];
unsigned i;
memset (&handled_p, 0, sizeof (handled_p));
handled_p[TS_BASE] = true;
handled_p[TS_TYPED] = true;
handled_p[TS_COMMON] = true;
handled_p[TS_INT_CST] = true;
handled_p[TS_REAL_CST] = true;
handled_p[TS_FIXED_CST] = true;
handled_p[TS_VECTOR] = true;
handled_p[TS_STRING] = true;
handled_p[TS_COMPLEX] = true;
handled_p[TS_IDENTIFIER] = true;
handled_p[TS_DECL_MINIMAL] = true;
handled_p[TS_DECL_COMMON] = true;
handled_p[TS_DECL_WRTL] = true;
handled_p[TS_DECL_NON_COMMON] = true;
handled_p[TS_DECL_WITH_VIS] = true;
handled_p[TS_FIELD_DECL] = true;
handled_p[TS_VAR_DECL] = true;
handled_p[TS_PARM_DECL] = true;
handled_p[TS_LABEL_DECL] = true;
handled_p[TS_RESULT_DECL] = true;
handled_p[TS_CONST_DECL] = true;
handled_p[TS_TYPE_DECL] = true;
handled_p[TS_FUNCTION_DECL] = true;
handled_p[TS_TYPE_COMMON] = true;
handled_p[TS_TYPE_WITH_LANG_SPECIFIC] = true;
handled_p[TS_TYPE_NON_COMMON] = true;
handled_p[TS_LIST] = true;
handled_p[TS_VEC] = true;
handled_p[TS_EXP] = true;
handled_p[TS_SSA_NAME] = true;
handled_p[TS_BLOCK] = true;
handled_p[TS_BINFO] = true;
handled_p[TS_STATEMENT_LIST] = true;
handled_p[TS_CONSTRUCTOR] = true;
handled_p[TS_OMP_CLAUSE] = true;
handled_p[TS_OPTIMIZATION] = true;
handled_p[TS_TARGET_OPTION] = true;
handled_p[TS_TRANSLATION_UNIT_DECL] = true;
for (i = 0; i < LAST_TS_ENUM; i++)
gcc_assert (handled_p[i]);
} | [
"void",
"streamer_check_handled_ts_structures",
"(",
"void",
")",
"{",
"bool",
"handled_p",
"[",
"LAST_TS_ENUM",
"]",
";",
"unsigned",
"i",
";",
"memset",
"(",
"&",
"handled_p",
",",
"0",
",",
"sizeof",
"(",
"handled_p",
")",
")",
";",
"handled_p",
"[",
"TS_BASE",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_TYPED",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_COMMON",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_INT_CST",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_REAL_CST",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_FIXED_CST",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_VECTOR",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_STRING",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_COMPLEX",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_IDENTIFIER",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_DECL_MINIMAL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_DECL_COMMON",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_DECL_WRTL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_DECL_NON_COMMON",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_DECL_WITH_VIS",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_FIELD_DECL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_VAR_DECL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_PARM_DECL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_LABEL_DECL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_RESULT_DECL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_CONST_DECL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_TYPE_DECL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_FUNCTION_DECL",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_TYPE_COMMON",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_TYPE_WITH_LANG_SPECIFIC",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_TYPE_NON_COMMON",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_LIST",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_VEC",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_EXP",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_SSA_NAME",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_BLOCK",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_BINFO",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_STATEMENT_LIST",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_CONSTRUCTOR",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_OMP_CLAUSE",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_OPTIMIZATION",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_TARGET_OPTION",
"]",
"=",
"true",
";",
"handled_p",
"[",
"TS_TRANSLATION_UNIT_DECL",
"]",
"=",
"true",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"LAST_TS_ENUM",
";",
"i",
"++",
")",
"gcc_assert",
"(",
"handled_p",
"[",
"i",
"]",
")",
";",
"}"
] | Check that all the TS_* structures handled by the streamer_write_* and
streamer_read_* routines are exactly ALL the structures defined in
treestruct.def. | [
"Check",
"that",
"all",
"the",
"TS_",
"*",
"structures",
"handled",
"by",
"the",
"streamer_write_",
"*",
"and",
"streamer_read_",
"*",
"routines",
"are",
"exactly",
"ALL",
"the",
"structures",
"defined",
"in",
"treestruct",
".",
"def",
"."
] | [
"/* These are the TS_* structures that are either handled or\n explicitly ignored by the streamer routines. */",
"/* Anything not marked above will trigger the following assertion.\n If this assertion triggers, it means that there is a new TS_*\n structure that should be handled by the streamer. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
8e0a917f96a3137b9dfc96db538fe5ad42ccd872 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-streamer.c | [
"BSD-3-Clause"
] | C | streamer_tree_cache_insert | bool | bool
streamer_tree_cache_insert (struct streamer_tree_cache_d *cache, tree t,
unsigned *ix_p)
{
return streamer_tree_cache_insert_1 (cache, t, ix_p, true);
} | /* Insert tree node T in CACHE. If T already existed in the cache
return true. Otherwise, return false.
If IX_P is non-null, update it with the index into the cache where
T has been stored. */ | Insert tree node T in CACHE. If T already existed in the cache
return true. Otherwise, return false.
If IX_P is non-null, update it with the index into the cache where
T has been stored. | [
"Insert",
"tree",
"node",
"T",
"in",
"CACHE",
".",
"If",
"T",
"already",
"existed",
"in",
"the",
"cache",
"return",
"true",
".",
"Otherwise",
"return",
"false",
".",
"If",
"IX_P",
"is",
"non",
"-",
"null",
"update",
"it",
"with",
"the",
"index",
"into",
"the",
"cache",
"where",
"T",
"has",
"been",
"stored",
"."
] | bool
streamer_tree_cache_insert (struct streamer_tree_cache_d *cache, tree t,
unsigned *ix_p)
{
return streamer_tree_cache_insert_1 (cache, t, ix_p, true);
} | [
"bool",
"streamer_tree_cache_insert",
"(",
"struct",
"streamer_tree_cache_d",
"*",
"cache",
",",
"tree",
"t",
",",
"unsigned",
"*",
"ix_p",
")",
"{",
"return",
"streamer_tree_cache_insert_1",
"(",
"cache",
",",
"t",
",",
"ix_p",
",",
"true",
")",
";",
"}"
] | Insert tree node T in CACHE. | [
"Insert",
"tree",
"node",
"T",
"in",
"CACHE",
"."
] | [] | [
{
"param": "cache",
"type": "struct streamer_tree_cache_d"
},
{
"param": "t",
"type": "tree"
},
{
"param": "ix_p",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "struct streamer_tree_cache_d",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ix_p",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8e0a917f96a3137b9dfc96db538fe5ad42ccd872 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-streamer.c | [
"BSD-3-Clause"
] | C | streamer_tree_cache_insert_at | bool | bool
streamer_tree_cache_insert_at (struct streamer_tree_cache_d *cache,
tree t, unsigned ix)
{
return streamer_tree_cache_insert_1 (cache, t, &ix, false);
} | /* Insert tree node T in CACHE at slot IX. If T already
existed in the cache return true. Otherwise, return false. */ | Insert tree node T in CACHE at slot IX. If T already
existed in the cache return true. Otherwise, return false. | [
"Insert",
"tree",
"node",
"T",
"in",
"CACHE",
"at",
"slot",
"IX",
".",
"If",
"T",
"already",
"existed",
"in",
"the",
"cache",
"return",
"true",
".",
"Otherwise",
"return",
"false",
"."
] | bool
streamer_tree_cache_insert_at (struct streamer_tree_cache_d *cache,
tree t, unsigned ix)
{
return streamer_tree_cache_insert_1 (cache, t, &ix, false);
} | [
"bool",
"streamer_tree_cache_insert_at",
"(",
"struct",
"streamer_tree_cache_d",
"*",
"cache",
",",
"tree",
"t",
",",
"unsigned",
"ix",
")",
"{",
"return",
"streamer_tree_cache_insert_1",
"(",
"cache",
",",
"t",
",",
"&",
"ix",
",",
"false",
")",
";",
"}"
] | Insert tree node T in CACHE at slot IX. | [
"Insert",
"tree",
"node",
"T",
"in",
"CACHE",
"at",
"slot",
"IX",
"."
] | [] | [
{
"param": "cache",
"type": "struct streamer_tree_cache_d"
},
{
"param": "t",
"type": "tree"
},
{
"param": "ix",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "struct streamer_tree_cache_d",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ix",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8e0a917f96a3137b9dfc96db538fe5ad42ccd872 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-streamer.c | [
"BSD-3-Clause"
] | C | streamer_tree_cache_append | void | void
streamer_tree_cache_append (struct streamer_tree_cache_d *cache, tree t)
{
unsigned ix = VEC_length (tree, cache->nodes);
streamer_tree_cache_insert_1 (cache, t, &ix, false);
} | /* Appends tree node T to CACHE, even if T already existed in it. */ | Appends tree node T to CACHE, even if T already existed in it. | [
"Appends",
"tree",
"node",
"T",
"to",
"CACHE",
"even",
"if",
"T",
"already",
"existed",
"in",
"it",
"."
] | void
streamer_tree_cache_append (struct streamer_tree_cache_d *cache, tree t)
{
unsigned ix = VEC_length (tree, cache->nodes);
streamer_tree_cache_insert_1 (cache, t, &ix, false);
} | [
"void",
"streamer_tree_cache_append",
"(",
"struct",
"streamer_tree_cache_d",
"*",
"cache",
",",
"tree",
"t",
")",
"{",
"unsigned",
"ix",
"=",
"VEC_length",
"(",
"tree",
",",
"cache",
"->",
"nodes",
")",
";",
"streamer_tree_cache_insert_1",
"(",
"cache",
",",
"t",
",",
"&",
"ix",
",",
"false",
")",
";",
"}"
] | Appends tree node T to CACHE, even if T already existed in it. | [
"Appends",
"tree",
"node",
"T",
"to",
"CACHE",
"even",
"if",
"T",
"already",
"existed",
"in",
"it",
"."
] | [] | [
{
"param": "cache",
"type": "struct streamer_tree_cache_d"
},
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "struct streamer_tree_cache_d",
"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": []
} |
8e0a917f96a3137b9dfc96db538fe5ad42ccd872 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-streamer.c | [
"BSD-3-Clause"
] | C | streamer_tree_cache_lookup | bool | bool
streamer_tree_cache_lookup (struct streamer_tree_cache_d *cache, tree t,
unsigned *ix_p)
{
void **slot;
bool retval;
unsigned ix;
gcc_assert (t);
slot = pointer_map_contains (cache->node_map, t);
if (slot == NULL)
{
retval = false;
ix = -1;
}
else
{
retval = true;
ix = (size_t) *slot - 1;
}
if (ix_p)
*ix_p = ix;
return retval;
} | /* Return true if tree node T exists in CACHE, otherwise false. If IX_P is
not NULL, write to *IX_P the index into the cache where T is stored
((unsigned)-1 if T is not found). */ | Return true if tree node T exists in CACHE, otherwise false. If IX_P is
not NULL, write to *IX_P the index into the cache where T is stored
((unsigned)-1 if T is not found). | [
"Return",
"true",
"if",
"tree",
"node",
"T",
"exists",
"in",
"CACHE",
"otherwise",
"false",
".",
"If",
"IX_P",
"is",
"not",
"NULL",
"write",
"to",
"*",
"IX_P",
"the",
"index",
"into",
"the",
"cache",
"where",
"T",
"is",
"stored",
"((",
"unsigned",
")",
"-",
"1",
"if",
"T",
"is",
"not",
"found",
")",
"."
] | bool
streamer_tree_cache_lookup (struct streamer_tree_cache_d *cache, tree t,
unsigned *ix_p)
{
void **slot;
bool retval;
unsigned ix;
gcc_assert (t);
slot = pointer_map_contains (cache->node_map, t);
if (slot == NULL)
{
retval = false;
ix = -1;
}
else
{
retval = true;
ix = (size_t) *slot - 1;
}
if (ix_p)
*ix_p = ix;
return retval;
} | [
"bool",
"streamer_tree_cache_lookup",
"(",
"struct",
"streamer_tree_cache_d",
"*",
"cache",
",",
"tree",
"t",
",",
"unsigned",
"*",
"ix_p",
")",
"{",
"void",
"*",
"*",
"slot",
";",
"bool",
"retval",
";",
"unsigned",
"ix",
";",
"gcc_assert",
"(",
"t",
")",
";",
"slot",
"=",
"pointer_map_contains",
"(",
"cache",
"->",
"node_map",
",",
"t",
")",
";",
"if",
"(",
"slot",
"==",
"NULL",
")",
"{",
"retval",
"=",
"false",
";",
"ix",
"=",
"-1",
";",
"}",
"else",
"{",
"retval",
"=",
"true",
";",
"ix",
"=",
"(",
"size_t",
")",
"*",
"slot",
"-",
"1",
";",
"}",
"if",
"(",
"ix_p",
")",
"*",
"ix_p",
"=",
"ix",
";",
"return",
"retval",
";",
"}"
] | Return true if tree node T exists in CACHE, otherwise false. | [
"Return",
"true",
"if",
"tree",
"node",
"T",
"exists",
"in",
"CACHE",
"otherwise",
"false",
"."
] | [] | [
{
"param": "cache",
"type": "struct streamer_tree_cache_d"
},
{
"param": "t",
"type": "tree"
},
{
"param": "ix_p",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "struct streamer_tree_cache_d",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ix_p",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8e0a917f96a3137b9dfc96db538fe5ad42ccd872 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-streamer.c | [
"BSD-3-Clause"
] | C | streamer_tree_cache_get | tree | tree
streamer_tree_cache_get (struct streamer_tree_cache_d *cache, unsigned ix)
{
gcc_assert (cache);
/* Make sure we're not requesting something we don't have. */
gcc_assert (ix < VEC_length (tree, cache->nodes));
return VEC_index (tree, cache->nodes, ix);
} | /* Return the tree node at slot IX in CACHE. */ | Return the tree node at slot IX in CACHE. | [
"Return",
"the",
"tree",
"node",
"at",
"slot",
"IX",
"in",
"CACHE",
"."
] | tree
streamer_tree_cache_get (struct streamer_tree_cache_d *cache, unsigned ix)
{
gcc_assert (cache);
gcc_assert (ix < VEC_length (tree, cache->nodes));
return VEC_index (tree, cache->nodes, ix);
} | [
"tree",
"streamer_tree_cache_get",
"(",
"struct",
"streamer_tree_cache_d",
"*",
"cache",
",",
"unsigned",
"ix",
")",
"{",
"gcc_assert",
"(",
"cache",
")",
";",
"gcc_assert",
"(",
"ix",
"<",
"VEC_length",
"(",
"tree",
",",
"cache",
"->",
"nodes",
")",
")",
";",
"return",
"VEC_index",
"(",
"tree",
",",
"cache",
"->",
"nodes",
",",
"ix",
")",
";",
"}"
] | Return the tree node at slot IX in CACHE. | [
"Return",
"the",
"tree",
"node",
"at",
"slot",
"IX",
"in",
"CACHE",
"."
] | [
"/* Make sure we're not requesting something we don't have. */"
] | [
{
"param": "cache",
"type": "struct streamer_tree_cache_d"
},
{
"param": "ix",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "struct streamer_tree_cache_d",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ix",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8e0a917f96a3137b9dfc96db538fe5ad42ccd872 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-streamer.c | [
"BSD-3-Clause"
] | C | preload_common_nodes | void | static void
preload_common_nodes (struct streamer_tree_cache_d *cache)
{
unsigned i;
for (i = 0; i < itk_none; i++)
/* Skip itk_char. char_type_node is dependent on -f[un]signed-char. */
if (i != itk_char)
record_common_node (cache, integer_types[i]);
for (i = 0; i < TYPE_KIND_LAST; i++)
record_common_node (cache, sizetype_tab[i]);
for (i = 0; i < TI_MAX; i++)
/* Skip boolean type and constants, they are frontend dependent. */
if (i != TI_BOOLEAN_TYPE
&& i != TI_BOOLEAN_FALSE
&& i != TI_BOOLEAN_TRUE)
record_common_node (cache, global_trees[i]);
} | /* Preload common nodes into CACHE and make sure they are merged
properly according to the gimple type table. */ | Preload common nodes into CACHE and make sure they are merged
properly according to the gimple type table. | [
"Preload",
"common",
"nodes",
"into",
"CACHE",
"and",
"make",
"sure",
"they",
"are",
"merged",
"properly",
"according",
"to",
"the",
"gimple",
"type",
"table",
"."
] | static void
preload_common_nodes (struct streamer_tree_cache_d *cache)
{
unsigned i;
for (i = 0; i < itk_none; i++)
if (i != itk_char)
record_common_node (cache, integer_types[i]);
for (i = 0; i < TYPE_KIND_LAST; i++)
record_common_node (cache, sizetype_tab[i]);
for (i = 0; i < TI_MAX; i++)
if (i != TI_BOOLEAN_TYPE
&& i != TI_BOOLEAN_FALSE
&& i != TI_BOOLEAN_TRUE)
record_common_node (cache, global_trees[i]);
} | [
"static",
"void",
"preload_common_nodes",
"(",
"struct",
"streamer_tree_cache_d",
"*",
"cache",
")",
"{",
"unsigned",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"itk_none",
";",
"i",
"++",
")",
"if",
"(",
"i",
"!=",
"itk_char",
")",
"record_common_node",
"(",
"cache",
",",
"integer_types",
"[",
"i",
"]",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"TYPE_KIND_LAST",
";",
"i",
"++",
")",
"record_common_node",
"(",
"cache",
",",
"sizetype_tab",
"[",
"i",
"]",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"TI_MAX",
";",
"i",
"++",
")",
"if",
"(",
"i",
"!=",
"TI_BOOLEAN_TYPE",
"&&",
"i",
"!=",
"TI_BOOLEAN_FALSE",
"&&",
"i",
"!=",
"TI_BOOLEAN_TRUE",
")",
"record_common_node",
"(",
"cache",
",",
"global_trees",
"[",
"i",
"]",
")",
";",
"}"
] | Preload common nodes into CACHE and make sure they are merged
properly according to the gimple type table. | [
"Preload",
"common",
"nodes",
"into",
"CACHE",
"and",
"make",
"sure",
"they",
"are",
"merged",
"properly",
"according",
"to",
"the",
"gimple",
"type",
"table",
"."
] | [
"/* Skip itk_char. char_type_node is dependent on -f[un]signed-char. */",
"/* Skip boolean type and constants, they are frontend dependent. */"
] | [
{
"param": "cache",
"type": "struct streamer_tree_cache_d"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cache",
"type": "struct streamer_tree_cache_d",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8e0a917f96a3137b9dfc96db538fe5ad42ccd872 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-streamer.c | [
"BSD-3-Clause"
] | C | streamer_tree_cache_delete | void | void
streamer_tree_cache_delete (struct streamer_tree_cache_d *c)
{
if (c == NULL)
return;
pointer_map_destroy (c->node_map);
VEC_free (tree, heap, c->nodes);
free (c);
} | /* Delete the streamer cache C. */ | Delete the streamer cache C. | [
"Delete",
"the",
"streamer",
"cache",
"C",
"."
] | void
streamer_tree_cache_delete (struct streamer_tree_cache_d *c)
{
if (c == NULL)
return;
pointer_map_destroy (c->node_map);
VEC_free (tree, heap, c->nodes);
free (c);
} | [
"void",
"streamer_tree_cache_delete",
"(",
"struct",
"streamer_tree_cache_d",
"*",
"c",
")",
"{",
"if",
"(",
"c",
"==",
"NULL",
")",
"return",
";",
"pointer_map_destroy",
"(",
"c",
"->",
"node_map",
")",
";",
"VEC_free",
"(",
"tree",
",",
"heap",
",",
"c",
"->",
"nodes",
")",
";",
"free",
"(",
"c",
")",
";",
"}"
] | Delete the streamer cache C. | [
"Delete",
"the",
"streamer",
"cache",
"C",
"."
] | [] | [
{
"param": "c",
"type": "struct streamer_tree_cache_d"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": "struct streamer_tree_cache_d",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3176e1588a37ef6468be53147d93987abd0af2c3 | atrens/DragonFlyBSD-src | usr.bin/talk/io.c | [
"BSD-3-Clause"
] | C | talk | void | void
talk(void)
{
struct hostent *hp, *hp2;
int nb;
fd_set read_set, read_template;
char buf[BUFSIZ], **addr, *his_machine_name;
struct timeval wait;
his_machine_name = NULL;
hp = gethostbyaddr(&his_machine_addr.s_addr,
sizeof(his_machine_addr.s_addr), AF_INET);
if (hp != NULL) {
hp2 = gethostbyname(hp->h_name);
if (hp2 != NULL && hp2->h_addrtype == AF_INET &&
hp2->h_length == sizeof(his_machine_addr))
for (addr = hp2->h_addr_list; *addr != NULL; addr++)
if (memcmp(*addr, &his_machine_addr,
sizeof(his_machine_addr)) == 0) {
his_machine_name = strdup(hp->h_name);
break;
}
}
if (his_machine_name == NULL)
his_machine_name = strdup(inet_ntoa(his_machine_addr));
snprintf(buf, sizeof(buf), "Connection established with %s@%s.",
msg.r_name, his_machine_name);
free(his_machine_name);
message(buf);
write(STDOUT_FILENO, "\007\007\007", 3);
current_line = 0;
/*
* Wait on both the other process (sockt_mask) and
* standard input ( STDIN_MASK )
*/
FD_ZERO(&read_template);
FD_SET(sockt, &read_template);
FD_SET(fileno(stdin), &read_template);
for (;;) {
read_set = read_template;
wait.tv_sec = A_LONG_TIME;
wait.tv_usec = 0;
nb = select(32, &read_set, 0, 0, &wait);
if (nb <= 0) {
if (errno == EINTR) {
read_set = read_template;
continue;
}
/* panic, we don't know what happened */
p_error("Unexpected error from select");
quit();
}
if (FD_ISSET(sockt, &read_set)) {
/* There is data on sockt */
nb = read(sockt, buf, sizeof buf);
if (nb <= 0) {
message("Connection closed. Exiting");
quit();
}
display(&his_win, buf, nb);
}
if (FD_ISSET(fileno(stdin), &read_set)) {
/*
* We can't make the tty non_blocking, because
* curses's output routines would screw up
*/
int i;
ioctl(0, FIONREAD, (struct sgttyb *) &nb);
nb = read(0, buf, nb);
display(&my_win, buf, nb);
/* might lose data here because sockt is non-blocking */
for (i = 0; i < nb; ++i)
if (buf[i] == '\r')
buf[i] = '\n';
write(sockt, buf, nb);
}
}
} | /*
* The routine to do the actual talking
*/ | The routine to do the actual talking | [
"The",
"routine",
"to",
"do",
"the",
"actual",
"talking"
] | void
talk(void)
{
struct hostent *hp, *hp2;
int nb;
fd_set read_set, read_template;
char buf[BUFSIZ], **addr, *his_machine_name;
struct timeval wait;
his_machine_name = NULL;
hp = gethostbyaddr(&his_machine_addr.s_addr,
sizeof(his_machine_addr.s_addr), AF_INET);
if (hp != NULL) {
hp2 = gethostbyname(hp->h_name);
if (hp2 != NULL && hp2->h_addrtype == AF_INET &&
hp2->h_length == sizeof(his_machine_addr))
for (addr = hp2->h_addr_list; *addr != NULL; addr++)
if (memcmp(*addr, &his_machine_addr,
sizeof(his_machine_addr)) == 0) {
his_machine_name = strdup(hp->h_name);
break;
}
}
if (his_machine_name == NULL)
his_machine_name = strdup(inet_ntoa(his_machine_addr));
snprintf(buf, sizeof(buf), "Connection established with %s@%s.",
msg.r_name, his_machine_name);
free(his_machine_name);
message(buf);
write(STDOUT_FILENO, "\007\007\007", 3);
current_line = 0;
FD_ZERO(&read_template);
FD_SET(sockt, &read_template);
FD_SET(fileno(stdin), &read_template);
for (;;) {
read_set = read_template;
wait.tv_sec = A_LONG_TIME;
wait.tv_usec = 0;
nb = select(32, &read_set, 0, 0, &wait);
if (nb <= 0) {
if (errno == EINTR) {
read_set = read_template;
continue;
}
p_error("Unexpected error from select");
quit();
}
if (FD_ISSET(sockt, &read_set)) {
nb = read(sockt, buf, sizeof buf);
if (nb <= 0) {
message("Connection closed. Exiting");
quit();
}
display(&his_win, buf, nb);
}
if (FD_ISSET(fileno(stdin), &read_set)) {
int i;
ioctl(0, FIONREAD, (struct sgttyb *) &nb);
nb = read(0, buf, nb);
display(&my_win, buf, nb);
for (i = 0; i < nb; ++i)
if (buf[i] == '\r')
buf[i] = '\n';
write(sockt, buf, nb);
}
}
} | [
"void",
"talk",
"(",
"void",
")",
"{",
"struct",
"hostent",
"*",
"hp",
",",
"*",
"hp2",
";",
"int",
"nb",
";",
"fd_set",
"read_set",
",",
"read_template",
";",
"char",
"buf",
"[",
"BUFSIZ",
"]",
",",
"*",
"*",
"addr",
",",
"*",
"his_machine_name",
";",
"struct",
"timeval",
"wait",
";",
"his_machine_name",
"=",
"NULL",
";",
"hp",
"=",
"gethostbyaddr",
"(",
"&",
"his_machine_addr",
".",
"s_addr",
",",
"sizeof",
"(",
"his_machine_addr",
".",
"s_addr",
")",
",",
"AF_INET",
")",
";",
"if",
"(",
"hp",
"!=",
"NULL",
")",
"{",
"hp2",
"=",
"gethostbyname",
"(",
"hp",
"->",
"h_name",
")",
";",
"if",
"(",
"hp2",
"!=",
"NULL",
"&&",
"hp2",
"->",
"h_addrtype",
"==",
"AF_INET",
"&&",
"hp2",
"->",
"h_length",
"==",
"sizeof",
"(",
"his_machine_addr",
")",
")",
"for",
"(",
"addr",
"=",
"hp2",
"->",
"h_addr_list",
";",
"*",
"addr",
"!=",
"NULL",
";",
"addr",
"++",
")",
"if",
"(",
"memcmp",
"(",
"*",
"addr",
",",
"&",
"his_machine_addr",
",",
"sizeof",
"(",
"his_machine_addr",
")",
")",
"==",
"0",
")",
"{",
"his_machine_name",
"=",
"strdup",
"(",
"hp",
"->",
"h_name",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"his_machine_name",
"==",
"NULL",
")",
"his_machine_name",
"=",
"strdup",
"(",
"inet_ntoa",
"(",
"his_machine_addr",
")",
")",
";",
"snprintf",
"(",
"buf",
",",
"sizeof",
"(",
"buf",
")",
",",
"\"",
"\"",
",",
"msg",
".",
"r_name",
",",
"his_machine_name",
")",
";",
"free",
"(",
"his_machine_name",
")",
";",
"message",
"(",
"buf",
")",
";",
"write",
"(",
"STDOUT_FILENO",
",",
"\"",
"\\007",
"\\007",
"\\007",
"\"",
",",
"3",
")",
";",
"current_line",
"=",
"0",
";",
"FD_ZERO",
"(",
"&",
"read_template",
")",
";",
"FD_SET",
"(",
"sockt",
",",
"&",
"read_template",
")",
";",
"FD_SET",
"(",
"fileno",
"(",
"stdin",
")",
",",
"&",
"read_template",
")",
";",
"for",
"(",
";",
";",
")",
"{",
"read_set",
"=",
"read_template",
";",
"wait",
".",
"tv_sec",
"=",
"A_LONG_TIME",
";",
"wait",
".",
"tv_usec",
"=",
"0",
";",
"nb",
"=",
"select",
"(",
"32",
",",
"&",
"read_set",
",",
"0",
",",
"0",
",",
"&",
"wait",
")",
";",
"if",
"(",
"nb",
"<=",
"0",
")",
"{",
"if",
"(",
"errno",
"==",
"EINTR",
")",
"{",
"read_set",
"=",
"read_template",
";",
"continue",
";",
"}",
"p_error",
"(",
"\"",
"\"",
")",
";",
"quit",
"(",
")",
";",
"}",
"if",
"(",
"FD_ISSET",
"(",
"sockt",
",",
"&",
"read_set",
")",
")",
"{",
"nb",
"=",
"read",
"(",
"sockt",
",",
"buf",
",",
"sizeof",
"buf",
")",
";",
"if",
"(",
"nb",
"<=",
"0",
")",
"{",
"message",
"(",
"\"",
"\"",
")",
";",
"quit",
"(",
")",
";",
"}",
"display",
"(",
"&",
"his_win",
",",
"buf",
",",
"nb",
")",
";",
"}",
"if",
"(",
"FD_ISSET",
"(",
"fileno",
"(",
"stdin",
")",
",",
"&",
"read_set",
")",
")",
"{",
"int",
"i",
";",
"ioctl",
"(",
"0",
",",
"FIONREAD",
",",
"(",
"struct",
"sgttyb",
"*",
")",
"&",
"nb",
")",
";",
"nb",
"=",
"read",
"(",
"0",
",",
"buf",
",",
"nb",
")",
";",
"display",
"(",
"&",
"my_win",
",",
"buf",
",",
"nb",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nb",
";",
"++",
"i",
")",
"if",
"(",
"buf",
"[",
"i",
"]",
"==",
"'",
"\\r",
"'",
")",
"buf",
"[",
"i",
"]",
"=",
"'",
"\\n",
"'",
";",
"write",
"(",
"sockt",
",",
"buf",
",",
"nb",
")",
";",
"}",
"}",
"}"
] | The routine to do the actual talking | [
"The",
"routine",
"to",
"do",
"the",
"actual",
"talking"
] | [
"/*\n\t * Wait on both the other process (sockt_mask) and\n\t * standard input ( STDIN_MASK )\n\t */",
"/* panic, we don't know what happened */",
"/* There is data on sockt */",
"/*\n\t\t\t * We can't make the tty non_blocking, because\n\t\t\t * curses's output routines would screw up\n\t\t\t */",
"/* might lose data here because sockt is non-blocking */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3176e1588a37ef6468be53147d93987abd0af2c3 | atrens/DragonFlyBSD-src | usr.bin/talk/io.c | [
"BSD-3-Clause"
] | C | p_error | void | void
p_error(const char *string)
{
wmove(my_win.x_win, current_line, 0);
wprintw(my_win.x_win, "[%s : %s (%d)]\n",
string, strerror(errno), errno);
wrefresh(my_win.x_win);
move(LINES-1, 0);
refresh();
quit();
} | /*
* p_error prints the system error message on the standard location
* on the screen and then exits. (i.e. a curses version of perror)
*/ | p_error prints the system error message on the standard location
on the screen and then exits. | [
"p_error",
"prints",
"the",
"system",
"error",
"message",
"on",
"the",
"standard",
"location",
"on",
"the",
"screen",
"and",
"then",
"exits",
"."
] | void
p_error(const char *string)
{
wmove(my_win.x_win, current_line, 0);
wprintw(my_win.x_win, "[%s : %s (%d)]\n",
string, strerror(errno), errno);
wrefresh(my_win.x_win);
move(LINES-1, 0);
refresh();
quit();
} | [
"void",
"p_error",
"(",
"const",
"char",
"*",
"string",
")",
"{",
"wmove",
"(",
"my_win",
".",
"x_win",
",",
"current_line",
",",
"0",
")",
";",
"wprintw",
"(",
"my_win",
".",
"x_win",
",",
"\"",
"\\n",
"\"",
",",
"string",
",",
"strerror",
"(",
"errno",
")",
",",
"errno",
")",
";",
"wrefresh",
"(",
"my_win",
".",
"x_win",
")",
";",
"move",
"(",
"LINES",
"-",
"1",
",",
"0",
")",
";",
"refresh",
"(",
")",
";",
"quit",
"(",
")",
";",
"}"
] | p_error prints the system error message on the standard location
on the screen and then exits. | [
"p_error",
"prints",
"the",
"system",
"error",
"message",
"on",
"the",
"standard",
"location",
"on",
"the",
"screen",
"and",
"then",
"exits",
"."
] | [] | [
{
"param": "string",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3176e1588a37ef6468be53147d93987abd0af2c3 | atrens/DragonFlyBSD-src | usr.bin/talk/io.c | [
"BSD-3-Clause"
] | C | message | void | void
message(const char *string)
{
wmove(my_win.x_win, current_line, 0);
wprintw(my_win.x_win, "[%s]\n", string);
if (current_line < my_win.x_nlines - 1)
current_line++;
wrefresh(my_win.x_win);
} | /*
* Display string in the standard location
*/ | Display string in the standard location | [
"Display",
"string",
"in",
"the",
"standard",
"location"
] | void
message(const char *string)
{
wmove(my_win.x_win, current_line, 0);
wprintw(my_win.x_win, "[%s]\n", string);
if (current_line < my_win.x_nlines - 1)
current_line++;
wrefresh(my_win.x_win);
} | [
"void",
"message",
"(",
"const",
"char",
"*",
"string",
")",
"{",
"wmove",
"(",
"my_win",
".",
"x_win",
",",
"current_line",
",",
"0",
")",
";",
"wprintw",
"(",
"my_win",
".",
"x_win",
",",
"\"",
"\\n",
"\"",
",",
"string",
")",
";",
"if",
"(",
"current_line",
"<",
"my_win",
".",
"x_nlines",
"-",
"1",
")",
"current_line",
"++",
";",
"wrefresh",
"(",
"my_win",
".",
"x_win",
")",
";",
"}"
] | Display string in the standard location | [
"Display",
"string",
"in",
"the",
"standard",
"location"
] | [] | [
{
"param": "string",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | copy_phi_arg_into_existing_phi | void | static void
copy_phi_arg_into_existing_phi (edge src_e, edge tgt_e)
{
int src_idx = src_e->dest_idx;
int tgt_idx = tgt_e->dest_idx;
/* Iterate over each PHI in e->dest. */
for (gphi_iterator gsi = gsi_start_phis (src_e->dest),
gsi2 = gsi_start_phis (tgt_e->dest);
!gsi_end_p (gsi);
gsi_next (&gsi), gsi_next (&gsi2))
{
gphi *src_phi = gsi.phi ();
gphi *dest_phi = gsi2.phi ();
tree val = gimple_phi_arg_def (src_phi, src_idx);
source_location locus = gimple_phi_arg_location (src_phi, src_idx);
SET_PHI_ARG_DEF (dest_phi, tgt_idx, val);
gimple_phi_arg_set_location (dest_phi, tgt_idx, locus);
}
} | /* Similar to copy_phi_args, except that the PHI arg exists, it just
does not have a value associated with it. */ | Similar to copy_phi_args, except that the PHI arg exists, it just
does not have a value associated with it. | [
"Similar",
"to",
"copy_phi_args",
"except",
"that",
"the",
"PHI",
"arg",
"exists",
"it",
"just",
"does",
"not",
"have",
"a",
"value",
"associated",
"with",
"it",
"."
] | static void
copy_phi_arg_into_existing_phi (edge src_e, edge tgt_e)
{
int src_idx = src_e->dest_idx;
int tgt_idx = tgt_e->dest_idx;
for (gphi_iterator gsi = gsi_start_phis (src_e->dest),
gsi2 = gsi_start_phis (tgt_e->dest);
!gsi_end_p (gsi);
gsi_next (&gsi), gsi_next (&gsi2))
{
gphi *src_phi = gsi.phi ();
gphi *dest_phi = gsi2.phi ();
tree val = gimple_phi_arg_def (src_phi, src_idx);
source_location locus = gimple_phi_arg_location (src_phi, src_idx);
SET_PHI_ARG_DEF (dest_phi, tgt_idx, val);
gimple_phi_arg_set_location (dest_phi, tgt_idx, locus);
}
} | [
"static",
"void",
"copy_phi_arg_into_existing_phi",
"(",
"edge",
"src_e",
",",
"edge",
"tgt_e",
")",
"{",
"int",
"src_idx",
"=",
"src_e",
"->",
"dest_idx",
";",
"int",
"tgt_idx",
"=",
"tgt_e",
"->",
"dest_idx",
";",
"for",
"(",
"gphi_iterator",
"gsi",
"=",
"gsi_start_phis",
"(",
"src_e",
"->",
"dest",
")",
",",
"gsi2",
"=",
"gsi_start_phis",
"(",
"tgt_e",
"->",
"dest",
")",
";",
"!",
"gsi_end_p",
"(",
"gsi",
")",
";",
"gsi_next",
"(",
"&",
"gsi",
")",
",",
"gsi_next",
"(",
"&",
"gsi2",
")",
")",
"{",
"gphi",
"*",
"src_phi",
"=",
"gsi",
".",
"phi",
"(",
")",
";",
"gphi",
"*",
"dest_phi",
"=",
"gsi2",
".",
"phi",
"(",
")",
";",
"tree",
"val",
"=",
"gimple_phi_arg_def",
"(",
"src_phi",
",",
"src_idx",
")",
";",
"source_location",
"locus",
"=",
"gimple_phi_arg_location",
"(",
"src_phi",
",",
"src_idx",
")",
";",
"SET_PHI_ARG_DEF",
"(",
"dest_phi",
",",
"tgt_idx",
",",
"val",
")",
";",
"gimple_phi_arg_set_location",
"(",
"dest_phi",
",",
"tgt_idx",
",",
"locus",
")",
";",
"}",
"}"
] | Similar to copy_phi_args, except that the PHI arg exists, it just
does not have a value associated with it. | [
"Similar",
"to",
"copy_phi_args",
"except",
"that",
"the",
"PHI",
"arg",
"exists",
"it",
"just",
"does",
"not",
"have",
"a",
"value",
"associated",
"with",
"it",
"."
] | [
"/* Iterate over each PHI in e->dest. */"
] | [
{
"param": "src_e",
"type": "edge"
},
{
"param": "tgt_e",
"type": "edge"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "src_e",
"type": "edge",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tgt_e",
"type": "edge",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | create_edge_and_update_destination_phis | void | static void
create_edge_and_update_destination_phis (struct redirection_data *rd,
basic_block bb, int idx)
{
edge e = make_single_succ_edge (bb, rd->path->last ()->e->dest, EDGE_FALLTHRU);
rescan_loop_exit (e, true, false);
/* We used to copy the thread path here. That was added in 2007
and dutifully updated through the representation changes in 2013.
In 2013 we added code to thread from an interior node through
the backedge to another interior node. That runs after the code
to thread through loop headers from outside the loop.
The latter may delete edges in the CFG, including those
which appeared in the jump threading path we copied here. Thus
we'd end up using a dangling pointer.
After reviewing the 2007/2011 code, I can't see how anything
depended on copying the AUX field and clearly copying the jump
threading path is problematical due to embedded edge pointers.
It has been removed. */
e->aux = NULL;
/* If there are any PHI nodes at the destination of the outgoing edge
from the duplicate block, then we will need to add a new argument
to them. The argument should have the same value as the argument
associated with the outgoing edge stored in RD. */
copy_phi_args (e->dest, rd->path->last ()->e, e, rd->path, idx);
} | /* Given a duplicate block and its single destination (both stored
in RD). Create an edge between the duplicate and its single
destination.
Add an additional argument to any PHI nodes at the single
destination. IDX is the start node in jump threading path
we start to check to see if the new PHI argument has constant
value along the jump threading path. */ | Given a duplicate block and its single destination (both stored
in RD). Create an edge between the duplicate and its single
destination.
Add an additional argument to any PHI nodes at the single
destination. IDX is the start node in jump threading path
we start to check to see if the new PHI argument has constant
value along the jump threading path. | [
"Given",
"a",
"duplicate",
"block",
"and",
"its",
"single",
"destination",
"(",
"both",
"stored",
"in",
"RD",
")",
".",
"Create",
"an",
"edge",
"between",
"the",
"duplicate",
"and",
"its",
"single",
"destination",
".",
"Add",
"an",
"additional",
"argument",
"to",
"any",
"PHI",
"nodes",
"at",
"the",
"single",
"destination",
".",
"IDX",
"is",
"the",
"start",
"node",
"in",
"jump",
"threading",
"path",
"we",
"start",
"to",
"check",
"to",
"see",
"if",
"the",
"new",
"PHI",
"argument",
"has",
"constant",
"value",
"along",
"the",
"jump",
"threading",
"path",
"."
] | static void
create_edge_and_update_destination_phis (struct redirection_data *rd,
basic_block bb, int idx)
{
edge e = make_single_succ_edge (bb, rd->path->last ()->e->dest, EDGE_FALLTHRU);
rescan_loop_exit (e, true, false);
e->aux = NULL;
copy_phi_args (e->dest, rd->path->last ()->e, e, rd->path, idx);
} | [
"static",
"void",
"create_edge_and_update_destination_phis",
"(",
"struct",
"redirection_data",
"*",
"rd",
",",
"basic_block",
"bb",
",",
"int",
"idx",
")",
"{",
"edge",
"e",
"=",
"make_single_succ_edge",
"(",
"bb",
",",
"rd",
"->",
"path",
"->",
"last",
"(",
")",
"->",
"e",
"->",
"dest",
",",
"EDGE_FALLTHRU",
")",
";",
"rescan_loop_exit",
"(",
"e",
",",
"true",
",",
"false",
")",
";",
"e",
"->",
"aux",
"=",
"NULL",
";",
"copy_phi_args",
"(",
"e",
"->",
"dest",
",",
"rd",
"->",
"path",
"->",
"last",
"(",
")",
"->",
"e",
",",
"e",
",",
"rd",
"->",
"path",
",",
"idx",
")",
";",
"}"
] | Given a duplicate block and its single destination (both stored
in RD). | [
"Given",
"a",
"duplicate",
"block",
"and",
"its",
"single",
"destination",
"(",
"both",
"stored",
"in",
"RD",
")",
"."
] | [
"/* We used to copy the thread path here. That was added in 2007\n and dutifully updated through the representation changes in 2013.\n\n In 2013 we added code to thread from an interior node through\n the backedge to another interior node. That runs after the code\n to thread through loop headers from outside the loop.\n\n The latter may delete edges in the CFG, including those\n which appeared in the jump threading path we copied here. Thus\n we'd end up using a dangling pointer.\n\n After reviewing the 2007/2011 code, I can't see how anything\n depended on copying the AUX field and clearly copying the jump\n threading path is problematical due to embedded edge pointers.\n It has been removed. */",
"/* If there are any PHI nodes at the destination of the outgoing edge\n from the duplicate block, then we will need to add a new argument\n to them. The argument should have the same value as the argument\n associated with the outgoing edge stored in RD. */"
] | [
{
"param": "rd",
"type": "struct redirection_data"
},
{
"param": "bb",
"type": "basic_block"
},
{
"param": "idx",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rd",
"type": "struct redirection_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bb",
"type": "basic_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "idx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | ssa_fixup_template_block | int | inline int
ssa_fixup_template_block (struct redirection_data **slot,
ssa_local_info_t *local_info)
{
struct redirection_data *rd = *slot;
/* If this is the template block halt the traversal after updating
it appropriately.
If we were threading through an joiner block, then we want
to keep its control statement and redirect an outgoing edge.
Else we want to remove the control statement & edges, then create
a new outgoing edge. In both cases we may need to update PHIs. */
if (rd->dup_blocks[0] && rd->dup_blocks[0] == local_info->template_block)
{
ssa_fix_duplicate_block_edges (rd, local_info);
return 0;
}
return 1;
} | /* We did not create any outgoing edges for the template block during
block creation. This hash table traversal callback creates the
outgoing edge for the template block. */ | We did not create any outgoing edges for the template block during
block creation. This hash table traversal callback creates the
outgoing edge for the template block. | [
"We",
"did",
"not",
"create",
"any",
"outgoing",
"edges",
"for",
"the",
"template",
"block",
"during",
"block",
"creation",
".",
"This",
"hash",
"table",
"traversal",
"callback",
"creates",
"the",
"outgoing",
"edge",
"for",
"the",
"template",
"block",
"."
] | inline int
ssa_fixup_template_block (struct redirection_data **slot,
ssa_local_info_t *local_info)
{
struct redirection_data *rd = *slot;
if (rd->dup_blocks[0] && rd->dup_blocks[0] == local_info->template_block)
{
ssa_fix_duplicate_block_edges (rd, local_info);
return 0;
}
return 1;
} | [
"inline",
"int",
"ssa_fixup_template_block",
"(",
"struct",
"redirection_data",
"*",
"*",
"slot",
",",
"ssa_local_info_t",
"*",
"local_info",
")",
"{",
"struct",
"redirection_data",
"*",
"rd",
"=",
"*",
"slot",
";",
"if",
"(",
"rd",
"->",
"dup_blocks",
"[",
"0",
"]",
"&&",
"rd",
"->",
"dup_blocks",
"[",
"0",
"]",
"==",
"local_info",
"->",
"template_block",
")",
"{",
"ssa_fix_duplicate_block_edges",
"(",
"rd",
",",
"local_info",
")",
";",
"return",
"0",
";",
"}",
"return",
"1",
";",
"}"
] | We did not create any outgoing edges for the template block during
block creation. | [
"We",
"did",
"not",
"create",
"any",
"outgoing",
"edges",
"for",
"the",
"template",
"block",
"during",
"block",
"creation",
"."
] | [
"/* If this is the template block halt the traversal after updating\n it appropriately.\n\n If we were threading through an joiner block, then we want\n to keep its control statement and redirect an outgoing edge.\n Else we want to remove the control statement & edges, then create\n a new outgoing edge. In both cases we may need to update PHIs. */"
] | [
{
"param": "slot",
"type": "struct redirection_data"
},
{
"param": "local_info",
"type": "ssa_local_info_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "slot",
"type": "struct redirection_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "local_info",
"type": "ssa_local_info_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | redirection_block_p | bool | static bool
redirection_block_p (basic_block bb)
{
gimple_stmt_iterator gsi;
/* Advance to the first executable statement. */
gsi = gsi_start_bb (bb);
while (!gsi_end_p (gsi)
&& (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL
|| is_gimple_debug (gsi_stmt (gsi))
|| gimple_nop_p (gsi_stmt (gsi))
|| gimple_clobber_p (gsi_stmt (gsi))))
gsi_next (&gsi);
/* Check if this is an empty block. */
if (gsi_end_p (gsi))
return true;
/* Test that we've reached the terminating control statement. */
return gsi_stmt (gsi)
&& (gimple_code (gsi_stmt (gsi)) == GIMPLE_COND
|| gimple_code (gsi_stmt (gsi)) == GIMPLE_GOTO
|| gimple_code (gsi_stmt (gsi)) == GIMPLE_SWITCH);
} | /* Return true if this block has no executable statements other than
a simple ctrl flow instruction. When the number of outgoing edges
is one, this is equivalent to a "forwarder" block. */ | Return true if this block has no executable statements other than
a simple ctrl flow instruction. When the number of outgoing edges
is one, this is equivalent to a "forwarder" block. | [
"Return",
"true",
"if",
"this",
"block",
"has",
"no",
"executable",
"statements",
"other",
"than",
"a",
"simple",
"ctrl",
"flow",
"instruction",
".",
"When",
"the",
"number",
"of",
"outgoing",
"edges",
"is",
"one",
"this",
"is",
"equivalent",
"to",
"a",
"\"",
"forwarder",
"\"",
"block",
"."
] | static bool
redirection_block_p (basic_block bb)
{
gimple_stmt_iterator gsi;
gsi = gsi_start_bb (bb);
while (!gsi_end_p (gsi)
&& (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL
|| is_gimple_debug (gsi_stmt (gsi))
|| gimple_nop_p (gsi_stmt (gsi))
|| gimple_clobber_p (gsi_stmt (gsi))))
gsi_next (&gsi);
if (gsi_end_p (gsi))
return true;
return gsi_stmt (gsi)
&& (gimple_code (gsi_stmt (gsi)) == GIMPLE_COND
|| gimple_code (gsi_stmt (gsi)) == GIMPLE_GOTO
|| gimple_code (gsi_stmt (gsi)) == GIMPLE_SWITCH);
} | [
"static",
"bool",
"redirection_block_p",
"(",
"basic_block",
"bb",
")",
"{",
"gimple_stmt_iterator",
"gsi",
";",
"gsi",
"=",
"gsi_start_bb",
"(",
"bb",
")",
";",
"while",
"(",
"!",
"gsi_end_p",
"(",
"gsi",
")",
"&&",
"(",
"gimple_code",
"(",
"gsi_stmt",
"(",
"gsi",
")",
")",
"==",
"GIMPLE_LABEL",
"||",
"is_gimple_debug",
"(",
"gsi_stmt",
"(",
"gsi",
")",
")",
"||",
"gimple_nop_p",
"(",
"gsi_stmt",
"(",
"gsi",
")",
")",
"||",
"gimple_clobber_p",
"(",
"gsi_stmt",
"(",
"gsi",
")",
")",
")",
")",
"gsi_next",
"(",
"&",
"gsi",
")",
";",
"if",
"(",
"gsi_end_p",
"(",
"gsi",
")",
")",
"return",
"true",
";",
"return",
"gsi_stmt",
"(",
"gsi",
")",
"&&",
"(",
"gimple_code",
"(",
"gsi_stmt",
"(",
"gsi",
")",
")",
"==",
"GIMPLE_COND",
"||",
"gimple_code",
"(",
"gsi_stmt",
"(",
"gsi",
")",
")",
"==",
"GIMPLE_GOTO",
"||",
"gimple_code",
"(",
"gsi_stmt",
"(",
"gsi",
")",
")",
"==",
"GIMPLE_SWITCH",
")",
";",
"}"
] | Return true if this block has no executable statements other than
a simple ctrl flow instruction. | [
"Return",
"true",
"if",
"this",
"block",
"has",
"no",
"executable",
"statements",
"other",
"than",
"a",
"simple",
"ctrl",
"flow",
"instruction",
"."
] | [
"/* Advance to the first executable statement. */",
"/* Check if this is an empty block. */",
"/* Test that we've reached the terminating control statement. */"
] | [
{
"param": "bb",
"type": "basic_block"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bb",
"type": "basic_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | thread_block | bool | static bool
thread_block (basic_block bb, bool noloop_only)
{
bool retval;
retval = thread_block_1 (bb, noloop_only, false);
retval |= thread_block_1 (bb, noloop_only, true);
return retval;
} | /* Wrapper for thread_block_1 so that we can first handle jump
thread paths which do not involve copying joiner blocks, then
handle jump thread paths which have joiner blocks.
By doing things this way we can be as aggressive as possible and
not worry that copying a joiner block will create a jump threading
opportunity. */ | Wrapper for thread_block_1 so that we can first handle jump
thread paths which do not involve copying joiner blocks, then
handle jump thread paths which have joiner blocks.
By doing things this way we can be as aggressive as possible and
not worry that copying a joiner block will create a jump threading
opportunity. | [
"Wrapper",
"for",
"thread_block_1",
"so",
"that",
"we",
"can",
"first",
"handle",
"jump",
"thread",
"paths",
"which",
"do",
"not",
"involve",
"copying",
"joiner",
"blocks",
"then",
"handle",
"jump",
"thread",
"paths",
"which",
"have",
"joiner",
"blocks",
".",
"By",
"doing",
"things",
"this",
"way",
"we",
"can",
"be",
"as",
"aggressive",
"as",
"possible",
"and",
"not",
"worry",
"that",
"copying",
"a",
"joiner",
"block",
"will",
"create",
"a",
"jump",
"threading",
"opportunity",
"."
] | static bool
thread_block (basic_block bb, bool noloop_only)
{
bool retval;
retval = thread_block_1 (bb, noloop_only, false);
retval |= thread_block_1 (bb, noloop_only, true);
return retval;
} | [
"static",
"bool",
"thread_block",
"(",
"basic_block",
"bb",
",",
"bool",
"noloop_only",
")",
"{",
"bool",
"retval",
";",
"retval",
"=",
"thread_block_1",
"(",
"bb",
",",
"noloop_only",
",",
"false",
")",
";",
"retval",
"|=",
"thread_block_1",
"(",
"bb",
",",
"noloop_only",
",",
"true",
")",
";",
"return",
"retval",
";",
"}"
] | Wrapper for thread_block_1 so that we can first handle jump
thread paths which do not involve copying joiner blocks, then
handle jump thread paths which have joiner blocks. | [
"Wrapper",
"for",
"thread_block_1",
"so",
"that",
"we",
"can",
"first",
"handle",
"jump",
"thread",
"paths",
"which",
"do",
"not",
"involve",
"copying",
"joiner",
"blocks",
"then",
"handle",
"jump",
"thread",
"paths",
"which",
"have",
"joiner",
"blocks",
"."
] | [] | [
{
"param": "bb",
"type": "basic_block"
},
{
"param": "noloop_only",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bb",
"type": "basic_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "noloop_only",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | determine_bb_domination_status | null | enum bb_dom_status
determine_bb_domination_status (struct loop *loop, basic_block bb)
{
basic_block *bblocks;
unsigned nblocks, i;
bool bb_reachable = false;
edge_iterator ei;
edge e;
/* This function assumes BB is a successor of LOOP->header.
If that is not the case return DOMST_NONDOMINATING which
is always safe. */
{
bool ok = false;
FOR_EACH_EDGE (e, ei, bb->preds)
{
if (e->src == loop->header)
{
ok = true;
break;
}
}
if (!ok)
return DOMST_NONDOMINATING;
}
if (bb == loop->latch)
return DOMST_DOMINATING;
/* Check that BB dominates LOOP->latch, and that it is back-reachable
from it. */
bblocks = XCNEWVEC (basic_block, loop->num_nodes);
dbds_ce_stop = loop->header;
nblocks = dfs_enumerate_from (loop->latch, 1, dbds_continue_enumeration_p,
bblocks, loop->num_nodes, bb);
for (i = 0; i < nblocks; i++)
FOR_EACH_EDGE (e, ei, bblocks[i]->preds)
{
if (e->src == loop->header)
{
free (bblocks);
return DOMST_NONDOMINATING;
}
if (e->src == bb)
bb_reachable = true;
}
free (bblocks);
return (bb_reachable ? DOMST_DOMINATING : DOMST_LOOP_BROKEN);
} | /* Evaluates the dominance relationship of latch of the LOOP and BB, and
returns the state. */ | Evaluates the dominance relationship of latch of the LOOP and BB, and
returns the state. | [
"Evaluates",
"the",
"dominance",
"relationship",
"of",
"latch",
"of",
"the",
"LOOP",
"and",
"BB",
"and",
"returns",
"the",
"state",
"."
] | enum bb_dom_status
determine_bb_domination_status (struct loop *loop, basic_block bb)
{
basic_block *bblocks;
unsigned nblocks, i;
bool bb_reachable = false;
edge_iterator ei;
edge e;
{
bool ok = false;
FOR_EACH_EDGE (e, ei, bb->preds)
{
if (e->src == loop->header)
{
ok = true;
break;
}
}
if (!ok)
return DOMST_NONDOMINATING;
}
if (bb == loop->latch)
return DOMST_DOMINATING;
bblocks = XCNEWVEC (basic_block, loop->num_nodes);
dbds_ce_stop = loop->header;
nblocks = dfs_enumerate_from (loop->latch, 1, dbds_continue_enumeration_p,
bblocks, loop->num_nodes, bb);
for (i = 0; i < nblocks; i++)
FOR_EACH_EDGE (e, ei, bblocks[i]->preds)
{
if (e->src == loop->header)
{
free (bblocks);
return DOMST_NONDOMINATING;
}
if (e->src == bb)
bb_reachable = true;
}
free (bblocks);
return (bb_reachable ? DOMST_DOMINATING : DOMST_LOOP_BROKEN);
} | [
"enum",
"bb_dom_status",
"determine_bb_domination_status",
"(",
"struct",
"loop",
"*",
"loop",
",",
"basic_block",
"bb",
")",
"{",
"basic_block",
"*",
"bblocks",
";",
"unsigned",
"nblocks",
",",
"i",
";",
"bool",
"bb_reachable",
"=",
"false",
";",
"edge_iterator",
"ei",
";",
"edge",
"e",
";",
"{",
"bool",
"ok",
"=",
"false",
";",
"FOR_EACH_EDGE",
"(",
"e",
",",
"ei",
",",
"bb",
"->",
"preds",
")",
"",
"{",
"if",
"(",
"e",
"->",
"src",
"==",
"loop",
"->",
"header",
")",
"{",
"ok",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"ok",
")",
"return",
"DOMST_NONDOMINATING",
";",
"}",
"if",
"(",
"bb",
"==",
"loop",
"->",
"latch",
")",
"return",
"DOMST_DOMINATING",
";",
"bblocks",
"=",
"XCNEWVEC",
"(",
"basic_block",
",",
"loop",
"->",
"num_nodes",
")",
";",
"dbds_ce_stop",
"=",
"loop",
"->",
"header",
";",
"nblocks",
"=",
"dfs_enumerate_from",
"(",
"loop",
"->",
"latch",
",",
"1",
",",
"dbds_continue_enumeration_p",
",",
"bblocks",
",",
"loop",
"->",
"num_nodes",
",",
"bb",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nblocks",
";",
"i",
"++",
")",
"FOR_EACH_EDGE",
"(",
"e",
",",
"ei",
",",
"bblocks",
"[",
"i",
"]",
"->",
"preds",
")",
"",
"{",
"if",
"(",
"e",
"->",
"src",
"==",
"loop",
"->",
"header",
")",
"{",
"free",
"(",
"bblocks",
")",
";",
"return",
"DOMST_NONDOMINATING",
";",
"}",
"if",
"(",
"e",
"->",
"src",
"==",
"bb",
")",
"bb_reachable",
"=",
"true",
";",
"}",
"free",
"(",
"bblocks",
")",
";",
"return",
"(",
"bb_reachable",
"?",
"DOMST_DOMINATING",
":",
"DOMST_LOOP_BROKEN",
")",
";",
"}"
] | Evaluates the dominance relationship of latch of the LOOP and BB, and
returns the state. | [
"Evaluates",
"the",
"dominance",
"relationship",
"of",
"latch",
"of",
"the",
"LOOP",
"and",
"BB",
"and",
"returns",
"the",
"state",
"."
] | [
"/* This function assumes BB is a successor of LOOP->header.\n If that is not the case return DOMST_NONDOMINATING which\n is always safe. */",
"/* Check that BB dominates LOOP->latch, and that it is back-reachable\n from it. */"
] | [
{
"param": "loop",
"type": "struct loop"
},
{
"param": "bb",
"type": "basic_block"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "struct loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bb",
"type": "basic_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | phi_args_equal_on_edges | bool | static bool
phi_args_equal_on_edges (edge e1, edge e2)
{
gphi_iterator gsi;
int indx1 = e1->dest_idx;
int indx2 = e2->dest_idx;
for (gsi = gsi_start_phis (e1->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
gphi *phi = gsi.phi ();
if (!operand_equal_p (gimple_phi_arg_def (phi, indx1),
gimple_phi_arg_def (phi, indx2), 0))
return false;
}
return true;
} | /* E1 and E2 are edges into the same basic block. Return TRUE if the
PHI arguments associated with those edges are equal or there are no
PHI arguments, otherwise return FALSE. */ | E1 and E2 are edges into the same basic block. Return TRUE if the
PHI arguments associated with those edges are equal or there are no
PHI arguments, otherwise return FALSE. | [
"E1",
"and",
"E2",
"are",
"edges",
"into",
"the",
"same",
"basic",
"block",
".",
"Return",
"TRUE",
"if",
"the",
"PHI",
"arguments",
"associated",
"with",
"those",
"edges",
"are",
"equal",
"or",
"there",
"are",
"no",
"PHI",
"arguments",
"otherwise",
"return",
"FALSE",
"."
] | static bool
phi_args_equal_on_edges (edge e1, edge e2)
{
gphi_iterator gsi;
int indx1 = e1->dest_idx;
int indx2 = e2->dest_idx;
for (gsi = gsi_start_phis (e1->dest); !gsi_end_p (gsi); gsi_next (&gsi))
{
gphi *phi = gsi.phi ();
if (!operand_equal_p (gimple_phi_arg_def (phi, indx1),
gimple_phi_arg_def (phi, indx2), 0))
return false;
}
return true;
} | [
"static",
"bool",
"phi_args_equal_on_edges",
"(",
"edge",
"e1",
",",
"edge",
"e2",
")",
"{",
"gphi_iterator",
"gsi",
";",
"int",
"indx1",
"=",
"e1",
"->",
"dest_idx",
";",
"int",
"indx2",
"=",
"e2",
"->",
"dest_idx",
";",
"for",
"(",
"gsi",
"=",
"gsi_start_phis",
"(",
"e1",
"->",
"dest",
")",
";",
"!",
"gsi_end_p",
"(",
"gsi",
")",
";",
"gsi_next",
"(",
"&",
"gsi",
")",
")",
"{",
"gphi",
"*",
"phi",
"=",
"gsi",
".",
"phi",
"(",
")",
";",
"if",
"(",
"!",
"operand_equal_p",
"(",
"gimple_phi_arg_def",
"(",
"phi",
",",
"indx1",
")",
",",
"gimple_phi_arg_def",
"(",
"phi",
",",
"indx2",
")",
",",
"0",
")",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | E1 and E2 are edges into the same basic block. | [
"E1",
"and",
"E2",
"are",
"edges",
"into",
"the",
"same",
"basic",
"block",
"."
] | [] | [
{
"param": "e1",
"type": "edge"
},
{
"param": "e2",
"type": "edge"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "e1",
"type": "edge",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "e2",
"type": "edge",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | count_stmts_and_phis_in_block | null | static unsigned int
count_stmts_and_phis_in_block (basic_block bb)
{
unsigned int num_stmts = 0;
gphi_iterator gpi;
for (gpi = gsi_start_phis (bb); !gsi_end_p (gpi); gsi_next (&gpi))
if (!virtual_operand_p (PHI_RESULT (gpi.phi ())))
num_stmts++;
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
if (!is_gimple_debug (stmt))
num_stmts++;
}
return num_stmts;
} | /* Return the number of non-debug statements and non-virtual PHIs in a
block. */ | Return the number of non-debug statements and non-virtual PHIs in a
block. | [
"Return",
"the",
"number",
"of",
"non",
"-",
"debug",
"statements",
"and",
"non",
"-",
"virtual",
"PHIs",
"in",
"a",
"block",
"."
] | static unsigned int
count_stmts_and_phis_in_block (basic_block bb)
{
unsigned int num_stmts = 0;
gphi_iterator gpi;
for (gpi = gsi_start_phis (bb); !gsi_end_p (gpi); gsi_next (&gpi))
if (!virtual_operand_p (PHI_RESULT (gpi.phi ())))
num_stmts++;
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
if (!is_gimple_debug (stmt))
num_stmts++;
}
return num_stmts;
} | [
"static",
"unsigned",
"int",
"count_stmts_and_phis_in_block",
"(",
"basic_block",
"bb",
")",
"{",
"unsigned",
"int",
"num_stmts",
"=",
"0",
";",
"gphi_iterator",
"gpi",
";",
"for",
"(",
"gpi",
"=",
"gsi_start_phis",
"(",
"bb",
")",
";",
"!",
"gsi_end_p",
"(",
"gpi",
")",
";",
"gsi_next",
"(",
"&",
"gpi",
")",
")",
"if",
"(",
"!",
"virtual_operand_p",
"(",
"PHI_RESULT",
"(",
"gpi",
".",
"phi",
"(",
")",
")",
")",
")",
"num_stmts",
"++",
";",
"gimple_stmt_iterator",
"gsi",
";",
"for",
"(",
"gsi",
"=",
"gsi_start_bb",
"(",
"bb",
")",
";",
"!",
"gsi_end_p",
"(",
"gsi",
")",
";",
"gsi_next",
"(",
"&",
"gsi",
")",
")",
"{",
"gimple",
"*",
"stmt",
"=",
"gsi_stmt",
"(",
"gsi",
")",
";",
"if",
"(",
"!",
"is_gimple_debug",
"(",
"stmt",
")",
")",
"num_stmts",
"++",
";",
"}",
"return",
"num_stmts",
";",
"}"
] | Return the number of non-debug statements and non-virtual PHIs in a
block. | [
"Return",
"the",
"number",
"of",
"non",
"-",
"debug",
"statements",
"and",
"non",
"-",
"virtual",
"PHIs",
"in",
"a",
"block",
"."
] | [] | [
{
"param": "bb",
"type": "basic_block"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bb",
"type": "basic_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | bb_in_bbs | bool | static inline bool
bb_in_bbs (basic_block bb, basic_block *bbs, int n)
{
for (int i = 0; i < n; i++)
if (bb == bbs[i])
return true;
return false;
} | /* Return true when BB is one of the first N items in BBS. */ | Return true when BB is one of the first N items in BBS. | [
"Return",
"true",
"when",
"BB",
"is",
"one",
"of",
"the",
"first",
"N",
"items",
"in",
"BBS",
"."
] | static inline bool
bb_in_bbs (basic_block bb, basic_block *bbs, int n)
{
for (int i = 0; i < n; i++)
if (bb == bbs[i])
return true;
return false;
} | [
"static",
"inline",
"bool",
"bb_in_bbs",
"(",
"basic_block",
"bb",
",",
"basic_block",
"*",
"bbs",
",",
"int",
"n",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"if",
"(",
"bb",
"==",
"bbs",
"[",
"i",
"]",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | Return true when BB is one of the first N items in BBS. | [
"Return",
"true",
"when",
"BB",
"is",
"one",
"of",
"the",
"first",
"N",
"items",
"in",
"BBS",
"."
] | [] | [
{
"param": "bb",
"type": "basic_block"
},
{
"param": "bbs",
"type": "basic_block"
},
{
"param": "n",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bb",
"type": "basic_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bbs",
"type": "basic_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "n",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
b6bc5fcf17593bd66af019975b69b47d273dd828 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/tree-ssa-threadupdate.c | [
"BSD-3-Clause"
] | C | uses_in_bb | int | static int
uses_in_bb (tree t, basic_block bb)
{
int uses = 0;
bool outside_bb = false;
imm_use_iterator iter;
use_operand_p use_p;
FOR_EACH_IMM_USE_FAST (use_p, iter, t)
{
if (is_gimple_debug (USE_STMT (use_p)))
continue;
if (gimple_bb (USE_STMT (use_p)) != bb)
outside_bb = true;
else
uses++;
if (outside_bb && uses > 1)
return -2;
}
if (outside_bb)
return -1;
return uses;
} | /* Return how many uses of T there are within BB, as long as there
aren't any uses outside BB. If there are any uses outside BB,
return -1 if there's at most one use within BB, or -2 if there is
more than one use within BB. */ | Return how many uses of T there are within BB, as long as there
aren't any uses outside BB. If there are any uses outside BB,
return -1 if there's at most one use within BB, or -2 if there is
more than one use within BB. | [
"Return",
"how",
"many",
"uses",
"of",
"T",
"there",
"are",
"within",
"BB",
"as",
"long",
"as",
"there",
"aren",
"'",
"t",
"any",
"uses",
"outside",
"BB",
".",
"If",
"there",
"are",
"any",
"uses",
"outside",
"BB",
"return",
"-",
"1",
"if",
"there",
"'",
"s",
"at",
"most",
"one",
"use",
"within",
"BB",
"or",
"-",
"2",
"if",
"there",
"is",
"more",
"than",
"one",
"use",
"within",
"BB",
"."
] | static int
uses_in_bb (tree t, basic_block bb)
{
int uses = 0;
bool outside_bb = false;
imm_use_iterator iter;
use_operand_p use_p;
FOR_EACH_IMM_USE_FAST (use_p, iter, t)
{
if (is_gimple_debug (USE_STMT (use_p)))
continue;
if (gimple_bb (USE_STMT (use_p)) != bb)
outside_bb = true;
else
uses++;
if (outside_bb && uses > 1)
return -2;
}
if (outside_bb)
return -1;
return uses;
} | [
"static",
"int",
"uses_in_bb",
"(",
"tree",
"t",
",",
"basic_block",
"bb",
")",
"{",
"int",
"uses",
"=",
"0",
";",
"bool",
"outside_bb",
"=",
"false",
";",
"imm_use_iterator",
"iter",
";",
"use_operand_p",
"use_p",
";",
"FOR_EACH_IMM_USE_FAST",
"(",
"use_p",
",",
"iter",
",",
"t",
")",
"",
"{",
"if",
"(",
"is_gimple_debug",
"(",
"USE_STMT",
"(",
"use_p",
")",
")",
")",
"continue",
";",
"if",
"(",
"gimple_bb",
"(",
"USE_STMT",
"(",
"use_p",
")",
")",
"!=",
"bb",
")",
"outside_bb",
"=",
"true",
";",
"else",
"uses",
"++",
";",
"if",
"(",
"outside_bb",
"&&",
"uses",
">",
"1",
")",
"return",
"-2",
";",
"}",
"if",
"(",
"outside_bb",
")",
"return",
"-1",
";",
"return",
"uses",
";",
"}"
] | Return how many uses of T there are within BB, as long as there
aren't any uses outside BB. | [
"Return",
"how",
"many",
"uses",
"of",
"T",
"there",
"are",
"within",
"BB",
"as",
"long",
"as",
"there",
"aren",
"'",
"t",
"any",
"uses",
"outside",
"BB",
"."
] | [] | [
{
"param": "t",
"type": "tree"
},
{
"param": "bb",
"type": "basic_block"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bb",
"type": "basic_block",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3101165a8c695aea652222cf901e8f9b3aeb3c00 | atrens/DragonFlyBSD-src | sys/platform/pc64/vmm/vmx.c | [
"BSD-3-Clause"
] | C | vmx_set_ctl_setting | int | static int
vmx_set_ctl_setting(struct vmx_ctl_info *vmx_ctl, uint32_t bit_no, setting_t value) {
uint64_t vmx_basic;
uint64_t ctl_val;
/* Check if its branch b. or c. */
vmx_basic = rdmsr(IA32_VMX_BASIC);
if (IS_TRUE_CTL_AVAIL(vmx_basic))
ctl_val = rdmsr(vmx_ctl->msr_true_addr);
else
ctl_val = rdmsr(vmx_ctl->msr_addr);
/* Check if the value is known by VMM or set on DEFAULT */
switch(value) {
case DEFAULT:
/*
* Both settings are allowd
* - step b.iii)
* or
* - c.iii), c.iv)
*/
if (IS_ZERO_SETTING_ALLOWED(ctl_val, bit_no) &&
IS_ONE_SETTING_ALLOWED(ctl_val, bit_no)) {
/* For c.iii) and c.iv) */
if (IS_TRUE_CTL_AVAIL(vmx_basic))
ctl_val = rdmsr(vmx_ctl->msr_addr);
if (IS_ZERO_SETTING_ALLOWED(ctl_val, bit_no))
vmx_ctl->ctls &= ~BIT(bit_no);
else if (IS_ONE_SETTING_ALLOWED(ctl_val, bit_no))
vmx_ctl->ctls |= BIT(bit_no);
} else if (IS_ZERO_SETTING_ALLOWED(ctl_val, bit_no)) {
/* b.i), c.i) */
vmx_ctl->ctls &= ~BIT(bit_no);
} else if (IS_ONE_SETTING_ALLOWED(ctl_val, bit_no)) {
/* b.i), c.i) */
vmx_ctl->ctls |= BIT(bit_no);
} else {
return (EINVAL);
}
break;
case ZERO:
/* For b.ii) or c.ii) */
if (!IS_ZERO_SETTING_ALLOWED(ctl_val, bit_no))
return (EINVAL);
vmx_ctl->ctls &= ~BIT(bit_no);
break;
case ONE:
/* For b.ii) or c.ii) */
if (!IS_ONE_SETTING_ALLOWED(ctl_val, bit_no))
return (EINVAL);
vmx_ctl->ctls |= BIT(bit_no);
break;
}
return 0;
} | /* VMX set control setting
* Intel System Programming Guide, Part 3, Order Number 326019
* 31.5.1 Algorithms for Determining VMX Capabilities
* Implement Algorithm 3
*/ | VMX set control setting
Intel System Programming Guide, Part 3, Order Number 326019
31.5.1 Algorithms for Determining VMX Capabilities
Implement Algorithm 3 | [
"VMX",
"set",
"control",
"setting",
"Intel",
"System",
"Programming",
"Guide",
"Part",
"3",
"Order",
"Number",
"326019",
"31",
".",
"5",
".",
"1",
"Algorithms",
"for",
"Determining",
"VMX",
"Capabilities",
"Implement",
"Algorithm",
"3"
] | static int
vmx_set_ctl_setting(struct vmx_ctl_info *vmx_ctl, uint32_t bit_no, setting_t value) {
uint64_t vmx_basic;
uint64_t ctl_val;
vmx_basic = rdmsr(IA32_VMX_BASIC);
if (IS_TRUE_CTL_AVAIL(vmx_basic))
ctl_val = rdmsr(vmx_ctl->msr_true_addr);
else
ctl_val = rdmsr(vmx_ctl->msr_addr);
switch(value) {
case DEFAULT:
if (IS_ZERO_SETTING_ALLOWED(ctl_val, bit_no) &&
IS_ONE_SETTING_ALLOWED(ctl_val, bit_no)) {
if (IS_TRUE_CTL_AVAIL(vmx_basic))
ctl_val = rdmsr(vmx_ctl->msr_addr);
if (IS_ZERO_SETTING_ALLOWED(ctl_val, bit_no))
vmx_ctl->ctls &= ~BIT(bit_no);
else if (IS_ONE_SETTING_ALLOWED(ctl_val, bit_no))
vmx_ctl->ctls |= BIT(bit_no);
} else if (IS_ZERO_SETTING_ALLOWED(ctl_val, bit_no)) {
vmx_ctl->ctls &= ~BIT(bit_no);
} else if (IS_ONE_SETTING_ALLOWED(ctl_val, bit_no)) {
vmx_ctl->ctls |= BIT(bit_no);
} else {
return (EINVAL);
}
break;
case ZERO:
if (!IS_ZERO_SETTING_ALLOWED(ctl_val, bit_no))
return (EINVAL);
vmx_ctl->ctls &= ~BIT(bit_no);
break;
case ONE:
if (!IS_ONE_SETTING_ALLOWED(ctl_val, bit_no))
return (EINVAL);
vmx_ctl->ctls |= BIT(bit_no);
break;
}
return 0;
} | [
"static",
"int",
"vmx_set_ctl_setting",
"(",
"struct",
"vmx_ctl_info",
"*",
"vmx_ctl",
",",
"uint32_t",
"bit_no",
",",
"setting_t",
"value",
")",
"{",
"uint64_t",
"vmx_basic",
";",
"uint64_t",
"ctl_val",
";",
"vmx_basic",
"=",
"rdmsr",
"(",
"IA32_VMX_BASIC",
")",
";",
"if",
"(",
"IS_TRUE_CTL_AVAIL",
"(",
"vmx_basic",
")",
")",
"ctl_val",
"=",
"rdmsr",
"(",
"vmx_ctl",
"->",
"msr_true_addr",
")",
";",
"else",
"ctl_val",
"=",
"rdmsr",
"(",
"vmx_ctl",
"->",
"msr_addr",
")",
";",
"switch",
"(",
"value",
")",
"{",
"case",
"DEFAULT",
":",
"if",
"(",
"IS_ZERO_SETTING_ALLOWED",
"(",
"ctl_val",
",",
"bit_no",
")",
"&&",
"IS_ONE_SETTING_ALLOWED",
"(",
"ctl_val",
",",
"bit_no",
")",
")",
"{",
"if",
"(",
"IS_TRUE_CTL_AVAIL",
"(",
"vmx_basic",
")",
")",
"ctl_val",
"=",
"rdmsr",
"(",
"vmx_ctl",
"->",
"msr_addr",
")",
";",
"if",
"(",
"IS_ZERO_SETTING_ALLOWED",
"(",
"ctl_val",
",",
"bit_no",
")",
")",
"vmx_ctl",
"->",
"ctls",
"&=",
"~",
"BIT",
"(",
"bit_no",
")",
";",
"else",
"if",
"(",
"IS_ONE_SETTING_ALLOWED",
"(",
"ctl_val",
",",
"bit_no",
")",
")",
"vmx_ctl",
"->",
"ctls",
"|=",
"BIT",
"(",
"bit_no",
")",
";",
"}",
"else",
"if",
"(",
"IS_ZERO_SETTING_ALLOWED",
"(",
"ctl_val",
",",
"bit_no",
")",
")",
"{",
"vmx_ctl",
"->",
"ctls",
"&=",
"~",
"BIT",
"(",
"bit_no",
")",
";",
"}",
"else",
"if",
"(",
"IS_ONE_SETTING_ALLOWED",
"(",
"ctl_val",
",",
"bit_no",
")",
")",
"{",
"vmx_ctl",
"->",
"ctls",
"|=",
"BIT",
"(",
"bit_no",
")",
";",
"}",
"else",
"{",
"return",
"(",
"EINVAL",
")",
";",
"}",
"break",
";",
"case",
"ZERO",
":",
"if",
"(",
"!",
"IS_ZERO_SETTING_ALLOWED",
"(",
"ctl_val",
",",
"bit_no",
")",
")",
"return",
"(",
"EINVAL",
")",
";",
"vmx_ctl",
"->",
"ctls",
"&=",
"~",
"BIT",
"(",
"bit_no",
")",
";",
"break",
";",
"case",
"ONE",
":",
"if",
"(",
"!",
"IS_ONE_SETTING_ALLOWED",
"(",
"ctl_val",
",",
"bit_no",
")",
")",
"return",
"(",
"EINVAL",
")",
";",
"vmx_ctl",
"->",
"ctls",
"|=",
"BIT",
"(",
"bit_no",
")",
";",
"break",
";",
"}",
"return",
"0",
";",
"}"
] | VMX set control setting
Intel System Programming Guide, Part 3, Order Number 326019
31.5.1 Algorithms for Determining VMX Capabilities
Implement Algorithm 3 | [
"VMX",
"set",
"control",
"setting",
"Intel",
"System",
"Programming",
"Guide",
"Part",
"3",
"Order",
"Number",
"326019",
"31",
".",
"5",
".",
"1",
"Algorithms",
"for",
"Determining",
"VMX",
"Capabilities",
"Implement",
"Algorithm",
"3"
] | [
"/* Check if its branch b. or c. */",
"/* Check if the value is known by VMM or set on DEFAULT */",
"/*\n\t\t * Both settings are allowd\n\t\t * - step b.iii)\n\t\t * or\n\t\t * - c.iii), c.iv)\n\t\t */",
"/* For c.iii) and c.iv) */",
"/* b.i), c.i) */",
"/* b.i), c.i) */",
"/* For b.ii) or c.ii) */",
"/* For b.ii) or c.ii) */"
] | [
{
"param": "vmx_ctl",
"type": "struct vmx_ctl_info"
},
{
"param": "bit_no",
"type": "uint32_t"
},
{
"param": "value",
"type": "setting_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vmx_ctl",
"type": "struct vmx_ctl_info",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bit_no",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "setting_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3101165a8c695aea652222cf901e8f9b3aeb3c00 | atrens/DragonFlyBSD-src | sys/platform/pc64/vmm/vmx.c | [
"BSD-3-Clause"
] | C | vmx_vminit_master | int | static int
vmx_vminit_master(struct vmm_guest_options *options)
{
struct vmspace *oldvmspace;
struct vmspace *newvmspace;
struct proc *p = curthread->td_proc;
struct vmm_proc *p_vmm;
oldvmspace = curthread->td_lwp->lwp_vmspace;
newvmspace = vmspace_fork(oldvmspace, NULL, NULL);
vmx_ept_pmap_pinit(vmspace_pmap(newvmspace));
bzero(vmspace_pmap(newvmspace)->pm_pml4, PAGE_SIZE);
lwkt_gettoken(&oldvmspace->vm_map.token);
lwkt_gettoken(&newvmspace->vm_map.token);
pmap_pinit2(vmspace_pmap(newvmspace));
pmap_replacevm(curthread->td_proc, newvmspace, 0);
lwkt_reltoken(&newvmspace->vm_map.token);
lwkt_reltoken(&oldvmspace->vm_map.token);
vmspace_rel(oldvmspace);
options->vmm_cr3 = vtophys(vmspace_pmap(newvmspace)->pm_pml4);
p_vmm = kmalloc(sizeof(struct vmm_proc), M_TEMP, M_WAITOK | M_ZERO);
p_vmm->guest_cr3 = options->guest_cr3;
p_vmm->vmm_cr3 = options->vmm_cr3;
p->p_vmm = (void *)p_vmm;
if (p->p_vkernel) {
p->p_vkernel->vkernel_cr3 = options->guest_cr3;
dkprintf("PROCESS CR3 %016jx\n", (intmax_t)options->guest_cr3);
}
return 0;
} | /*
* Called by the first thread of the VMM process
* - create a new vmspace
* - init the vmspace with EPT PG_* bits and
* EPT copyin/copyout functions
* - replace the vmspace of the current proc
* - remove the old vmspace
*/ | Called by the first thread of the VMM process
- create a new vmspace
- init the vmspace with EPT PG_* bits and
EPT copyin/copyout functions
- replace the vmspace of the current proc
- remove the old vmspace | [
"Called",
"by",
"the",
"first",
"thread",
"of",
"the",
"VMM",
"process",
"-",
"create",
"a",
"new",
"vmspace",
"-",
"init",
"the",
"vmspace",
"with",
"EPT",
"PG_",
"*",
"bits",
"and",
"EPT",
"copyin",
"/",
"copyout",
"functions",
"-",
"replace",
"the",
"vmspace",
"of",
"the",
"current",
"proc",
"-",
"remove",
"the",
"old",
"vmspace"
] | static int
vmx_vminit_master(struct vmm_guest_options *options)
{
struct vmspace *oldvmspace;
struct vmspace *newvmspace;
struct proc *p = curthread->td_proc;
struct vmm_proc *p_vmm;
oldvmspace = curthread->td_lwp->lwp_vmspace;
newvmspace = vmspace_fork(oldvmspace, NULL, NULL);
vmx_ept_pmap_pinit(vmspace_pmap(newvmspace));
bzero(vmspace_pmap(newvmspace)->pm_pml4, PAGE_SIZE);
lwkt_gettoken(&oldvmspace->vm_map.token);
lwkt_gettoken(&newvmspace->vm_map.token);
pmap_pinit2(vmspace_pmap(newvmspace));
pmap_replacevm(curthread->td_proc, newvmspace, 0);
lwkt_reltoken(&newvmspace->vm_map.token);
lwkt_reltoken(&oldvmspace->vm_map.token);
vmspace_rel(oldvmspace);
options->vmm_cr3 = vtophys(vmspace_pmap(newvmspace)->pm_pml4);
p_vmm = kmalloc(sizeof(struct vmm_proc), M_TEMP, M_WAITOK | M_ZERO);
p_vmm->guest_cr3 = options->guest_cr3;
p_vmm->vmm_cr3 = options->vmm_cr3;
p->p_vmm = (void *)p_vmm;
if (p->p_vkernel) {
p->p_vkernel->vkernel_cr3 = options->guest_cr3;
dkprintf("PROCESS CR3 %016jx\n", (intmax_t)options->guest_cr3);
}
return 0;
} | [
"static",
"int",
"vmx_vminit_master",
"(",
"struct",
"vmm_guest_options",
"*",
"options",
")",
"{",
"struct",
"vmspace",
"*",
"oldvmspace",
";",
"struct",
"vmspace",
"*",
"newvmspace",
";",
"struct",
"proc",
"*",
"p",
"=",
"curthread",
"->",
"td_proc",
";",
"struct",
"vmm_proc",
"*",
"p_vmm",
";",
"oldvmspace",
"=",
"curthread",
"->",
"td_lwp",
"->",
"lwp_vmspace",
";",
"newvmspace",
"=",
"vmspace_fork",
"(",
"oldvmspace",
",",
"NULL",
",",
"NULL",
")",
";",
"vmx_ept_pmap_pinit",
"(",
"vmspace_pmap",
"(",
"newvmspace",
")",
")",
";",
"bzero",
"(",
"vmspace_pmap",
"(",
"newvmspace",
")",
"->",
"pm_pml4",
",",
"PAGE_SIZE",
")",
";",
"lwkt_gettoken",
"(",
"&",
"oldvmspace",
"->",
"vm_map",
".",
"token",
")",
";",
"lwkt_gettoken",
"(",
"&",
"newvmspace",
"->",
"vm_map",
".",
"token",
")",
";",
"pmap_pinit2",
"(",
"vmspace_pmap",
"(",
"newvmspace",
")",
")",
";",
"pmap_replacevm",
"(",
"curthread",
"->",
"td_proc",
",",
"newvmspace",
",",
"0",
")",
";",
"lwkt_reltoken",
"(",
"&",
"newvmspace",
"->",
"vm_map",
".",
"token",
")",
";",
"lwkt_reltoken",
"(",
"&",
"oldvmspace",
"->",
"vm_map",
".",
"token",
")",
";",
"vmspace_rel",
"(",
"oldvmspace",
")",
";",
"options",
"->",
"vmm_cr3",
"=",
"vtophys",
"(",
"vmspace_pmap",
"(",
"newvmspace",
")",
"->",
"pm_pml4",
")",
";",
"p_vmm",
"=",
"kmalloc",
"(",
"sizeof",
"(",
"struct",
"vmm_proc",
")",
",",
"M_TEMP",
",",
"M_WAITOK",
"|",
"M_ZERO",
")",
";",
"p_vmm",
"->",
"guest_cr3",
"=",
"options",
"->",
"guest_cr3",
";",
"p_vmm",
"->",
"vmm_cr3",
"=",
"options",
"->",
"vmm_cr3",
";",
"p",
"->",
"p_vmm",
"=",
"(",
"void",
"*",
")",
"p_vmm",
";",
"if",
"(",
"p",
"->",
"p_vkernel",
")",
"{",
"p",
"->",
"p_vkernel",
"->",
"vkernel_cr3",
"=",
"options",
"->",
"guest_cr3",
";",
"dkprintf",
"(",
"\"",
"\\n",
"\"",
",",
"(",
"intmax_t",
")",
"options",
"->",
"guest_cr3",
")",
";",
"}",
"return",
"0",
";",
"}"
] | Called by the first thread of the VMM process
- create a new vmspace
- init the vmspace with EPT PG_* bits and
EPT copyin/copyout functions
- replace the vmspace of the current proc
- remove the old vmspace | [
"Called",
"by",
"the",
"first",
"thread",
"of",
"the",
"VMM",
"process",
"-",
"create",
"a",
"new",
"vmspace",
"-",
"init",
"the",
"vmspace",
"with",
"EPT",
"PG_",
"*",
"bits",
"and",
"EPT",
"copyin",
"/",
"copyout",
"functions",
"-",
"replace",
"the",
"vmspace",
"of",
"the",
"current",
"proc",
"-",
"remove",
"the",
"old",
"vmspace"
] | [] | [
{
"param": "options",
"type": "struct vmm_guest_options"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "options",
"type": "struct vmm_guest_options",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3101165a8c695aea652222cf901e8f9b3aeb3c00 | atrens/DragonFlyBSD-src | sys/platform/pc64/vmm/vmx.c | [
"BSD-3-Clause"
] | C | vmx_vmdestroy | int | static int
vmx_vmdestroy(void)
{
struct vmx_thread_info *vti = curthread->td_vmm;
struct proc *p = curproc;
int error = -1;
if (vti != NULL) {
vmx_check_cpu_migration();
execute_vmclear(vti);
invept(INVEPT_TYPE_SINGLE_CONTEXT,
(uint64_t*)&vti->invept_desc);
if (vti->vmcs_region_na != NULL) {
kfree(vti->vmcs_region_na, M_TEMP);
error = 0;
}
curthread->td_vmm = NULL;
kfree(vti, M_TEMP);
lwkt_gettoken(&p->p_token);
if (p->p_nthreads == 1) {
kfree(p->p_vmm, M_TEMP);
p->p_vmm = NULL;
}
lwkt_reltoken(&p->p_token);
}
return error;
} | /*
* Destroy a context. Make sure the context has been cleared and that
* no TLB translations are stlil cached for its EPT.
*/ | Destroy a context. Make sure the context has been cleared and that
no TLB translations are stlil cached for its EPT. | [
"Destroy",
"a",
"context",
".",
"Make",
"sure",
"the",
"context",
"has",
"been",
"cleared",
"and",
"that",
"no",
"TLB",
"translations",
"are",
"stlil",
"cached",
"for",
"its",
"EPT",
"."
] | static int
vmx_vmdestroy(void)
{
struct vmx_thread_info *vti = curthread->td_vmm;
struct proc *p = curproc;
int error = -1;
if (vti != NULL) {
vmx_check_cpu_migration();
execute_vmclear(vti);
invept(INVEPT_TYPE_SINGLE_CONTEXT,
(uint64_t*)&vti->invept_desc);
if (vti->vmcs_region_na != NULL) {
kfree(vti->vmcs_region_na, M_TEMP);
error = 0;
}
curthread->td_vmm = NULL;
kfree(vti, M_TEMP);
lwkt_gettoken(&p->p_token);
if (p->p_nthreads == 1) {
kfree(p->p_vmm, M_TEMP);
p->p_vmm = NULL;
}
lwkt_reltoken(&p->p_token);
}
return error;
} | [
"static",
"int",
"vmx_vmdestroy",
"(",
"void",
")",
"{",
"struct",
"vmx_thread_info",
"*",
"vti",
"=",
"curthread",
"->",
"td_vmm",
";",
"struct",
"proc",
"*",
"p",
"=",
"curproc",
";",
"int",
"error",
"=",
"-1",
";",
"if",
"(",
"vti",
"!=",
"NULL",
")",
"{",
"vmx_check_cpu_migration",
"(",
")",
";",
"execute_vmclear",
"(",
"vti",
")",
";",
"invept",
"(",
"INVEPT_TYPE_SINGLE_CONTEXT",
",",
"(",
"uint64_t",
"*",
")",
"&",
"vti",
"->",
"invept_desc",
")",
";",
"if",
"(",
"vti",
"->",
"vmcs_region_na",
"!=",
"NULL",
")",
"{",
"kfree",
"(",
"vti",
"->",
"vmcs_region_na",
",",
"M_TEMP",
")",
";",
"error",
"=",
"0",
";",
"}",
"curthread",
"->",
"td_vmm",
"=",
"NULL",
";",
"kfree",
"(",
"vti",
",",
"M_TEMP",
")",
";",
"lwkt_gettoken",
"(",
"&",
"p",
"->",
"p_token",
")",
";",
"if",
"(",
"p",
"->",
"p_nthreads",
"==",
"1",
")",
"{",
"kfree",
"(",
"p",
"->",
"p_vmm",
",",
"M_TEMP",
")",
";",
"p",
"->",
"p_vmm",
"=",
"NULL",
";",
"}",
"lwkt_reltoken",
"(",
"&",
"p",
"->",
"p_token",
")",
";",
"}",
"return",
"error",
";",
"}"
] | Destroy a context. | [
"Destroy",
"a",
"context",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3101165a8c695aea652222cf901e8f9b3aeb3c00 | atrens/DragonFlyBSD-src | sys/platform/pc64/vmm/vmx.c | [
"BSD-3-Clause"
] | C | vmx_check_cpu_migration | int | static int
vmx_check_cpu_migration(void)
{
struct vmx_thread_info *vti;
struct globaldata *gd;
cpumask_t mask;
int err;
gd = mycpu;
vti = (struct vmx_thread_info *)curthread->td_vmm;
ERROR_IF(vti == NULL);
if (vti->last_cpu != -1 && vti->last_cpu != gd->gd_cpuid) {
/*
* Clear the context on the remote cpu if it is still
* holding it (can race, we check again in the callback).
*/
CPUMASK_ASSBIT(mask, vti->last_cpu);
lwkt_cpusync_simple(mask, execute_vmclear, (void *)vti);
/*
* Remote cpu may have raced us, we must make sure that
* any reads were not reordered before the check.
*/
cpu_lfence();
}
return 0;
error:
kprintf("VMM: vmx_check_cpu_migration failed\n");
return err;
} | /*
* Checks if we migrated to another cpu
*
* No locks are required
*/ | Checks if we migrated to another cpu
No locks are required | [
"Checks",
"if",
"we",
"migrated",
"to",
"another",
"cpu",
"No",
"locks",
"are",
"required"
] | static int
vmx_check_cpu_migration(void)
{
struct vmx_thread_info *vti;
struct globaldata *gd;
cpumask_t mask;
int err;
gd = mycpu;
vti = (struct vmx_thread_info *)curthread->td_vmm;
ERROR_IF(vti == NULL);
if (vti->last_cpu != -1 && vti->last_cpu != gd->gd_cpuid) {
CPUMASK_ASSBIT(mask, vti->last_cpu);
lwkt_cpusync_simple(mask, execute_vmclear, (void *)vti);
cpu_lfence();
}
return 0;
error:
kprintf("VMM: vmx_check_cpu_migration failed\n");
return err;
} | [
"static",
"int",
"vmx_check_cpu_migration",
"(",
"void",
")",
"{",
"struct",
"vmx_thread_info",
"*",
"vti",
";",
"struct",
"globaldata",
"*",
"gd",
";",
"cpumask_t",
"mask",
";",
"int",
"err",
";",
"gd",
"=",
"mycpu",
";",
"vti",
"=",
"(",
"struct",
"vmx_thread_info",
"*",
")",
"curthread",
"->",
"td_vmm",
";",
"ERROR_IF",
"(",
"vti",
"==",
"NULL",
")",
";",
"if",
"(",
"vti",
"->",
"last_cpu",
"!=",
"-1",
"&&",
"vti",
"->",
"last_cpu",
"!=",
"gd",
"->",
"gd_cpuid",
")",
"{",
"CPUMASK_ASSBIT",
"(",
"mask",
",",
"vti",
"->",
"last_cpu",
")",
";",
"lwkt_cpusync_simple",
"(",
"mask",
",",
"execute_vmclear",
",",
"(",
"void",
"*",
")",
"vti",
")",
";",
"cpu_lfence",
"(",
")",
";",
"}",
"return",
"0",
";",
"error",
":",
"kprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"err",
";",
"}"
] | Checks if we migrated to another cpu
No locks are required | [
"Checks",
"if",
"we",
"migrated",
"to",
"another",
"cpu",
"No",
"locks",
"are",
"required"
] | [
"/*\n\t\t * Clear the context on the remote cpu if it is still\n\t\t * holding it (can race, we check again in the callback).\n\t\t */",
"/*\n\t\t * Remote cpu may have raced us, we must make sure that\n\t\t * any reads were not reordered before the check.\n\t\t */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3101165a8c695aea652222cf901e8f9b3aeb3c00 | atrens/DragonFlyBSD-src | sys/platform/pc64/vmm/vmx.c | [
"BSD-3-Clause"
] | C | vmx_handle_cpu_migration | int | static inline int
vmx_handle_cpu_migration(void)
{
struct vmx_thread_info *vti;
struct globaldata *gd;
int err;
gd = mycpu;
vti = (struct vmx_thread_info *)curthread->td_vmm;
ERROR_IF(vti == NULL);
if (vti->last_cpu != gd->gd_cpuid) {
/*
* We need to synchronize the per-cpu fields after changing
* cpus. Also make sure there are no stale EPT translations
* cached.
*/
dkprintf("VMM: vmx_handle_cpu_migration init per CPU data\n");
ERROR_IF(execute_vmptrld(vti));
invept(INVEPT_TYPE_SINGLE_CONTEXT,
(uint64_t*)&vti->invept_desc);
/* Host related registers */
ERROR_IF(vmwrite(VMCS_HOST_GS_BASE, (uint64_t) gd)); /* mycpu points to %gs:0 */
ERROR_IF(vmwrite(VMCS_HOST_TR_BASE, (uint64_t) &gd->gd_prvspace->common_tss));
ERROR_IF(vmwrite(VMCS_HOST_GDTR_BASE, (uint64_t) &gdt[gd->gd_cpuid * NGDT]));
ERROR_IF(vmwrite(VMCS_HOST_IDTR_BASE, (uint64_t) r_idt_arr[gd->gd_cpuid].rd_base));
/* Guest related register */
ERROR_IF(vmwrite(VMCS_GUEST_GDTR_BASE, (uint64_t) &gdt[gd->gd_cpuid * NGDT]));
ERROR_IF(vmwrite(VMCS_GUEST_GDTR_LIMIT, (uint64_t) (NGDT * sizeof(gdt[0]) - 1)));
} else if (pcpu_info[gd->gd_cpuid].loaded_vmx != vti) {
/*
* We only need to vmptrld
*/
dkprintf("VMM: vmx_handle_cpu_migration: vmcs is not loaded\n");
ERROR_IF(execute_vmptrld(vti));
} /* else we don't need to do anything */
return 0;
error:
kprintf("VMM: vmx_handle_cpu_migration failed\n");
return err;
} | /* Handle CPU migration
*
* We have to enter with interrupts disabled/critical section
* to be sure that another VMCS won't steel our CPU.
*/ | Handle CPU migration
We have to enter with interrupts disabled/critical section
to be sure that another VMCS won't steel our CPU. | [
"Handle",
"CPU",
"migration",
"We",
"have",
"to",
"enter",
"with",
"interrupts",
"disabled",
"/",
"critical",
"section",
"to",
"be",
"sure",
"that",
"another",
"VMCS",
"won",
"'",
"t",
"steel",
"our",
"CPU",
"."
] | static inline int
vmx_handle_cpu_migration(void)
{
struct vmx_thread_info *vti;
struct globaldata *gd;
int err;
gd = mycpu;
vti = (struct vmx_thread_info *)curthread->td_vmm;
ERROR_IF(vti == NULL);
if (vti->last_cpu != gd->gd_cpuid) {
dkprintf("VMM: vmx_handle_cpu_migration init per CPU data\n");
ERROR_IF(execute_vmptrld(vti));
invept(INVEPT_TYPE_SINGLE_CONTEXT,
(uint64_t*)&vti->invept_desc);
ERROR_IF(vmwrite(VMCS_HOST_GS_BASE, (uint64_t) gd));
ERROR_IF(vmwrite(VMCS_HOST_TR_BASE, (uint64_t) &gd->gd_prvspace->common_tss));
ERROR_IF(vmwrite(VMCS_HOST_GDTR_BASE, (uint64_t) &gdt[gd->gd_cpuid * NGDT]));
ERROR_IF(vmwrite(VMCS_HOST_IDTR_BASE, (uint64_t) r_idt_arr[gd->gd_cpuid].rd_base));
ERROR_IF(vmwrite(VMCS_GUEST_GDTR_BASE, (uint64_t) &gdt[gd->gd_cpuid * NGDT]));
ERROR_IF(vmwrite(VMCS_GUEST_GDTR_LIMIT, (uint64_t) (NGDT * sizeof(gdt[0]) - 1)));
} else if (pcpu_info[gd->gd_cpuid].loaded_vmx != vti) {
dkprintf("VMM: vmx_handle_cpu_migration: vmcs is not loaded\n");
ERROR_IF(execute_vmptrld(vti));
}
return 0;
error:
kprintf("VMM: vmx_handle_cpu_migration failed\n");
return err;
} | [
"static",
"inline",
"int",
"vmx_handle_cpu_migration",
"(",
"void",
")",
"{",
"struct",
"vmx_thread_info",
"*",
"vti",
";",
"struct",
"globaldata",
"*",
"gd",
";",
"int",
"err",
";",
"gd",
"=",
"mycpu",
";",
"vti",
"=",
"(",
"struct",
"vmx_thread_info",
"*",
")",
"curthread",
"->",
"td_vmm",
";",
"ERROR_IF",
"(",
"vti",
"==",
"NULL",
")",
";",
"if",
"(",
"vti",
"->",
"last_cpu",
"!=",
"gd",
"->",
"gd_cpuid",
")",
"{",
"dkprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"ERROR_IF",
"(",
"execute_vmptrld",
"(",
"vti",
")",
")",
";",
"invept",
"(",
"INVEPT_TYPE_SINGLE_CONTEXT",
",",
"(",
"uint64_t",
"*",
")",
"&",
"vti",
"->",
"invept_desc",
")",
";",
"ERROR_IF",
"(",
"vmwrite",
"(",
"VMCS_HOST_GS_BASE",
",",
"(",
"uint64_t",
")",
"gd",
")",
")",
";",
"ERROR_IF",
"(",
"vmwrite",
"(",
"VMCS_HOST_TR_BASE",
",",
"(",
"uint64_t",
")",
"&",
"gd",
"->",
"gd_prvspace",
"->",
"common_tss",
")",
")",
";",
"ERROR_IF",
"(",
"vmwrite",
"(",
"VMCS_HOST_GDTR_BASE",
",",
"(",
"uint64_t",
")",
"&",
"gdt",
"[",
"gd",
"->",
"gd_cpuid",
"*",
"NGDT",
"]",
")",
")",
";",
"ERROR_IF",
"(",
"vmwrite",
"(",
"VMCS_HOST_IDTR_BASE",
",",
"(",
"uint64_t",
")",
"r_idt_arr",
"[",
"gd",
"->",
"gd_cpuid",
"]",
".",
"rd_base",
")",
")",
";",
"ERROR_IF",
"(",
"vmwrite",
"(",
"VMCS_GUEST_GDTR_BASE",
",",
"(",
"uint64_t",
")",
"&",
"gdt",
"[",
"gd",
"->",
"gd_cpuid",
"*",
"NGDT",
"]",
")",
")",
";",
"ERROR_IF",
"(",
"vmwrite",
"(",
"VMCS_GUEST_GDTR_LIMIT",
",",
"(",
"uint64_t",
")",
"(",
"NGDT",
"*",
"sizeof",
"(",
"gdt",
"[",
"0",
"]",
")",
"-",
"1",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"pcpu_info",
"[",
"gd",
"->",
"gd_cpuid",
"]",
".",
"loaded_vmx",
"!=",
"vti",
")",
"{",
"dkprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"ERROR_IF",
"(",
"execute_vmptrld",
"(",
"vti",
")",
")",
";",
"}",
"return",
"0",
";",
"error",
":",
"kprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"err",
";",
"}"
] | Handle CPU migration
We have to enter with interrupts disabled/critical section
to be sure that another VMCS won't steel our CPU. | [
"Handle",
"CPU",
"migration",
"We",
"have",
"to",
"enter",
"with",
"interrupts",
"disabled",
"/",
"critical",
"section",
"to",
"be",
"sure",
"that",
"another",
"VMCS",
"won",
"'",
"t",
"steel",
"our",
"CPU",
"."
] | [
"/*\n\t\t * We need to synchronize the per-cpu fields after changing\n\t\t * cpus. Also make sure there are no stale EPT translations\n\t\t * cached.\n\t\t */",
"/* Host related registers */",
"/* mycpu points to %gs:0 */",
"/* Guest related register */",
"/*\n\t\t * We only need to vmptrld\n\t\t */",
"/* else we don't need to do anything */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3101165a8c695aea652222cf901e8f9b3aeb3c00 | atrens/DragonFlyBSD-src | sys/platform/pc64/vmm/vmx.c | [
"BSD-3-Clause"
] | C | vmx_vmexit_loadinfo | int | static inline int
vmx_vmexit_loadinfo(void)
{
struct vmx_thread_info *vti;
int err;
vti = (struct vmx_thread_info *) curthread->td_vmm;
ERROR_IF(vti == NULL);
ERROR_IF(vmread(VMCS_VMEXIT_REASON, &vti->vmexit_reason));
ERROR_IF(vmread(VMCS_EXIT_QUALIFICATION, &vti->vmexit_qualification));
ERROR_IF(vmread(VMCS_VMEXIT_INTERRUPTION_INFO, &vti->vmexit_interruption_info));
ERROR_IF(vmread(VMCS_VMEXIT_INTERRUPTION_ERROR, &vti->vmexit_interruption_error));
ERROR_IF(vmread(VMCS_VMEXIT_INSTRUCTION_LENGTH, &vti->vmexit_instruction_length));
ERROR_IF(vmread(VMCS_GUEST_PHYSICAL_ADDRESS, &vti->guest_physical_address));
ERROR_IF(vmread(VMCS_GUEST_RIP, &vti->guest.tf_rip));
ERROR_IF(vmread(VMCS_GUEST_CS_SELECTOR, &vti->guest.tf_cs));
ERROR_IF(vmread(VMCS_GUEST_RFLAGS, &vti->guest.tf_rflags));
ERROR_IF(vmread(VMCS_GUEST_RSP, &vti->guest.tf_rsp));
ERROR_IF(vmread(VMCS_GUEST_SS_SELECTOR, &vti->guest.tf_ss));
return 0;
error:
kprintf("VMM: vmx_vmexit_loadinfo failed\n");
return err;
} | /*
* Load information about VMexit
*
* We still are with interrupts disabled/critical secion
* because we must operate with the VMCS on the CPU
*/ | Load information about VMexit
We still are with interrupts disabled/critical secion
because we must operate with the VMCS on the CPU | [
"Load",
"information",
"about",
"VMexit",
"We",
"still",
"are",
"with",
"interrupts",
"disabled",
"/",
"critical",
"secion",
"because",
"we",
"must",
"operate",
"with",
"the",
"VMCS",
"on",
"the",
"CPU"
] | static inline int
vmx_vmexit_loadinfo(void)
{
struct vmx_thread_info *vti;
int err;
vti = (struct vmx_thread_info *) curthread->td_vmm;
ERROR_IF(vti == NULL);
ERROR_IF(vmread(VMCS_VMEXIT_REASON, &vti->vmexit_reason));
ERROR_IF(vmread(VMCS_EXIT_QUALIFICATION, &vti->vmexit_qualification));
ERROR_IF(vmread(VMCS_VMEXIT_INTERRUPTION_INFO, &vti->vmexit_interruption_info));
ERROR_IF(vmread(VMCS_VMEXIT_INTERRUPTION_ERROR, &vti->vmexit_interruption_error));
ERROR_IF(vmread(VMCS_VMEXIT_INSTRUCTION_LENGTH, &vti->vmexit_instruction_length));
ERROR_IF(vmread(VMCS_GUEST_PHYSICAL_ADDRESS, &vti->guest_physical_address));
ERROR_IF(vmread(VMCS_GUEST_RIP, &vti->guest.tf_rip));
ERROR_IF(vmread(VMCS_GUEST_CS_SELECTOR, &vti->guest.tf_cs));
ERROR_IF(vmread(VMCS_GUEST_RFLAGS, &vti->guest.tf_rflags));
ERROR_IF(vmread(VMCS_GUEST_RSP, &vti->guest.tf_rsp));
ERROR_IF(vmread(VMCS_GUEST_SS_SELECTOR, &vti->guest.tf_ss));
return 0;
error:
kprintf("VMM: vmx_vmexit_loadinfo failed\n");
return err;
} | [
"static",
"inline",
"int",
"vmx_vmexit_loadinfo",
"(",
"void",
")",
"{",
"struct",
"vmx_thread_info",
"*",
"vti",
";",
"int",
"err",
";",
"vti",
"=",
"(",
"struct",
"vmx_thread_info",
"*",
")",
"curthread",
"->",
"td_vmm",
";",
"ERROR_IF",
"(",
"vti",
"==",
"NULL",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_VMEXIT_REASON",
",",
"&",
"vti",
"->",
"vmexit_reason",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_EXIT_QUALIFICATION",
",",
"&",
"vti",
"->",
"vmexit_qualification",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_VMEXIT_INTERRUPTION_INFO",
",",
"&",
"vti",
"->",
"vmexit_interruption_info",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_VMEXIT_INTERRUPTION_ERROR",
",",
"&",
"vti",
"->",
"vmexit_interruption_error",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_VMEXIT_INSTRUCTION_LENGTH",
",",
"&",
"vti",
"->",
"vmexit_instruction_length",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_GUEST_PHYSICAL_ADDRESS",
",",
"&",
"vti",
"->",
"guest_physical_address",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_GUEST_RIP",
",",
"&",
"vti",
"->",
"guest",
".",
"tf_rip",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_GUEST_CS_SELECTOR",
",",
"&",
"vti",
"->",
"guest",
".",
"tf_cs",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_GUEST_RFLAGS",
",",
"&",
"vti",
"->",
"guest",
".",
"tf_rflags",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_GUEST_RSP",
",",
"&",
"vti",
"->",
"guest",
".",
"tf_rsp",
")",
")",
";",
"ERROR_IF",
"(",
"vmread",
"(",
"VMCS_GUEST_SS_SELECTOR",
",",
"&",
"vti",
"->",
"guest",
".",
"tf_ss",
")",
")",
";",
"return",
"0",
";",
"error",
":",
"kprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"err",
";",
"}"
] | Load information about VMexit
We still are with interrupts disabled/critical secion
because we must operate with the VMCS on the CPU | [
"Load",
"information",
"about",
"VMexit",
"We",
"still",
"are",
"with",
"interrupts",
"disabled",
"/",
"critical",
"secion",
"because",
"we",
"must",
"operate",
"with",
"the",
"VMCS",
"on",
"the",
"CPU"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3101165a8c695aea652222cf901e8f9b3aeb3c00 | atrens/DragonFlyBSD-src | sys/platform/pc64/vmm/vmx.c | [
"BSD-3-Clause"
] | C | vmx_lwp_return | void | static void
vmx_lwp_return(struct lwp *lp, struct trapframe *frame)
{
struct vmm_guest_options options;
int vmrun_err;
struct vmm_proc *p_vmm = (struct vmm_proc *)curproc->p_vmm;
dkprintf("VMM: vmx_lwp_return \n");
bzero(&options, sizeof(struct vmm_guest_options));
bcopy(frame, &options.tf, sizeof(struct trapframe));
options.guest_cr3 = p_vmm->guest_cr3;
options.vmm_cr3 = p_vmm->vmm_cr3;
vmx_vminit(&options);
generic_lwp_return(lp, frame);
vmrun_err = vmx_vmrun();
exit1(W_EXITCODE(vmrun_err, 0));
} | /*
* Called when returning to user-space
* after executing lwp_fork.
*/ | Called when returning to user-space
after executing lwp_fork. | [
"Called",
"when",
"returning",
"to",
"user",
"-",
"space",
"after",
"executing",
"lwp_fork",
"."
] | static void
vmx_lwp_return(struct lwp *lp, struct trapframe *frame)
{
struct vmm_guest_options options;
int vmrun_err;
struct vmm_proc *p_vmm = (struct vmm_proc *)curproc->p_vmm;
dkprintf("VMM: vmx_lwp_return \n");
bzero(&options, sizeof(struct vmm_guest_options));
bcopy(frame, &options.tf, sizeof(struct trapframe));
options.guest_cr3 = p_vmm->guest_cr3;
options.vmm_cr3 = p_vmm->vmm_cr3;
vmx_vminit(&options);
generic_lwp_return(lp, frame);
vmrun_err = vmx_vmrun();
exit1(W_EXITCODE(vmrun_err, 0));
} | [
"static",
"void",
"vmx_lwp_return",
"(",
"struct",
"lwp",
"*",
"lp",
",",
"struct",
"trapframe",
"*",
"frame",
")",
"{",
"struct",
"vmm_guest_options",
"options",
";",
"int",
"vmrun_err",
";",
"struct",
"vmm_proc",
"*",
"p_vmm",
"=",
"(",
"struct",
"vmm_proc",
"*",
")",
"curproc",
"->",
"p_vmm",
";",
"dkprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"bzero",
"(",
"&",
"options",
",",
"sizeof",
"(",
"struct",
"vmm_guest_options",
")",
")",
";",
"bcopy",
"(",
"frame",
",",
"&",
"options",
".",
"tf",
",",
"sizeof",
"(",
"struct",
"trapframe",
")",
")",
";",
"options",
".",
"guest_cr3",
"=",
"p_vmm",
"->",
"guest_cr3",
";",
"options",
".",
"vmm_cr3",
"=",
"p_vmm",
"->",
"vmm_cr3",
";",
"vmx_vminit",
"(",
"&",
"options",
")",
";",
"generic_lwp_return",
"(",
"lp",
",",
"frame",
")",
";",
"vmrun_err",
"=",
"vmx_vmrun",
"(",
")",
";",
"exit1",
"(",
"W_EXITCODE",
"(",
"vmrun_err",
",",
"0",
")",
")",
";",
"}"
] | Called when returning to user-space
after executing lwp_fork. | [
"Called",
"when",
"returning",
"to",
"user",
"-",
"space",
"after",
"executing",
"lwp_fork",
"."
] | [] | [
{
"param": "lp",
"type": "struct lwp"
},
{
"param": "frame",
"type": "struct trapframe"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lp",
"type": "struct lwp",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "frame",
"type": "struct trapframe",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a4ad0a30f38836d42f50aeb67b05eac6acae9e42 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c-family/c-lex.c | [
"BSD-3-Clause"
] | C | cb_line_change | void | static void
cb_line_change (cpp_reader * ARG_UNUSED (pfile), const cpp_token *token,
int parsing_args)
{
if (token->type != CPP_EOF && !parsing_args)
input_location = token->src_loc;
} | /* Called at the start of every non-empty line. TOKEN is the first
lexed token on the line. Used for diagnostic line numbers. */ | Called at the start of every non-empty line. TOKEN is the first
lexed token on the line. Used for diagnostic line numbers. | [
"Called",
"at",
"the",
"start",
"of",
"every",
"non",
"-",
"empty",
"line",
".",
"TOKEN",
"is",
"the",
"first",
"lexed",
"token",
"on",
"the",
"line",
".",
"Used",
"for",
"diagnostic",
"line",
"numbers",
"."
] | static void
cb_line_change (cpp_reader * ARG_UNUSED (pfile), const cpp_token *token,
int parsing_args)
{
if (token->type != CPP_EOF && !parsing_args)
input_location = token->src_loc;
} | [
"static",
"void",
"cb_line_change",
"(",
"cpp_reader",
"*",
"ARG_UNUSED",
"(",
"pfile",
")",
",",
"const",
"cpp_token",
"*",
"token",
",",
"int",
"parsing_args",
")",
"{",
"if",
"(",
"token",
"->",
"type",
"!=",
"CPP_EOF",
"&&",
"!",
"parsing_args",
")",
"input_location",
"=",
"token",
"->",
"src_loc",
";",
"}"
] | Called at the start of every non-empty line. | [
"Called",
"at",
"the",
"start",
"of",
"every",
"non",
"-",
"empty",
"line",
"."
] | [] | [
{
"param": "ARG_UNUSED",
"type": "cpp_reader"
},
{
"param": "token",
"type": "cpp_token"
},
{
"param": "parsing_args",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ARG_UNUSED",
"type": "cpp_reader",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "token",
"type": "cpp_token",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parsing_args",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a4ad0a30f38836d42f50aeb67b05eac6acae9e42 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c-family/c-lex.c | [
"BSD-3-Clause"
] | C | cb_define | void | static void
cb_define (cpp_reader *pfile, source_location loc, cpp_hashnode *node)
{
const struct line_map *map = linemap_lookup (line_table, loc);
(*debug_hooks->define) (SOURCE_LINE (linemap_check_ordinary (map), loc),
(const char *) cpp_macro_definition (pfile, node));
} | /* #define callback for DWARF and DWARF2 debug info. */ | define callback for DWARF and DWARF2 debug info. | [
"define",
"callback",
"for",
"DWARF",
"and",
"DWARF2",
"debug",
"info",
"."
] | static void
cb_define (cpp_reader *pfile, source_location loc, cpp_hashnode *node)
{
const struct line_map *map = linemap_lookup (line_table, loc);
(*debug_hooks->define) (SOURCE_LINE (linemap_check_ordinary (map), loc),
(const char *) cpp_macro_definition (pfile, node));
} | [
"static",
"void",
"cb_define",
"(",
"cpp_reader",
"*",
"pfile",
",",
"source_location",
"loc",
",",
"cpp_hashnode",
"*",
"node",
")",
"{",
"const",
"struct",
"line_map",
"*",
"map",
"=",
"linemap_lookup",
"(",
"line_table",
",",
"loc",
")",
";",
"(",
"*",
"debug_hooks",
"->",
"define",
")",
"(",
"SOURCE_LINE",
"(",
"linemap_check_ordinary",
"(",
"map",
")",
",",
"loc",
")",
",",
"(",
"const",
"char",
"*",
")",
"cpp_macro_definition",
"(",
"pfile",
",",
"node",
")",
")",
";",
"}"
] | define callback for DWARF and DWARF2 debug info. | [
"define",
"callback",
"for",
"DWARF",
"and",
"DWARF2",
"debug",
"info",
"."
] | [] | [
{
"param": "pfile",
"type": "cpp_reader"
},
{
"param": "loc",
"type": "source_location"
},
{
"param": "node",
"type": "cpp_hashnode"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pfile",
"type": "cpp_reader",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "loc",
"type": "source_location",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": "cpp_hashnode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a4ad0a30f38836d42f50aeb67b05eac6acae9e42 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c-family/c-lex.c | [
"BSD-3-Clause"
] | C | cb_undef | void | static void
cb_undef (cpp_reader * ARG_UNUSED (pfile), source_location loc,
cpp_hashnode *node)
{
const struct line_map *map = linemap_lookup (line_table, loc);
(*debug_hooks->undef) (SOURCE_LINE (linemap_check_ordinary (map), loc),
(const char *) NODE_NAME (node));
} | /* #undef callback for DWARF and DWARF2 debug info. */ | undef callback for DWARF and DWARF2 debug info. | [
"undef",
"callback",
"for",
"DWARF",
"and",
"DWARF2",
"debug",
"info",
"."
] | static void
cb_undef (cpp_reader * ARG_UNUSED (pfile), source_location loc,
cpp_hashnode *node)
{
const struct line_map *map = linemap_lookup (line_table, loc);
(*debug_hooks->undef) (SOURCE_LINE (linemap_check_ordinary (map), loc),
(const char *) NODE_NAME (node));
} | [
"static",
"void",
"cb_undef",
"(",
"cpp_reader",
"*",
"ARG_UNUSED",
"(",
"pfile",
")",
",",
"source_location",
"loc",
",",
"cpp_hashnode",
"*",
"node",
")",
"{",
"const",
"struct",
"line_map",
"*",
"map",
"=",
"linemap_lookup",
"(",
"line_table",
",",
"loc",
")",
";",
"(",
"*",
"debug_hooks",
"->",
"undef",
")",
"(",
"SOURCE_LINE",
"(",
"linemap_check_ordinary",
"(",
"map",
")",
",",
"loc",
")",
",",
"(",
"const",
"char",
"*",
")",
"NODE_NAME",
"(",
"node",
")",
")",
";",
"}"
] | undef callback for DWARF and DWARF2 debug info. | [
"undef",
"callback",
"for",
"DWARF",
"and",
"DWARF2",
"debug",
"info",
"."
] | [] | [
{
"param": "ARG_UNUSED",
"type": "cpp_reader"
},
{
"param": "loc",
"type": "source_location"
},
{
"param": "node",
"type": "cpp_hashnode"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ARG_UNUSED",
"type": "cpp_reader",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "loc",
"type": "source_location",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": "cpp_hashnode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a4ad0a30f38836d42f50aeb67b05eac6acae9e42 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c-family/c-lex.c | [
"BSD-3-Clause"
] | C | interpret_float | tree | static tree
interpret_float (const cpp_token *token, unsigned int flags,
const char *suffix, enum overflow_type *overflow)
{
tree type;
tree const_type;
tree value;
REAL_VALUE_TYPE real;
REAL_VALUE_TYPE real_trunc;
char *copy;
size_t copylen;
*overflow = OT_NONE;
/* Default (no suffix) depends on whether the FLOAT_CONST_DECIMAL64
pragma has been used and is either double or _Decimal64. Types
that are not allowed with decimal float default to double. */
if (flags & CPP_N_DEFAULT)
{
flags ^= CPP_N_DEFAULT;
flags |= CPP_N_MEDIUM;
if (((flags & CPP_N_HEX) == 0) && ((flags & CPP_N_IMAGINARY) == 0))
{
warning (OPT_Wunsuffixed_float_constants,
"unsuffixed float constant");
if (float_const_decimal64_p ())
flags |= CPP_N_DFLOAT;
}
}
/* Decode _Fract and _Accum. */
if (flags & CPP_N_FRACT || flags & CPP_N_ACCUM)
return interpret_fixed (token, flags);
/* Decode type based on width and properties. */
if (flags & CPP_N_DFLOAT)
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
type = dfloat128_type_node;
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
type = dfloat32_type_node;
else
type = dfloat64_type_node;
else
if (flags & CPP_N_WIDTH_MD)
{
char suffix;
machine_mode mode;
if ((flags & CPP_N_WIDTH_MD) == CPP_N_MD_W)
suffix = 'w';
else
suffix = 'q';
mode = targetm.c.mode_for_suffix (suffix);
if (mode == VOIDmode)
{
error ("unsupported non-standard suffix on floating constant");
return error_mark_node;
}
else
pedwarn (input_location, OPT_Wpedantic, "non-standard suffix on floating constant");
type = c_common_type_for_mode (mode, 0);
gcc_assert (type);
}
else if ((flags & (CPP_N_FLOATN | CPP_N_FLOATNX)) != 0)
{
unsigned int n = (flags & CPP_N_WIDTH_FLOATN_NX) >> CPP_FLOATN_SHIFT;
bool extended = (flags & CPP_N_FLOATNX) != 0;
type = NULL_TREE;
for (int i = 0; i < NUM_FLOATN_NX_TYPES; i++)
if (floatn_nx_types[i].n == (int) n
&& floatn_nx_types[i].extended == extended)
{
type = FLOATN_NX_TYPE_NODE (i);
break;
}
if (type == NULL_TREE)
{
error ("unsupported non-standard suffix on floating constant");
return error_mark_node;
}
else
pedwarn (input_location, OPT_Wpedantic, "non-standard suffix on floating constant");
}
else if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
type = long_double_type_node;
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL
|| flag_single_precision_constant)
type = float_type_node;
else
type = double_type_node;
const_type = excess_precision_type (type);
if (!const_type)
const_type = type;
/* Copy the constant to a nul-terminated buffer. If the constant
has any suffixes, cut them off; REAL_VALUE_ATOF/ REAL_VALUE_HTOF
can't handle them. */
copylen = token->val.str.len;
if (flags & CPP_N_USERDEF)
copylen -= strlen (suffix);
else if (flags & CPP_N_DFLOAT)
copylen -= 2;
else
{
if ((flags & CPP_N_WIDTH) != CPP_N_MEDIUM)
/* Must be an F or L or machine defined suffix. */
copylen--;
if (flags & CPP_N_IMAGINARY)
/* I or J suffix. */
copylen--;
if (flags & CPP_N_FLOATNX)
copylen--;
if (flags & (CPP_N_FLOATN | CPP_N_FLOATNX))
{
unsigned int n = (flags & CPP_N_WIDTH_FLOATN_NX) >> CPP_FLOATN_SHIFT;
while (n > 0)
{
copylen--;
n /= 10;
}
}
}
copy = (char *) alloca (copylen + 1);
if (cxx_dialect > cxx11)
{
size_t maxlen = 0;
for (size_t i = 0; i < copylen; ++i)
if (token->val.str.text[i] != '\'')
copy[maxlen++] = token->val.str.text[i];
copy[maxlen] = '\0';
}
else
{
memcpy (copy, token->val.str.text, copylen);
copy[copylen] = '\0';
}
real_from_string3 (&real, copy, TYPE_MODE (const_type));
if (const_type != type)
/* Diagnosing if the result of converting the value with excess
precision to the semantic type would overflow (with associated
double rounding) is more appropriate than diagnosing if the
result of converting the string directly to the semantic type
would overflow. */
real_convert (&real_trunc, TYPE_MODE (type), &real);
/* Both C and C++ require a diagnostic for a floating constant
outside the range of representable values of its type. Since we
have __builtin_inf* to produce an infinity, this is now a
mandatory pedwarn if the target does not support infinities. */
if (REAL_VALUE_ISINF (real)
|| (const_type != type && REAL_VALUE_ISINF (real_trunc)))
{
*overflow = OT_OVERFLOW;
if (!(flags & CPP_N_USERDEF))
{
if (!MODE_HAS_INFINITIES (TYPE_MODE (type)))
pedwarn (input_location, 0,
"floating constant exceeds range of %qT", type);
else
warning (OPT_Woverflow,
"floating constant exceeds range of %qT", type);
}
}
/* We also give a warning if the value underflows. */
else if (real_equal (&real, &dconst0)
|| (const_type != type
&& real_equal (&real_trunc, &dconst0)))
{
REAL_VALUE_TYPE realvoidmode;
int oflow = real_from_string (&realvoidmode, copy);
*overflow = (oflow == 0 ? OT_NONE
: (oflow < 0 ? OT_UNDERFLOW : OT_OVERFLOW));
if (!(flags & CPP_N_USERDEF))
{
if (oflow < 0 || !real_equal (&realvoidmode, &dconst0))
warning (OPT_Woverflow, "floating constant truncated to zero");
}
}
/* Create a node with determined type and value. */
value = build_real (const_type, real);
if (flags & CPP_N_IMAGINARY)
{
value = build_complex (NULL_TREE,
fold_convert (const_type,
integer_zero_node), value);
if (type != const_type)
{
const_type = TREE_TYPE (value);
type = build_complex_type (type);
}
}
if (type != const_type)
value = build1_loc (token->src_loc, EXCESS_PRECISION_EXPR, type, value);
return value;
} | /* Interpret TOKEN, a floating point number with FLAGS as classified
by cpplib. For C++11 SUFFIX may contain a user-defined literal suffix. */ | Interpret TOKEN, a floating point number with FLAGS as classified
by cpplib. For C++11 SUFFIX may contain a user-defined literal suffix. | [
"Interpret",
"TOKEN",
"a",
"floating",
"point",
"number",
"with",
"FLAGS",
"as",
"classified",
"by",
"cpplib",
".",
"For",
"C",
"++",
"11",
"SUFFIX",
"may",
"contain",
"a",
"user",
"-",
"defined",
"literal",
"suffix",
"."
] | static tree
interpret_float (const cpp_token *token, unsigned int flags,
const char *suffix, enum overflow_type *overflow)
{
tree type;
tree const_type;
tree value;
REAL_VALUE_TYPE real;
REAL_VALUE_TYPE real_trunc;
char *copy;
size_t copylen;
*overflow = OT_NONE;
if (flags & CPP_N_DEFAULT)
{
flags ^= CPP_N_DEFAULT;
flags |= CPP_N_MEDIUM;
if (((flags & CPP_N_HEX) == 0) && ((flags & CPP_N_IMAGINARY) == 0))
{
warning (OPT_Wunsuffixed_float_constants,
"unsuffixed float constant");
if (float_const_decimal64_p ())
flags |= CPP_N_DFLOAT;
}
}
if (flags & CPP_N_FRACT || flags & CPP_N_ACCUM)
return interpret_fixed (token, flags);
if (flags & CPP_N_DFLOAT)
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
type = dfloat128_type_node;
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
type = dfloat32_type_node;
else
type = dfloat64_type_node;
else
if (flags & CPP_N_WIDTH_MD)
{
char suffix;
machine_mode mode;
if ((flags & CPP_N_WIDTH_MD) == CPP_N_MD_W)
suffix = 'w';
else
suffix = 'q';
mode = targetm.c.mode_for_suffix (suffix);
if (mode == VOIDmode)
{
error ("unsupported non-standard suffix on floating constant");
return error_mark_node;
}
else
pedwarn (input_location, OPT_Wpedantic, "non-standard suffix on floating constant");
type = c_common_type_for_mode (mode, 0);
gcc_assert (type);
}
else if ((flags & (CPP_N_FLOATN | CPP_N_FLOATNX)) != 0)
{
unsigned int n = (flags & CPP_N_WIDTH_FLOATN_NX) >> CPP_FLOATN_SHIFT;
bool extended = (flags & CPP_N_FLOATNX) != 0;
type = NULL_TREE;
for (int i = 0; i < NUM_FLOATN_NX_TYPES; i++)
if (floatn_nx_types[i].n == (int) n
&& floatn_nx_types[i].extended == extended)
{
type = FLOATN_NX_TYPE_NODE (i);
break;
}
if (type == NULL_TREE)
{
error ("unsupported non-standard suffix on floating constant");
return error_mark_node;
}
else
pedwarn (input_location, OPT_Wpedantic, "non-standard suffix on floating constant");
}
else if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
type = long_double_type_node;
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL
|| flag_single_precision_constant)
type = float_type_node;
else
type = double_type_node;
const_type = excess_precision_type (type);
if (!const_type)
const_type = type;
copylen = token->val.str.len;
if (flags & CPP_N_USERDEF)
copylen -= strlen (suffix);
else if (flags & CPP_N_DFLOAT)
copylen -= 2;
else
{
if ((flags & CPP_N_WIDTH) != CPP_N_MEDIUM)
copylen--;
if (flags & CPP_N_IMAGINARY)
copylen--;
if (flags & CPP_N_FLOATNX)
copylen--;
if (flags & (CPP_N_FLOATN | CPP_N_FLOATNX))
{
unsigned int n = (flags & CPP_N_WIDTH_FLOATN_NX) >> CPP_FLOATN_SHIFT;
while (n > 0)
{
copylen--;
n /= 10;
}
}
}
copy = (char *) alloca (copylen + 1);
if (cxx_dialect > cxx11)
{
size_t maxlen = 0;
for (size_t i = 0; i < copylen; ++i)
if (token->val.str.text[i] != '\'')
copy[maxlen++] = token->val.str.text[i];
copy[maxlen] = '\0';
}
else
{
memcpy (copy, token->val.str.text, copylen);
copy[copylen] = '\0';
}
real_from_string3 (&real, copy, TYPE_MODE (const_type));
if (const_type != type)
real_convert (&real_trunc, TYPE_MODE (type), &real);
if (REAL_VALUE_ISINF (real)
|| (const_type != type && REAL_VALUE_ISINF (real_trunc)))
{
*overflow = OT_OVERFLOW;
if (!(flags & CPP_N_USERDEF))
{
if (!MODE_HAS_INFINITIES (TYPE_MODE (type)))
pedwarn (input_location, 0,
"floating constant exceeds range of %qT", type);
else
warning (OPT_Woverflow,
"floating constant exceeds range of %qT", type);
}
}
else if (real_equal (&real, &dconst0)
|| (const_type != type
&& real_equal (&real_trunc, &dconst0)))
{
REAL_VALUE_TYPE realvoidmode;
int oflow = real_from_string (&realvoidmode, copy);
*overflow = (oflow == 0 ? OT_NONE
: (oflow < 0 ? OT_UNDERFLOW : OT_OVERFLOW));
if (!(flags & CPP_N_USERDEF))
{
if (oflow < 0 || !real_equal (&realvoidmode, &dconst0))
warning (OPT_Woverflow, "floating constant truncated to zero");
}
}
value = build_real (const_type, real);
if (flags & CPP_N_IMAGINARY)
{
value = build_complex (NULL_TREE,
fold_convert (const_type,
integer_zero_node), value);
if (type != const_type)
{
const_type = TREE_TYPE (value);
type = build_complex_type (type);
}
}
if (type != const_type)
value = build1_loc (token->src_loc, EXCESS_PRECISION_EXPR, type, value);
return value;
} | [
"static",
"tree",
"interpret_float",
"(",
"const",
"cpp_token",
"*",
"token",
",",
"unsigned",
"int",
"flags",
",",
"const",
"char",
"*",
"suffix",
",",
"enum",
"overflow_type",
"*",
"overflow",
")",
"{",
"tree",
"type",
";",
"tree",
"const_type",
";",
"tree",
"value",
";",
"REAL_VALUE_TYPE",
"real",
";",
"REAL_VALUE_TYPE",
"real_trunc",
";",
"char",
"*",
"copy",
";",
"size_t",
"copylen",
";",
"*",
"overflow",
"=",
"OT_NONE",
";",
"if",
"(",
"flags",
"&",
"CPP_N_DEFAULT",
")",
"{",
"flags",
"^=",
"CPP_N_DEFAULT",
";",
"flags",
"|=",
"CPP_N_MEDIUM",
";",
"if",
"(",
"(",
"(",
"flags",
"&",
"CPP_N_HEX",
")",
"==",
"0",
")",
"&&",
"(",
"(",
"flags",
"&",
"CPP_N_IMAGINARY",
")",
"==",
"0",
")",
")",
"{",
"warning",
"(",
"OPT_Wunsuffixed_float_constants",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"float_const_decimal64_p",
"(",
")",
")",
"flags",
"|=",
"CPP_N_DFLOAT",
";",
"}",
"}",
"if",
"(",
"flags",
"&",
"CPP_N_FRACT",
"||",
"flags",
"&",
"CPP_N_ACCUM",
")",
"return",
"interpret_fixed",
"(",
"token",
",",
"flags",
")",
";",
"if",
"(",
"flags",
"&",
"CPP_N_DFLOAT",
")",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_LARGE",
")",
"type",
"=",
"dfloat128_type_node",
";",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_SMALL",
")",
"type",
"=",
"dfloat32_type_node",
";",
"else",
"type",
"=",
"dfloat64_type_node",
";",
"else",
"if",
"(",
"flags",
"&",
"CPP_N_WIDTH_MD",
")",
"{",
"char",
"suffix",
";",
"machine_mode",
"mode",
";",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH_MD",
")",
"==",
"CPP_N_MD_W",
")",
"suffix",
"=",
"'",
"'",
";",
"else",
"suffix",
"=",
"'",
"'",
";",
"mode",
"=",
"targetm",
".",
"c",
".",
"mode_for_suffix",
"(",
"suffix",
")",
";",
"if",
"(",
"mode",
"==",
"VOIDmode",
")",
"{",
"error",
"(",
"\"",
"\"",
")",
";",
"return",
"error_mark_node",
";",
"}",
"else",
"pedwarn",
"(",
"input_location",
",",
"OPT_Wpedantic",
",",
"\"",
"\"",
")",
";",
"type",
"=",
"c_common_type_for_mode",
"(",
"mode",
",",
"0",
")",
";",
"gcc_assert",
"(",
"type",
")",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"(",
"CPP_N_FLOATN",
"|",
"CPP_N_FLOATNX",
")",
")",
"!=",
"0",
")",
"{",
"unsigned",
"int",
"n",
"=",
"(",
"flags",
"&",
"CPP_N_WIDTH_FLOATN_NX",
")",
">>",
"CPP_FLOATN_SHIFT",
";",
"bool",
"extended",
"=",
"(",
"flags",
"&",
"CPP_N_FLOATNX",
")",
"!=",
"0",
";",
"type",
"=",
"NULL_TREE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"NUM_FLOATN_NX_TYPES",
";",
"i",
"++",
")",
"if",
"(",
"floatn_nx_types",
"[",
"i",
"]",
".",
"n",
"==",
"(",
"int",
")",
"n",
"&&",
"floatn_nx_types",
"[",
"i",
"]",
".",
"extended",
"==",
"extended",
")",
"{",
"type",
"=",
"FLOATN_NX_TYPE_NODE",
"(",
"i",
")",
";",
"break",
";",
"}",
"if",
"(",
"type",
"==",
"NULL_TREE",
")",
"{",
"error",
"(",
"\"",
"\"",
")",
";",
"return",
"error_mark_node",
";",
"}",
"else",
"pedwarn",
"(",
"input_location",
",",
"OPT_Wpedantic",
",",
"\"",
"\"",
")",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_LARGE",
")",
"type",
"=",
"long_double_type_node",
";",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_SMALL",
"||",
"flag_single_precision_constant",
")",
"type",
"=",
"float_type_node",
";",
"else",
"type",
"=",
"double_type_node",
";",
"const_type",
"=",
"excess_precision_type",
"(",
"type",
")",
";",
"if",
"(",
"!",
"const_type",
")",
"const_type",
"=",
"type",
";",
"copylen",
"=",
"token",
"->",
"val",
".",
"str",
".",
"len",
";",
"if",
"(",
"flags",
"&",
"CPP_N_USERDEF",
")",
"copylen",
"-=",
"strlen",
"(",
"suffix",
")",
";",
"else",
"if",
"(",
"flags",
"&",
"CPP_N_DFLOAT",
")",
"copylen",
"-=",
"2",
";",
"else",
"{",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"!=",
"CPP_N_MEDIUM",
")",
"copylen",
"--",
";",
"if",
"(",
"flags",
"&",
"CPP_N_IMAGINARY",
")",
"copylen",
"--",
";",
"if",
"(",
"flags",
"&",
"CPP_N_FLOATNX",
")",
"copylen",
"--",
";",
"if",
"(",
"flags",
"&",
"(",
"CPP_N_FLOATN",
"|",
"CPP_N_FLOATNX",
")",
")",
"{",
"unsigned",
"int",
"n",
"=",
"(",
"flags",
"&",
"CPP_N_WIDTH_FLOATN_NX",
")",
">>",
"CPP_FLOATN_SHIFT",
";",
"while",
"(",
"n",
">",
"0",
")",
"{",
"copylen",
"--",
";",
"n",
"/=",
"10",
";",
"}",
"}",
"}",
"copy",
"=",
"(",
"char",
"*",
")",
"alloca",
"(",
"copylen",
"+",
"1",
")",
";",
"if",
"(",
"cxx_dialect",
">",
"cxx11",
")",
"{",
"size_t",
"maxlen",
"=",
"0",
";",
"for",
"(",
"size_t",
"i",
"=",
"0",
";",
"i",
"<",
"copylen",
";",
"++",
"i",
")",
"if",
"(",
"token",
"->",
"val",
".",
"str",
".",
"text",
"[",
"i",
"]",
"!=",
"'",
"\\'",
"'",
")",
"copy",
"[",
"maxlen",
"++",
"]",
"=",
"token",
"->",
"val",
".",
"str",
".",
"text",
"[",
"i",
"]",
";",
"copy",
"[",
"maxlen",
"]",
"=",
"'",
"\\0",
"'",
";",
"}",
"else",
"{",
"memcpy",
"(",
"copy",
",",
"token",
"->",
"val",
".",
"str",
".",
"text",
",",
"copylen",
")",
";",
"copy",
"[",
"copylen",
"]",
"=",
"'",
"\\0",
"'",
";",
"}",
"real_from_string3",
"(",
"&",
"real",
",",
"copy",
",",
"TYPE_MODE",
"(",
"const_type",
")",
")",
";",
"if",
"(",
"const_type",
"!=",
"type",
")",
"real_convert",
"(",
"&",
"real_trunc",
",",
"TYPE_MODE",
"(",
"type",
")",
",",
"&",
"real",
")",
";",
"if",
"(",
"REAL_VALUE_ISINF",
"(",
"real",
")",
"||",
"(",
"const_type",
"!=",
"type",
"&&",
"REAL_VALUE_ISINF",
"(",
"real_trunc",
")",
")",
")",
"{",
"*",
"overflow",
"=",
"OT_OVERFLOW",
";",
"if",
"(",
"!",
"(",
"flags",
"&",
"CPP_N_USERDEF",
")",
")",
"{",
"if",
"(",
"!",
"MODE_HAS_INFINITIES",
"(",
"TYPE_MODE",
"(",
"type",
")",
")",
")",
"pedwarn",
"(",
"input_location",
",",
"0",
",",
"\"",
"\"",
",",
"type",
")",
";",
"else",
"warning",
"(",
"OPT_Woverflow",
",",
"\"",
"\"",
",",
"type",
")",
";",
"}",
"}",
"else",
"if",
"(",
"real_equal",
"(",
"&",
"real",
",",
"&",
"dconst0",
")",
"||",
"(",
"const_type",
"!=",
"type",
"&&",
"real_equal",
"(",
"&",
"real_trunc",
",",
"&",
"dconst0",
")",
")",
")",
"{",
"REAL_VALUE_TYPE",
"realvoidmode",
";",
"int",
"oflow",
"=",
"real_from_string",
"(",
"&",
"realvoidmode",
",",
"copy",
")",
";",
"*",
"overflow",
"=",
"(",
"oflow",
"==",
"0",
"?",
"OT_NONE",
":",
"(",
"oflow",
"<",
"0",
"?",
"OT_UNDERFLOW",
":",
"OT_OVERFLOW",
")",
")",
";",
"if",
"(",
"!",
"(",
"flags",
"&",
"CPP_N_USERDEF",
")",
")",
"{",
"if",
"(",
"oflow",
"<",
"0",
"||",
"!",
"real_equal",
"(",
"&",
"realvoidmode",
",",
"&",
"dconst0",
")",
")",
"warning",
"(",
"OPT_Woverflow",
",",
"\"",
"\"",
")",
";",
"}",
"}",
"value",
"=",
"build_real",
"(",
"const_type",
",",
"real",
")",
";",
"if",
"(",
"flags",
"&",
"CPP_N_IMAGINARY",
")",
"{",
"value",
"=",
"build_complex",
"(",
"NULL_TREE",
",",
"fold_convert",
"(",
"const_type",
",",
"integer_zero_node",
")",
",",
"value",
")",
";",
"if",
"(",
"type",
"!=",
"const_type",
")",
"{",
"const_type",
"=",
"TREE_TYPE",
"(",
"value",
")",
";",
"type",
"=",
"build_complex_type",
"(",
"type",
")",
";",
"}",
"}",
"if",
"(",
"type",
"!=",
"const_type",
")",
"value",
"=",
"build1_loc",
"(",
"token",
"->",
"src_loc",
",",
"EXCESS_PRECISION_EXPR",
",",
"type",
",",
"value",
")",
";",
"return",
"value",
";",
"}"
] | Interpret TOKEN, a floating point number with FLAGS as classified
by cpplib. | [
"Interpret",
"TOKEN",
"a",
"floating",
"point",
"number",
"with",
"FLAGS",
"as",
"classified",
"by",
"cpplib",
"."
] | [
"/* Default (no suffix) depends on whether the FLOAT_CONST_DECIMAL64\n pragma has been used and is either double or _Decimal64. Types\n that are not allowed with decimal float default to double. */",
"/* Decode _Fract and _Accum. */",
"/* Decode type based on width and properties. */",
"/* Copy the constant to a nul-terminated buffer. If the constant\n has any suffixes, cut them off; REAL_VALUE_ATOF/ REAL_VALUE_HTOF\n can't handle them. */",
"/* Must be an F or L or machine defined suffix. */",
"/* I or J suffix. */",
"/* Diagnosing if the result of converting the value with excess\n precision to the semantic type would overflow (with associated\n double rounding) is more appropriate than diagnosing if the\n result of converting the string directly to the semantic type\n would overflow. */",
"/* Both C and C++ require a diagnostic for a floating constant\n outside the range of representable values of its type. Since we\n have __builtin_inf* to produce an infinity, this is now a\n mandatory pedwarn if the target does not support infinities. */",
"/* We also give a warning if the value underflows. */",
"/* Create a node with determined type and value. */"
] | [
{
"param": "token",
"type": "cpp_token"
},
{
"param": "flags",
"type": "unsigned int"
},
{
"param": "suffix",
"type": "char"
},
{
"param": "overflow",
"type": "enum overflow_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "token",
"type": "cpp_token",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "unsigned int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "suffix",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "overflow",
"type": "enum overflow_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a4ad0a30f38836d42f50aeb67b05eac6acae9e42 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c-family/c-lex.c | [
"BSD-3-Clause"
] | C | interpret_fixed | tree | static tree
interpret_fixed (const cpp_token *token, unsigned int flags)
{
tree type;
tree value;
FIXED_VALUE_TYPE fixed;
char *copy;
size_t copylen;
copylen = token->val.str.len;
if (flags & CPP_N_FRACT) /* _Fract. */
{
if (flags & CPP_N_UNSIGNED) /* Unsigned _Fract. */
{
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = unsigned_long_long_fract_type_node;
copylen -= 4;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
{
type = unsigned_long_fract_type_node;
copylen -= 3;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
{
type = unsigned_short_fract_type_node;
copylen -= 3;
}
else
{
type = unsigned_fract_type_node;
copylen -= 2;
}
}
else /* Signed _Fract. */
{
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = long_long_fract_type_node;
copylen -= 3;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
{
type = long_fract_type_node;
copylen -= 2;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
{
type = short_fract_type_node;
copylen -= 2;
}
else
{
type = fract_type_node;
copylen --;
}
}
}
else /* _Accum. */
{
if (flags & CPP_N_UNSIGNED) /* Unsigned _Accum. */
{
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = unsigned_long_long_accum_type_node;
copylen -= 4;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
{
type = unsigned_long_accum_type_node;
copylen -= 3;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
{
type = unsigned_short_accum_type_node;
copylen -= 3;
}
else
{
type = unsigned_accum_type_node;
copylen -= 2;
}
}
else /* Signed _Accum. */
{
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = long_long_accum_type_node;
copylen -= 3;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
{
type = long_accum_type_node;
copylen -= 2;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
{
type = short_accum_type_node;
copylen -= 2;
}
else
{
type = accum_type_node;
copylen --;
}
}
}
copy = (char *) alloca (copylen + 1);
memcpy (copy, token->val.str.text, copylen);
copy[copylen] = '\0';
fixed_from_string (&fixed, copy, SCALAR_TYPE_MODE (type));
/* Create a node with determined type and value. */
value = build_fixed (type, fixed);
return value;
} | /* Interpret TOKEN, a fixed-point number with FLAGS as classified
by cpplib. */ | Interpret TOKEN, a fixed-point number with FLAGS as classified
by cpplib. | [
"Interpret",
"TOKEN",
"a",
"fixed",
"-",
"point",
"number",
"with",
"FLAGS",
"as",
"classified",
"by",
"cpplib",
"."
] | static tree
interpret_fixed (const cpp_token *token, unsigned int flags)
{
tree type;
tree value;
FIXED_VALUE_TYPE fixed;
char *copy;
size_t copylen;
copylen = token->val.str.len;
if (flags & CPP_N_FRACT)
{
if (flags & CPP_N_UNSIGNED)
{
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = unsigned_long_long_fract_type_node;
copylen -= 4;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
{
type = unsigned_long_fract_type_node;
copylen -= 3;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
{
type = unsigned_short_fract_type_node;
copylen -= 3;
}
else
{
type = unsigned_fract_type_node;
copylen -= 2;
}
}
else
{
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = long_long_fract_type_node;
copylen -= 3;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
{
type = long_fract_type_node;
copylen -= 2;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
{
type = short_fract_type_node;
copylen -= 2;
}
else
{
type = fract_type_node;
copylen --;
}
}
}
else
{
if (flags & CPP_N_UNSIGNED)
{
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = unsigned_long_long_accum_type_node;
copylen -= 4;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
{
type = unsigned_long_accum_type_node;
copylen -= 3;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
{
type = unsigned_short_accum_type_node;
copylen -= 3;
}
else
{
type = unsigned_accum_type_node;
copylen -= 2;
}
}
else
{
if ((flags & CPP_N_WIDTH) == CPP_N_LARGE)
{
type = long_long_accum_type_node;
copylen -= 3;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_MEDIUM)
{
type = long_accum_type_node;
copylen -= 2;
}
else if ((flags & CPP_N_WIDTH) == CPP_N_SMALL)
{
type = short_accum_type_node;
copylen -= 2;
}
else
{
type = accum_type_node;
copylen --;
}
}
}
copy = (char *) alloca (copylen + 1);
memcpy (copy, token->val.str.text, copylen);
copy[copylen] = '\0';
fixed_from_string (&fixed, copy, SCALAR_TYPE_MODE (type));
value = build_fixed (type, fixed);
return value;
} | [
"static",
"tree",
"interpret_fixed",
"(",
"const",
"cpp_token",
"*",
"token",
",",
"unsigned",
"int",
"flags",
")",
"{",
"tree",
"type",
";",
"tree",
"value",
";",
"FIXED_VALUE_TYPE",
"fixed",
";",
"char",
"*",
"copy",
";",
"size_t",
"copylen",
";",
"copylen",
"=",
"token",
"->",
"val",
".",
"str",
".",
"len",
";",
"if",
"(",
"flags",
"&",
"CPP_N_FRACT",
")",
"{",
"if",
"(",
"flags",
"&",
"CPP_N_UNSIGNED",
")",
"{",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_LARGE",
")",
"{",
"type",
"=",
"unsigned_long_long_fract_type_node",
";",
"copylen",
"-=",
"4",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_MEDIUM",
")",
"{",
"type",
"=",
"unsigned_long_fract_type_node",
";",
"copylen",
"-=",
"3",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_SMALL",
")",
"{",
"type",
"=",
"unsigned_short_fract_type_node",
";",
"copylen",
"-=",
"3",
";",
"}",
"else",
"{",
"type",
"=",
"unsigned_fract_type_node",
";",
"copylen",
"-=",
"2",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_LARGE",
")",
"{",
"type",
"=",
"long_long_fract_type_node",
";",
"copylen",
"-=",
"3",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_MEDIUM",
")",
"{",
"type",
"=",
"long_fract_type_node",
";",
"copylen",
"-=",
"2",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_SMALL",
")",
"{",
"type",
"=",
"short_fract_type_node",
";",
"copylen",
"-=",
"2",
";",
"}",
"else",
"{",
"type",
"=",
"fract_type_node",
";",
"copylen",
"--",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"flags",
"&",
"CPP_N_UNSIGNED",
")",
"{",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_LARGE",
")",
"{",
"type",
"=",
"unsigned_long_long_accum_type_node",
";",
"copylen",
"-=",
"4",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_MEDIUM",
")",
"{",
"type",
"=",
"unsigned_long_accum_type_node",
";",
"copylen",
"-=",
"3",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_SMALL",
")",
"{",
"type",
"=",
"unsigned_short_accum_type_node",
";",
"copylen",
"-=",
"3",
";",
"}",
"else",
"{",
"type",
"=",
"unsigned_accum_type_node",
";",
"copylen",
"-=",
"2",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_LARGE",
")",
"{",
"type",
"=",
"long_long_accum_type_node",
";",
"copylen",
"-=",
"3",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_MEDIUM",
")",
"{",
"type",
"=",
"long_accum_type_node",
";",
"copylen",
"-=",
"2",
";",
"}",
"else",
"if",
"(",
"(",
"flags",
"&",
"CPP_N_WIDTH",
")",
"==",
"CPP_N_SMALL",
")",
"{",
"type",
"=",
"short_accum_type_node",
";",
"copylen",
"-=",
"2",
";",
"}",
"else",
"{",
"type",
"=",
"accum_type_node",
";",
"copylen",
"--",
";",
"}",
"}",
"}",
"copy",
"=",
"(",
"char",
"*",
")",
"alloca",
"(",
"copylen",
"+",
"1",
")",
";",
"memcpy",
"(",
"copy",
",",
"token",
"->",
"val",
".",
"str",
".",
"text",
",",
"copylen",
")",
";",
"copy",
"[",
"copylen",
"]",
"=",
"'",
"\\0",
"'",
";",
"fixed_from_string",
"(",
"&",
"fixed",
",",
"copy",
",",
"SCALAR_TYPE_MODE",
"(",
"type",
")",
")",
";",
"value",
"=",
"build_fixed",
"(",
"type",
",",
"fixed",
")",
";",
"return",
"value",
";",
"}"
] | Interpret TOKEN, a fixed-point number with FLAGS as classified
by cpplib. | [
"Interpret",
"TOKEN",
"a",
"fixed",
"-",
"point",
"number",
"with",
"FLAGS",
"as",
"classified",
"by",
"cpplib",
"."
] | [
"/* _Fract. */",
"/* Unsigned _Fract. */",
"/* Signed _Fract. */",
"/* _Accum. */",
"/* Unsigned _Accum. */",
"/* Signed _Accum. */",
"/* Create a node with determined type and value. */"
] | [
{
"param": "token",
"type": "cpp_token"
},
{
"param": "flags",
"type": "unsigned int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "token",
"type": "cpp_token",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "unsigned int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a4ad0a30f38836d42f50aeb67b05eac6acae9e42 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/c-family/c-lex.c | [
"BSD-3-Clause"
] | C | lex_charconst | tree | static tree
lex_charconst (const cpp_token *token)
{
cppchar_t result;
tree type, value;
unsigned int chars_seen;
int unsignedp = 0;
result = cpp_interpret_charconst (parse_in, token,
&chars_seen, &unsignedp);
if (token->type == CPP_WCHAR)
type = wchar_type_node;
else if (token->type == CPP_CHAR32)
type = char32_type_node;
else if (token->type == CPP_CHAR16)
type = char16_type_node;
else if (token->type == CPP_UTF8CHAR)
type = char_type_node;
/* In C, a character constant has type 'int'.
In C++ 'char', but multi-char charconsts have type 'int'. */
else if (!c_dialect_cxx () || chars_seen > 1)
type = integer_type_node;
else
type = char_type_node;
/* Cast to cppchar_signed_t to get correct sign-extension of RESULT
before possibly widening to HOST_WIDE_INT for build_int_cst. */
if (unsignedp || (cppchar_signed_t) result >= 0)
value = build_int_cst (type, result);
else
value = build_int_cst (type, (cppchar_signed_t) result);
return value;
} | /* Converts a (possibly wide) character constant token into a tree. */ | Converts a (possibly wide) character constant token into a tree. | [
"Converts",
"a",
"(",
"possibly",
"wide",
")",
"character",
"constant",
"token",
"into",
"a",
"tree",
"."
] | static tree
lex_charconst (const cpp_token *token)
{
cppchar_t result;
tree type, value;
unsigned int chars_seen;
int unsignedp = 0;
result = cpp_interpret_charconst (parse_in, token,
&chars_seen, &unsignedp);
if (token->type == CPP_WCHAR)
type = wchar_type_node;
else if (token->type == CPP_CHAR32)
type = char32_type_node;
else if (token->type == CPP_CHAR16)
type = char16_type_node;
else if (token->type == CPP_UTF8CHAR)
type = char_type_node;
else if (!c_dialect_cxx () || chars_seen > 1)
type = integer_type_node;
else
type = char_type_node;
if (unsignedp || (cppchar_signed_t) result >= 0)
value = build_int_cst (type, result);
else
value = build_int_cst (type, (cppchar_signed_t) result);
return value;
} | [
"static",
"tree",
"lex_charconst",
"(",
"const",
"cpp_token",
"*",
"token",
")",
"{",
"cppchar_t",
"result",
";",
"tree",
"type",
",",
"value",
";",
"unsigned",
"int",
"chars_seen",
";",
"int",
"unsignedp",
"=",
"0",
";",
"result",
"=",
"cpp_interpret_charconst",
"(",
"parse_in",
",",
"token",
",",
"&",
"chars_seen",
",",
"&",
"unsignedp",
")",
";",
"if",
"(",
"token",
"->",
"type",
"==",
"CPP_WCHAR",
")",
"type",
"=",
"wchar_type_node",
";",
"else",
"if",
"(",
"token",
"->",
"type",
"==",
"CPP_CHAR32",
")",
"type",
"=",
"char32_type_node",
";",
"else",
"if",
"(",
"token",
"->",
"type",
"==",
"CPP_CHAR16",
")",
"type",
"=",
"char16_type_node",
";",
"else",
"if",
"(",
"token",
"->",
"type",
"==",
"CPP_UTF8CHAR",
")",
"type",
"=",
"char_type_node",
";",
"else",
"if",
"(",
"!",
"c_dialect_cxx",
"(",
")",
"||",
"chars_seen",
">",
"1",
")",
"type",
"=",
"integer_type_node",
";",
"else",
"type",
"=",
"char_type_node",
";",
"if",
"(",
"unsignedp",
"||",
"(",
"cppchar_signed_t",
")",
"result",
">=",
"0",
")",
"value",
"=",
"build_int_cst",
"(",
"type",
",",
"result",
")",
";",
"else",
"value",
"=",
"build_int_cst",
"(",
"type",
",",
"(",
"cppchar_signed_t",
")",
"result",
")",
";",
"return",
"value",
";",
"}"
] | Converts a (possibly wide) character constant token into a tree. | [
"Converts",
"a",
"(",
"possibly",
"wide",
")",
"character",
"constant",
"token",
"into",
"a",
"tree",
"."
] | [
"/* In C, a character constant has type 'int'.\n In C++ 'char', but multi-char charconsts have type 'int'. */",
"/* Cast to cppchar_signed_t to get correct sign-extension of RESULT\n before possibly widening to HOST_WIDE_INT for build_int_cst. */"
] | [
{
"param": "token",
"type": "cpp_token"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "token",
"type": "cpp_token",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31411770c79da86c11777f5f4ab7638f830350c3 | atrens/DragonFlyBSD-src | sys/netgraph7/bluetooth/hci/ng_hci_main.c | [
"BSD-3-Clause"
] | C | ng_hci_connect | int | static int
ng_hci_connect(hook_p hook)
{
ng_hci_unit_p unit = (ng_hci_unit_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
if (hook != unit->drv) {
if (hook == unit->acl) {
NG_HOOK_SET_RCVMSG(hook, ng_hci_upper_rcvmsg);
NG_HOOK_SET_RCVDATA(hook, ng_hci_acl_rcvdata);
} else if (hook == unit->sco) {
NG_HOOK_SET_RCVMSG(hook, ng_hci_upper_rcvmsg);
NG_HOOK_SET_RCVDATA(hook, ng_hci_sco_rcvdata);
} else
NG_HOOK_SET_RCVDATA(hook, ng_hci_raw_rcvdata);
/* Send delayed notification to the upper layers */
if (hook != unit->raw)
ng_send_fn(unit->node, hook, ng_hci_node_is_up, NULL,0);
} else
unit->state |= NG_HCI_UNIT_CONNECTED;
return (0);
} | /*
* Give our final OK to connect hook
*/ | Give our final OK to connect hook | [
"Give",
"our",
"final",
"OK",
"to",
"connect",
"hook"
] | static int
ng_hci_connect(hook_p hook)
{
ng_hci_unit_p unit = (ng_hci_unit_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
if (hook != unit->drv) {
if (hook == unit->acl) {
NG_HOOK_SET_RCVMSG(hook, ng_hci_upper_rcvmsg);
NG_HOOK_SET_RCVDATA(hook, ng_hci_acl_rcvdata);
} else if (hook == unit->sco) {
NG_HOOK_SET_RCVMSG(hook, ng_hci_upper_rcvmsg);
NG_HOOK_SET_RCVDATA(hook, ng_hci_sco_rcvdata);
} else
NG_HOOK_SET_RCVDATA(hook, ng_hci_raw_rcvdata);
if (hook != unit->raw)
ng_send_fn(unit->node, hook, ng_hci_node_is_up, NULL,0);
} else
unit->state |= NG_HCI_UNIT_CONNECTED;
return (0);
} | [
"static",
"int",
"ng_hci_connect",
"(",
"hook_p",
"hook",
")",
"{",
"ng_hci_unit_p",
"unit",
"=",
"(",
"ng_hci_unit_p",
")",
"NG_NODE_PRIVATE",
"(",
"NG_HOOK_NODE",
"(",
"hook",
")",
")",
";",
"if",
"(",
"hook",
"!=",
"unit",
"->",
"drv",
")",
"{",
"if",
"(",
"hook",
"==",
"unit",
"->",
"acl",
")",
"{",
"NG_HOOK_SET_RCVMSG",
"(",
"hook",
",",
"ng_hci_upper_rcvmsg",
")",
";",
"NG_HOOK_SET_RCVDATA",
"(",
"hook",
",",
"ng_hci_acl_rcvdata",
")",
";",
"}",
"else",
"if",
"(",
"hook",
"==",
"unit",
"->",
"sco",
")",
"{",
"NG_HOOK_SET_RCVMSG",
"(",
"hook",
",",
"ng_hci_upper_rcvmsg",
")",
";",
"NG_HOOK_SET_RCVDATA",
"(",
"hook",
",",
"ng_hci_sco_rcvdata",
")",
";",
"}",
"else",
"NG_HOOK_SET_RCVDATA",
"(",
"hook",
",",
"ng_hci_raw_rcvdata",
")",
";",
"if",
"(",
"hook",
"!=",
"unit",
"->",
"raw",
")",
"ng_send_fn",
"(",
"unit",
"->",
"node",
",",
"hook",
",",
"ng_hci_node_is_up",
",",
"NULL",
",",
"0",
")",
";",
"}",
"else",
"unit",
"->",
"state",
"|=",
"NG_HCI_UNIT_CONNECTED",
";",
"return",
"(",
"0",
")",
";",
"}"
] | Give our final OK to connect hook | [
"Give",
"our",
"final",
"OK",
"to",
"connect",
"hook"
] | [
"/* Send delayed notification to the upper layers */"
] | [
{
"param": "hook",
"type": "hook_p"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "hook",
"type": "hook_p",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31411770c79da86c11777f5f4ab7638f830350c3 | atrens/DragonFlyBSD-src | sys/netgraph7/bluetooth/hci/ng_hci_main.c | [
"BSD-3-Clause"
] | C | ng_hci_upper_rcvmsg | int | static int
ng_hci_upper_rcvmsg(node_p node, item_p item, hook_p lasthook)
{
ng_hci_unit_p unit = (ng_hci_unit_p) NG_NODE_PRIVATE(node);
int error = 0;
switch (NGI_MSG(item)->header.typecookie) {
case NGM_HCI_COOKIE:
switch (NGI_MSG(item)->header.cmd) {
case NGM_HCI_LP_CON_REQ:
error = ng_hci_lp_con_req(unit, item, lasthook);
break;
case NGM_HCI_LP_DISCON_REQ: /* XXX not defined by specs */
error = ng_hci_lp_discon_req(unit, item, lasthook);
break;
case NGM_HCI_LP_CON_RSP:
error = ng_hci_lp_con_rsp(unit, item, lasthook);
break;
case NGM_HCI_LP_QOS_REQ:
error = ng_hci_lp_qos_req(unit, item, lasthook);
break;
default:
error = ng_hci_default_rcvmsg(node, item, lasthook);
break;
}
break;
default:
error = ng_hci_default_rcvmsg(node, item, lasthook);
break;
}
return (error);
} | /*
* Process control message from upstream hooks (ACL and SCO).
* Handle LP_xxx messages here, give everything else to default routine.
*/ | Process control message from upstream hooks (ACL and SCO).
Handle LP_xxx messages here, give everything else to default routine. | [
"Process",
"control",
"message",
"from",
"upstream",
"hooks",
"(",
"ACL",
"and",
"SCO",
")",
".",
"Handle",
"LP_xxx",
"messages",
"here",
"give",
"everything",
"else",
"to",
"default",
"routine",
"."
] | static int
ng_hci_upper_rcvmsg(node_p node, item_p item, hook_p lasthook)
{
ng_hci_unit_p unit = (ng_hci_unit_p) NG_NODE_PRIVATE(node);
int error = 0;
switch (NGI_MSG(item)->header.typecookie) {
case NGM_HCI_COOKIE:
switch (NGI_MSG(item)->header.cmd) {
case NGM_HCI_LP_CON_REQ:
error = ng_hci_lp_con_req(unit, item, lasthook);
break;
case NGM_HCI_LP_DISCON_REQ:
error = ng_hci_lp_discon_req(unit, item, lasthook);
break;
case NGM_HCI_LP_CON_RSP:
error = ng_hci_lp_con_rsp(unit, item, lasthook);
break;
case NGM_HCI_LP_QOS_REQ:
error = ng_hci_lp_qos_req(unit, item, lasthook);
break;
default:
error = ng_hci_default_rcvmsg(node, item, lasthook);
break;
}
break;
default:
error = ng_hci_default_rcvmsg(node, item, lasthook);
break;
}
return (error);
} | [
"static",
"int",
"ng_hci_upper_rcvmsg",
"(",
"node_p",
"node",
",",
"item_p",
"item",
",",
"hook_p",
"lasthook",
")",
"{",
"ng_hci_unit_p",
"unit",
"=",
"(",
"ng_hci_unit_p",
")",
"NG_NODE_PRIVATE",
"(",
"node",
")",
";",
"int",
"error",
"=",
"0",
";",
"switch",
"(",
"NGI_MSG",
"(",
"item",
")",
"->",
"header",
".",
"typecookie",
")",
"{",
"case",
"NGM_HCI_COOKIE",
":",
"switch",
"(",
"NGI_MSG",
"(",
"item",
")",
"->",
"header",
".",
"cmd",
")",
"{",
"case",
"NGM_HCI_LP_CON_REQ",
":",
"error",
"=",
"ng_hci_lp_con_req",
"(",
"unit",
",",
"item",
",",
"lasthook",
")",
";",
"break",
";",
"case",
"NGM_HCI_LP_DISCON_REQ",
":",
"error",
"=",
"ng_hci_lp_discon_req",
"(",
"unit",
",",
"item",
",",
"lasthook",
")",
";",
"break",
";",
"case",
"NGM_HCI_LP_CON_RSP",
":",
"error",
"=",
"ng_hci_lp_con_rsp",
"(",
"unit",
",",
"item",
",",
"lasthook",
")",
";",
"break",
";",
"case",
"NGM_HCI_LP_QOS_REQ",
":",
"error",
"=",
"ng_hci_lp_qos_req",
"(",
"unit",
",",
"item",
",",
"lasthook",
")",
";",
"break",
";",
"default",
":",
"error",
"=",
"ng_hci_default_rcvmsg",
"(",
"node",
",",
"item",
",",
"lasthook",
")",
";",
"break",
";",
"}",
"break",
";",
"default",
":",
"error",
"=",
"ng_hci_default_rcvmsg",
"(",
"node",
",",
"item",
",",
"lasthook",
")",
";",
"break",
";",
"}",
"return",
"(",
"error",
")",
";",
"}"
] | Process control message from upstream hooks (ACL and SCO). | [
"Process",
"control",
"message",
"from",
"upstream",
"hooks",
"(",
"ACL",
"and",
"SCO",
")",
"."
] | [
"/* XXX not defined by specs */"
] | [
{
"param": "node",
"type": "node_p"
},
{
"param": "item",
"type": "item_p"
},
{
"param": "lasthook",
"type": "hook_p"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": "node_p",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "item",
"type": "item_p",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lasthook",
"type": "hook_p",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8edad10b6d87828086dcdd66a015f49c7251a5f2 | atrens/DragonFlyBSD-src | contrib/lvm2/dist/lib/commands/toolcontext.c | [
"BSD-3-Clause"
] | C | _init_lvm_conf | int | static int _init_lvm_conf(struct cmd_context *cmd)
{
/* No config file if LVM_SYSTEM_DIR is empty */
if (!*cmd->system_dir) {
if (!(cmd->cft = create_config_tree(NULL, 0))) {
log_error("Failed to create config tree");
return 0;
}
return 1;
}
if (!_load_config_file(cmd, ""))
return_0;
return 1;
} | /* Find and read first config file */ | Find and read first config file | [
"Find",
"and",
"read",
"first",
"config",
"file"
] | static int _init_lvm_conf(struct cmd_context *cmd)
{
if (!*cmd->system_dir) {
if (!(cmd->cft = create_config_tree(NULL, 0))) {
log_error("Failed to create config tree");
return 0;
}
return 1;
}
if (!_load_config_file(cmd, ""))
return_0;
return 1;
} | [
"static",
"int",
"_init_lvm_conf",
"(",
"struct",
"cmd_context",
"*",
"cmd",
")",
"{",
"if",
"(",
"!",
"*",
"cmd",
"->",
"system_dir",
")",
"{",
"if",
"(",
"!",
"(",
"cmd",
"->",
"cft",
"=",
"create_config_tree",
"(",
"NULL",
",",
"0",
")",
")",
")",
"{",
"log_error",
"(",
"\"",
"\"",
")",
";",
"return",
"0",
";",
"}",
"return",
"1",
";",
"}",
"if",
"(",
"!",
"_load_config_file",
"(",
"cmd",
",",
"\"",
"\"",
")",
")",
"return_0",
";",
"return",
"1",
";",
"}"
] | Find and read first config file | [
"Find",
"and",
"read",
"first",
"config",
"file"
] | [
"/* No config file if LVM_SYSTEM_DIR is empty */"
] | [
{
"param": "cmd",
"type": "struct cmd_context"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cmd",
"type": "struct cmd_context",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31b830f3e29344491d838eb25d9ec2fafe4272a5 | atrens/DragonFlyBSD-src | sys/bus/ppbus/ppb_1284.c | [
"BSD-3-Clause"
] | C | ppb_peripheral_negotiate | int | int
ppb_peripheral_negotiate(device_t bus, int mode, int options)
{
int spin, request_mode, error = 0;
char r;
ppb_set_mode(bus, PPB_COMPATIBLE);
ppb_1284_set_state(bus, PPB_PERIPHERAL_NEGOTIATION);
/* compute ext. value */
request_mode = ppb_request_mode(mode, options);
/* wait host */
spin = 10;
while (spin-- && (ppb_rstr(bus) & nBUSY))
DELAY(1);
/* check termination */
if (!(ppb_rstr(bus) & SELECT) || !spin) {
error = ENODEV;
goto error;
}
/* Event 4 - read ext. value */
r = ppb_rdtr(bus);
/* nibble mode is not supported */
if ((r == (char)request_mode) ||
(r == NIBBLE_1284_NORMAL)) {
/* Event 5 - restore direction bit, no data avail */
ppb_wctr(bus, (STROBE | nINIT) & ~(SELECTIN));
DELAY(1);
/* Event 6 */
ppb_wctr(bus, (nINIT) & ~(SELECTIN | STROBE));
if (r == NIBBLE_1284_NORMAL) {
#ifdef DEBUG_1284
kprintf("R");
#endif
ppb_1284_set_error(bus, PPB_MODE_UNSUPPORTED, 4);
error = EINVAL;
goto error;
} else {
ppb_1284_set_state(bus, PPB_PERIPHERAL_IDLE);
switch (r) {
case BYTE_1284_NORMAL:
ppb_set_mode(bus, PPB_BYTE);
break;
default:
break;
}
#ifdef DEBUG_1284
kprintf("A");
#endif
/* negotiation succeeds */
}
} else {
/* Event 5 - mode not supported */
ppb_wctr(bus, SELECTIN);
DELAY(1);
/* Event 6 */
ppb_wctr(bus, (SELECTIN) & ~(STROBE | nINIT));
ppb_1284_set_error(bus, PPB_MODE_UNSUPPORTED, 4);
#ifdef DEBUG_1284
kprintf("r");
#endif
error = EINVAL;
goto error;
}
return (0);
error:
ppb_peripheral_terminate(bus, PPB_WAIT);
return (error);
} | /*
* ppb_peripheral_negotiate()
*
* Negotiate the peripheral side
*/ | ppb_peripheral_negotiate()
Negotiate the peripheral side | [
"ppb_peripheral_negotiate",
"()",
"Negotiate",
"the",
"peripheral",
"side"
] | int
ppb_peripheral_negotiate(device_t bus, int mode, int options)
{
int spin, request_mode, error = 0;
char r;
ppb_set_mode(bus, PPB_COMPATIBLE);
ppb_1284_set_state(bus, PPB_PERIPHERAL_NEGOTIATION);
request_mode = ppb_request_mode(mode, options);
spin = 10;
while (spin-- && (ppb_rstr(bus) & nBUSY))
DELAY(1);
if (!(ppb_rstr(bus) & SELECT) || !spin) {
error = ENODEV;
goto error;
}
r = ppb_rdtr(bus);
if ((r == (char)request_mode) ||
(r == NIBBLE_1284_NORMAL)) {
ppb_wctr(bus, (STROBE | nINIT) & ~(SELECTIN));
DELAY(1);
ppb_wctr(bus, (nINIT) & ~(SELECTIN | STROBE));
if (r == NIBBLE_1284_NORMAL) {
#ifdef DEBUG_1284
kprintf("R");
#endif
ppb_1284_set_error(bus, PPB_MODE_UNSUPPORTED, 4);
error = EINVAL;
goto error;
} else {
ppb_1284_set_state(bus, PPB_PERIPHERAL_IDLE);
switch (r) {
case BYTE_1284_NORMAL:
ppb_set_mode(bus, PPB_BYTE);
break;
default:
break;
}
#ifdef DEBUG_1284
kprintf("A");
#endif
}
} else {
ppb_wctr(bus, SELECTIN);
DELAY(1);
ppb_wctr(bus, (SELECTIN) & ~(STROBE | nINIT));
ppb_1284_set_error(bus, PPB_MODE_UNSUPPORTED, 4);
#ifdef DEBUG_1284
kprintf("r");
#endif
error = EINVAL;
goto error;
}
return (0);
error:
ppb_peripheral_terminate(bus, PPB_WAIT);
return (error);
} | [
"int",
"ppb_peripheral_negotiate",
"(",
"device_t",
"bus",
",",
"int",
"mode",
",",
"int",
"options",
")",
"{",
"int",
"spin",
",",
"request_mode",
",",
"error",
"=",
"0",
";",
"char",
"r",
";",
"ppb_set_mode",
"(",
"bus",
",",
"PPB_COMPATIBLE",
")",
";",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_PERIPHERAL_NEGOTIATION",
")",
";",
"request_mode",
"=",
"ppb_request_mode",
"(",
"mode",
",",
"options",
")",
";",
"spin",
"=",
"10",
";",
"while",
"(",
"spin",
"--",
"&&",
"(",
"ppb_rstr",
"(",
"bus",
")",
"&",
"nBUSY",
")",
")",
"DELAY",
"(",
"1",
")",
";",
"if",
"(",
"!",
"(",
"ppb_rstr",
"(",
"bus",
")",
"&",
"SELECT",
")",
"||",
"!",
"spin",
")",
"{",
"error",
"=",
"ENODEV",
";",
"goto",
"error",
";",
"}",
"r",
"=",
"ppb_rdtr",
"(",
"bus",
")",
";",
"if",
"(",
"(",
"r",
"==",
"(",
"char",
")",
"request_mode",
")",
"||",
"(",
"r",
"==",
"NIBBLE_1284_NORMAL",
")",
")",
"{",
"ppb_wctr",
"(",
"bus",
",",
"(",
"STROBE",
"|",
"nINIT",
")",
"&",
"~",
"(",
"SELECTIN",
")",
")",
";",
"DELAY",
"(",
"1",
")",
";",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
")",
"&",
"~",
"(",
"SELECTIN",
"|",
"STROBE",
")",
")",
";",
"if",
"(",
"r",
"==",
"NIBBLE_1284_NORMAL",
")",
"{",
"#ifdef",
"DEBUG_1284",
"kprintf",
"(",
"\"",
"\"",
")",
";",
"#endif",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_MODE_UNSUPPORTED",
",",
"4",
")",
";",
"error",
"=",
"EINVAL",
";",
"goto",
"error",
";",
"}",
"else",
"{",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_PERIPHERAL_IDLE",
")",
";",
"switch",
"(",
"r",
")",
"{",
"case",
"BYTE_1284_NORMAL",
":",
"ppb_set_mode",
"(",
"bus",
",",
"PPB_BYTE",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"#ifdef",
"DEBUG_1284",
"kprintf",
"(",
"\"",
"\"",
")",
";",
"#endif",
"}",
"}",
"else",
"{",
"ppb_wctr",
"(",
"bus",
",",
"SELECTIN",
")",
";",
"DELAY",
"(",
"1",
")",
";",
"ppb_wctr",
"(",
"bus",
",",
"(",
"SELECTIN",
")",
"&",
"~",
"(",
"STROBE",
"|",
"nINIT",
")",
")",
";",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_MODE_UNSUPPORTED",
",",
"4",
")",
";",
"#ifdef",
"DEBUG_1284",
"kprintf",
"(",
"\"",
"\"",
")",
";",
"#endif",
"error",
"=",
"EINVAL",
";",
"goto",
"error",
";",
"}",
"return",
"(",
"0",
")",
";",
"error",
":",
"ppb_peripheral_terminate",
"(",
"bus",
",",
"PPB_WAIT",
")",
";",
"return",
"(",
"error",
")",
";",
"}"
] | ppb_peripheral_negotiate()
Negotiate the peripheral side | [
"ppb_peripheral_negotiate",
"()",
"Negotiate",
"the",
"peripheral",
"side"
] | [
"/* compute ext. value */",
"/* wait host */",
"/* check termination */",
"/* Event 4 - read ext. value */",
"/* nibble mode is not supported */",
"/* Event 5 - restore direction bit, no data avail */",
"/* Event 6 */",
"/* negotiation succeeds */",
"/* Event 5 - mode not supported */",
"/* Event 6 */"
] | [
{
"param": "bus",
"type": "device_t"
},
{
"param": "mode",
"type": "int"
},
{
"param": "options",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bus",
"type": "device_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "options",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31b830f3e29344491d838eb25d9ec2fafe4272a5 | atrens/DragonFlyBSD-src | sys/bus/ppbus/ppb_1284.c | [
"BSD-3-Clause"
] | C | ppb_peripheral_terminate | int | int
ppb_peripheral_terminate(device_t bus, int how)
{
int error = 0;
#ifdef DEBUG_1284
kprintf("t");
#endif
ppb_1284_set_state(bus, PPB_PERIPHERAL_TERMINATION);
/* Event 22 - wait up to host response time (1s) */
if ((error = do_peripheral_wait(bus, SELECT | nBUSY, 0))) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 22);
goto error;
}
/* Event 24 */
ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN));
/* Event 25 - wait up to host response time (1s) */
if ((error = do_peripheral_wait(bus, nBUSY, nBUSY))) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 25);
goto error;
}
/* Event 26 */
ppb_wctr(bus, (SELECTIN | nINIT | STROBE) & ~(AUTOFEED));
DELAY(1);
/* Event 27 */
ppb_wctr(bus, (SELECTIN | nINIT) & ~(STROBE | AUTOFEED));
/* Event 28 - wait up to host response time (1s) */
if ((error = do_peripheral_wait(bus, nBUSY, 0))) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 28);
goto error;
}
error:
ppb_set_mode(bus, PPB_COMPATIBLE);
ppb_1284_set_state(bus, PPB_FORWARD_IDLE);
return (0);
} | /*
* ppb_peripheral_terminate()
*
* Terminate peripheral transfer side
*
* Always return 0 in compatible mode
*/ | ppb_peripheral_terminate()
Terminate peripheral transfer side
Always return 0 in compatible mode | [
"ppb_peripheral_terminate",
"()",
"Terminate",
"peripheral",
"transfer",
"side",
"Always",
"return",
"0",
"in",
"compatible",
"mode"
] | int
ppb_peripheral_terminate(device_t bus, int how)
{
int error = 0;
#ifdef DEBUG_1284
kprintf("t");
#endif
ppb_1284_set_state(bus, PPB_PERIPHERAL_TERMINATION);
if ((error = do_peripheral_wait(bus, SELECT | nBUSY, 0))) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 22);
goto error;
}
ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN));
if ((error = do_peripheral_wait(bus, nBUSY, nBUSY))) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 25);
goto error;
}
ppb_wctr(bus, (SELECTIN | nINIT | STROBE) & ~(AUTOFEED));
DELAY(1);
ppb_wctr(bus, (SELECTIN | nINIT) & ~(STROBE | AUTOFEED));
if ((error = do_peripheral_wait(bus, nBUSY, 0))) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 28);
goto error;
}
error:
ppb_set_mode(bus, PPB_COMPATIBLE);
ppb_1284_set_state(bus, PPB_FORWARD_IDLE);
return (0);
} | [
"int",
"ppb_peripheral_terminate",
"(",
"device_t",
"bus",
",",
"int",
"how",
")",
"{",
"int",
"error",
"=",
"0",
";",
"#ifdef",
"DEBUG_1284",
"kprintf",
"(",
"\"",
"\"",
")",
";",
"#endif",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_PERIPHERAL_TERMINATION",
")",
";",
"if",
"(",
"(",
"error",
"=",
"do_peripheral_wait",
"(",
"bus",
",",
"SELECT",
"|",
"nBUSY",
",",
"0",
")",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_TIMEOUT",
",",
"22",
")",
";",
"goto",
"error",
";",
"}",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"STROBE",
")",
"&",
"~",
"(",
"AUTOFEED",
"|",
"SELECTIN",
")",
")",
";",
"if",
"(",
"(",
"error",
"=",
"do_peripheral_wait",
"(",
"bus",
",",
"nBUSY",
",",
"nBUSY",
")",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_TIMEOUT",
",",
"25",
")",
";",
"goto",
"error",
";",
"}",
"ppb_wctr",
"(",
"bus",
",",
"(",
"SELECTIN",
"|",
"nINIT",
"|",
"STROBE",
")",
"&",
"~",
"(",
"AUTOFEED",
")",
")",
";",
"DELAY",
"(",
"1",
")",
";",
"ppb_wctr",
"(",
"bus",
",",
"(",
"SELECTIN",
"|",
"nINIT",
")",
"&",
"~",
"(",
"STROBE",
"|",
"AUTOFEED",
")",
")",
";",
"if",
"(",
"(",
"error",
"=",
"do_peripheral_wait",
"(",
"bus",
",",
"nBUSY",
",",
"0",
")",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_TIMEOUT",
",",
"28",
")",
";",
"goto",
"error",
";",
"}",
"error",
":",
"ppb_set_mode",
"(",
"bus",
",",
"PPB_COMPATIBLE",
")",
";",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_FORWARD_IDLE",
")",
";",
"return",
"(",
"0",
")",
";",
"}"
] | ppb_peripheral_terminate()
Terminate peripheral transfer side | [
"ppb_peripheral_terminate",
"()",
"Terminate",
"peripheral",
"transfer",
"side"
] | [
"/* Event 22 - wait up to host response time (1s) */",
"/* Event 24 */",
"/* Event 25 - wait up to host response time (1s) */",
"/* Event 26 */",
"/* Event 27 */",
"/* Event 28 - wait up to host response time (1s) */"
] | [
{
"param": "bus",
"type": "device_t"
},
{
"param": "how",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bus",
"type": "device_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "how",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31b830f3e29344491d838eb25d9ec2fafe4272a5 | atrens/DragonFlyBSD-src | sys/bus/ppbus/ppb_1284.c | [
"BSD-3-Clause"
] | C | ppb_1284_negotiate | int | int
ppb_1284_negotiate(device_t bus, int mode, int options)
{
int error;
int request_mode;
#ifdef DEBUG_1284
kprintf("n");
#endif
if (ppb_1284_get_state(bus) >= PPB_PERIPHERAL_NEGOTIATION)
ppb_peripheral_terminate(bus, PPB_WAIT);
if (ppb_1284_get_state(bus) != PPB_FORWARD_IDLE)
ppb_1284_terminate(bus);
#ifdef DEBUG_1284
kprintf("%d", mode);
#endif
/* ensure the host is in compatible mode */
ppb_set_mode(bus, PPB_COMPATIBLE);
/* reset error to catch the actual negotiation error */
ppb_1284_reset_error(bus, PPB_FORWARD_IDLE);
/* calculate ext. value */
request_mode = ppb_request_mode(mode, options);
/* default state */
ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED));
DELAY(1);
/* enter negotiation phase */
ppb_1284_set_state(bus, PPB_NEGOTIATION);
/* Event 0 - put the exten. value on the data lines */
ppb_wdtr(bus, request_mode);
#ifdef PERIPH_1284
/* request remote host attention */
ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN));
DELAY(1);
ppb_wctr(bus, (nINIT) & ~(STROBE | AUTOFEED | SELECTIN));
#else
DELAY(1);
#endif /* !PERIPH_1284 */
/* Event 1 - enter IEEE1284 mode */
ppb_wctr(bus, (nINIT | AUTOFEED) & ~(STROBE | SELECTIN));
#ifdef PERIPH_1284
/* ignore the PError line, wait a bit more, remote host's
* interrupts don't respond fast enough */
if (ppb_poll_bus(bus, 40, nACK | SELECT | nFAULT,
SELECT | nFAULT, PPB_NOINTR | PPB_POLL)) {
ppb_1284_set_error(bus, PPB_NOT_IEEE1284, 2);
error = ENODEV;
goto error;
}
#else
/* Event 2 - trying IEEE1284 dialog */
if (do_1284_wait(bus, nACK | PERROR | SELECT | nFAULT,
PERROR | SELECT | nFAULT)) {
ppb_1284_set_error(bus, PPB_NOT_IEEE1284, 2);
error = ENODEV;
goto error;
}
#endif /* !PERIPH_1284 */
/* Event 3 - latch the ext. value to the peripheral */
ppb_wctr(bus, (nINIT | STROBE | AUTOFEED) & ~SELECTIN);
DELAY(1);
/* Event 4 - IEEE1284 device recognized */
ppb_wctr(bus, nINIT & ~(SELECTIN | AUTOFEED | STROBE));
/* Event 6 - waiting for status lines */
if (do_1284_wait(bus, nACK, nACK)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 6);
error = EBUSY;
goto error;
}
/* Event 7 - quering result consider nACK not to misunderstand
* a remote computer terminate sequence */
if (options & PPB_EXTENSIBILITY_LINK) {
/* XXX not fully supported yet */
ppb_1284_terminate(bus);
return (0);
}
if (request_mode == NIBBLE_1284_NORMAL) {
if (do_1284_wait(bus, nACK | SELECT, nACK)) {
ppb_1284_set_error(bus, PPB_MODE_UNSUPPORTED, 7);
error = ENODEV;
goto error;
}
} else {
if (do_1284_wait(bus, nACK | SELECT, SELECT | nACK)) {
ppb_1284_set_error(bus, PPB_MODE_UNSUPPORTED, 7);
error = ENODEV;
goto error;
}
}
switch (mode) {
case PPB_NIBBLE:
case PPB_PS2:
/* enter reverse idle phase */
ppb_1284_set_state(bus, PPB_REVERSE_IDLE);
break;
case PPB_ECP:
/* negotiation ok, now setup the communication */
ppb_1284_set_state(bus, PPB_SETUP);
ppb_wctr(bus, (nINIT | AUTOFEED) & ~(SELECTIN | STROBE));
#ifdef PERIPH_1284
/* ignore PError line */
if (do_1284_wait(bus, nACK | SELECT | nBUSY,
nACK | SELECT | nBUSY)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 30);
error = ENODEV;
goto error;
}
#else
if (do_1284_wait(bus, nACK | SELECT | PERROR | nBUSY,
nACK | SELECT | PERROR | nBUSY)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 30);
error = ENODEV;
goto error;
}
#endif /* !PERIPH_1284 */
/* ok, the host enters the ForwardIdle state */
ppb_1284_set_state(bus, PPB_ECP_FORWARD_IDLE);
break;
case PPB_EPP:
ppb_1284_set_state(bus, PPB_EPP_IDLE);
break;
default:
panic("%s: unknown mode (%d)!", __func__, mode);
}
ppb_set_mode(bus, mode);
return (0);
error:
ppb_1284_terminate(bus);
return (error);
} | /*
* ppb_1284_negotiate()
*
* IEEE1284 negotiation phase
*
* Normal nibble mode or request device id mode (see ppb_1284.h)
*
* After negotiation, nFAULT is low if data is available
*/ | ppb_1284_negotiate()
IEEE1284 negotiation phase
Normal nibble mode or request device id mode
After negotiation, nFAULT is low if data is available | [
"ppb_1284_negotiate",
"()",
"IEEE1284",
"negotiation",
"phase",
"Normal",
"nibble",
"mode",
"or",
"request",
"device",
"id",
"mode",
"After",
"negotiation",
"nFAULT",
"is",
"low",
"if",
"data",
"is",
"available"
] | int
ppb_1284_negotiate(device_t bus, int mode, int options)
{
int error;
int request_mode;
#ifdef DEBUG_1284
kprintf("n");
#endif
if (ppb_1284_get_state(bus) >= PPB_PERIPHERAL_NEGOTIATION)
ppb_peripheral_terminate(bus, PPB_WAIT);
if (ppb_1284_get_state(bus) != PPB_FORWARD_IDLE)
ppb_1284_terminate(bus);
#ifdef DEBUG_1284
kprintf("%d", mode);
#endif
ppb_set_mode(bus, PPB_COMPATIBLE);
ppb_1284_reset_error(bus, PPB_FORWARD_IDLE);
request_mode = ppb_request_mode(mode, options);
ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED));
DELAY(1);
ppb_1284_set_state(bus, PPB_NEGOTIATION);
ppb_wdtr(bus, request_mode);
#ifdef PERIPH_1284
ppb_wctr(bus, (nINIT | STROBE) & ~(AUTOFEED | SELECTIN));
DELAY(1);
ppb_wctr(bus, (nINIT) & ~(STROBE | AUTOFEED | SELECTIN));
#else
DELAY(1);
#endif
ppb_wctr(bus, (nINIT | AUTOFEED) & ~(STROBE | SELECTIN));
#ifdef PERIPH_1284
if (ppb_poll_bus(bus, 40, nACK | SELECT | nFAULT,
SELECT | nFAULT, PPB_NOINTR | PPB_POLL)) {
ppb_1284_set_error(bus, PPB_NOT_IEEE1284, 2);
error = ENODEV;
goto error;
}
#else
if (do_1284_wait(bus, nACK | PERROR | SELECT | nFAULT,
PERROR | SELECT | nFAULT)) {
ppb_1284_set_error(bus, PPB_NOT_IEEE1284, 2);
error = ENODEV;
goto error;
}
#endif
ppb_wctr(bus, (nINIT | STROBE | AUTOFEED) & ~SELECTIN);
DELAY(1);
ppb_wctr(bus, nINIT & ~(SELECTIN | AUTOFEED | STROBE));
if (do_1284_wait(bus, nACK, nACK)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 6);
error = EBUSY;
goto error;
}
if (options & PPB_EXTENSIBILITY_LINK) {
ppb_1284_terminate(bus);
return (0);
}
if (request_mode == NIBBLE_1284_NORMAL) {
if (do_1284_wait(bus, nACK | SELECT, nACK)) {
ppb_1284_set_error(bus, PPB_MODE_UNSUPPORTED, 7);
error = ENODEV;
goto error;
}
} else {
if (do_1284_wait(bus, nACK | SELECT, SELECT | nACK)) {
ppb_1284_set_error(bus, PPB_MODE_UNSUPPORTED, 7);
error = ENODEV;
goto error;
}
}
switch (mode) {
case PPB_NIBBLE:
case PPB_PS2:
ppb_1284_set_state(bus, PPB_REVERSE_IDLE);
break;
case PPB_ECP:
ppb_1284_set_state(bus, PPB_SETUP);
ppb_wctr(bus, (nINIT | AUTOFEED) & ~(SELECTIN | STROBE));
#ifdef PERIPH_1284
if (do_1284_wait(bus, nACK | SELECT | nBUSY,
nACK | SELECT | nBUSY)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 30);
error = ENODEV;
goto error;
}
#else
if (do_1284_wait(bus, nACK | SELECT | PERROR | nBUSY,
nACK | SELECT | PERROR | nBUSY)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 30);
error = ENODEV;
goto error;
}
#endif
ppb_1284_set_state(bus, PPB_ECP_FORWARD_IDLE);
break;
case PPB_EPP:
ppb_1284_set_state(bus, PPB_EPP_IDLE);
break;
default:
panic("%s: unknown mode (%d)!", __func__, mode);
}
ppb_set_mode(bus, mode);
return (0);
error:
ppb_1284_terminate(bus);
return (error);
} | [
"int",
"ppb_1284_negotiate",
"(",
"device_t",
"bus",
",",
"int",
"mode",
",",
"int",
"options",
")",
"{",
"int",
"error",
";",
"int",
"request_mode",
";",
"#ifdef",
"DEBUG_1284",
"kprintf",
"(",
"\"",
"\"",
")",
";",
"#endif",
"if",
"(",
"ppb_1284_get_state",
"(",
"bus",
")",
">=",
"PPB_PERIPHERAL_NEGOTIATION",
")",
"ppb_peripheral_terminate",
"(",
"bus",
",",
"PPB_WAIT",
")",
";",
"if",
"(",
"ppb_1284_get_state",
"(",
"bus",
")",
"!=",
"PPB_FORWARD_IDLE",
")",
"ppb_1284_terminate",
"(",
"bus",
")",
";",
"#ifdef",
"DEBUG_1284",
"kprintf",
"(",
"\"",
"\"",
",",
"mode",
")",
";",
"#endif",
"ppb_set_mode",
"(",
"bus",
",",
"PPB_COMPATIBLE",
")",
";",
"ppb_1284_reset_error",
"(",
"bus",
",",
"PPB_FORWARD_IDLE",
")",
";",
"request_mode",
"=",
"ppb_request_mode",
"(",
"mode",
",",
"options",
")",
";",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"SELECTIN",
")",
"&",
"~",
"(",
"STROBE",
"|",
"AUTOFEED",
")",
")",
";",
"DELAY",
"(",
"1",
")",
";",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_NEGOTIATION",
")",
";",
"ppb_wdtr",
"(",
"bus",
",",
"request_mode",
")",
";",
"#ifdef",
"PERIPH_1284",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"STROBE",
")",
"&",
"~",
"(",
"AUTOFEED",
"|",
"SELECTIN",
")",
")",
";",
"DELAY",
"(",
"1",
")",
";",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
")",
"&",
"~",
"(",
"STROBE",
"|",
"AUTOFEED",
"|",
"SELECTIN",
")",
")",
";",
"#else",
"DELAY",
"(",
"1",
")",
";",
"#endif",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"AUTOFEED",
")",
"&",
"~",
"(",
"STROBE",
"|",
"SELECTIN",
")",
")",
";",
"#ifdef",
"PERIPH_1284",
"if",
"(",
"ppb_poll_bus",
"(",
"bus",
",",
"40",
",",
"nACK",
"|",
"SELECT",
"|",
"nFAULT",
",",
"SELECT",
"|",
"nFAULT",
",",
"PPB_NOINTR",
"|",
"PPB_POLL",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_NOT_IEEE1284",
",",
"2",
")",
";",
"error",
"=",
"ENODEV",
";",
"goto",
"error",
";",
"}",
"#else",
"if",
"(",
"do_1284_wait",
"(",
"bus",
",",
"nACK",
"|",
"PERROR",
"|",
"SELECT",
"|",
"nFAULT",
",",
"PERROR",
"|",
"SELECT",
"|",
"nFAULT",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_NOT_IEEE1284",
",",
"2",
")",
";",
"error",
"=",
"ENODEV",
";",
"goto",
"error",
";",
"}",
"#endif",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"STROBE",
"|",
"AUTOFEED",
")",
"&",
"~",
"SELECTIN",
")",
";",
"DELAY",
"(",
"1",
")",
";",
"ppb_wctr",
"(",
"bus",
",",
"nINIT",
"&",
"~",
"(",
"SELECTIN",
"|",
"AUTOFEED",
"|",
"STROBE",
")",
")",
";",
"if",
"(",
"do_1284_wait",
"(",
"bus",
",",
"nACK",
",",
"nACK",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_TIMEOUT",
",",
"6",
")",
";",
"error",
"=",
"EBUSY",
";",
"goto",
"error",
";",
"}",
"if",
"(",
"options",
"&",
"PPB_EXTENSIBILITY_LINK",
")",
"{",
"ppb_1284_terminate",
"(",
"bus",
")",
";",
"return",
"(",
"0",
")",
";",
"}",
"if",
"(",
"request_mode",
"==",
"NIBBLE_1284_NORMAL",
")",
"{",
"if",
"(",
"do_1284_wait",
"(",
"bus",
",",
"nACK",
"|",
"SELECT",
",",
"nACK",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_MODE_UNSUPPORTED",
",",
"7",
")",
";",
"error",
"=",
"ENODEV",
";",
"goto",
"error",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"do_1284_wait",
"(",
"bus",
",",
"nACK",
"|",
"SELECT",
",",
"SELECT",
"|",
"nACK",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_MODE_UNSUPPORTED",
",",
"7",
")",
";",
"error",
"=",
"ENODEV",
";",
"goto",
"error",
";",
"}",
"}",
"switch",
"(",
"mode",
")",
"{",
"case",
"PPB_NIBBLE",
":",
"case",
"PPB_PS2",
":",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_REVERSE_IDLE",
")",
";",
"break",
";",
"case",
"PPB_ECP",
":",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_SETUP",
")",
";",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"AUTOFEED",
")",
"&",
"~",
"(",
"SELECTIN",
"|",
"STROBE",
")",
")",
";",
"#ifdef",
"PERIPH_1284",
"if",
"(",
"do_1284_wait",
"(",
"bus",
",",
"nACK",
"|",
"SELECT",
"|",
"nBUSY",
",",
"nACK",
"|",
"SELECT",
"|",
"nBUSY",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_TIMEOUT",
",",
"30",
")",
";",
"error",
"=",
"ENODEV",
";",
"goto",
"error",
";",
"}",
"#else",
"if",
"(",
"do_1284_wait",
"(",
"bus",
",",
"nACK",
"|",
"SELECT",
"|",
"PERROR",
"|",
"nBUSY",
",",
"nACK",
"|",
"SELECT",
"|",
"PERROR",
"|",
"nBUSY",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_TIMEOUT",
",",
"30",
")",
";",
"error",
"=",
"ENODEV",
";",
"goto",
"error",
";",
"}",
"#endif",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_ECP_FORWARD_IDLE",
")",
";",
"break",
";",
"case",
"PPB_EPP",
":",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_EPP_IDLE",
")",
";",
"break",
";",
"default",
":",
"panic",
"(",
"\"",
"\"",
",",
"__func__",
",",
"mode",
")",
";",
"}",
"ppb_set_mode",
"(",
"bus",
",",
"mode",
")",
";",
"return",
"(",
"0",
")",
";",
"error",
":",
"ppb_1284_terminate",
"(",
"bus",
")",
";",
"return",
"(",
"error",
")",
";",
"}"
] | ppb_1284_negotiate()
IEEE1284 negotiation phase | [
"ppb_1284_negotiate",
"()",
"IEEE1284",
"negotiation",
"phase"
] | [
"/* ensure the host is in compatible mode */",
"/* reset error to catch the actual negotiation error */",
"/* calculate ext. value */",
"/* default state */",
"/* enter negotiation phase */",
"/* Event 0 - put the exten. value on the data lines */",
"/* request remote host attention */",
"/* !PERIPH_1284 */",
"/* Event 1 - enter IEEE1284 mode */",
"/* ignore the PError line, wait a bit more, remote host's \n\t * interrupts don't respond fast enough */",
"/* Event 2 - trying IEEE1284 dialog */",
"/* !PERIPH_1284 */",
"/* Event 3 - latch the ext. value to the peripheral */",
"/* Event 4 - IEEE1284 device recognized */",
"/* Event 6 - waiting for status lines */",
"/* Event 7 - quering result consider nACK not to misunderstand\n\t * a remote computer terminate sequence */",
"/* XXX not fully supported yet */",
"/* enter reverse idle phase */",
"/* negotiation ok, now setup the communication */",
"/* ignore PError line */",
"/* !PERIPH_1284 */",
"/* ok, the host enters the ForwardIdle state */"
] | [
{
"param": "bus",
"type": "device_t"
},
{
"param": "mode",
"type": "int"
},
{
"param": "options",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bus",
"type": "device_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mode",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "options",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31b830f3e29344491d838eb25d9ec2fafe4272a5 | atrens/DragonFlyBSD-src | sys/bus/ppbus/ppb_1284.c | [
"BSD-3-Clause"
] | C | ppb_1284_terminate | int | int
ppb_1284_terminate(device_t bus)
{
#ifdef DEBUG_1284
kprintf("T");
#endif
/* do not reset error here to keep the error that
* may occured before the ppb_1284_terminate() call */
ppb_1284_set_state(bus, PPB_TERMINATION);
#ifdef PERIPH_1284
/* request remote host attention */
ppb_wctr(bus, (nINIT | STROBE | SELECTIN) & ~(AUTOFEED));
DELAY(1);
#endif /* PERIPH_1284 */
/* Event 22 - set nSelectin low and nAutoFeed high */
ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED));
/* Event 24 - waiting for peripheral, Xflag ignored */
if (do_1284_wait(bus, nACK | nBUSY | nFAULT, nFAULT)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 24);
goto error;
}
/* Event 25 - set nAutoFd low */
ppb_wctr(bus, (nINIT | SELECTIN | AUTOFEED) & ~STROBE);
/* Event 26 - compatible mode status is set */
/* Event 27 - peripheral set nAck high */
if (do_1284_wait(bus, nACK, nACK)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 27);
}
/* Event 28 - end termination, return to idle phase */
ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED));
error:
/* return to compatible mode */
ppb_set_mode(bus, PPB_COMPATIBLE);
ppb_1284_set_state(bus, PPB_FORWARD_IDLE);
return (0);
} | /*
* ppb_1284_terminate()
*
* IEEE1284 termination phase, return code should ignored since the host
* is _always_ in compatible mode after ppb_1284_terminate()
*/ | ppb_1284_terminate()
IEEE1284 termination phase, return code should ignored since the host
is _always_ in compatible mode after ppb_1284_terminate() | [
"ppb_1284_terminate",
"()",
"IEEE1284",
"termination",
"phase",
"return",
"code",
"should",
"ignored",
"since",
"the",
"host",
"is",
"_always_",
"in",
"compatible",
"mode",
"after",
"ppb_1284_terminate",
"()"
] | int
ppb_1284_terminate(device_t bus)
{
#ifdef DEBUG_1284
kprintf("T");
#endif
ppb_1284_set_state(bus, PPB_TERMINATION);
#ifdef PERIPH_1284
ppb_wctr(bus, (nINIT | STROBE | SELECTIN) & ~(AUTOFEED));
DELAY(1);
#endif
ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED));
if (do_1284_wait(bus, nACK | nBUSY | nFAULT, nFAULT)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 24);
goto error;
}
ppb_wctr(bus, (nINIT | SELECTIN | AUTOFEED) & ~STROBE);
if (do_1284_wait(bus, nACK, nACK)) {
ppb_1284_set_error(bus, PPB_TIMEOUT, 27);
}
ppb_wctr(bus, (nINIT | SELECTIN) & ~(STROBE | AUTOFEED));
error:
ppb_set_mode(bus, PPB_COMPATIBLE);
ppb_1284_set_state(bus, PPB_FORWARD_IDLE);
return (0);
} | [
"int",
"ppb_1284_terminate",
"(",
"device_t",
"bus",
")",
"{",
"#ifdef",
"DEBUG_1284",
"kprintf",
"(",
"\"",
"\"",
")",
";",
"#endif",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_TERMINATION",
")",
";",
"#ifdef",
"PERIPH_1284",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"STROBE",
"|",
"SELECTIN",
")",
"&",
"~",
"(",
"AUTOFEED",
")",
")",
";",
"DELAY",
"(",
"1",
")",
";",
"#endif",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"SELECTIN",
")",
"&",
"~",
"(",
"STROBE",
"|",
"AUTOFEED",
")",
")",
";",
"if",
"(",
"do_1284_wait",
"(",
"bus",
",",
"nACK",
"|",
"nBUSY",
"|",
"nFAULT",
",",
"nFAULT",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_TIMEOUT",
",",
"24",
")",
";",
"goto",
"error",
";",
"}",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"SELECTIN",
"|",
"AUTOFEED",
")",
"&",
"~",
"STROBE",
")",
";",
"if",
"(",
"do_1284_wait",
"(",
"bus",
",",
"nACK",
",",
"nACK",
")",
")",
"{",
"ppb_1284_set_error",
"(",
"bus",
",",
"PPB_TIMEOUT",
",",
"27",
")",
";",
"}",
"ppb_wctr",
"(",
"bus",
",",
"(",
"nINIT",
"|",
"SELECTIN",
")",
"&",
"~",
"(",
"STROBE",
"|",
"AUTOFEED",
")",
")",
";",
"error",
":",
"ppb_set_mode",
"(",
"bus",
",",
"PPB_COMPATIBLE",
")",
";",
"ppb_1284_set_state",
"(",
"bus",
",",
"PPB_FORWARD_IDLE",
")",
";",
"return",
"(",
"0",
")",
";",
"}"
] | ppb_1284_terminate()
IEEE1284 termination phase, return code should ignored since the host
is _always_ in compatible mode after ppb_1284_terminate() | [
"ppb_1284_terminate",
"()",
"IEEE1284",
"termination",
"phase",
"return",
"code",
"should",
"ignored",
"since",
"the",
"host",
"is",
"_always_",
"in",
"compatible",
"mode",
"after",
"ppb_1284_terminate",
"()"
] | [
"/* do not reset error here to keep the error that\n\t * may occured before the ppb_1284_terminate() call */",
"/* request remote host attention */",
"/* PERIPH_1284 */",
"/* Event 22 - set nSelectin low and nAutoFeed high */",
"/* Event 24 - waiting for peripheral, Xflag ignored */",
"/* Event 25 - set nAutoFd low */",
"/* Event 26 - compatible mode status is set */",
"/* Event 27 - peripheral set nAck high */",
"/* Event 28 - end termination, return to idle phase */",
"/* return to compatible mode */"
] | [
{
"param": "bus",
"type": "device_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bus",
"type": "device_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31e5da4d51649aadb570ec075bf1c7996e9b218f | atrens/DragonFlyBSD-src | contrib/cryptsetup/luks/pbkdf.c | [
"BSD-3-Clause"
] | C | PBKDF2_performance_check | int | int PBKDF2_performance_check(const char *hash, uint64_t *iter)
{
int r;
char buf;
struct itimerval it;
if (__PBKDF2_global_j) {
printf("foo1\n");
return -EBUSY;
}
if (!PBKDF2_HMAC_ready(hash)) {
printf("foo2\n");
return -EINVAL;
}
signal(SIGVTALRM,sigvtalarm);
it.it_interval.tv_usec = 0;
it.it_interval.tv_sec = 0;
it.it_value.tv_usec = 0;
it.it_value.tv_sec = 1;
if (setitimer (ITIMER_VIRTUAL, &it, NULL) < 0) {
printf("foo3\n");
return -EINVAL;
}
r = pkcs5_pbkdf2(hash, "foo", 3, "bar", 3, ~(0U), 1, &buf, 1);
*iter = __PBKDF2_performance;
__PBKDF2_global_j = 0;
__PBKDF2_performance = 0;
return r;
} | /* This code benchmarks PBKDF2 and returns iterations/second using wth specified hash */ | This code benchmarks PBKDF2 and returns iterations/second using wth specified hash | [
"This",
"code",
"benchmarks",
"PBKDF2",
"and",
"returns",
"iterations",
"/",
"second",
"using",
"wth",
"specified",
"hash"
] | int PBKDF2_performance_check(const char *hash, uint64_t *iter)
{
int r;
char buf;
struct itimerval it;
if (__PBKDF2_global_j) {
printf("foo1\n");
return -EBUSY;
}
if (!PBKDF2_HMAC_ready(hash)) {
printf("foo2\n");
return -EINVAL;
}
signal(SIGVTALRM,sigvtalarm);
it.it_interval.tv_usec = 0;
it.it_interval.tv_sec = 0;
it.it_value.tv_usec = 0;
it.it_value.tv_sec = 1;
if (setitimer (ITIMER_VIRTUAL, &it, NULL) < 0) {
printf("foo3\n");
return -EINVAL;
}
r = pkcs5_pbkdf2(hash, "foo", 3, "bar", 3, ~(0U), 1, &buf, 1);
*iter = __PBKDF2_performance;
__PBKDF2_global_j = 0;
__PBKDF2_performance = 0;
return r;
} | [
"int",
"PBKDF2_performance_check",
"(",
"const",
"char",
"*",
"hash",
",",
"uint64_t",
"*",
"iter",
")",
"{",
"int",
"r",
";",
"char",
"buf",
";",
"struct",
"itimerval",
"it",
";",
"if",
"(",
"__PBKDF2_global_j",
")",
"{",
"printf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"-",
"EBUSY",
";",
"}",
"if",
"(",
"!",
"PBKDF2_HMAC_ready",
"(",
"hash",
")",
")",
"{",
"printf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"-",
"EINVAL",
";",
"}",
"signal",
"(",
"SIGVTALRM",
",",
"sigvtalarm",
")",
";",
"it",
".",
"it_interval",
".",
"tv_usec",
"=",
"0",
";",
"it",
".",
"it_interval",
".",
"tv_sec",
"=",
"0",
";",
"it",
".",
"it_value",
".",
"tv_usec",
"=",
"0",
";",
"it",
".",
"it_value",
".",
"tv_sec",
"=",
"1",
";",
"if",
"(",
"setitimer",
"(",
"ITIMER_VIRTUAL",
",",
"&",
"it",
",",
"NULL",
")",
"<",
"0",
")",
"{",
"printf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"-",
"EINVAL",
";",
"}",
"r",
"=",
"pkcs5_pbkdf2",
"(",
"hash",
",",
"\"",
"\"",
",",
"3",
",",
"\"",
"\"",
",",
"3",
",",
"~",
"(",
"0U",
")",
",",
"1",
",",
"&",
"buf",
",",
"1",
")",
";",
"*",
"iter",
"=",
"__PBKDF2_performance",
";",
"__PBKDF2_global_j",
"=",
"0",
";",
"__PBKDF2_performance",
"=",
"0",
";",
"return",
"r",
";",
"}"
] | This code benchmarks PBKDF2 and returns iterations/second using wth specified hash | [
"This",
"code",
"benchmarks",
"PBKDF2",
"and",
"returns",
"iterations",
"/",
"second",
"using",
"wth",
"specified",
"hash"
] | [] | [
{
"param": "hash",
"type": "char"
},
{
"param": "iter",
"type": "uint64_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "hash",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "iter",
"type": "uint64_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | hash_name | hashval_t | static hashval_t
hash_name (const void *p)
{
const struct lto_section_slot *ds = (const struct lto_section_slot *) p;
return (hashval_t) htab_hash_string (ds->name);
} | /* Returns a hash code for P. */ | Returns a hash code for P. | [
"Returns",
"a",
"hash",
"code",
"for",
"P",
"."
] | static hashval_t
hash_name (const void *p)
{
const struct lto_section_slot *ds = (const struct lto_section_slot *) p;
return (hashval_t) htab_hash_string (ds->name);
} | [
"static",
"hashval_t",
"hash_name",
"(",
"const",
"void",
"*",
"p",
")",
"{",
"const",
"struct",
"lto_section_slot",
"*",
"ds",
"=",
"(",
"const",
"struct",
"lto_section_slot",
"*",
")",
"p",
";",
"return",
"(",
"hashval_t",
")",
"htab_hash_string",
"(",
"ds",
"->",
"name",
")",
";",
"}"
] | Returns a hash code for P. | [
"Returns",
"a",
"hash",
"code",
"for",
"P",
"."
] | [] | [
{
"param": "p",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | eq_name | int | static int
eq_name (const void *p1, const void *p2)
{
const struct lto_section_slot *s1 =
(const struct lto_section_slot *) p1;
const struct lto_section_slot *s2 =
(const struct lto_section_slot *) p2;
return strcmp (s1->name, s2->name) == 0;
} | /* Returns nonzero if P1 and P2 are equal. */ | Returns nonzero if P1 and P2 are equal. | [
"Returns",
"nonzero",
"if",
"P1",
"and",
"P2",
"are",
"equal",
"."
] | static int
eq_name (const void *p1, const void *p2)
{
const struct lto_section_slot *s1 =
(const struct lto_section_slot *) p1;
const struct lto_section_slot *s2 =
(const struct lto_section_slot *) p2;
return strcmp (s1->name, s2->name) == 0;
} | [
"static",
"int",
"eq_name",
"(",
"const",
"void",
"*",
"p1",
",",
"const",
"void",
"*",
"p2",
")",
"{",
"const",
"struct",
"lto_section_slot",
"*",
"s1",
"=",
"(",
"const",
"struct",
"lto_section_slot",
"*",
")",
"p1",
";",
"const",
"struct",
"lto_section_slot",
"*",
"s2",
"=",
"(",
"const",
"struct",
"lto_section_slot",
"*",
")",
"p2",
";",
"return",
"strcmp",
"(",
"s1",
"->",
"name",
",",
"s2",
"->",
"name",
")",
"==",
"0",
";",
"}"
] | Returns nonzero if P1 and P2 are equal. | [
"Returns",
"nonzero",
"if",
"P1",
"and",
"P2",
"are",
"equal",
"."
] | [] | [
{
"param": "p1",
"type": "void"
},
{
"param": "p2",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p1",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p2",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_splay_tree_delete_id | void | static void
lto_splay_tree_delete_id (splay_tree_key key)
{
free ((void *) key);
} | /* Delete an allocated integer KEY in the splay tree. */ | Delete an allocated integer KEY in the splay tree. | [
"Delete",
"an",
"allocated",
"integer",
"KEY",
"in",
"the",
"splay",
"tree",
"."
] | static void
lto_splay_tree_delete_id (splay_tree_key key)
{
free ((void *) key);
} | [
"static",
"void",
"lto_splay_tree_delete_id",
"(",
"splay_tree_key",
"key",
")",
"{",
"free",
"(",
"(",
"void",
"*",
")",
"key",
")",
";",
"}"
] | Delete an allocated integer KEY in the splay tree. | [
"Delete",
"an",
"allocated",
"integer",
"KEY",
"in",
"the",
"splay",
"tree",
"."
] | [] | [
{
"param": "key",
"type": "splay_tree_key"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": "splay_tree_key",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_splay_tree_compare_ids | int | static int
lto_splay_tree_compare_ids (splay_tree_key a, splay_tree_key b)
{
unsigned HOST_WIDE_INT ai;
unsigned HOST_WIDE_INT bi;
ai = *(unsigned HOST_WIDE_INT *) a;
bi = *(unsigned HOST_WIDE_INT *) b;
if (ai < bi)
return -1;
else if (ai > bi)
return 1;
return 0;
} | /* Compare splay tree node ids A and B. */ | Compare splay tree node ids A and B. | [
"Compare",
"splay",
"tree",
"node",
"ids",
"A",
"and",
"B",
"."
] | static int
lto_splay_tree_compare_ids (splay_tree_key a, splay_tree_key b)
{
unsigned HOST_WIDE_INT ai;
unsigned HOST_WIDE_INT bi;
ai = *(unsigned HOST_WIDE_INT *) a;
bi = *(unsigned HOST_WIDE_INT *) b;
if (ai < bi)
return -1;
else if (ai > bi)
return 1;
return 0;
} | [
"static",
"int",
"lto_splay_tree_compare_ids",
"(",
"splay_tree_key",
"a",
",",
"splay_tree_key",
"b",
")",
"{",
"unsigned",
"HOST_WIDE_INT",
"ai",
";",
"unsigned",
"HOST_WIDE_INT",
"bi",
";",
"ai",
"=",
"*",
"(",
"unsigned",
"HOST_WIDE_INT",
"*",
")",
"a",
";",
"bi",
"=",
"*",
"(",
"unsigned",
"HOST_WIDE_INT",
"*",
")",
"b",
";",
"if",
"(",
"ai",
"<",
"bi",
")",
"return",
"-1",
";",
"else",
"if",
"(",
"ai",
">",
"bi",
")",
"return",
"1",
";",
"return",
"0",
";",
"}"
] | Compare splay tree node ids A and B. | [
"Compare",
"splay",
"tree",
"node",
"ids",
"A",
"and",
"B",
"."
] | [] | [
{
"param": "a",
"type": "splay_tree_key"
},
{
"param": "b",
"type": "splay_tree_key"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": "splay_tree_key",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": "splay_tree_key",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_splay_tree_lookup | splay_tree_node | static splay_tree_node
lto_splay_tree_lookup (splay_tree t, unsigned HOST_WIDE_INT id)
{
return splay_tree_lookup (t, (splay_tree_key) &id);
} | /* Look up splay tree node by ID in splay tree T. */ | Look up splay tree node by ID in splay tree T. | [
"Look",
"up",
"splay",
"tree",
"node",
"by",
"ID",
"in",
"splay",
"tree",
"T",
"."
] | static splay_tree_node
lto_splay_tree_lookup (splay_tree t, unsigned HOST_WIDE_INT id)
{
return splay_tree_lookup (t, (splay_tree_key) &id);
} | [
"static",
"splay_tree_node",
"lto_splay_tree_lookup",
"(",
"splay_tree",
"t",
",",
"unsigned",
"HOST_WIDE_INT",
"id",
")",
"{",
"return",
"splay_tree_lookup",
"(",
"t",
",",
"(",
"splay_tree_key",
")",
"&",
"id",
")",
";",
"}"
] | Look up splay tree node by ID in splay tree T. | [
"Look",
"up",
"splay",
"tree",
"node",
"by",
"ID",
"in",
"splay",
"tree",
"T",
"."
] | [] | [
{
"param": "t",
"type": "splay_tree"
},
{
"param": "id",
"type": "unsigned HOST_WIDE_INT"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "splay_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": "unsigned HOST_WIDE_INT",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_splay_tree_id_equal_p | bool | static bool
lto_splay_tree_id_equal_p (splay_tree_key key, unsigned HOST_WIDE_INT id)
{
return *(unsigned HOST_WIDE_INT *) key == id;
} | /* Check if KEY has ID. */ | Check if KEY has ID. | [
"Check",
"if",
"KEY",
"has",
"ID",
"."
] | static bool
lto_splay_tree_id_equal_p (splay_tree_key key, unsigned HOST_WIDE_INT id)
{
return *(unsigned HOST_WIDE_INT *) key == id;
} | [
"static",
"bool",
"lto_splay_tree_id_equal_p",
"(",
"splay_tree_key",
"key",
",",
"unsigned",
"HOST_WIDE_INT",
"id",
")",
"{",
"return",
"*",
"(",
"unsigned",
"HOST_WIDE_INT",
"*",
")",
"key",
"==",
"id",
";",
"}"
] | Check if KEY has ID. | [
"Check",
"if",
"KEY",
"has",
"ID",
"."
] | [] | [
{
"param": "key",
"type": "splay_tree_key"
},
{
"param": "id",
"type": "unsigned HOST_WIDE_INT"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "key",
"type": "splay_tree_key",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": "unsigned HOST_WIDE_INT",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | has_analyzed_clone_p | bool | static bool
has_analyzed_clone_p (struct cgraph_node *node)
{
struct cgraph_node *orig = node;
node = node->clones;
if (node)
while (node != orig)
{
if (node->analyzed)
return true;
if (node->clones)
node = node->clones;
else if (node->next_sibling_clone)
node = node->next_sibling_clone;
else
{
while (node != orig && !node->next_sibling_clone)
node = node->clone_of;
if (node != orig)
node = node->next_sibling_clone;
}
}
return false;
} | /* Return true when NODE has a clone that is analyzed (i.e. we need
to load its body even if the node itself is not needed). */ | Return true when NODE has a clone that is analyzed . | [
"Return",
"true",
"when",
"NODE",
"has",
"a",
"clone",
"that",
"is",
"analyzed",
"."
] | static bool
has_analyzed_clone_p (struct cgraph_node *node)
{
struct cgraph_node *orig = node;
node = node->clones;
if (node)
while (node != orig)
{
if (node->analyzed)
return true;
if (node->clones)
node = node->clones;
else if (node->next_sibling_clone)
node = node->next_sibling_clone;
else
{
while (node != orig && !node->next_sibling_clone)
node = node->clone_of;
if (node != orig)
node = node->next_sibling_clone;
}
}
return false;
} | [
"static",
"bool",
"has_analyzed_clone_p",
"(",
"struct",
"cgraph_node",
"*",
"node",
")",
"{",
"struct",
"cgraph_node",
"*",
"orig",
"=",
"node",
";",
"node",
"=",
"node",
"->",
"clones",
";",
"if",
"(",
"node",
")",
"while",
"(",
"node",
"!=",
"orig",
")",
"{",
"if",
"(",
"node",
"->",
"analyzed",
")",
"return",
"true",
";",
"if",
"(",
"node",
"->",
"clones",
")",
"node",
"=",
"node",
"->",
"clones",
";",
"else",
"if",
"(",
"node",
"->",
"next_sibling_clone",
")",
"node",
"=",
"node",
"->",
"next_sibling_clone",
";",
"else",
"{",
"while",
"(",
"node",
"!=",
"orig",
"&&",
"!",
"node",
"->",
"next_sibling_clone",
")",
"node",
"=",
"node",
"->",
"clone_of",
";",
"if",
"(",
"node",
"!=",
"orig",
")",
"node",
"=",
"node",
"->",
"next_sibling_clone",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Return true when NODE has a clone that is analyzed (i.e. | [
"Return",
"true",
"when",
"NODE",
"has",
"a",
"clone",
"that",
"is",
"analyzed",
"(",
"i",
".",
"e",
"."
] | [] | [
{
"param": "node",
"type": "struct cgraph_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": "struct cgraph_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_materialize_function | void | static void
lto_materialize_function (struct cgraph_node *node)
{
tree decl;
decl = node->decl;
/* Read in functions with body (analyzed nodes)
and also functions that are needed to produce virtual clones. */
if ((node->has_gimple_body_p () && node->analyzed)
|| node->used_as_abstract_origin
|| has_analyzed_clone_p (node))
{
/* Clones don't need to be read. */
if (node->clone_of)
return;
if (DECL_FUNCTION_PERSONALITY (decl) && !first_personality_decl)
first_personality_decl = DECL_FUNCTION_PERSONALITY (decl);
}
/* Let the middle end know about the function. */
rest_of_decl_compilation (decl, 1, 0);
} | /* Read the function body for the function associated with NODE. */ | Read the function body for the function associated with NODE. | [
"Read",
"the",
"function",
"body",
"for",
"the",
"function",
"associated",
"with",
"NODE",
"."
] | static void
lto_materialize_function (struct cgraph_node *node)
{
tree decl;
decl = node->decl;
if ((node->has_gimple_body_p () && node->analyzed)
|| node->used_as_abstract_origin
|| has_analyzed_clone_p (node))
{
if (node->clone_of)
return;
if (DECL_FUNCTION_PERSONALITY (decl) && !first_personality_decl)
first_personality_decl = DECL_FUNCTION_PERSONALITY (decl);
}
rest_of_decl_compilation (decl, 1, 0);
} | [
"static",
"void",
"lto_materialize_function",
"(",
"struct",
"cgraph_node",
"*",
"node",
")",
"{",
"tree",
"decl",
";",
"decl",
"=",
"node",
"->",
"decl",
";",
"if",
"(",
"(",
"node",
"->",
"has_gimple_body_p",
"(",
")",
"&&",
"node",
"->",
"analyzed",
")",
"||",
"node",
"->",
"used_as_abstract_origin",
"||",
"has_analyzed_clone_p",
"(",
"node",
")",
")",
"{",
"if",
"(",
"node",
"->",
"clone_of",
")",
"return",
";",
"if",
"(",
"DECL_FUNCTION_PERSONALITY",
"(",
"decl",
")",
"&&",
"!",
"first_personality_decl",
")",
"first_personality_decl",
"=",
"DECL_FUNCTION_PERSONALITY",
"(",
"decl",
")",
";",
"}",
"rest_of_decl_compilation",
"(",
"decl",
",",
"1",
",",
"0",
")",
";",
"}"
] | Read the function body for the function associated with NODE. | [
"Read",
"the",
"function",
"body",
"for",
"the",
"function",
"associated",
"with",
"NODE",
"."
] | [
"/* Read in functions with body (analyzed nodes)\n and also functions that are needed to produce virtual clones. */",
"/* Clones don't need to be read. */",
"/* Let the middle end know about the function. */"
] | [
{
"param": "node",
"type": "struct cgraph_node"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": "struct cgraph_node",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_read_in_decl_state | uint32_t | static const uint32_t *
lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data,
struct lto_in_decl_state *state)
{
uint32_t ix;
tree decl;
uint32_t i, j;
ix = *data++;
state->compressed = ix & 1;
ix /= 2;
decl = streamer_tree_cache_get_tree (data_in->reader_cache, ix);
if (!VAR_OR_FUNCTION_DECL_P (decl))
{
gcc_assert (decl == void_type_node);
decl = NULL_TREE;
}
state->fn_decl = decl;
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
{
uint32_t size = *data++;
vec<tree, va_gc> *decls = NULL;
vec_alloc (decls, size);
for (j = 0; j < size; j++)
vec_safe_push (decls,
streamer_tree_cache_get_tree (data_in->reader_cache,
data[j]));
state->streams[i] = decls;
data += size;
}
return data;
} | /* Decode the content of memory pointed to by DATA in the in decl
state object STATE. DATA_IN points to a data_in structure for
decoding. Return the address after the decoded object in the
input. */ | Decode the content of memory pointed to by DATA in the in decl
state object STATE. DATA_IN points to a data_in structure for
decoding. Return the address after the decoded object in the
input. | [
"Decode",
"the",
"content",
"of",
"memory",
"pointed",
"to",
"by",
"DATA",
"in",
"the",
"in",
"decl",
"state",
"object",
"STATE",
".",
"DATA_IN",
"points",
"to",
"a",
"data_in",
"structure",
"for",
"decoding",
".",
"Return",
"the",
"address",
"after",
"the",
"decoded",
"object",
"in",
"the",
"input",
"."
] | static const uint32_t *
lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data,
struct lto_in_decl_state *state)
{
uint32_t ix;
tree decl;
uint32_t i, j;
ix = *data++;
state->compressed = ix & 1;
ix /= 2;
decl = streamer_tree_cache_get_tree (data_in->reader_cache, ix);
if (!VAR_OR_FUNCTION_DECL_P (decl))
{
gcc_assert (decl == void_type_node);
decl = NULL_TREE;
}
state->fn_decl = decl;
for (i = 0; i < LTO_N_DECL_STREAMS; i++)
{
uint32_t size = *data++;
vec<tree, va_gc> *decls = NULL;
vec_alloc (decls, size);
for (j = 0; j < size; j++)
vec_safe_push (decls,
streamer_tree_cache_get_tree (data_in->reader_cache,
data[j]));
state->streams[i] = decls;
data += size;
}
return data;
} | [
"static",
"const",
"uint32_t",
"*",
"lto_read_in_decl_state",
"(",
"struct",
"data_in",
"*",
"data_in",
",",
"const",
"uint32_t",
"*",
"data",
",",
"struct",
"lto_in_decl_state",
"*",
"state",
")",
"{",
"uint32_t",
"ix",
";",
"tree",
"decl",
";",
"uint32_t",
"i",
",",
"j",
";",
"ix",
"=",
"*",
"data",
"++",
";",
"state",
"->",
"compressed",
"=",
"ix",
"&",
"1",
";",
"ix",
"/=",
"2",
";",
"decl",
"=",
"streamer_tree_cache_get_tree",
"(",
"data_in",
"->",
"reader_cache",
",",
"ix",
")",
";",
"if",
"(",
"!",
"VAR_OR_FUNCTION_DECL_P",
"(",
"decl",
")",
")",
"{",
"gcc_assert",
"(",
"decl",
"==",
"void_type_node",
")",
";",
"decl",
"=",
"NULL_TREE",
";",
"}",
"state",
"->",
"fn_decl",
"=",
"decl",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"LTO_N_DECL_STREAMS",
";",
"i",
"++",
")",
"{",
"uint32_t",
"size",
"=",
"*",
"data",
"++",
";",
"vec",
"<",
"tree",
",",
"va_gc",
">",
"*",
"decls",
"=",
"NULL",
";",
"vec_alloc",
"(",
"decls",
",",
"size",
")",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"size",
";",
"j",
"++",
")",
"vec_safe_push",
"(",
"decls",
",",
"streamer_tree_cache_get_tree",
"(",
"data_in",
"->",
"reader_cache",
",",
"data",
"[",
"j",
"]",
")",
")",
";",
"state",
"->",
"streams",
"[",
"i",
"]",
"=",
"decls",
";",
"data",
"+=",
"size",
";",
"}",
"return",
"data",
";",
"}"
] | Decode the content of memory pointed to by DATA in the in decl
state object STATE. | [
"Decode",
"the",
"content",
"of",
"memory",
"pointed",
"to",
"by",
"DATA",
"in",
"the",
"in",
"decl",
"state",
"object",
"STATE",
"."
] | [] | [
{
"param": "data_in",
"type": "struct data_in"
},
{
"param": "data",
"type": "uint32_t"
},
{
"param": "state",
"type": "struct lto_in_decl_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_in",
"type": "struct data_in",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "uint32_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "state",
"type": "struct lto_in_decl_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | gimple_canonical_type_hash | hashval_t | static hashval_t
gimple_canonical_type_hash (const void *p)
{
num_canonical_type_hash_queries++;
hashval_t *slot = canonical_type_hash_cache->get ((const_tree) p);
gcc_assert (slot != NULL);
return *slot;
} | /* Returns the hash for a canonical type P. */ | Returns the hash for a canonical type P. | [
"Returns",
"the",
"hash",
"for",
"a",
"canonical",
"type",
"P",
"."
] | static hashval_t
gimple_canonical_type_hash (const void *p)
{
num_canonical_type_hash_queries++;
hashval_t *slot = canonical_type_hash_cache->get ((const_tree) p);
gcc_assert (slot != NULL);
return *slot;
} | [
"static",
"hashval_t",
"gimple_canonical_type_hash",
"(",
"const",
"void",
"*",
"p",
")",
"{",
"num_canonical_type_hash_queries",
"++",
";",
"hashval_t",
"*",
"slot",
"=",
"canonical_type_hash_cache",
"->",
"get",
"(",
"(",
"const_tree",
")",
"p",
")",
";",
"gcc_assert",
"(",
"slot",
"!=",
"NULL",
")",
";",
"return",
"*",
"slot",
";",
"}"
] | Returns the hash for a canonical type P. | [
"Returns",
"the",
"hash",
"for",
"a",
"canonical",
"type",
"P",
"."
] | [] | [
{
"param": "p",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | gimple_canonical_type_eq | int | static int
gimple_canonical_type_eq (const void *p1, const void *p2)
{
const_tree t1 = (const_tree) p1;
const_tree t2 = (const_tree) p2;
return gimple_canonical_types_compatible_p (CONST_CAST_TREE (t1),
CONST_CAST_TREE (t2));
} | /* Returns nonzero if P1 and P2 are equal. */ | Returns nonzero if P1 and P2 are equal. | [
"Returns",
"nonzero",
"if",
"P1",
"and",
"P2",
"are",
"equal",
"."
] | static int
gimple_canonical_type_eq (const void *p1, const void *p2)
{
const_tree t1 = (const_tree) p1;
const_tree t2 = (const_tree) p2;
return gimple_canonical_types_compatible_p (CONST_CAST_TREE (t1),
CONST_CAST_TREE (t2));
} | [
"static",
"int",
"gimple_canonical_type_eq",
"(",
"const",
"void",
"*",
"p1",
",",
"const",
"void",
"*",
"p2",
")",
"{",
"const_tree",
"t1",
"=",
"(",
"const_tree",
")",
"p1",
";",
"const_tree",
"t2",
"=",
"(",
"const_tree",
")",
"p2",
";",
"return",
"gimple_canonical_types_compatible_p",
"(",
"CONST_CAST_TREE",
"(",
"t1",
")",
",",
"CONST_CAST_TREE",
"(",
"t2",
")",
")",
";",
"}"
] | Returns nonzero if P1 and P2 are equal. | [
"Returns",
"nonzero",
"if",
"P1",
"and",
"P2",
"are",
"equal",
"."
] | [] | [
{
"param": "p1",
"type": "void"
},
{
"param": "p2",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p1",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p2",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | gimple_register_canonical_type | void | static void
gimple_register_canonical_type (tree t)
{
if (TYPE_CANONICAL (t) || !type_with_alias_set_p (t)
|| !canonical_type_used_p (t))
return;
/* Canonical types are same among all complete variants. */
if (TYPE_CANONICAL (TYPE_MAIN_VARIANT (t)))
TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t));
else
{
gimple_register_canonical_type_1 (TYPE_MAIN_VARIANT (t),
hash_canonical_type (TYPE_MAIN_VARIANT (t)));
TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t));
}
} | /* Register type T in the global type table gimple_types and set
TYPE_CANONICAL of T accordingly.
This is used by LTO to merge structurally equivalent types for
type-based aliasing purposes across different TUs and languages.
??? This merging does not exactly match how the tree.c middle-end
functions will assign TYPE_CANONICAL when new types are created
during optimization (which at least happens for pointer and array
types). */ | Register type T in the global type table gimple_types and set
TYPE_CANONICAL of T accordingly.
This is used by LTO to merge structurally equivalent types for
type-based aliasing purposes across different TUs and languages.
| [
"Register",
"type",
"T",
"in",
"the",
"global",
"type",
"table",
"gimple_types",
"and",
"set",
"TYPE_CANONICAL",
"of",
"T",
"accordingly",
".",
"This",
"is",
"used",
"by",
"LTO",
"to",
"merge",
"structurally",
"equivalent",
"types",
"for",
"type",
"-",
"based",
"aliasing",
"purposes",
"across",
"different",
"TUs",
"and",
"languages",
"."
] | static void
gimple_register_canonical_type (tree t)
{
if (TYPE_CANONICAL (t) || !type_with_alias_set_p (t)
|| !canonical_type_used_p (t))
return;
if (TYPE_CANONICAL (TYPE_MAIN_VARIANT (t)))
TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t));
else
{
gimple_register_canonical_type_1 (TYPE_MAIN_VARIANT (t),
hash_canonical_type (TYPE_MAIN_VARIANT (t)));
TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t));
}
} | [
"static",
"void",
"gimple_register_canonical_type",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"TYPE_CANONICAL",
"(",
"t",
")",
"||",
"!",
"type_with_alias_set_p",
"(",
"t",
")",
"||",
"!",
"canonical_type_used_p",
"(",
"t",
")",
")",
"return",
";",
"if",
"(",
"TYPE_CANONICAL",
"(",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
")",
")",
"TYPE_CANONICAL",
"(",
"t",
")",
"=",
"TYPE_CANONICAL",
"(",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
")",
";",
"else",
"{",
"gimple_register_canonical_type_1",
"(",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
",",
"hash_canonical_type",
"(",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
")",
")",
";",
"TYPE_CANONICAL",
"(",
"t",
")",
"=",
"TYPE_CANONICAL",
"(",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
")",
";",
"}",
"}"
] | Register type T in the global type table gimple_types and set
TYPE_CANONICAL of T accordingly. | [
"Register",
"type",
"T",
"in",
"the",
"global",
"type",
"table",
"gimple_types",
"and",
"set",
"TYPE_CANONICAL",
"of",
"T",
"accordingly",
"."
] | [
"/* Canonical types are same among all complete variants. */"
] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_register_canonical_types | void | static void
lto_register_canonical_types (tree node, bool first_p)
{
if (!node
|| !TYPE_P (node))
return;
if (first_p)
TYPE_CANONICAL (node) = NULL_TREE;
if (POINTER_TYPE_P (node)
|| TREE_CODE (node) == COMPLEX_TYPE
|| TREE_CODE (node) == ARRAY_TYPE)
lto_register_canonical_types (TREE_TYPE (node), first_p);
if (!first_p)
gimple_register_canonical_type (node);
} | /* Re-compute TYPE_CANONICAL for NODE and related types. */ | Re-compute TYPE_CANONICAL for NODE and related types. | [
"Re",
"-",
"compute",
"TYPE_CANONICAL",
"for",
"NODE",
"and",
"related",
"types",
"."
] | static void
lto_register_canonical_types (tree node, bool first_p)
{
if (!node
|| !TYPE_P (node))
return;
if (first_p)
TYPE_CANONICAL (node) = NULL_TREE;
if (POINTER_TYPE_P (node)
|| TREE_CODE (node) == COMPLEX_TYPE
|| TREE_CODE (node) == ARRAY_TYPE)
lto_register_canonical_types (TREE_TYPE (node), first_p);
if (!first_p)
gimple_register_canonical_type (node);
} | [
"static",
"void",
"lto_register_canonical_types",
"(",
"tree",
"node",
",",
"bool",
"first_p",
")",
"{",
"if",
"(",
"!",
"node",
"||",
"!",
"TYPE_P",
"(",
"node",
")",
")",
"return",
";",
"if",
"(",
"first_p",
")",
"TYPE_CANONICAL",
"(",
"node",
")",
"=",
"NULL_TREE",
";",
"if",
"(",
"POINTER_TYPE_P",
"(",
"node",
")",
"||",
"TREE_CODE",
"(",
"node",
")",
"==",
"COMPLEX_TYPE",
"||",
"TREE_CODE",
"(",
"node",
")",
"==",
"ARRAY_TYPE",
")",
"lto_register_canonical_types",
"(",
"TREE_TYPE",
"(",
"node",
")",
",",
"first_p",
")",
";",
"if",
"(",
"!",
"first_p",
")",
"gimple_register_canonical_type",
"(",
"node",
")",
";",
"}"
] | Re-compute TYPE_CANONICAL for NODE and related types. | [
"Re",
"-",
"compute",
"TYPE_CANONICAL",
"for",
"NODE",
"and",
"related",
"types",
"."
] | [] | [
{
"param": "node",
"type": "tree"
},
{
"param": "first_p",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "node",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "first_p",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_typed | bool | static inline bool
mentions_vars_p_typed (tree t)
{
CHECK_NO_VAR (TREE_TYPE (t));
return false;
} | /* Check presence of pointers to decls in fields of a tree_typed T. */ | Check presence of pointers to decls in fields of a tree_typed T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"tree_typed",
"T",
"."
] | static inline bool
mentions_vars_p_typed (tree t)
{
CHECK_NO_VAR (TREE_TYPE (t));
return false;
} | [
"static",
"inline",
"bool",
"mentions_vars_p_typed",
"(",
"tree",
"t",
")",
"{",
"CHECK_NO_VAR",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a tree_typed T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"tree_typed",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_common | bool | static inline bool
mentions_vars_p_common (tree t)
{
if (mentions_vars_p_typed (t))
return true;
CHECK_NO_VAR (TREE_CHAIN (t));
return false;
} | /* Check presence of pointers to decls in fields of a tree_common T. */ | Check presence of pointers to decls in fields of a tree_common T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"tree_common",
"T",
"."
] | static inline bool
mentions_vars_p_common (tree t)
{
if (mentions_vars_p_typed (t))
return true;
CHECK_NO_VAR (TREE_CHAIN (t));
return false;
} | [
"static",
"inline",
"bool",
"mentions_vars_p_common",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"mentions_vars_p_typed",
"(",
"t",
")",
")",
"return",
"true",
";",
"CHECK_NO_VAR",
"(",
"TREE_CHAIN",
"(",
"t",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a tree_common T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"tree_common",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_decl_minimal | bool | static inline bool
mentions_vars_p_decl_minimal (tree t)
{
if (mentions_vars_p_common (t))
return true;
CHECK_NO_VAR (DECL_NAME (t));
CHECK_VAR (DECL_CONTEXT (t));
return false;
} | /* Check presence of pointers to decls in fields of a decl_minimal T. */ | Check presence of pointers to decls in fields of a decl_minimal T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_minimal",
"T",
"."
] | static inline bool
mentions_vars_p_decl_minimal (tree t)
{
if (mentions_vars_p_common (t))
return true;
CHECK_NO_VAR (DECL_NAME (t));
CHECK_VAR (DECL_CONTEXT (t));
return false;
} | [
"static",
"inline",
"bool",
"mentions_vars_p_decl_minimal",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"mentions_vars_p_common",
"(",
"t",
")",
")",
"return",
"true",
";",
"CHECK_NO_VAR",
"(",
"DECL_NAME",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"DECL_CONTEXT",
"(",
"t",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a decl_minimal T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_minimal",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_decl_common | bool | static inline bool
mentions_vars_p_decl_common (tree t)
{
if (mentions_vars_p_decl_minimal (t))
return true;
CHECK_VAR (DECL_SIZE (t));
CHECK_VAR (DECL_SIZE_UNIT (t));
CHECK_VAR (DECL_INITIAL (t));
CHECK_NO_VAR (DECL_ATTRIBUTES (t));
CHECK_VAR (DECL_ABSTRACT_ORIGIN (t));
return false;
} | /* Check presence of pointers to decls in fields of a decl_common T. */ | Check presence of pointers to decls in fields of a decl_common T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_common",
"T",
"."
] | static inline bool
mentions_vars_p_decl_common (tree t)
{
if (mentions_vars_p_decl_minimal (t))
return true;
CHECK_VAR (DECL_SIZE (t));
CHECK_VAR (DECL_SIZE_UNIT (t));
CHECK_VAR (DECL_INITIAL (t));
CHECK_NO_VAR (DECL_ATTRIBUTES (t));
CHECK_VAR (DECL_ABSTRACT_ORIGIN (t));
return false;
} | [
"static",
"inline",
"bool",
"mentions_vars_p_decl_common",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"mentions_vars_p_decl_minimal",
"(",
"t",
")",
")",
"return",
"true",
";",
"CHECK_VAR",
"(",
"DECL_SIZE",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"DECL_SIZE_UNIT",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"DECL_INITIAL",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"DECL_ATTRIBUTES",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"DECL_ABSTRACT_ORIGIN",
"(",
"t",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a decl_common T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_common",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_decl_with_vis | bool | static inline bool
mentions_vars_p_decl_with_vis (tree t)
{
if (mentions_vars_p_decl_common (t))
return true;
/* Accessor macro has side-effects, use field-name here. */
CHECK_NO_VAR (DECL_ASSEMBLER_NAME_RAW (t));
return false;
} | /* Check presence of pointers to decls in fields of a decl_with_vis T. */ | Check presence of pointers to decls in fields of a decl_with_vis T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_with_vis",
"T",
"."
] | static inline bool
mentions_vars_p_decl_with_vis (tree t)
{
if (mentions_vars_p_decl_common (t))
return true;
CHECK_NO_VAR (DECL_ASSEMBLER_NAME_RAW (t));
return false;
} | [
"static",
"inline",
"bool",
"mentions_vars_p_decl_with_vis",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"mentions_vars_p_decl_common",
"(",
"t",
")",
")",
"return",
"true",
";",
"CHECK_NO_VAR",
"(",
"DECL_ASSEMBLER_NAME_RAW",
"(",
"t",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a decl_with_vis T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_with_vis",
"T",
"."
] | [
"/* Accessor macro has side-effects, use field-name here. */"
] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_decl_non_common | bool | static inline bool
mentions_vars_p_decl_non_common (tree t)
{
if (mentions_vars_p_decl_with_vis (t))
return true;
CHECK_NO_VAR (DECL_RESULT_FLD (t));
return false;
} | /* Check presence of pointers to decls in fields of a decl_non_common T. */ | Check presence of pointers to decls in fields of a decl_non_common T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_non_common",
"T",
"."
] | static inline bool
mentions_vars_p_decl_non_common (tree t)
{
if (mentions_vars_p_decl_with_vis (t))
return true;
CHECK_NO_VAR (DECL_RESULT_FLD (t));
return false;
} | [
"static",
"inline",
"bool",
"mentions_vars_p_decl_non_common",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"mentions_vars_p_decl_with_vis",
"(",
"t",
")",
")",
"return",
"true",
";",
"CHECK_NO_VAR",
"(",
"DECL_RESULT_FLD",
"(",
"t",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a decl_non_common T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_non_common",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_function | bool | static bool
mentions_vars_p_function (tree t)
{
if (mentions_vars_p_decl_non_common (t))
return true;
CHECK_NO_VAR (DECL_ARGUMENTS (t));
CHECK_NO_VAR (DECL_VINDEX (t));
CHECK_VAR (DECL_FUNCTION_PERSONALITY (t));
return false;
} | /* Check presence of pointers to decls in fields of a decl_non_common T. */ | Check presence of pointers to decls in fields of a decl_non_common T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_non_common",
"T",
"."
] | static bool
mentions_vars_p_function (tree t)
{
if (mentions_vars_p_decl_non_common (t))
return true;
CHECK_NO_VAR (DECL_ARGUMENTS (t));
CHECK_NO_VAR (DECL_VINDEX (t));
CHECK_VAR (DECL_FUNCTION_PERSONALITY (t));
return false;
} | [
"static",
"bool",
"mentions_vars_p_function",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"mentions_vars_p_decl_non_common",
"(",
"t",
")",
")",
"return",
"true",
";",
"CHECK_NO_VAR",
"(",
"DECL_ARGUMENTS",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"DECL_VINDEX",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"DECL_FUNCTION_PERSONALITY",
"(",
"t",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a decl_non_common T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"decl_non_common",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_field_decl | bool | static bool
mentions_vars_p_field_decl (tree t)
{
if (mentions_vars_p_decl_common (t))
return true;
CHECK_VAR (DECL_FIELD_OFFSET (t));
CHECK_NO_VAR (DECL_BIT_FIELD_TYPE (t));
CHECK_NO_VAR (DECL_QUALIFIER (t));
CHECK_NO_VAR (DECL_FIELD_BIT_OFFSET (t));
CHECK_NO_VAR (DECL_FCONTEXT (t));
return false;
} | /* Check presence of pointers to decls in fields of a field_decl T. */ | Check presence of pointers to decls in fields of a field_decl T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"field_decl",
"T",
"."
] | static bool
mentions_vars_p_field_decl (tree t)
{
if (mentions_vars_p_decl_common (t))
return true;
CHECK_VAR (DECL_FIELD_OFFSET (t));
CHECK_NO_VAR (DECL_BIT_FIELD_TYPE (t));
CHECK_NO_VAR (DECL_QUALIFIER (t));
CHECK_NO_VAR (DECL_FIELD_BIT_OFFSET (t));
CHECK_NO_VAR (DECL_FCONTEXT (t));
return false;
} | [
"static",
"bool",
"mentions_vars_p_field_decl",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"mentions_vars_p_decl_common",
"(",
"t",
")",
")",
"return",
"true",
";",
"CHECK_VAR",
"(",
"DECL_FIELD_OFFSET",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"DECL_BIT_FIELD_TYPE",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"DECL_QUALIFIER",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"DECL_FIELD_BIT_OFFSET",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"DECL_FCONTEXT",
"(",
"t",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a field_decl T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"field_decl",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_type | bool | static bool
mentions_vars_p_type (tree t)
{
if (mentions_vars_p_common (t))
return true;
CHECK_NO_VAR (TYPE_CACHED_VALUES (t));
CHECK_VAR (TYPE_SIZE (t));
CHECK_VAR (TYPE_SIZE_UNIT (t));
CHECK_NO_VAR (TYPE_ATTRIBUTES (t));
CHECK_NO_VAR (TYPE_NAME (t));
CHECK_VAR (TYPE_MIN_VALUE_RAW (t));
CHECK_VAR (TYPE_MAX_VALUE_RAW (t));
/* Accessor is for derived node types only. */
CHECK_NO_VAR (TYPE_LANG_SLOT_1 (t));
CHECK_VAR (TYPE_CONTEXT (t));
CHECK_NO_VAR (TYPE_CANONICAL (t));
CHECK_NO_VAR (TYPE_MAIN_VARIANT (t));
CHECK_NO_VAR (TYPE_NEXT_VARIANT (t));
return false;
} | /* Check presence of pointers to decls in fields of a type T. */ | Check presence of pointers to decls in fields of a type T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"type",
"T",
"."
] | static bool
mentions_vars_p_type (tree t)
{
if (mentions_vars_p_common (t))
return true;
CHECK_NO_VAR (TYPE_CACHED_VALUES (t));
CHECK_VAR (TYPE_SIZE (t));
CHECK_VAR (TYPE_SIZE_UNIT (t));
CHECK_NO_VAR (TYPE_ATTRIBUTES (t));
CHECK_NO_VAR (TYPE_NAME (t));
CHECK_VAR (TYPE_MIN_VALUE_RAW (t));
CHECK_VAR (TYPE_MAX_VALUE_RAW (t));
CHECK_NO_VAR (TYPE_LANG_SLOT_1 (t));
CHECK_VAR (TYPE_CONTEXT (t));
CHECK_NO_VAR (TYPE_CANONICAL (t));
CHECK_NO_VAR (TYPE_MAIN_VARIANT (t));
CHECK_NO_VAR (TYPE_NEXT_VARIANT (t));
return false;
} | [
"static",
"bool",
"mentions_vars_p_type",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"mentions_vars_p_common",
"(",
"t",
")",
")",
"return",
"true",
";",
"CHECK_NO_VAR",
"(",
"TYPE_CACHED_VALUES",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"TYPE_SIZE",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"TYPE_SIZE_UNIT",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"TYPE_ATTRIBUTES",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"TYPE_NAME",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"TYPE_MIN_VALUE_RAW",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"TYPE_MAX_VALUE_RAW",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"TYPE_LANG_SLOT_1",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"TYPE_CONTEXT",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"TYPE_CANONICAL",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"TYPE_NEXT_VARIANT",
"(",
"t",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a type T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"type",
"T",
"."
] | [
"/* Accessor is for derived node types only. */"
] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_binfo | bool | static bool
mentions_vars_p_binfo (tree t)
{
unsigned HOST_WIDE_INT i, n;
if (mentions_vars_p_common (t))
return true;
CHECK_VAR (BINFO_VTABLE (t));
CHECK_NO_VAR (BINFO_OFFSET (t));
CHECK_NO_VAR (BINFO_VIRTUALS (t));
CHECK_NO_VAR (BINFO_VPTR_FIELD (t));
n = vec_safe_length (BINFO_BASE_ACCESSES (t));
for (i = 0; i < n; i++)
CHECK_NO_VAR (BINFO_BASE_ACCESS (t, i));
/* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
and BINFO_VPTR_INDEX; these are used by C++ FE only. */
n = BINFO_N_BASE_BINFOS (t);
for (i = 0; i < n; i++)
CHECK_NO_VAR (BINFO_BASE_BINFO (t, i));
return false;
} | /* Check presence of pointers to decls in fields of a BINFO T. */ | Check presence of pointers to decls in fields of a BINFO T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"BINFO",
"T",
"."
] | static bool
mentions_vars_p_binfo (tree t)
{
unsigned HOST_WIDE_INT i, n;
if (mentions_vars_p_common (t))
return true;
CHECK_VAR (BINFO_VTABLE (t));
CHECK_NO_VAR (BINFO_OFFSET (t));
CHECK_NO_VAR (BINFO_VIRTUALS (t));
CHECK_NO_VAR (BINFO_VPTR_FIELD (t));
n = vec_safe_length (BINFO_BASE_ACCESSES (t));
for (i = 0; i < n; i++)
CHECK_NO_VAR (BINFO_BASE_ACCESS (t, i));
n = BINFO_N_BASE_BINFOS (t);
for (i = 0; i < n; i++)
CHECK_NO_VAR (BINFO_BASE_BINFO (t, i));
return false;
} | [
"static",
"bool",
"mentions_vars_p_binfo",
"(",
"tree",
"t",
")",
"{",
"unsigned",
"HOST_WIDE_INT",
"i",
",",
"n",
";",
"if",
"(",
"mentions_vars_p_common",
"(",
"t",
")",
")",
"return",
"true",
";",
"CHECK_VAR",
"(",
"BINFO_VTABLE",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"BINFO_OFFSET",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"BINFO_VIRTUALS",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"BINFO_VPTR_FIELD",
"(",
"t",
")",
")",
";",
"n",
"=",
"vec_safe_length",
"(",
"BINFO_BASE_ACCESSES",
"(",
"t",
")",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"CHECK_NO_VAR",
"(",
"BINFO_BASE_ACCESS",
"(",
"t",
",",
"i",
")",
")",
";",
"n",
"=",
"BINFO_N_BASE_BINFOS",
"(",
"t",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"CHECK_NO_VAR",
"(",
"BINFO_BASE_BINFO",
"(",
"t",
",",
"i",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of a BINFO T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"a",
"BINFO",
"T",
"."
] | [
"/* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX\n and BINFO_VPTR_INDEX; these are used by C++ FE only. */"
] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_expr | bool | static bool
mentions_vars_p_expr (tree t)
{
int i;
if (mentions_vars_p_typed (t))
return true;
for (i = TREE_OPERAND_LENGTH (t) - 1; i >= 0; --i)
CHECK_VAR (TREE_OPERAND (t, i));
return false;
} | /* Check presence of pointers to decls in fields of an expression tree T. */ | Check presence of pointers to decls in fields of an expression tree T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"an",
"expression",
"tree",
"T",
"."
] | static bool
mentions_vars_p_expr (tree t)
{
int i;
if (mentions_vars_p_typed (t))
return true;
for (i = TREE_OPERAND_LENGTH (t) - 1; i >= 0; --i)
CHECK_VAR (TREE_OPERAND (t, i));
return false;
} | [
"static",
"bool",
"mentions_vars_p_expr",
"(",
"tree",
"t",
")",
"{",
"int",
"i",
";",
"if",
"(",
"mentions_vars_p_typed",
"(",
"t",
")",
")",
"return",
"true",
";",
"for",
"(",
"i",
"=",
"TREE_OPERAND_LENGTH",
"(",
"t",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"CHECK_VAR",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"i",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of an expression tree T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"an",
"expression",
"tree",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p_omp_clause | bool | static bool
mentions_vars_p_omp_clause (tree t)
{
int i;
if (mentions_vars_p_common (t))
return true;
for (i = omp_clause_num_ops[OMP_CLAUSE_CODE (t)] - 1; i >= 0; --i)
CHECK_VAR (OMP_CLAUSE_OPERAND (t, i));
return false;
} | /* Check presence of pointers to decls in fields of an OMP_CLAUSE T. */ | Check presence of pointers to decls in fields of an OMP_CLAUSE T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"an",
"OMP_CLAUSE",
"T",
"."
] | static bool
mentions_vars_p_omp_clause (tree t)
{
int i;
if (mentions_vars_p_common (t))
return true;
for (i = omp_clause_num_ops[OMP_CLAUSE_CODE (t)] - 1; i >= 0; --i)
CHECK_VAR (OMP_CLAUSE_OPERAND (t, i));
return false;
} | [
"static",
"bool",
"mentions_vars_p_omp_clause",
"(",
"tree",
"t",
")",
"{",
"int",
"i",
";",
"if",
"(",
"mentions_vars_p_common",
"(",
"t",
")",
")",
"return",
"true",
";",
"for",
"(",
"i",
"=",
"omp_clause_num_ops",
"[",
"OMP_CLAUSE_CODE",
"(",
"t",
")",
"]",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"CHECK_VAR",
"(",
"OMP_CLAUSE_OPERAND",
"(",
"t",
",",
"i",
")",
")",
";",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls in fields of an OMP_CLAUSE T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"in",
"fields",
"of",
"an",
"OMP_CLAUSE",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | mentions_vars_p | bool | static bool
mentions_vars_p (tree t)
{
switch (TREE_CODE (t))
{
case IDENTIFIER_NODE:
break;
case TREE_LIST:
CHECK_VAR (TREE_VALUE (t));
CHECK_VAR (TREE_PURPOSE (t));
CHECK_NO_VAR (TREE_CHAIN (t));
break;
case FIELD_DECL:
return mentions_vars_p_field_decl (t);
case LABEL_DECL:
case CONST_DECL:
case PARM_DECL:
case RESULT_DECL:
case IMPORTED_DECL:
case NAMESPACE_DECL:
case NAMELIST_DECL:
return mentions_vars_p_decl_common (t);
case VAR_DECL:
return mentions_vars_p_decl_with_vis (t);
case TYPE_DECL:
return mentions_vars_p_decl_non_common (t);
case FUNCTION_DECL:
return mentions_vars_p_function (t);
case TREE_BINFO:
return mentions_vars_p_binfo (t);
case PLACEHOLDER_EXPR:
return mentions_vars_p_common (t);
case BLOCK:
case TRANSLATION_UNIT_DECL:
case OPTIMIZATION_NODE:
case TARGET_OPTION_NODE:
break;
case CONSTRUCTOR:
return mentions_vars_p_constructor (t);
case OMP_CLAUSE:
return mentions_vars_p_omp_clause (t);
default:
if (TYPE_P (t))
{
if (mentions_vars_p_type (t))
return true;
}
else if (EXPR_P (t))
{
if (mentions_vars_p_expr (t))
return true;
}
else if (CONSTANT_CLASS_P (t))
CHECK_NO_VAR (TREE_TYPE (t));
else
gcc_unreachable ();
}
return false;
} | /* Check presence of pointers to decls that needs later fixup in T. */ | Check presence of pointers to decls that needs later fixup in T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"that",
"needs",
"later",
"fixup",
"in",
"T",
"."
] | static bool
mentions_vars_p (tree t)
{
switch (TREE_CODE (t))
{
case IDENTIFIER_NODE:
break;
case TREE_LIST:
CHECK_VAR (TREE_VALUE (t));
CHECK_VAR (TREE_PURPOSE (t));
CHECK_NO_VAR (TREE_CHAIN (t));
break;
case FIELD_DECL:
return mentions_vars_p_field_decl (t);
case LABEL_DECL:
case CONST_DECL:
case PARM_DECL:
case RESULT_DECL:
case IMPORTED_DECL:
case NAMESPACE_DECL:
case NAMELIST_DECL:
return mentions_vars_p_decl_common (t);
case VAR_DECL:
return mentions_vars_p_decl_with_vis (t);
case TYPE_DECL:
return mentions_vars_p_decl_non_common (t);
case FUNCTION_DECL:
return mentions_vars_p_function (t);
case TREE_BINFO:
return mentions_vars_p_binfo (t);
case PLACEHOLDER_EXPR:
return mentions_vars_p_common (t);
case BLOCK:
case TRANSLATION_UNIT_DECL:
case OPTIMIZATION_NODE:
case TARGET_OPTION_NODE:
break;
case CONSTRUCTOR:
return mentions_vars_p_constructor (t);
case OMP_CLAUSE:
return mentions_vars_p_omp_clause (t);
default:
if (TYPE_P (t))
{
if (mentions_vars_p_type (t))
return true;
}
else if (EXPR_P (t))
{
if (mentions_vars_p_expr (t))
return true;
}
else if (CONSTANT_CLASS_P (t))
CHECK_NO_VAR (TREE_TYPE (t));
else
gcc_unreachable ();
}
return false;
} | [
"static",
"bool",
"mentions_vars_p",
"(",
"tree",
"t",
")",
"{",
"switch",
"(",
"TREE_CODE",
"(",
"t",
")",
")",
"{",
"case",
"IDENTIFIER_NODE",
":",
"break",
";",
"case",
"TREE_LIST",
":",
"CHECK_VAR",
"(",
"TREE_VALUE",
"(",
"t",
")",
")",
";",
"CHECK_VAR",
"(",
"TREE_PURPOSE",
"(",
"t",
")",
")",
";",
"CHECK_NO_VAR",
"(",
"TREE_CHAIN",
"(",
"t",
")",
")",
";",
"break",
";",
"case",
"FIELD_DECL",
":",
"return",
"mentions_vars_p_field_decl",
"(",
"t",
")",
";",
"case",
"LABEL_DECL",
":",
"case",
"CONST_DECL",
":",
"case",
"PARM_DECL",
":",
"case",
"RESULT_DECL",
":",
"case",
"IMPORTED_DECL",
":",
"case",
"NAMESPACE_DECL",
":",
"case",
"NAMELIST_DECL",
":",
"return",
"mentions_vars_p_decl_common",
"(",
"t",
")",
";",
"case",
"VAR_DECL",
":",
"return",
"mentions_vars_p_decl_with_vis",
"(",
"t",
")",
";",
"case",
"TYPE_DECL",
":",
"return",
"mentions_vars_p_decl_non_common",
"(",
"t",
")",
";",
"case",
"FUNCTION_DECL",
":",
"return",
"mentions_vars_p_function",
"(",
"t",
")",
";",
"case",
"TREE_BINFO",
":",
"return",
"mentions_vars_p_binfo",
"(",
"t",
")",
";",
"case",
"PLACEHOLDER_EXPR",
":",
"return",
"mentions_vars_p_common",
"(",
"t",
")",
";",
"case",
"BLOCK",
":",
"case",
"TRANSLATION_UNIT_DECL",
":",
"case",
"OPTIMIZATION_NODE",
":",
"case",
"TARGET_OPTION_NODE",
":",
"break",
";",
"case",
"CONSTRUCTOR",
":",
"return",
"mentions_vars_p_constructor",
"(",
"t",
")",
";",
"case",
"OMP_CLAUSE",
":",
"return",
"mentions_vars_p_omp_clause",
"(",
"t",
")",
";",
"default",
":",
"if",
"(",
"TYPE_P",
"(",
"t",
")",
")",
"{",
"if",
"(",
"mentions_vars_p_type",
"(",
"t",
")",
")",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"EXPR_P",
"(",
"t",
")",
")",
"{",
"if",
"(",
"mentions_vars_p_expr",
"(",
"t",
")",
")",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"CONSTANT_CLASS_P",
"(",
"t",
")",
")",
"CHECK_NO_VAR",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
";",
"else",
"gcc_unreachable",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Check presence of pointers to decls that needs later fixup in T. | [
"Check",
"presence",
"of",
"pointers",
"to",
"decls",
"that",
"needs",
"later",
"fixup",
"in",
"T",
"."
] | [] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_register_var_decl_in_symtab | void | static void
lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl,
unsigned ix)
{
tree context;
/* Variable has file scope, not local. */
if (!TREE_PUBLIC (decl)
&& !((context = decl_function_context (decl))
&& auto_var_in_fn_p (decl, context)))
rest_of_decl_compilation (decl, 1, 0);
/* If this variable has already been declared, queue the
declaration for merging. */
if (TREE_PUBLIC (decl))
register_resolution (data_in->file_data,
decl, get_resolution (data_in, ix));
} | /* Register DECL with the global symbol table and change its
name if necessary to avoid name clashes for static globals across
different files. */ | Register DECL with the global symbol table and change its
name if necessary to avoid name clashes for static globals across
different files. | [
"Register",
"DECL",
"with",
"the",
"global",
"symbol",
"table",
"and",
"change",
"its",
"name",
"if",
"necessary",
"to",
"avoid",
"name",
"clashes",
"for",
"static",
"globals",
"across",
"different",
"files",
"."
] | static void
lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl,
unsigned ix)
{
tree context;
if (!TREE_PUBLIC (decl)
&& !((context = decl_function_context (decl))
&& auto_var_in_fn_p (decl, context)))
rest_of_decl_compilation (decl, 1, 0);
if (TREE_PUBLIC (decl))
register_resolution (data_in->file_data,
decl, get_resolution (data_in, ix));
} | [
"static",
"void",
"lto_register_var_decl_in_symtab",
"(",
"struct",
"data_in",
"*",
"data_in",
",",
"tree",
"decl",
",",
"unsigned",
"ix",
")",
"{",
"tree",
"context",
";",
"if",
"(",
"!",
"TREE_PUBLIC",
"(",
"decl",
")",
"&&",
"!",
"(",
"(",
"context",
"=",
"decl_function_context",
"(",
"decl",
")",
")",
"&&",
"auto_var_in_fn_p",
"(",
"decl",
",",
"context",
")",
")",
")",
"rest_of_decl_compilation",
"(",
"decl",
",",
"1",
",",
"0",
")",
";",
"if",
"(",
"TREE_PUBLIC",
"(",
"decl",
")",
")",
"register_resolution",
"(",
"data_in",
"->",
"file_data",
",",
"decl",
",",
"get_resolution",
"(",
"data_in",
",",
"ix",
")",
")",
";",
"}"
] | Register DECL with the global symbol table and change its
name if necessary to avoid name clashes for static globals across
different files. | [
"Register",
"DECL",
"with",
"the",
"global",
"symbol",
"table",
"and",
"change",
"its",
"name",
"if",
"necessary",
"to",
"avoid",
"name",
"clashes",
"for",
"static",
"globals",
"across",
"different",
"files",
"."
] | [
"/* Variable has file scope, not local. */",
"/* If this variable has already been declared, queue the\n declaration for merging. */"
] | [
{
"param": "data_in",
"type": "struct data_in"
},
{
"param": "decl",
"type": "tree"
},
{
"param": "ix",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_in",
"type": "struct data_in",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "decl",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ix",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_register_function_decl_in_symtab | void | static void
lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl,
unsigned ix)
{
/* If this variable has already been declared, queue the
declaration for merging. */
if (TREE_PUBLIC (decl) && !DECL_ABSTRACT_P (decl))
register_resolution (data_in->file_data,
decl, get_resolution (data_in, ix));
} | /* Register DECL with the global symbol table and change its
name if necessary to avoid name clashes for static globals across
different files. DATA_IN contains descriptors and tables for the
file being read. */ | Register DECL with the global symbol table and change its
name if necessary to avoid name clashes for static globals across
different files. DATA_IN contains descriptors and tables for the
file being read. | [
"Register",
"DECL",
"with",
"the",
"global",
"symbol",
"table",
"and",
"change",
"its",
"name",
"if",
"necessary",
"to",
"avoid",
"name",
"clashes",
"for",
"static",
"globals",
"across",
"different",
"files",
".",
"DATA_IN",
"contains",
"descriptors",
"and",
"tables",
"for",
"the",
"file",
"being",
"read",
"."
] | static void
lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl,
unsigned ix)
{
if (TREE_PUBLIC (decl) && !DECL_ABSTRACT_P (decl))
register_resolution (data_in->file_data,
decl, get_resolution (data_in, ix));
} | [
"static",
"void",
"lto_register_function_decl_in_symtab",
"(",
"struct",
"data_in",
"*",
"data_in",
",",
"tree",
"decl",
",",
"unsigned",
"ix",
")",
"{",
"if",
"(",
"TREE_PUBLIC",
"(",
"decl",
")",
"&&",
"!",
"DECL_ABSTRACT_P",
"(",
"decl",
")",
")",
"register_resolution",
"(",
"data_in",
"->",
"file_data",
",",
"decl",
",",
"get_resolution",
"(",
"data_in",
",",
"ix",
")",
")",
";",
"}"
] | Register DECL with the global symbol table and change its
name if necessary to avoid name clashes for static globals across
different files. | [
"Register",
"DECL",
"with",
"the",
"global",
"symbol",
"table",
"and",
"change",
"its",
"name",
"if",
"necessary",
"to",
"avoid",
"name",
"clashes",
"for",
"static",
"globals",
"across",
"different",
"files",
"."
] | [
"/* If this variable has already been declared, queue the\n declaration for merging. */"
] | [
{
"param": "data_in",
"type": "struct data_in"
},
{
"param": "decl",
"type": "tree"
},
{
"param": "ix",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_in",
"type": "struct data_in",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "decl",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ix",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_maybe_register_decl | void | static void
lto_maybe_register_decl (struct data_in *data_in, tree t, unsigned ix)
{
if (TREE_CODE (t) == VAR_DECL)
lto_register_var_decl_in_symtab (data_in, t, ix);
else if (TREE_CODE (t) == FUNCTION_DECL
&& !DECL_BUILT_IN (t))
lto_register_function_decl_in_symtab (data_in, t, ix);
} | /* Check if T is a decl and needs register its resolution info. */ | Check if T is a decl and needs register its resolution info. | [
"Check",
"if",
"T",
"is",
"a",
"decl",
"and",
"needs",
"register",
"its",
"resolution",
"info",
"."
] | static void
lto_maybe_register_decl (struct data_in *data_in, tree t, unsigned ix)
{
if (TREE_CODE (t) == VAR_DECL)
lto_register_var_decl_in_symtab (data_in, t, ix);
else if (TREE_CODE (t) == FUNCTION_DECL
&& !DECL_BUILT_IN (t))
lto_register_function_decl_in_symtab (data_in, t, ix);
} | [
"static",
"void",
"lto_maybe_register_decl",
"(",
"struct",
"data_in",
"*",
"data_in",
",",
"tree",
"t",
",",
"unsigned",
"ix",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"VAR_DECL",
")",
"lto_register_var_decl_in_symtab",
"(",
"data_in",
",",
"t",
",",
"ix",
")",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"FUNCTION_DECL",
"&&",
"!",
"DECL_BUILT_IN",
"(",
"t",
")",
")",
"lto_register_function_decl_in_symtab",
"(",
"data_in",
",",
"t",
",",
"ix",
")",
";",
"}"
] | Check if T is a decl and needs register its resolution info. | [
"Check",
"if",
"T",
"is",
"a",
"decl",
"and",
"needs",
"register",
"its",
"resolution",
"info",
"."
] | [] | [
{
"param": "data_in",
"type": "struct data_in"
},
{
"param": "t",
"type": "tree"
},
{
"param": "ix",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_in",
"type": "struct data_in",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ix",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_fixup_prevailing_type | void | static void
lto_fixup_prevailing_type (tree t)
{
/* The following re-creates proper variant lists while fixing up
the variant leaders. We do not stream TYPE_NEXT_VARIANT so the
variant list state before fixup is broken. */
/* If we are not our own variant leader link us into our new leaders
variant list. */
if (TYPE_MAIN_VARIANT (t) != t)
{
tree mv = TYPE_MAIN_VARIANT (t);
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (mv);
TYPE_NEXT_VARIANT (mv) = t;
}
/* The following reconstructs the pointer chains
of the new pointed-to type if we are a main variant. We do
not stream those so they are broken before fixup. */
if (TREE_CODE (t) == POINTER_TYPE
&& TYPE_MAIN_VARIANT (t) == t)
{
TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (TREE_TYPE (t));
TYPE_POINTER_TO (TREE_TYPE (t)) = t;
}
else if (TREE_CODE (t) == REFERENCE_TYPE
&& TYPE_MAIN_VARIANT (t) == t)
{
TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (TREE_TYPE (t));
TYPE_REFERENCE_TO (TREE_TYPE (t)) = t;
}
} | /* For the type T re-materialize it in the type variant list and
the pointer/reference-to chains. */ | For the type T re-materialize it in the type variant list and
the pointer/reference-to chains. | [
"For",
"the",
"type",
"T",
"re",
"-",
"materialize",
"it",
"in",
"the",
"type",
"variant",
"list",
"and",
"the",
"pointer",
"/",
"reference",
"-",
"to",
"chains",
"."
] | static void
lto_fixup_prevailing_type (tree t)
{
if (TYPE_MAIN_VARIANT (t) != t)
{
tree mv = TYPE_MAIN_VARIANT (t);
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (mv);
TYPE_NEXT_VARIANT (mv) = t;
}
if (TREE_CODE (t) == POINTER_TYPE
&& TYPE_MAIN_VARIANT (t) == t)
{
TYPE_NEXT_PTR_TO (t) = TYPE_POINTER_TO (TREE_TYPE (t));
TYPE_POINTER_TO (TREE_TYPE (t)) = t;
}
else if (TREE_CODE (t) == REFERENCE_TYPE
&& TYPE_MAIN_VARIANT (t) == t)
{
TYPE_NEXT_REF_TO (t) = TYPE_REFERENCE_TO (TREE_TYPE (t));
TYPE_REFERENCE_TO (TREE_TYPE (t)) = t;
}
} | [
"static",
"void",
"lto_fixup_prevailing_type",
"(",
"tree",
"t",
")",
"{",
"if",
"(",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
"!=",
"t",
")",
"{",
"tree",
"mv",
"=",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
";",
"TYPE_NEXT_VARIANT",
"(",
"t",
")",
"=",
"TYPE_NEXT_VARIANT",
"(",
"mv",
")",
";",
"TYPE_NEXT_VARIANT",
"(",
"mv",
")",
"=",
"t",
";",
"}",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"POINTER_TYPE",
"&&",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
"==",
"t",
")",
"{",
"TYPE_NEXT_PTR_TO",
"(",
"t",
")",
"=",
"TYPE_POINTER_TO",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
";",
"TYPE_POINTER_TO",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
"=",
"t",
";",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"REFERENCE_TYPE",
"&&",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
"==",
"t",
")",
"{",
"TYPE_NEXT_REF_TO",
"(",
"t",
")",
"=",
"TYPE_REFERENCE_TO",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
";",
"TYPE_REFERENCE_TO",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
"=",
"t",
";",
"}",
"}"
] | For the type T re-materialize it in the type variant list and
the pointer/reference-to chains. | [
"For",
"the",
"type",
"T",
"re",
"-",
"materialize",
"it",
"in",
"the",
"type",
"variant",
"list",
"and",
"the",
"pointer",
"/",
"reference",
"-",
"to",
"chains",
"."
] | [
"/* The following re-creates proper variant lists while fixing up\n the variant leaders. We do not stream TYPE_NEXT_VARIANT so the\n variant list state before fixup is broken. */",
"/* If we are not our own variant leader link us into our new leaders\n variant list. */",
"/* The following reconstructs the pointer chains\n of the new pointed-to type if we are a main variant. We do\n not stream those so they are broken before fixup. */"
] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | compare_tree_sccs | bool | static bool
compare_tree_sccs (tree_scc *pscc, tree_scc *scc,
tree *map)
{
/* Assume SCC entry hashes are sorted after their cardinality. Which
means we can simply take the first n-tuple of equal hashes
(which is recorded as entry_len) and do n SCC entry candidate
comparisons. */
for (unsigned i = 0; i < pscc->entry_len; ++i)
{
tree *mapp = map;
num_scc_compare_collisions++;
if (compare_tree_sccs_1 (pscc->entries[0], scc->entries[i], &mapp))
{
/* Equal - no need to reset TREE_VISITED or TREE_ASM_WRITTEN
on the scc as all trees will be freed. */
return true;
}
/* Reset TREE_ASM_WRITTEN on scc for the next compare or in case
the SCC prevails. */
for (unsigned j = 0; j < scc->len; ++j)
TREE_ASM_WRITTEN (scc->entries[j]) = 0;
}
return false;
} | /* Compare the tree scc SCC to the prevailing candidate PSCC, filling
out MAP if they are equal. */ | Compare the tree scc SCC to the prevailing candidate PSCC, filling
out MAP if they are equal. | [
"Compare",
"the",
"tree",
"scc",
"SCC",
"to",
"the",
"prevailing",
"candidate",
"PSCC",
"filling",
"out",
"MAP",
"if",
"they",
"are",
"equal",
"."
] | static bool
compare_tree_sccs (tree_scc *pscc, tree_scc *scc,
tree *map)
{
for (unsigned i = 0; i < pscc->entry_len; ++i)
{
tree *mapp = map;
num_scc_compare_collisions++;
if (compare_tree_sccs_1 (pscc->entries[0], scc->entries[i], &mapp))
{
return true;
}
for (unsigned j = 0; j < scc->len; ++j)
TREE_ASM_WRITTEN (scc->entries[j]) = 0;
}
return false;
} | [
"static",
"bool",
"compare_tree_sccs",
"(",
"tree_scc",
"*",
"pscc",
",",
"tree_scc",
"*",
"scc",
",",
"tree",
"*",
"map",
")",
"{",
"for",
"(",
"unsigned",
"i",
"=",
"0",
";",
"i",
"<",
"pscc",
"->",
"entry_len",
";",
"++",
"i",
")",
"{",
"tree",
"*",
"mapp",
"=",
"map",
";",
"num_scc_compare_collisions",
"++",
";",
"if",
"(",
"compare_tree_sccs_1",
"(",
"pscc",
"->",
"entries",
"[",
"0",
"]",
",",
"scc",
"->",
"entries",
"[",
"i",
"]",
",",
"&",
"mapp",
")",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"unsigned",
"j",
"=",
"0",
";",
"j",
"<",
"scc",
"->",
"len",
";",
"++",
"j",
")",
"TREE_ASM_WRITTEN",
"(",
"scc",
"->",
"entries",
"[",
"j",
"]",
")",
"=",
"0",
";",
"}",
"return",
"false",
";",
"}"
] | Compare the tree scc SCC to the prevailing candidate PSCC, filling
out MAP if they are equal. | [
"Compare",
"the",
"tree",
"scc",
"SCC",
"to",
"the",
"prevailing",
"candidate",
"PSCC",
"filling",
"out",
"MAP",
"if",
"they",
"are",
"equal",
"."
] | [
"/* Assume SCC entry hashes are sorted after their cardinality. Which\n means we can simply take the first n-tuple of equal hashes\n (which is recorded as entry_len) and do n SCC entry candidate\n comparisons. */",
"/* Equal - no need to reset TREE_VISITED or TREE_ASM_WRITTEN\n\t on the scc as all trees will be freed. */",
"/* Reset TREE_ASM_WRITTEN on scc for the next compare or in case\n the SCC prevails. */"
] | [
{
"param": "pscc",
"type": "tree_scc"
},
{
"param": "scc",
"type": "tree_scc"
},
{
"param": "map",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pscc",
"type": "tree_scc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scc",
"type": "tree_scc",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "map",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | unify_scc | bool | static bool
unify_scc (struct data_in *data_in, unsigned from,
unsigned len, unsigned scc_entry_len, hashval_t scc_hash)
{
bool unified_p = false;
struct streamer_tree_cache_d *cache = data_in->reader_cache;
tree_scc *scc
= (tree_scc *) alloca (sizeof (tree_scc) + (len - 1) * sizeof (tree));
scc->next = NULL;
scc->hash = scc_hash;
scc->len = len;
scc->entry_len = scc_entry_len;
for (unsigned i = 0; i < len; ++i)
{
tree t = streamer_tree_cache_get_tree (cache, from + i);
scc->entries[i] = t;
/* Do not merge SCCs with local entities inside them. Also do
not merge TRANSLATION_UNIT_DECLs. */
if (TREE_CODE (t) == TRANSLATION_UNIT_DECL
|| (VAR_OR_FUNCTION_DECL_P (t)
&& !(TREE_PUBLIC (t) || DECL_EXTERNAL (t)))
|| TREE_CODE (t) == LABEL_DECL)
{
/* Avoid doing any work for these cases and do not worry to
record the SCCs for further merging. */
return false;
}
}
/* Look for the list of candidate SCCs to compare against. */
tree_scc **slot;
slot = tree_scc_hash->find_slot_with_hash (scc, scc_hash, INSERT);
if (*slot)
{
/* Try unifying against each candidate. */
num_scc_compares++;
/* Set TREE_VISITED on the scc so we can easily identify tree nodes
outside of the scc when following tree edges. Make sure
that TREE_ASM_WRITTEN is unset so we can use it as 2nd bit
to track whether we visited the SCC member during the compare.
We cannot use TREE_VISITED on the pscc members as the extended
scc and pscc can overlap. */
for (unsigned i = 0; i < scc->len; ++i)
{
TREE_VISITED (scc->entries[i]) = 1;
gcc_checking_assert (!TREE_ASM_WRITTEN (scc->entries[i]));
}
tree *map = XALLOCAVEC (tree, 2 * len);
for (tree_scc *pscc = *slot; pscc; pscc = pscc->next)
{
if (!compare_tree_sccs (pscc, scc, map))
continue;
/* Found an equal SCC. */
unified_p = true;
num_scc_compare_collisions--;
num_sccs_merged++;
total_scc_size_merged += len;
if (flag_checking)
for (unsigned i = 0; i < len; ++i)
{
tree t = map[2*i+1];
enum tree_code code = TREE_CODE (t);
/* IDENTIFIER_NODEs should be singletons and are merged by the
streamer. The others should be singletons, too, and we
should not merge them in any way. */
gcc_assert (code != TRANSLATION_UNIT_DECL
&& code != IDENTIFIER_NODE);
}
/* Fixup the streamer cache with the prevailing nodes according
to the tree node mapping computed by compare_tree_sccs. */
if (len == 1)
{
lto_maybe_register_decl (data_in, pscc->entries[0], from);
streamer_tree_cache_replace_tree (cache, pscc->entries[0], from);
}
else
{
tree *map2 = XALLOCAVEC (tree, 2 * len);
for (unsigned i = 0; i < len; ++i)
{
map2[i*2] = (tree)(uintptr_t)(from + i);
map2[i*2+1] = scc->entries[i];
}
qsort (map2, len, 2 * sizeof (tree), cmp_tree);
qsort (map, len, 2 * sizeof (tree), cmp_tree);
for (unsigned i = 0; i < len; ++i)
{
lto_maybe_register_decl (data_in, map[2*i],
(uintptr_t)map2[2*i]);
streamer_tree_cache_replace_tree (cache, map[2*i],
(uintptr_t)map2[2*i]);
}
}
/* Free the tree nodes from the read SCC. */
data_in->location_cache.revert_location_cache ();
for (unsigned i = 0; i < len; ++i)
{
if (TYPE_P (scc->entries[i]))
num_merged_types++;
free_node (scc->entries[i]);
}
/* Drop DIE references. */
dref_queue.truncate (0);
break;
}
/* Reset TREE_VISITED if we didn't unify the SCC with another. */
if (!unified_p)
for (unsigned i = 0; i < scc->len; ++i)
TREE_VISITED (scc->entries[i]) = 0;
}
/* If we didn't unify it to any candidate duplicate the relevant
pieces to permanent storage and link it into the chain. */
if (!unified_p)
{
tree_scc *pscc
= XOBNEWVAR (&tree_scc_hash_obstack, tree_scc, sizeof (tree_scc));
memcpy (pscc, scc, sizeof (tree_scc));
pscc->next = (*slot);
*slot = pscc;
}
return unified_p;
} | /* Try to unify the SCC with nodes FROM to FROM + LEN in CACHE and
hash value SCC_HASH with an already recorded SCC. Return true if
that was successful, otherwise return false. */ | Try to unify the SCC with nodes FROM to FROM + LEN in CACHE and
hash value SCC_HASH with an already recorded SCC. Return true if
that was successful, otherwise return false. | [
"Try",
"to",
"unify",
"the",
"SCC",
"with",
"nodes",
"FROM",
"to",
"FROM",
"+",
"LEN",
"in",
"CACHE",
"and",
"hash",
"value",
"SCC_HASH",
"with",
"an",
"already",
"recorded",
"SCC",
".",
"Return",
"true",
"if",
"that",
"was",
"successful",
"otherwise",
"return",
"false",
"."
] | static bool
unify_scc (struct data_in *data_in, unsigned from,
unsigned len, unsigned scc_entry_len, hashval_t scc_hash)
{
bool unified_p = false;
struct streamer_tree_cache_d *cache = data_in->reader_cache;
tree_scc *scc
= (tree_scc *) alloca (sizeof (tree_scc) + (len - 1) * sizeof (tree));
scc->next = NULL;
scc->hash = scc_hash;
scc->len = len;
scc->entry_len = scc_entry_len;
for (unsigned i = 0; i < len; ++i)
{
tree t = streamer_tree_cache_get_tree (cache, from + i);
scc->entries[i] = t;
if (TREE_CODE (t) == TRANSLATION_UNIT_DECL
|| (VAR_OR_FUNCTION_DECL_P (t)
&& !(TREE_PUBLIC (t) || DECL_EXTERNAL (t)))
|| TREE_CODE (t) == LABEL_DECL)
{
return false;
}
}
tree_scc **slot;
slot = tree_scc_hash->find_slot_with_hash (scc, scc_hash, INSERT);
if (*slot)
{
num_scc_compares++;
for (unsigned i = 0; i < scc->len; ++i)
{
TREE_VISITED (scc->entries[i]) = 1;
gcc_checking_assert (!TREE_ASM_WRITTEN (scc->entries[i]));
}
tree *map = XALLOCAVEC (tree, 2 * len);
for (tree_scc *pscc = *slot; pscc; pscc = pscc->next)
{
if (!compare_tree_sccs (pscc, scc, map))
continue;
unified_p = true;
num_scc_compare_collisions--;
num_sccs_merged++;
total_scc_size_merged += len;
if (flag_checking)
for (unsigned i = 0; i < len; ++i)
{
tree t = map[2*i+1];
enum tree_code code = TREE_CODE (t);
gcc_assert (code != TRANSLATION_UNIT_DECL
&& code != IDENTIFIER_NODE);
}
if (len == 1)
{
lto_maybe_register_decl (data_in, pscc->entries[0], from);
streamer_tree_cache_replace_tree (cache, pscc->entries[0], from);
}
else
{
tree *map2 = XALLOCAVEC (tree, 2 * len);
for (unsigned i = 0; i < len; ++i)
{
map2[i*2] = (tree)(uintptr_t)(from + i);
map2[i*2+1] = scc->entries[i];
}
qsort (map2, len, 2 * sizeof (tree), cmp_tree);
qsort (map, len, 2 * sizeof (tree), cmp_tree);
for (unsigned i = 0; i < len; ++i)
{
lto_maybe_register_decl (data_in, map[2*i],
(uintptr_t)map2[2*i]);
streamer_tree_cache_replace_tree (cache, map[2*i],
(uintptr_t)map2[2*i]);
}
}
data_in->location_cache.revert_location_cache ();
for (unsigned i = 0; i < len; ++i)
{
if (TYPE_P (scc->entries[i]))
num_merged_types++;
free_node (scc->entries[i]);
}
dref_queue.truncate (0);
break;
}
if (!unified_p)
for (unsigned i = 0; i < scc->len; ++i)
TREE_VISITED (scc->entries[i]) = 0;
}
if (!unified_p)
{
tree_scc *pscc
= XOBNEWVAR (&tree_scc_hash_obstack, tree_scc, sizeof (tree_scc));
memcpy (pscc, scc, sizeof (tree_scc));
pscc->next = (*slot);
*slot = pscc;
}
return unified_p;
} | [
"static",
"bool",
"unify_scc",
"(",
"struct",
"data_in",
"*",
"data_in",
",",
"unsigned",
"from",
",",
"unsigned",
"len",
",",
"unsigned",
"scc_entry_len",
",",
"hashval_t",
"scc_hash",
")",
"{",
"bool",
"unified_p",
"=",
"false",
";",
"struct",
"streamer_tree_cache_d",
"*",
"cache",
"=",
"data_in",
"->",
"reader_cache",
";",
"tree_scc",
"*",
"scc",
"=",
"(",
"tree_scc",
"*",
")",
"alloca",
"(",
"sizeof",
"(",
"tree_scc",
")",
"+",
"(",
"len",
"-",
"1",
")",
"*",
"sizeof",
"(",
"tree",
")",
")",
";",
"scc",
"->",
"next",
"=",
"NULL",
";",
"scc",
"->",
"hash",
"=",
"scc_hash",
";",
"scc",
"->",
"len",
"=",
"len",
";",
"scc",
"->",
"entry_len",
"=",
"scc_entry_len",
";",
"for",
"(",
"unsigned",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"tree",
"t",
"=",
"streamer_tree_cache_get_tree",
"(",
"cache",
",",
"from",
"+",
"i",
")",
";",
"scc",
"->",
"entries",
"[",
"i",
"]",
"=",
"t",
";",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"TRANSLATION_UNIT_DECL",
"||",
"(",
"VAR_OR_FUNCTION_DECL_P",
"(",
"t",
")",
"&&",
"!",
"(",
"TREE_PUBLIC",
"(",
"t",
")",
"||",
"DECL_EXTERNAL",
"(",
"t",
")",
")",
")",
"||",
"TREE_CODE",
"(",
"t",
")",
"==",
"LABEL_DECL",
")",
"{",
"return",
"false",
";",
"}",
"}",
"tree_scc",
"*",
"*",
"slot",
";",
"slot",
"=",
"tree_scc_hash",
"->",
"find_slot_with_hash",
"(",
"scc",
",",
"scc_hash",
",",
"INSERT",
")",
";",
"if",
"(",
"*",
"slot",
")",
"{",
"num_scc_compares",
"++",
";",
"for",
"(",
"unsigned",
"i",
"=",
"0",
";",
"i",
"<",
"scc",
"->",
"len",
";",
"++",
"i",
")",
"{",
"TREE_VISITED",
"(",
"scc",
"->",
"entries",
"[",
"i",
"]",
")",
"=",
"1",
";",
"gcc_checking_assert",
"(",
"!",
"TREE_ASM_WRITTEN",
"(",
"scc",
"->",
"entries",
"[",
"i",
"]",
")",
")",
";",
"}",
"tree",
"*",
"map",
"=",
"XALLOCAVEC",
"(",
"tree",
",",
"2",
"*",
"len",
")",
";",
"for",
"(",
"tree_scc",
"*",
"pscc",
"=",
"*",
"slot",
";",
"pscc",
";",
"pscc",
"=",
"pscc",
"->",
"next",
")",
"{",
"if",
"(",
"!",
"compare_tree_sccs",
"(",
"pscc",
",",
"scc",
",",
"map",
")",
")",
"continue",
";",
"unified_p",
"=",
"true",
";",
"num_scc_compare_collisions",
"--",
";",
"num_sccs_merged",
"++",
";",
"total_scc_size_merged",
"+=",
"len",
";",
"if",
"(",
"flag_checking",
")",
"for",
"(",
"unsigned",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"tree",
"t",
"=",
"map",
"[",
"2",
"*",
"i",
"+",
"1",
"]",
";",
"enum",
"tree_code",
"code",
"=",
"TREE_CODE",
"(",
"t",
")",
";",
"gcc_assert",
"(",
"code",
"!=",
"TRANSLATION_UNIT_DECL",
"&&",
"code",
"!=",
"IDENTIFIER_NODE",
")",
";",
"}",
"if",
"(",
"len",
"==",
"1",
")",
"{",
"lto_maybe_register_decl",
"(",
"data_in",
",",
"pscc",
"->",
"entries",
"[",
"0",
"]",
",",
"from",
")",
";",
"streamer_tree_cache_replace_tree",
"(",
"cache",
",",
"pscc",
"->",
"entries",
"[",
"0",
"]",
",",
"from",
")",
";",
"}",
"else",
"{",
"tree",
"*",
"map2",
"=",
"XALLOCAVEC",
"(",
"tree",
",",
"2",
"*",
"len",
")",
";",
"for",
"(",
"unsigned",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"map2",
"[",
"i",
"*",
"2",
"]",
"=",
"(",
"tree",
")",
"(",
"uintptr_t",
")",
"(",
"from",
"+",
"i",
")",
";",
"map2",
"[",
"i",
"*",
"2",
"+",
"1",
"]",
"=",
"scc",
"->",
"entries",
"[",
"i",
"]",
";",
"}",
"qsort",
"(",
"map2",
",",
"len",
",",
"2",
"*",
"sizeof",
"(",
"tree",
")",
",",
"cmp_tree",
")",
";",
"qsort",
"(",
"map",
",",
"len",
",",
"2",
"*",
"sizeof",
"(",
"tree",
")",
",",
"cmp_tree",
")",
";",
"for",
"(",
"unsigned",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"lto_maybe_register_decl",
"(",
"data_in",
",",
"map",
"[",
"2",
"*",
"i",
"]",
",",
"(",
"uintptr_t",
")",
"map2",
"[",
"2",
"*",
"i",
"]",
")",
";",
"streamer_tree_cache_replace_tree",
"(",
"cache",
",",
"map",
"[",
"2",
"*",
"i",
"]",
",",
"(",
"uintptr_t",
")",
"map2",
"[",
"2",
"*",
"i",
"]",
")",
";",
"}",
"}",
"data_in",
"->",
"location_cache",
".",
"revert_location_cache",
"(",
")",
";",
"for",
"(",
"unsigned",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"if",
"(",
"TYPE_P",
"(",
"scc",
"->",
"entries",
"[",
"i",
"]",
")",
")",
"num_merged_types",
"++",
";",
"free_node",
"(",
"scc",
"->",
"entries",
"[",
"i",
"]",
")",
";",
"}",
"dref_queue",
".",
"truncate",
"(",
"0",
")",
";",
"break",
";",
"}",
"if",
"(",
"!",
"unified_p",
")",
"for",
"(",
"unsigned",
"i",
"=",
"0",
";",
"i",
"<",
"scc",
"->",
"len",
";",
"++",
"i",
")",
"TREE_VISITED",
"(",
"scc",
"->",
"entries",
"[",
"i",
"]",
")",
"=",
"0",
";",
"}",
"if",
"(",
"!",
"unified_p",
")",
"{",
"tree_scc",
"*",
"pscc",
"=",
"XOBNEWVAR",
"(",
"&",
"tree_scc_hash_obstack",
",",
"tree_scc",
",",
"sizeof",
"(",
"tree_scc",
")",
")",
";",
"memcpy",
"(",
"pscc",
",",
"scc",
",",
"sizeof",
"(",
"tree_scc",
")",
")",
";",
"pscc",
"->",
"next",
"=",
"(",
"*",
"slot",
")",
";",
"*",
"slot",
"=",
"pscc",
";",
"}",
"return",
"unified_p",
";",
"}"
] | Try to unify the SCC with nodes FROM to FROM + LEN in CACHE and
hash value SCC_HASH with an already recorded SCC. | [
"Try",
"to",
"unify",
"the",
"SCC",
"with",
"nodes",
"FROM",
"to",
"FROM",
"+",
"LEN",
"in",
"CACHE",
"and",
"hash",
"value",
"SCC_HASH",
"with",
"an",
"already",
"recorded",
"SCC",
"."
] | [
"/* Do not merge SCCs with local entities inside them. Also do\n\t not merge TRANSLATION_UNIT_DECLs. */",
"/* Avoid doing any work for these cases and do not worry to\n\t record the SCCs for further merging. */",
"/* Look for the list of candidate SCCs to compare against. */",
"/* Try unifying against each candidate. */",
"/* Set TREE_VISITED on the scc so we can easily identify tree nodes\n\t outside of the scc when following tree edges. Make sure\n\t that TREE_ASM_WRITTEN is unset so we can use it as 2nd bit\n\t to track whether we visited the SCC member during the compare.\n\t We cannot use TREE_VISITED on the pscc members as the extended\n\t scc and pscc can overlap. */",
"/* Found an equal SCC. */",
"/* IDENTIFIER_NODEs should be singletons and are merged by the\n\t\t streamer. The others should be singletons, too, and we\n\t\t should not merge them in any way. */",
"/* Fixup the streamer cache with the prevailing nodes according\n\t to the tree node mapping computed by compare_tree_sccs. */",
"/* Free the tree nodes from the read SCC. */",
"/* Drop DIE references. */",
"/* Reset TREE_VISITED if we didn't unify the SCC with another. */",
"/* If we didn't unify it to any candidate duplicate the relevant\n pieces to permanent storage and link it into the chain. */"
] | [
{
"param": "data_in",
"type": "struct data_in"
},
{
"param": "from",
"type": "unsigned"
},
{
"param": "len",
"type": "unsigned"
},
{
"param": "scc_entry_len",
"type": "unsigned"
},
{
"param": "scc_hash",
"type": "hashval_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_in",
"type": "struct data_in",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "from",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "len",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scc_entry_len",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scc_hash",
"type": "hashval_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_file_finalize | void | static void
lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file)
{
const char *data;
size_t len;
vec<ld_plugin_symbol_resolution_t>
resolutions = vNULL;
int i;
res_pair *rp;
/* Create vector for fast access of resolution. We do this lazily
to save memory. */
resolutions.safe_grow_cleared (file_data->max_index + 1);
for (i = 0; file_data->respairs.iterate (i, &rp); i++)
resolutions[rp->index] = rp->res;
file_data->respairs.release ();
file_data->renaming_hash_table = lto_create_renaming_table ();
file_data->file_name = file->filename;
#ifdef ACCEL_COMPILER
lto_input_mode_table (file_data);
#else
file_data->mode_table = lto_mode_identity_table;
#endif
data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len);
if (data == NULL)
{
internal_error ("cannot read LTO decls from %s", file_data->file_name);
return;
}
/* Frees resolutions */
lto_read_decls (file_data, data, resolutions);
lto_free_section_data (file_data, LTO_section_decls, NULL, data, len);
} | /* Read declarations and other initializations for a FILE_DATA. */ | Read declarations and other initializations for a FILE_DATA. | [
"Read",
"declarations",
"and",
"other",
"initializations",
"for",
"a",
"FILE_DATA",
"."
] | static void
lto_file_finalize (struct lto_file_decl_data *file_data, lto_file *file)
{
const char *data;
size_t len;
vec<ld_plugin_symbol_resolution_t>
resolutions = vNULL;
int i;
res_pair *rp;
resolutions.safe_grow_cleared (file_data->max_index + 1);
for (i = 0; file_data->respairs.iterate (i, &rp); i++)
resolutions[rp->index] = rp->res;
file_data->respairs.release ();
file_data->renaming_hash_table = lto_create_renaming_table ();
file_data->file_name = file->filename;
#ifdef ACCEL_COMPILER
lto_input_mode_table (file_data);
#else
file_data->mode_table = lto_mode_identity_table;
#endif
data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len);
if (data == NULL)
{
internal_error ("cannot read LTO decls from %s", file_data->file_name);
return;
}
lto_read_decls (file_data, data, resolutions);
lto_free_section_data (file_data, LTO_section_decls, NULL, data, len);
} | [
"static",
"void",
"lto_file_finalize",
"(",
"struct",
"lto_file_decl_data",
"*",
"file_data",
",",
"lto_file",
"*",
"file",
")",
"{",
"const",
"char",
"*",
"data",
";",
"size_t",
"len",
";",
"vec",
"<",
"ld_plugin_symbol_resolution_t",
">",
"resolutions",
"=",
"vNULL",
";",
"int",
"i",
";",
"res_pair",
"*",
"rp",
";",
"resolutions",
".",
"safe_grow_cleared",
"(",
"file_data",
"->",
"max_index",
"+",
"1",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"file_data",
"->",
"respairs",
".",
"iterate",
"(",
"i",
",",
"&",
"rp",
")",
";",
"i",
"++",
")",
"resolutions",
"[",
"rp",
"->",
"index",
"]",
"=",
"rp",
"->",
"res",
";",
"file_data",
"->",
"respairs",
".",
"release",
"(",
")",
";",
"file_data",
"->",
"renaming_hash_table",
"=",
"lto_create_renaming_table",
"(",
")",
";",
"file_data",
"->",
"file_name",
"=",
"file",
"->",
"filename",
";",
"#ifdef",
"ACCEL_COMPILER",
"lto_input_mode_table",
"(",
"file_data",
")",
";",
"#else",
"file_data",
"->",
"mode_table",
"=",
"lto_mode_identity_table",
";",
"#endif",
"data",
"=",
"lto_get_section_data",
"(",
"file_data",
",",
"LTO_section_decls",
",",
"NULL",
",",
"&",
"len",
")",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"{",
"internal_error",
"(",
"\"",
"\"",
",",
"file_data",
"->",
"file_name",
")",
";",
"return",
";",
"}",
"lto_read_decls",
"(",
"file_data",
",",
"data",
",",
"resolutions",
")",
";",
"lto_free_section_data",
"(",
"file_data",
",",
"LTO_section_decls",
",",
"NULL",
",",
"data",
",",
"len",
")",
";",
"}"
] | Read declarations and other initializations for a FILE_DATA. | [
"Read",
"declarations",
"and",
"other",
"initializations",
"for",
"a",
"FILE_DATA",
"."
] | [
"/* Create vector for fast access of resolution. We do this lazily\n to save memory. */",
"/* Frees resolutions */"
] | [
{
"param": "file_data",
"type": "struct lto_file_decl_data"
},
{
"param": "file",
"type": "lto_file"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_data",
"type": "struct lto_file_decl_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": "lto_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_file_read | null | static struct lto_file_decl_data *
lto_file_read (lto_file *file, FILE *resolution_file, int *count)
{
struct lto_file_decl_data *file_data = NULL;
splay_tree file_ids;
htab_t section_hash_table;
struct lto_section_slot *section;
struct file_data_list file_list;
struct lto_section_list section_list;
memset (§ion_list, 0, sizeof (struct lto_section_list));
section_hash_table = lto_obj_build_section_table (file, §ion_list);
/* Find all sub modules in the object and put their sections into new hash
tables in a splay tree. */
file_ids = lto_splay_tree_new ();
memset (&file_list, 0, sizeof (struct file_data_list));
for (section = section_list.first; section != NULL; section = section->next)
create_subid_section_table (section, file_ids, &file_list);
/* Add resolutions to file ids */
lto_resolution_read (file_ids, resolution_file, file);
/* Finalize each lto file for each submodule in the merged object */
for (file_data = file_list.first; file_data != NULL; file_data = file_data->next)
lto_create_files_from_ids (file, file_data, count);
splay_tree_delete (file_ids);
htab_delete (section_hash_table);
return file_list.first;
} | /* Generate a TREE representation for all types and external decls
entities in FILE.
Read all of the globals out of the file. Then read the cgraph
and process the .o index into the cgraph nodes so that it can open
the .o file to load the functions and ipa information. */ | Generate a TREE representation for all types and external decls
entities in FILE.
Read all of the globals out of the file. Then read the cgraph
and process the .o index into the cgraph nodes so that it can open
the .o file to load the functions and ipa information. | [
"Generate",
"a",
"TREE",
"representation",
"for",
"all",
"types",
"and",
"external",
"decls",
"entities",
"in",
"FILE",
".",
"Read",
"all",
"of",
"the",
"globals",
"out",
"of",
"the",
"file",
".",
"Then",
"read",
"the",
"cgraph",
"and",
"process",
"the",
".",
"o",
"index",
"into",
"the",
"cgraph",
"nodes",
"so",
"that",
"it",
"can",
"open",
"the",
".",
"o",
"file",
"to",
"load",
"the",
"functions",
"and",
"ipa",
"information",
"."
] | static struct lto_file_decl_data *
lto_file_read (lto_file *file, FILE *resolution_file, int *count)
{
struct lto_file_decl_data *file_data = NULL;
splay_tree file_ids;
htab_t section_hash_table;
struct lto_section_slot *section;
struct file_data_list file_list;
struct lto_section_list section_list;
memset (§ion_list, 0, sizeof (struct lto_section_list));
section_hash_table = lto_obj_build_section_table (file, §ion_list);
file_ids = lto_splay_tree_new ();
memset (&file_list, 0, sizeof (struct file_data_list));
for (section = section_list.first; section != NULL; section = section->next)
create_subid_section_table (section, file_ids, &file_list);
lto_resolution_read (file_ids, resolution_file, file);
for (file_data = file_list.first; file_data != NULL; file_data = file_data->next)
lto_create_files_from_ids (file, file_data, count);
splay_tree_delete (file_ids);
htab_delete (section_hash_table);
return file_list.first;
} | [
"static",
"struct",
"lto_file_decl_data",
"*",
"lto_file_read",
"(",
"lto_file",
"*",
"file",
",",
"FILE",
"*",
"resolution_file",
",",
"int",
"*",
"count",
")",
"{",
"struct",
"lto_file_decl_data",
"*",
"file_data",
"=",
"NULL",
";",
"splay_tree",
"file_ids",
";",
"htab_t",
"section_hash_table",
";",
"struct",
"lto_section_slot",
"*",
"section",
";",
"struct",
"file_data_list",
"file_list",
";",
"struct",
"lto_section_list",
"section_list",
";",
"memset",
"(",
"&",
"section_list",
",",
"0",
",",
"sizeof",
"(",
"struct",
"lto_section_list",
")",
")",
";",
"section_hash_table",
"=",
"lto_obj_build_section_table",
"(",
"file",
",",
"&",
"section_list",
")",
";",
"file_ids",
"=",
"lto_splay_tree_new",
"(",
")",
";",
"memset",
"(",
"&",
"file_list",
",",
"0",
",",
"sizeof",
"(",
"struct",
"file_data_list",
")",
")",
";",
"for",
"(",
"section",
"=",
"section_list",
".",
"first",
";",
"section",
"!=",
"NULL",
";",
"section",
"=",
"section",
"->",
"next",
")",
"create_subid_section_table",
"(",
"section",
",",
"file_ids",
",",
"&",
"file_list",
")",
";",
"lto_resolution_read",
"(",
"file_ids",
",",
"resolution_file",
",",
"file",
")",
";",
"for",
"(",
"file_data",
"=",
"file_list",
".",
"first",
";",
"file_data",
"!=",
"NULL",
";",
"file_data",
"=",
"file_data",
"->",
"next",
")",
"lto_create_files_from_ids",
"(",
"file",
",",
"file_data",
",",
"count",
")",
";",
"splay_tree_delete",
"(",
"file_ids",
")",
";",
"htab_delete",
"(",
"section_hash_table",
")",
";",
"return",
"file_list",
".",
"first",
";",
"}"
] | Generate a TREE representation for all types and external decls
entities in FILE. | [
"Generate",
"a",
"TREE",
"representation",
"for",
"all",
"types",
"and",
"external",
"decls",
"entities",
"in",
"FILE",
"."
] | [
"/* Find all sub modules in the object and put their sections into new hash\n tables in a splay tree. */",
"/* Add resolutions to file ids */",
"/* Finalize each lto file for each submodule in the merged object */"
] | [
{
"param": "file",
"type": "lto_file"
},
{
"param": "resolution_file",
"type": "FILE"
},
{
"param": "count",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "lto_file",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "resolution_file",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "count",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_read_section_data | char | static char *
lto_read_section_data (struct lto_file_decl_data *file_data,
intptr_t offset, size_t len)
{
char *result;
static int fd = -1;
static char *fd_name;
#if LTO_MMAP_IO
intptr_t computed_len;
intptr_t computed_offset;
intptr_t diff;
#endif
/* Keep a single-entry file-descriptor cache. The last file we
touched will get closed at exit.
??? Eventually we want to add a more sophisticated larger cache
or rather fix function body streaming to not stream them in
practically random order. */
if (fd != -1
&& filename_cmp (fd_name, file_data->file_name) != 0)
{
free (fd_name);
close (fd);
fd = -1;
}
if (fd == -1)
{
fd = open (file_data->file_name, O_RDONLY|O_BINARY);
if (fd == -1)
{
fatal_error (input_location, "Cannot open %s", file_data->file_name);
return NULL;
}
fd_name = xstrdup (file_data->file_name);
}
#if LTO_MMAP_IO
if (!page_mask)
{
size_t page_size = sysconf (_SC_PAGE_SIZE);
page_mask = ~(page_size - 1);
}
computed_offset = offset & page_mask;
diff = offset - computed_offset;
computed_len = len + diff;
result = (char *) mmap (NULL, computed_len, PROT_READ, MAP_PRIVATE,
fd, computed_offset);
if (result == MAP_FAILED)
{
fatal_error (input_location, "Cannot map %s", file_data->file_name);
return NULL;
}
return result + diff;
#else
result = (char *) xmalloc (len);
if (lseek (fd, offset, SEEK_SET) != offset
|| read (fd, result, len) != (ssize_t) len)
{
free (result);
fatal_error (input_location, "Cannot read %s", file_data->file_name);
result = NULL;
}
#ifdef __MINGW32__
/* Native windows doesn't supports delayed unlink on opened file. So
we close file here again. This produces higher I/O load, but at least
it prevents to have dangling file handles preventing unlink. */
free (fd_name);
fd_name = NULL;
close (fd);
fd = -1;
#endif
return result;
#endif
} | /* Get the section data of length LEN from FILENAME starting at
OFFSET. The data segment must be freed by the caller when the
caller is finished. Returns NULL if all was not well. */ | Get the section data of length LEN from FILENAME starting at
OFFSET. The data segment must be freed by the caller when the
caller is finished. Returns NULL if all was not well. | [
"Get",
"the",
"section",
"data",
"of",
"length",
"LEN",
"from",
"FILENAME",
"starting",
"at",
"OFFSET",
".",
"The",
"data",
"segment",
"must",
"be",
"freed",
"by",
"the",
"caller",
"when",
"the",
"caller",
"is",
"finished",
".",
"Returns",
"NULL",
"if",
"all",
"was",
"not",
"well",
"."
] | static char *
lto_read_section_data (struct lto_file_decl_data *file_data,
intptr_t offset, size_t len)
{
char *result;
static int fd = -1;
static char *fd_name;
#if LTO_MMAP_IO
intptr_t computed_len;
intptr_t computed_offset;
intptr_t diff;
#endif
if (fd != -1
&& filename_cmp (fd_name, file_data->file_name) != 0)
{
free (fd_name);
close (fd);
fd = -1;
}
if (fd == -1)
{
fd = open (file_data->file_name, O_RDONLY|O_BINARY);
if (fd == -1)
{
fatal_error (input_location, "Cannot open %s", file_data->file_name);
return NULL;
}
fd_name = xstrdup (file_data->file_name);
}
#if LTO_MMAP_IO
if (!page_mask)
{
size_t page_size = sysconf (_SC_PAGE_SIZE);
page_mask = ~(page_size - 1);
}
computed_offset = offset & page_mask;
diff = offset - computed_offset;
computed_len = len + diff;
result = (char *) mmap (NULL, computed_len, PROT_READ, MAP_PRIVATE,
fd, computed_offset);
if (result == MAP_FAILED)
{
fatal_error (input_location, "Cannot map %s", file_data->file_name);
return NULL;
}
return result + diff;
#else
result = (char *) xmalloc (len);
if (lseek (fd, offset, SEEK_SET) != offset
|| read (fd, result, len) != (ssize_t) len)
{
free (result);
fatal_error (input_location, "Cannot read %s", file_data->file_name);
result = NULL;
}
#ifdef __MINGW32__
free (fd_name);
fd_name = NULL;
close (fd);
fd = -1;
#endif
return result;
#endif
} | [
"static",
"char",
"*",
"lto_read_section_data",
"(",
"struct",
"lto_file_decl_data",
"*",
"file_data",
",",
"intptr_t",
"offset",
",",
"size_t",
"len",
")",
"{",
"char",
"*",
"result",
";",
"static",
"int",
"fd",
"=",
"-1",
";",
"static",
"char",
"*",
"fd_name",
";",
"#if",
"LTO_MMAP_IO",
"\n",
"intptr_t",
"computed_len",
";",
"intptr_t",
"computed_offset",
";",
"intptr_t",
"diff",
";",
"#endif",
"if",
"(",
"fd",
"!=",
"-1",
"&&",
"filename_cmp",
"(",
"fd_name",
",",
"file_data",
"->",
"file_name",
")",
"!=",
"0",
")",
"{",
"free",
"(",
"fd_name",
")",
";",
"close",
"(",
"fd",
")",
";",
"fd",
"=",
"-1",
";",
"}",
"if",
"(",
"fd",
"==",
"-1",
")",
"{",
"fd",
"=",
"open",
"(",
"file_data",
"->",
"file_name",
",",
"O_RDONLY",
"|",
"O_BINARY",
")",
";",
"if",
"(",
"fd",
"==",
"-1",
")",
"{",
"fatal_error",
"(",
"input_location",
",",
"\"",
"\"",
",",
"file_data",
"->",
"file_name",
")",
";",
"return",
"NULL",
";",
"}",
"fd_name",
"=",
"xstrdup",
"(",
"file_data",
"->",
"file_name",
")",
";",
"}",
"#if",
"LTO_MMAP_IO",
"\n",
"if",
"(",
"!",
"page_mask",
")",
"{",
"size_t",
"page_size",
"=",
"sysconf",
"(",
"_SC_PAGE_SIZE",
")",
";",
"page_mask",
"=",
"~",
"(",
"page_size",
"-",
"1",
")",
";",
"}",
"computed_offset",
"=",
"offset",
"&",
"page_mask",
";",
"diff",
"=",
"offset",
"-",
"computed_offset",
";",
"computed_len",
"=",
"len",
"+",
"diff",
";",
"result",
"=",
"(",
"char",
"*",
")",
"mmap",
"(",
"NULL",
",",
"computed_len",
",",
"PROT_READ",
",",
"MAP_PRIVATE",
",",
"fd",
",",
"computed_offset",
")",
";",
"if",
"(",
"result",
"==",
"MAP_FAILED",
")",
"{",
"fatal_error",
"(",
"input_location",
",",
"\"",
"\"",
",",
"file_data",
"->",
"file_name",
")",
";",
"return",
"NULL",
";",
"}",
"return",
"result",
"+",
"diff",
";",
"#else",
"result",
"=",
"(",
"char",
"*",
")",
"xmalloc",
"(",
"len",
")",
";",
"if",
"(",
"lseek",
"(",
"fd",
",",
"offset",
",",
"SEEK_SET",
")",
"!=",
"offset",
"||",
"read",
"(",
"fd",
",",
"result",
",",
"len",
")",
"!=",
"(",
"ssize_t",
")",
"len",
")",
"{",
"free",
"(",
"result",
")",
";",
"fatal_error",
"(",
"input_location",
",",
"\"",
"\"",
",",
"file_data",
"->",
"file_name",
")",
";",
"result",
"=",
"NULL",
";",
"}",
"#ifdef",
"__MINGW32__",
"free",
"(",
"fd_name",
")",
";",
"fd_name",
"=",
"NULL",
";",
"close",
"(",
"fd",
")",
";",
"fd",
"=",
"-1",
";",
"#endif",
"return",
"result",
";",
"#endif",
"}"
] | Get the section data of length LEN from FILENAME starting at
OFFSET. | [
"Get",
"the",
"section",
"data",
"of",
"length",
"LEN",
"from",
"FILENAME",
"starting",
"at",
"OFFSET",
"."
] | [
"/* Keep a single-entry file-descriptor cache. The last file we\n touched will get closed at exit.\n ??? Eventually we want to add a more sophisticated larger cache\n or rather fix function body streaming to not stream them in\n practically random order. */",
"/* Native windows doesn't supports delayed unlink on opened file. So\n we close file here again. This produces higher I/O load, but at least\n it prevents to have dangling file handles preventing unlink. */"
] | [
{
"param": "file_data",
"type": "struct lto_file_decl_data"
},
{
"param": "offset",
"type": "intptr_t"
},
{
"param": "len",
"type": "size_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_data",
"type": "struct lto_file_decl_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": "intptr_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "len",
"type": "size_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | stream_out | void | static void
stream_out (char *temp_filename, lto_symtab_encoder_t encoder,
bool ARG_UNUSED (last))
{
#ifdef HAVE_WORKING_FORK
static int nruns;
if (lto_parallelism <= 1)
{
do_stream_out (temp_filename, encoder);
return;
}
/* Do not run more than LTO_PARALLELISM streamings
FIXME: we ignore limits on jobserver. */
if (lto_parallelism > 0 && nruns >= lto_parallelism)
{
wait_for_child ();
nruns --;
}
/* If this is not the last parallel partition, execute new
streaming process. */
if (!last)
{
pid_t cpid = fork ();
if (!cpid)
{
setproctitle ("lto1-wpa-streaming");
do_stream_out (temp_filename, encoder);
exit (0);
}
/* Fork failed; lets do the job ourseleves. */
else if (cpid == -1)
do_stream_out (temp_filename, encoder);
else
nruns++;
}
/* Last partition; stream it and wait for all children to die. */
else
{
int i;
do_stream_out (temp_filename, encoder);
for (i = 0; i < nruns; i++)
wait_for_child ();
}
asm_nodes_output = true;
#else
do_stream_out (temp_filename, encoder);
#endif
} | /* Stream out ENCODER into TEMP_FILENAME
Fork if that seems to help. */ | Stream out ENCODER into TEMP_FILENAME
Fork if that seems to help. | [
"Stream",
"out",
"ENCODER",
"into",
"TEMP_FILENAME",
"Fork",
"if",
"that",
"seems",
"to",
"help",
"."
] | static void
stream_out (char *temp_filename, lto_symtab_encoder_t encoder,
bool ARG_UNUSED (last))
{
#ifdef HAVE_WORKING_FORK
static int nruns;
if (lto_parallelism <= 1)
{
do_stream_out (temp_filename, encoder);
return;
}
if (lto_parallelism > 0 && nruns >= lto_parallelism)
{
wait_for_child ();
nruns --;
}
if (!last)
{
pid_t cpid = fork ();
if (!cpid)
{
setproctitle ("lto1-wpa-streaming");
do_stream_out (temp_filename, encoder);
exit (0);
}
else if (cpid == -1)
do_stream_out (temp_filename, encoder);
else
nruns++;
}
else
{
int i;
do_stream_out (temp_filename, encoder);
for (i = 0; i < nruns; i++)
wait_for_child ();
}
asm_nodes_output = true;
#else
do_stream_out (temp_filename, encoder);
#endif
} | [
"static",
"void",
"stream_out",
"(",
"char",
"*",
"temp_filename",
",",
"lto_symtab_encoder_t",
"encoder",
",",
"bool",
"ARG_UNUSED",
"(",
"last",
")",
")",
"{",
"#ifdef",
"HAVE_WORKING_FORK",
"static",
"int",
"nruns",
";",
"if",
"(",
"lto_parallelism",
"<=",
"1",
")",
"{",
"do_stream_out",
"(",
"temp_filename",
",",
"encoder",
")",
";",
"return",
";",
"}",
"if",
"(",
"lto_parallelism",
">",
"0",
"&&",
"nruns",
">=",
"lto_parallelism",
")",
"{",
"wait_for_child",
"(",
")",
";",
"nruns",
"--",
";",
"}",
"if",
"(",
"!",
"last",
")",
"{",
"pid_t",
"cpid",
"=",
"fork",
"(",
")",
";",
"if",
"(",
"!",
"cpid",
")",
"{",
"setproctitle",
"(",
"\"",
"\"",
")",
";",
"do_stream_out",
"(",
"temp_filename",
",",
"encoder",
")",
";",
"exit",
"(",
"0",
")",
";",
"}",
"else",
"if",
"(",
"cpid",
"==",
"-1",
")",
"do_stream_out",
"(",
"temp_filename",
",",
"encoder",
")",
";",
"else",
"nruns",
"++",
";",
"}",
"else",
"{",
"int",
"i",
";",
"do_stream_out",
"(",
"temp_filename",
",",
"encoder",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nruns",
";",
"i",
"++",
")",
"wait_for_child",
"(",
")",
";",
"}",
"asm_nodes_output",
"=",
"true",
";",
"#else",
"do_stream_out",
"(",
"temp_filename",
",",
"encoder",
")",
";",
"#endif",
"}"
] | Stream out ENCODER into TEMP_FILENAME
Fork if that seems to help. | [
"Stream",
"out",
"ENCODER",
"into",
"TEMP_FILENAME",
"Fork",
"if",
"that",
"seems",
"to",
"help",
"."
] | [
"/* Do not run more than LTO_PARALLELISM streamings\n FIXME: we ignore limits on jobserver. */",
"/* If this is not the last parallel partition, execute new\n streaming process. */",
"/* Fork failed; lets do the job ourseleves. */",
"/* Last partition; stream it and wait for all children to die. */"
] | [
{
"param": "temp_filename",
"type": "char"
},
{
"param": "encoder",
"type": "lto_symtab_encoder_t"
},
{
"param": "ARG_UNUSED",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "temp_filename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "encoder",
"type": "lto_symtab_encoder_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ARG_UNUSED",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_fixup_prevailing_decls | void | static void
lto_fixup_prevailing_decls (tree t)
{
enum tree_code code = TREE_CODE (t);
bool fixed = false;
gcc_checking_assert (code != TREE_BINFO);
LTO_NO_PREVAIL (TREE_TYPE (t));
if (CODE_CONTAINS_STRUCT (code, TS_COMMON)
/* lto_symtab_prevail_decl use TREE_CHAIN to link to the prevailing decl.
in the case T is a prevailed declaration we would ICE here. */
&& !VAR_OR_FUNCTION_DECL_P (t))
LTO_NO_PREVAIL (TREE_CHAIN (t));
if (DECL_P (t))
{
LTO_NO_PREVAIL (DECL_NAME (t));
LTO_SET_PREVAIL (DECL_CONTEXT (t));
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{
LTO_SET_PREVAIL (DECL_SIZE (t));
LTO_SET_PREVAIL (DECL_SIZE_UNIT (t));
LTO_SET_PREVAIL (DECL_INITIAL (t));
LTO_NO_PREVAIL (DECL_ATTRIBUTES (t));
LTO_SET_PREVAIL (DECL_ABSTRACT_ORIGIN (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
{
LTO_NO_PREVAIL (DECL_ASSEMBLER_NAME_RAW (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
{
LTO_NO_PREVAIL (DECL_RESULT_FLD (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
{
LTO_NO_PREVAIL (DECL_ARGUMENTS (t));
LTO_SET_PREVAIL (DECL_FUNCTION_PERSONALITY (t));
LTO_NO_PREVAIL (DECL_VINDEX (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL))
{
LTO_SET_PREVAIL (DECL_FIELD_OFFSET (t));
LTO_NO_PREVAIL (DECL_BIT_FIELD_TYPE (t));
LTO_NO_PREVAIL (DECL_QUALIFIER (t));
LTO_NO_PREVAIL (DECL_FIELD_BIT_OFFSET (t));
LTO_NO_PREVAIL (DECL_FCONTEXT (t));
}
}
else if (TYPE_P (t))
{
LTO_NO_PREVAIL (TYPE_CACHED_VALUES (t));
LTO_SET_PREVAIL (TYPE_SIZE (t));
LTO_SET_PREVAIL (TYPE_SIZE_UNIT (t));
LTO_NO_PREVAIL (TYPE_ATTRIBUTES (t));
LTO_NO_PREVAIL (TYPE_NAME (t));
LTO_SET_PREVAIL (TYPE_MIN_VALUE_RAW (t));
LTO_SET_PREVAIL (TYPE_MAX_VALUE_RAW (t));
LTO_NO_PREVAIL (TYPE_LANG_SLOT_1 (t));
LTO_SET_PREVAIL (TYPE_CONTEXT (t));
LTO_NO_PREVAIL (TYPE_CANONICAL (t));
LTO_NO_PREVAIL (TYPE_MAIN_VARIANT (t));
LTO_NO_PREVAIL (TYPE_NEXT_VARIANT (t));
}
else if (EXPR_P (t))
{
int i;
for (i = TREE_OPERAND_LENGTH (t) - 1; i >= 0; --i)
LTO_SET_PREVAIL (TREE_OPERAND (t, i));
}
else if (TREE_CODE (t) == CONSTRUCTOR)
{
unsigned i;
tree val;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), i, val)
LTO_SET_PREVAIL (val);
}
else
{
switch (code)
{
case TREE_LIST:
LTO_SET_PREVAIL (TREE_VALUE (t));
LTO_SET_PREVAIL (TREE_PURPOSE (t));
LTO_NO_PREVAIL (TREE_PURPOSE (t));
break;
default:
gcc_unreachable ();
}
}
/* If we fixed nothing, then we missed something seen by
mentions_vars_p. */
gcc_checking_assert (fixed);
} | /* Given a tree T replace all fields referring to variables or functions
with their prevailing variant. */ | Given a tree T replace all fields referring to variables or functions
with their prevailing variant. | [
"Given",
"a",
"tree",
"T",
"replace",
"all",
"fields",
"referring",
"to",
"variables",
"or",
"functions",
"with",
"their",
"prevailing",
"variant",
"."
] | static void
lto_fixup_prevailing_decls (tree t)
{
enum tree_code code = TREE_CODE (t);
bool fixed = false;
gcc_checking_assert (code != TREE_BINFO);
LTO_NO_PREVAIL (TREE_TYPE (t));
if (CODE_CONTAINS_STRUCT (code, TS_COMMON)
&& !VAR_OR_FUNCTION_DECL_P (t))
LTO_NO_PREVAIL (TREE_CHAIN (t));
if (DECL_P (t))
{
LTO_NO_PREVAIL (DECL_NAME (t));
LTO_SET_PREVAIL (DECL_CONTEXT (t));
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{
LTO_SET_PREVAIL (DECL_SIZE (t));
LTO_SET_PREVAIL (DECL_SIZE_UNIT (t));
LTO_SET_PREVAIL (DECL_INITIAL (t));
LTO_NO_PREVAIL (DECL_ATTRIBUTES (t));
LTO_SET_PREVAIL (DECL_ABSTRACT_ORIGIN (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
{
LTO_NO_PREVAIL (DECL_ASSEMBLER_NAME_RAW (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
{
LTO_NO_PREVAIL (DECL_RESULT_FLD (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
{
LTO_NO_PREVAIL (DECL_ARGUMENTS (t));
LTO_SET_PREVAIL (DECL_FUNCTION_PERSONALITY (t));
LTO_NO_PREVAIL (DECL_VINDEX (t));
}
if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL))
{
LTO_SET_PREVAIL (DECL_FIELD_OFFSET (t));
LTO_NO_PREVAIL (DECL_BIT_FIELD_TYPE (t));
LTO_NO_PREVAIL (DECL_QUALIFIER (t));
LTO_NO_PREVAIL (DECL_FIELD_BIT_OFFSET (t));
LTO_NO_PREVAIL (DECL_FCONTEXT (t));
}
}
else if (TYPE_P (t))
{
LTO_NO_PREVAIL (TYPE_CACHED_VALUES (t));
LTO_SET_PREVAIL (TYPE_SIZE (t));
LTO_SET_PREVAIL (TYPE_SIZE_UNIT (t));
LTO_NO_PREVAIL (TYPE_ATTRIBUTES (t));
LTO_NO_PREVAIL (TYPE_NAME (t));
LTO_SET_PREVAIL (TYPE_MIN_VALUE_RAW (t));
LTO_SET_PREVAIL (TYPE_MAX_VALUE_RAW (t));
LTO_NO_PREVAIL (TYPE_LANG_SLOT_1 (t));
LTO_SET_PREVAIL (TYPE_CONTEXT (t));
LTO_NO_PREVAIL (TYPE_CANONICAL (t));
LTO_NO_PREVAIL (TYPE_MAIN_VARIANT (t));
LTO_NO_PREVAIL (TYPE_NEXT_VARIANT (t));
}
else if (EXPR_P (t))
{
int i;
for (i = TREE_OPERAND_LENGTH (t) - 1; i >= 0; --i)
LTO_SET_PREVAIL (TREE_OPERAND (t, i));
}
else if (TREE_CODE (t) == CONSTRUCTOR)
{
unsigned i;
tree val;
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (t), i, val)
LTO_SET_PREVAIL (val);
}
else
{
switch (code)
{
case TREE_LIST:
LTO_SET_PREVAIL (TREE_VALUE (t));
LTO_SET_PREVAIL (TREE_PURPOSE (t));
LTO_NO_PREVAIL (TREE_PURPOSE (t));
break;
default:
gcc_unreachable ();
}
}
gcc_checking_assert (fixed);
} | [
"static",
"void",
"lto_fixup_prevailing_decls",
"(",
"tree",
"t",
")",
"{",
"enum",
"tree_code",
"code",
"=",
"TREE_CODE",
"(",
"t",
")",
";",
"bool",
"fixed",
"=",
"false",
";",
"gcc_checking_assert",
"(",
"code",
"!=",
"TREE_BINFO",
")",
";",
"LTO_NO_PREVAIL",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
";",
"if",
"(",
"CODE_CONTAINS_STRUCT",
"(",
"code",
",",
"TS_COMMON",
")",
"&&",
"!",
"VAR_OR_FUNCTION_DECL_P",
"(",
"t",
")",
")",
"LTO_NO_PREVAIL",
"(",
"TREE_CHAIN",
"(",
"t",
")",
")",
";",
"if",
"(",
"DECL_P",
"(",
"t",
")",
")",
"{",
"LTO_NO_PREVAIL",
"(",
"DECL_NAME",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"DECL_CONTEXT",
"(",
"t",
")",
")",
";",
"if",
"(",
"CODE_CONTAINS_STRUCT",
"(",
"code",
",",
"TS_DECL_COMMON",
")",
")",
"{",
"LTO_SET_PREVAIL",
"(",
"DECL_SIZE",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"DECL_SIZE_UNIT",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"DECL_INITIAL",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"DECL_ATTRIBUTES",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"DECL_ABSTRACT_ORIGIN",
"(",
"t",
")",
")",
";",
"}",
"if",
"(",
"CODE_CONTAINS_STRUCT",
"(",
"code",
",",
"TS_DECL_WITH_VIS",
")",
")",
"{",
"LTO_NO_PREVAIL",
"(",
"DECL_ASSEMBLER_NAME_RAW",
"(",
"t",
")",
")",
";",
"}",
"if",
"(",
"CODE_CONTAINS_STRUCT",
"(",
"code",
",",
"TS_DECL_NON_COMMON",
")",
")",
"{",
"LTO_NO_PREVAIL",
"(",
"DECL_RESULT_FLD",
"(",
"t",
")",
")",
";",
"}",
"if",
"(",
"CODE_CONTAINS_STRUCT",
"(",
"code",
",",
"TS_FUNCTION_DECL",
")",
")",
"{",
"LTO_NO_PREVAIL",
"(",
"DECL_ARGUMENTS",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"DECL_FUNCTION_PERSONALITY",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"DECL_VINDEX",
"(",
"t",
")",
")",
";",
"}",
"if",
"(",
"CODE_CONTAINS_STRUCT",
"(",
"code",
",",
"TS_FIELD_DECL",
")",
")",
"{",
"LTO_SET_PREVAIL",
"(",
"DECL_FIELD_OFFSET",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"DECL_BIT_FIELD_TYPE",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"DECL_QUALIFIER",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"DECL_FIELD_BIT_OFFSET",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"DECL_FCONTEXT",
"(",
"t",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"TYPE_P",
"(",
"t",
")",
")",
"{",
"LTO_NO_PREVAIL",
"(",
"TYPE_CACHED_VALUES",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"TYPE_SIZE",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"TYPE_SIZE_UNIT",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"TYPE_ATTRIBUTES",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"TYPE_NAME",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"TYPE_MIN_VALUE_RAW",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"TYPE_MAX_VALUE_RAW",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"TYPE_LANG_SLOT_1",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"TYPE_CONTEXT",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"TYPE_CANONICAL",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"TYPE_MAIN_VARIANT",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"TYPE_NEXT_VARIANT",
"(",
"t",
")",
")",
";",
"}",
"else",
"if",
"(",
"EXPR_P",
"(",
"t",
")",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"TREE_OPERAND_LENGTH",
"(",
"t",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"LTO_SET_PREVAIL",
"(",
"TREE_OPERAND",
"(",
"t",
",",
"i",
")",
")",
";",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"CONSTRUCTOR",
")",
"{",
"unsigned",
"i",
";",
"tree",
"val",
";",
"FOR_EACH_CONSTRUCTOR_VALUE",
"(",
"CONSTRUCTOR_ELTS",
"(",
"t",
")",
",",
"i",
",",
"val",
")",
"",
"LTO_SET_PREVAIL",
"(",
"val",
")",
";",
"}",
"else",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"TREE_LIST",
":",
"LTO_SET_PREVAIL",
"(",
"TREE_VALUE",
"(",
"t",
")",
")",
";",
"LTO_SET_PREVAIL",
"(",
"TREE_PURPOSE",
"(",
"t",
")",
")",
";",
"LTO_NO_PREVAIL",
"(",
"TREE_PURPOSE",
"(",
"t",
")",
")",
";",
"break",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"}",
"gcc_checking_assert",
"(",
"fixed",
")",
";",
"}"
] | Given a tree T replace all fields referring to variables or functions
with their prevailing variant. | [
"Given",
"a",
"tree",
"T",
"replace",
"all",
"fields",
"referring",
"to",
"variables",
"or",
"functions",
"with",
"their",
"prevailing",
"variant",
"."
] | [
"/* lto_symtab_prevail_decl use TREE_CHAIN to link to the prevailing decl.\n\t in the case T is a prevailed declaration we would ICE here. */",
"/* If we fixed nothing, then we missed something seen by\n mentions_vars_p. */"
] | [
{
"param": "t",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_fixup_state | void | static void
lto_fixup_state (struct lto_in_decl_state *state)
{
unsigned i, si;
/* Although we only want to replace FUNCTION_DECLs and VAR_DECLs,
we still need to walk from all DECLs to find the reachable
FUNCTION_DECLs and VAR_DECLs. */
for (si = 0; si < LTO_N_DECL_STREAMS; si++)
{
vec<tree, va_gc> *trees = state->streams[si];
for (i = 0; i < vec_safe_length (trees); i++)
{
tree t = (*trees)[i];
if (flag_checking && TYPE_P (t))
verify_type (t);
if (VAR_OR_FUNCTION_DECL_P (t)
&& (TREE_PUBLIC (t) || DECL_EXTERNAL (t)))
(*trees)[i] = lto_symtab_prevailing_decl (t);
}
}
} | /* Helper function of lto_fixup_decls. Walks the var and fn streams in STATE,
replaces var and function decls with the corresponding prevailing def. */ | Helper function of lto_fixup_decls. Walks the var and fn streams in STATE,
replaces var and function decls with the corresponding prevailing def. | [
"Helper",
"function",
"of",
"lto_fixup_decls",
".",
"Walks",
"the",
"var",
"and",
"fn",
"streams",
"in",
"STATE",
"replaces",
"var",
"and",
"function",
"decls",
"with",
"the",
"corresponding",
"prevailing",
"def",
"."
] | static void
lto_fixup_state (struct lto_in_decl_state *state)
{
unsigned i, si;
for (si = 0; si < LTO_N_DECL_STREAMS; si++)
{
vec<tree, va_gc> *trees = state->streams[si];
for (i = 0; i < vec_safe_length (trees); i++)
{
tree t = (*trees)[i];
if (flag_checking && TYPE_P (t))
verify_type (t);
if (VAR_OR_FUNCTION_DECL_P (t)
&& (TREE_PUBLIC (t) || DECL_EXTERNAL (t)))
(*trees)[i] = lto_symtab_prevailing_decl (t);
}
}
} | [
"static",
"void",
"lto_fixup_state",
"(",
"struct",
"lto_in_decl_state",
"*",
"state",
")",
"{",
"unsigned",
"i",
",",
"si",
";",
"for",
"(",
"si",
"=",
"0",
";",
"si",
"<",
"LTO_N_DECL_STREAMS",
";",
"si",
"++",
")",
"{",
"vec",
"<",
"tree",
",",
"va_gc",
">",
"*",
"trees",
"=",
"state",
"->",
"streams",
"[",
"si",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"vec_safe_length",
"(",
"trees",
")",
";",
"i",
"++",
")",
"{",
"tree",
"t",
"=",
"(",
"*",
"trees",
")",
"[",
"i",
"]",
";",
"if",
"(",
"flag_checking",
"&&",
"TYPE_P",
"(",
"t",
")",
")",
"verify_type",
"(",
"t",
")",
";",
"if",
"(",
"VAR_OR_FUNCTION_DECL_P",
"(",
"t",
")",
"&&",
"(",
"TREE_PUBLIC",
"(",
"t",
")",
"||",
"DECL_EXTERNAL",
"(",
"t",
")",
")",
")",
"(",
"*",
"trees",
")",
"[",
"i",
"]",
"=",
"lto_symtab_prevailing_decl",
"(",
"t",
")",
";",
"}",
"}",
"}"
] | Helper function of lto_fixup_decls. | [
"Helper",
"function",
"of",
"lto_fixup_decls",
"."
] | [
"/* Although we only want to replace FUNCTION_DECLs and VAR_DECLs,\n we still need to walk from all DECLs to find the reachable\n FUNCTION_DECLs and VAR_DECLs. */"
] | [
{
"param": "state",
"type": "struct lto_in_decl_state"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "state",
"type": "struct lto_in_decl_state",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_flatten_files | void | static void
lto_flatten_files (struct lto_file_decl_data **orig, int count, int last_file_ix)
{
struct lto_file_decl_data *n, *next;
int i, k;
lto_stats.num_input_files = count;
all_file_decl_data
= ggc_cleared_vec_alloc<lto_file_decl_data_ptr> (count + 1);
/* Set the hooks so that all of the ipa passes can read in their data. */
lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data);
for (i = 0, k = 0; i < last_file_ix; i++)
{
for (n = orig[i]; n != NULL; n = next)
{
all_file_decl_data[k++] = n;
next = n->next;
n->next = NULL;
}
}
all_file_decl_data[k] = NULL;
gcc_assert (k == count);
} | /* Turn file datas for sub files into a single array, so that they look
like separate files for further passes. */ | Turn file datas for sub files into a single array, so that they look
like separate files for further passes. | [
"Turn",
"file",
"datas",
"for",
"sub",
"files",
"into",
"a",
"single",
"array",
"so",
"that",
"they",
"look",
"like",
"separate",
"files",
"for",
"further",
"passes",
"."
] | static void
lto_flatten_files (struct lto_file_decl_data **orig, int count, int last_file_ix)
{
struct lto_file_decl_data *n, *next;
int i, k;
lto_stats.num_input_files = count;
all_file_decl_data
= ggc_cleared_vec_alloc<lto_file_decl_data_ptr> (count + 1);
lto_set_in_hooks (all_file_decl_data, get_section_data, free_section_data);
for (i = 0, k = 0; i < last_file_ix; i++)
{
for (n = orig[i]; n != NULL; n = next)
{
all_file_decl_data[k++] = n;
next = n->next;
n->next = NULL;
}
}
all_file_decl_data[k] = NULL;
gcc_assert (k == count);
} | [
"static",
"void",
"lto_flatten_files",
"(",
"struct",
"lto_file_decl_data",
"*",
"*",
"orig",
",",
"int",
"count",
",",
"int",
"last_file_ix",
")",
"{",
"struct",
"lto_file_decl_data",
"*",
"n",
",",
"*",
"next",
";",
"int",
"i",
",",
"k",
";",
"lto_stats",
".",
"num_input_files",
"=",
"count",
";",
"all_file_decl_data",
"=",
"ggc_cleared_vec_alloc",
"<",
"lto_file_decl_data_ptr",
">",
"(",
"count",
"+",
"1",
")",
";",
"lto_set_in_hooks",
"(",
"all_file_decl_data",
",",
"get_section_data",
",",
"free_section_data",
")",
";",
"for",
"(",
"i",
"=",
"0",
",",
"k",
"=",
"0",
";",
"i",
"<",
"last_file_ix",
";",
"i",
"++",
")",
"{",
"for",
"(",
"n",
"=",
"orig",
"[",
"i",
"]",
";",
"n",
"!=",
"NULL",
";",
"n",
"=",
"next",
")",
"{",
"all_file_decl_data",
"[",
"k",
"++",
"]",
"=",
"n",
";",
"next",
"=",
"n",
"->",
"next",
";",
"n",
"->",
"next",
"=",
"NULL",
";",
"}",
"}",
"all_file_decl_data",
"[",
"k",
"]",
"=",
"NULL",
";",
"gcc_assert",
"(",
"k",
"==",
"count",
")",
";",
"}"
] | Turn file datas for sub files into a single array, so that they look
like separate files for further passes. | [
"Turn",
"file",
"datas",
"for",
"sub",
"files",
"into",
"a",
"single",
"array",
"so",
"that",
"they",
"look",
"like",
"separate",
"files",
"for",
"further",
"passes",
"."
] | [
"/* Set the hooks so that all of the ipa passes can read in their data. */"
] | [
{
"param": "orig",
"type": "struct lto_file_decl_data"
},
{
"param": "count",
"type": "int"
},
{
"param": "last_file_ix",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "orig",
"type": "struct lto_file_decl_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "count",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "last_file_ix",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | materialize_cgraph | void | static void
materialize_cgraph (void)
{
struct cgraph_node *node;
timevar_id_t lto_timer;
if (!quiet_flag)
fprintf (stderr,
flag_wpa ? "Materializing decls:" : "Reading function bodies:");
FOR_EACH_FUNCTION (node)
{
if (node->lto_file_data)
{
lto_materialize_function (node);
lto_stats.num_input_cgraph_nodes++;
}
}
/* Start the appropriate timer depending on the mode that we are
operating in. */
lto_timer = (flag_wpa) ? TV_WHOPR_WPA
: (flag_ltrans) ? TV_WHOPR_LTRANS
: TV_LTO;
timevar_push (lto_timer);
current_function_decl = NULL;
set_cfun (NULL);
if (!quiet_flag)
fprintf (stderr, "\n");
timevar_pop (lto_timer);
} | /* Materialize all the bodies for all the nodes in the callgraph. */ | Materialize all the bodies for all the nodes in the callgraph. | [
"Materialize",
"all",
"the",
"bodies",
"for",
"all",
"the",
"nodes",
"in",
"the",
"callgraph",
"."
] | static void
materialize_cgraph (void)
{
struct cgraph_node *node;
timevar_id_t lto_timer;
if (!quiet_flag)
fprintf (stderr,
flag_wpa ? "Materializing decls:" : "Reading function bodies:");
FOR_EACH_FUNCTION (node)
{
if (node->lto_file_data)
{
lto_materialize_function (node);
lto_stats.num_input_cgraph_nodes++;
}
}
lto_timer = (flag_wpa) ? TV_WHOPR_WPA
: (flag_ltrans) ? TV_WHOPR_LTRANS
: TV_LTO;
timevar_push (lto_timer);
current_function_decl = NULL;
set_cfun (NULL);
if (!quiet_flag)
fprintf (stderr, "\n");
timevar_pop (lto_timer);
} | [
"static",
"void",
"materialize_cgraph",
"(",
"void",
")",
"{",
"struct",
"cgraph_node",
"*",
"node",
";",
"timevar_id_t",
"lto_timer",
";",
"if",
"(",
"!",
"quiet_flag",
")",
"fprintf",
"(",
"stderr",
",",
"flag_wpa",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"FOR_EACH_FUNCTION",
"(",
"node",
")",
"{",
"if",
"(",
"node",
"->",
"lto_file_data",
")",
"{",
"lto_materialize_function",
"(",
"node",
")",
";",
"lto_stats",
".",
"num_input_cgraph_nodes",
"++",
";",
"}",
"}",
"lto_timer",
"=",
"(",
"flag_wpa",
")",
"?",
"TV_WHOPR_WPA",
":",
"(",
"flag_ltrans",
")",
"?",
"TV_WHOPR_LTRANS",
":",
"TV_LTO",
";",
"timevar_push",
"(",
"lto_timer",
")",
";",
"current_function_decl",
"=",
"NULL",
";",
"set_cfun",
"(",
"NULL",
")",
";",
"if",
"(",
"!",
"quiet_flag",
")",
"fprintf",
"(",
"stderr",
",",
"\"",
"\\n",
"\"",
")",
";",
"timevar_pop",
"(",
"lto_timer",
")",
";",
"}"
] | Materialize all the bodies for all the nodes in the callgraph. | [
"Materialize",
"all",
"the",
"bodies",
"for",
"all",
"the",
"nodes",
"in",
"the",
"callgraph",
"."
] | [
"/* Start the appropriate timer depending on the mode that we are\n operating in. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_eh_personality | tree | tree
lto_eh_personality (void)
{
if (!lto_eh_personality_decl)
{
/* Use the first personality DECL for our personality if we don't
support multiple ones. This ensures that we don't artificially
create the need for them in a single-language program. */
if (first_personality_decl && !dwarf2out_do_cfi_asm ())
lto_eh_personality_decl = first_personality_decl;
else
lto_eh_personality_decl = lhd_gcc_personality ();
}
return lto_eh_personality_decl;
} | /* Return the LTO personality function decl. */ | Return the LTO personality function decl. | [
"Return",
"the",
"LTO",
"personality",
"function",
"decl",
"."
] | tree
lto_eh_personality (void)
{
if (!lto_eh_personality_decl)
{
if (first_personality_decl && !dwarf2out_do_cfi_asm ())
lto_eh_personality_decl = first_personality_decl;
else
lto_eh_personality_decl = lhd_gcc_personality ();
}
return lto_eh_personality_decl;
} | [
"tree",
"lto_eh_personality",
"(",
"void",
")",
"{",
"if",
"(",
"!",
"lto_eh_personality_decl",
")",
"{",
"if",
"(",
"first_personality_decl",
"&&",
"!",
"dwarf2out_do_cfi_asm",
"(",
")",
")",
"lto_eh_personality_decl",
"=",
"first_personality_decl",
";",
"else",
"lto_eh_personality_decl",
"=",
"lhd_gcc_personality",
"(",
")",
";",
"}",
"return",
"lto_eh_personality_decl",
";",
"}"
] | Return the LTO personality function decl. | [
"Return",
"the",
"LTO",
"personality",
"function",
"decl",
"."
] | [
"/* Use the first personality DECL for our personality if we don't\n\t support multiple ones. This ensures that we don't artificially\n\t create the need for them in a single-language program. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d2ccaf676893785a60c31c58f13163d2e1b9c1ca | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/lto/lto.c | [
"BSD-3-Clause"
] | C | lto_process_name | void | static void
lto_process_name (void)
{
if (flag_lto)
setproctitle ("lto1-lto");
if (flag_wpa)
setproctitle ("lto1-wpa");
if (flag_ltrans)
setproctitle ("lto1-ltrans");
} | /* Set the process name based on the LTO mode. */ | Set the process name based on the LTO mode. | [
"Set",
"the",
"process",
"name",
"based",
"on",
"the",
"LTO",
"mode",
"."
] | static void
lto_process_name (void)
{
if (flag_lto)
setproctitle ("lto1-lto");
if (flag_wpa)
setproctitle ("lto1-wpa");
if (flag_ltrans)
setproctitle ("lto1-ltrans");
} | [
"static",
"void",
"lto_process_name",
"(",
"void",
")",
"{",
"if",
"(",
"flag_lto",
")",
"setproctitle",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"flag_wpa",
")",
"setproctitle",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"flag_ltrans",
")",
"setproctitle",
"(",
"\"",
"\"",
")",
";",
"}"
] | Set the process name based on the LTO mode. | [
"Set",
"the",
"process",
"name",
"based",
"on",
"the",
"LTO",
"mode",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3775bbe744d37980b22ec3876ffb9a783db8f8bc | atrens/DragonFlyBSD-src | sys/dev/sound/unit.c | [
"BSD-3-Clause"
] | C | snd_unit_init | void | void
snd_unit_init(void)
{
int i;
if (snd_unit_initialized != 0)
return;
snd_unit_initialized = 1;
if (kgetenv_int("hw.snd.maxunit", &i) != 0) {
if (i < SND_UNIT_UMIN)
i = SND_UNIT_UMIN;
else if (i > SND_UNIT_UMAX)
i = SND_UNIT_UMAX;
else
i = roundup2(i, 2);
for (snd_u_shift = 0; (i >> (snd_u_shift + 1)) != 0;
snd_u_shift++)
;
/*
* Make room for channels/clones allocation unit
* to fit within 24bit MAXMINOR limit.
*/
snd_c_shift = 24 - snd_u_shift - snd_d_shift;
}
if (bootverbose != 0)
kprintf("%s() u=0x%08x [%d] d=0x%08x [%d] c=0x%08x [%d]\n",
__func__, SND_U_MASK, snd_max_u() + 1,
SND_D_MASK, snd_max_d() + 1, SND_C_MASK, snd_max_c() + 1);
} | /*
* This *must* be called first before any of the functions above!!!
*/ | This *must* be called first before any of the functions above | [
"This",
"*",
"must",
"*",
"be",
"called",
"first",
"before",
"any",
"of",
"the",
"functions",
"above"
] | void
snd_unit_init(void)
{
int i;
if (snd_unit_initialized != 0)
return;
snd_unit_initialized = 1;
if (kgetenv_int("hw.snd.maxunit", &i) != 0) {
if (i < SND_UNIT_UMIN)
i = SND_UNIT_UMIN;
else if (i > SND_UNIT_UMAX)
i = SND_UNIT_UMAX;
else
i = roundup2(i, 2);
for (snd_u_shift = 0; (i >> (snd_u_shift + 1)) != 0;
snd_u_shift++)
;
snd_c_shift = 24 - snd_u_shift - snd_d_shift;
}
if (bootverbose != 0)
kprintf("%s() u=0x%08x [%d] d=0x%08x [%d] c=0x%08x [%d]\n",
__func__, SND_U_MASK, snd_max_u() + 1,
SND_D_MASK, snd_max_d() + 1, SND_C_MASK, snd_max_c() + 1);
} | [
"void",
"snd_unit_init",
"(",
"void",
")",
"{",
"int",
"i",
";",
"if",
"(",
"snd_unit_initialized",
"!=",
"0",
")",
"return",
";",
"snd_unit_initialized",
"=",
"1",
";",
"if",
"(",
"kgetenv_int",
"(",
"\"",
"\"",
",",
"&",
"i",
")",
"!=",
"0",
")",
"{",
"if",
"(",
"i",
"<",
"SND_UNIT_UMIN",
")",
"i",
"=",
"SND_UNIT_UMIN",
";",
"else",
"if",
"(",
"i",
">",
"SND_UNIT_UMAX",
")",
"i",
"=",
"SND_UNIT_UMAX",
";",
"else",
"i",
"=",
"roundup2",
"(",
"i",
",",
"2",
")",
";",
"for",
"(",
"snd_u_shift",
"=",
"0",
";",
"(",
"i",
">>",
"(",
"snd_u_shift",
"+",
"1",
")",
")",
"!=",
"0",
";",
"snd_u_shift",
"++",
")",
";",
"snd_c_shift",
"=",
"24",
"-",
"snd_u_shift",
"-",
"snd_d_shift",
";",
"}",
"if",
"(",
"bootverbose",
"!=",
"0",
")",
"kprintf",
"(",
"\"",
"\\n",
"\"",
",",
"__func__",
",",
"SND_U_MASK",
",",
"snd_max_u",
"(",
")",
"+",
"1",
",",
"SND_D_MASK",
",",
"snd_max_d",
"(",
")",
"+",
"1",
",",
"SND_C_MASK",
",",
"snd_max_c",
"(",
")",
"+",
"1",
")",
";",
"}"
] | This *must* be called first before any of the functions above!! | [
"This",
"*",
"must",
"*",
"be",
"called",
"first",
"before",
"any",
"of",
"the",
"functions",
"above!!"
] | [
"/*\n\t\t * Make room for channels/clones allocation unit\n\t\t * to fit within 24bit MAXMINOR limit.\n\t\t */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
8760e64e3e9ad2fe000bb7ee937083eeaa3bd2a9 | atrens/DragonFlyBSD-src | sys/dev/drm/radeon/radeon_bios.c | [
"BSD-3-Clause"
] | C | radeon_atrm_call | int | static int radeon_atrm_call(ACPI_HANDLE atrm_handle, uint8_t *bios,
int offset, int len)
{
ACPI_STATUS status;
ACPI_OBJECT atrm_arg_elements[2], *obj;
ACPI_OBJECT_LIST atrm_arg;
ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER, NULL};
atrm_arg.Count = 2;
atrm_arg.Pointer = &atrm_arg_elements[0];
atrm_arg_elements[0].Type = ACPI_TYPE_INTEGER;
atrm_arg_elements[0].Integer.Value = offset;
atrm_arg_elements[1].Type = ACPI_TYPE_INTEGER;
atrm_arg_elements[1].Integer.Value = len;
status = AcpiEvaluateObject(atrm_handle, NULL, &atrm_arg, &buffer);
if (ACPI_FAILURE(status)) {
printk("failed to evaluate ATRM got %s\n", AcpiFormatException(status));
return -ENODEV;
}
obj = (ACPI_OBJECT *)buffer.Pointer;
memcpy(bios+offset, obj->Buffer.Pointer, obj->Buffer.Length);
len = obj->Buffer.Length;
AcpiOsFree(buffer.Pointer);
return len;
} | /**
* radeon_atrm_call - fetch a chunk of the vbios
*
* @atrm_handle: acpi ATRM handle
* @bios: vbios image pointer
* @offset: offset of vbios image data to fetch
* @len: length of vbios image data to fetch
*
* Executes ATRM to fetch a chunk of the discrete
* vbios image on PX systems (all asics).
* Returns the length of the buffer fetched.
*/ | fetch a chunk of the vbios
@atrm_handle: acpi ATRM handle
@bios: vbios image pointer
@offset: offset of vbios image data to fetch
@len: length of vbios image data to fetch
Executes ATRM to fetch a chunk of the discrete
vbios image on PX systems (all asics).
Returns the length of the buffer fetched. | [
"fetch",
"a",
"chunk",
"of",
"the",
"vbios",
"@atrm_handle",
":",
"acpi",
"ATRM",
"handle",
"@bios",
":",
"vbios",
"image",
"pointer",
"@offset",
":",
"offset",
"of",
"vbios",
"image",
"data",
"to",
"fetch",
"@len",
":",
"length",
"of",
"vbios",
"image",
"data",
"to",
"fetch",
"Executes",
"ATRM",
"to",
"fetch",
"a",
"chunk",
"of",
"the",
"discrete",
"vbios",
"image",
"on",
"PX",
"systems",
"(",
"all",
"asics",
")",
".",
"Returns",
"the",
"length",
"of",
"the",
"buffer",
"fetched",
"."
] | static int radeon_atrm_call(ACPI_HANDLE atrm_handle, uint8_t *bios,
int offset, int len)
{
ACPI_STATUS status;
ACPI_OBJECT atrm_arg_elements[2], *obj;
ACPI_OBJECT_LIST atrm_arg;
ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER, NULL};
atrm_arg.Count = 2;
atrm_arg.Pointer = &atrm_arg_elements[0];
atrm_arg_elements[0].Type = ACPI_TYPE_INTEGER;
atrm_arg_elements[0].Integer.Value = offset;
atrm_arg_elements[1].Type = ACPI_TYPE_INTEGER;
atrm_arg_elements[1].Integer.Value = len;
status = AcpiEvaluateObject(atrm_handle, NULL, &atrm_arg, &buffer);
if (ACPI_FAILURE(status)) {
printk("failed to evaluate ATRM got %s\n", AcpiFormatException(status));
return -ENODEV;
}
obj = (ACPI_OBJECT *)buffer.Pointer;
memcpy(bios+offset, obj->Buffer.Pointer, obj->Buffer.Length);
len = obj->Buffer.Length;
AcpiOsFree(buffer.Pointer);
return len;
} | [
"static",
"int",
"radeon_atrm_call",
"(",
"ACPI_HANDLE",
"atrm_handle",
",",
"uint8_t",
"*",
"bios",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"ACPI_STATUS",
"status",
";",
"ACPI_OBJECT",
"atrm_arg_elements",
"[",
"2",
"]",
",",
"*",
"obj",
";",
"ACPI_OBJECT_LIST",
"atrm_arg",
";",
"ACPI_BUFFER",
"buffer",
"=",
"{",
"ACPI_ALLOCATE_BUFFER",
",",
"NULL",
"}",
";",
"atrm_arg",
".",
"Count",
"=",
"2",
";",
"atrm_arg",
".",
"Pointer",
"=",
"&",
"atrm_arg_elements",
"[",
"0",
"]",
";",
"atrm_arg_elements",
"[",
"0",
"]",
".",
"Type",
"=",
"ACPI_TYPE_INTEGER",
";",
"atrm_arg_elements",
"[",
"0",
"]",
".",
"Integer",
".",
"Value",
"=",
"offset",
";",
"atrm_arg_elements",
"[",
"1",
"]",
".",
"Type",
"=",
"ACPI_TYPE_INTEGER",
";",
"atrm_arg_elements",
"[",
"1",
"]",
".",
"Integer",
".",
"Value",
"=",
"len",
";",
"status",
"=",
"AcpiEvaluateObject",
"(",
"atrm_handle",
",",
"NULL",
",",
"&",
"atrm_arg",
",",
"&",
"buffer",
")",
";",
"if",
"(",
"ACPI_FAILURE",
"(",
"status",
")",
")",
"{",
"printk",
"(",
"\"",
"\\n",
"\"",
",",
"AcpiFormatException",
"(",
"status",
")",
")",
";",
"return",
"-",
"ENODEV",
";",
"}",
"obj",
"=",
"(",
"ACPI_OBJECT",
"*",
")",
"buffer",
".",
"Pointer",
";",
"memcpy",
"(",
"bios",
"+",
"offset",
",",
"obj",
"->",
"Buffer",
".",
"Pointer",
",",
"obj",
"->",
"Buffer",
".",
"Length",
")",
";",
"len",
"=",
"obj",
"->",
"Buffer",
".",
"Length",
";",
"AcpiOsFree",
"(",
"buffer",
".",
"Pointer",
")",
";",
"return",
"len",
";",
"}"
] | radeon_atrm_call - fetch a chunk of the vbios
@atrm_handle: acpi ATRM handle
@bios: vbios image pointer
@offset: offset of vbios image data to fetch
@len: length of vbios image data to fetch | [
"radeon_atrm_call",
"-",
"fetch",
"a",
"chunk",
"of",
"the",
"vbios",
"@atrm_handle",
":",
"acpi",
"ATRM",
"handle",
"@bios",
":",
"vbios",
"image",
"pointer",
"@offset",
":",
"offset",
"of",
"vbios",
"image",
"data",
"to",
"fetch",
"@len",
":",
"length",
"of",
"vbios",
"image",
"data",
"to",
"fetch"
] | [] | [
{
"param": "atrm_handle",
"type": "ACPI_HANDLE"
},
{
"param": "bios",
"type": "uint8_t"
},
{
"param": "offset",
"type": "int"
},
{
"param": "len",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "atrm_handle",
"type": "ACPI_HANDLE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bios",
"type": "uint8_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "len",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31e9badbb3b91ee15766b4d9e7f39f6c403bef3f | atrens/DragonFlyBSD-src | usr.sbin/ypserv/yp_dnslookup.c | [
"BSD-3-Clause"
] | C | yp_prune_dnsq | void | void
yp_prune_dnsq(void)
{
struct circleq_dnsentry *q, *n;
q = TAILQ_FIRST(&qhead);
while (q != NULL) {
q->ttl--;
n = TAILQ_NEXT(q, links);
if (!q->ttl) {
TAILQ_REMOVE(&qhead, q, links);
free(q->name);
free(q);
pending--;
}
q = n;
}
if (pending < 0)
pending = 0;
return;
} | /*
* Decrement TTL on all queue entries, possibly nuking
* any that have been around too long without being serviced.
*/ | Decrement TTL on all queue entries, possibly nuking
any that have been around too long without being serviced. | [
"Decrement",
"TTL",
"on",
"all",
"queue",
"entries",
"possibly",
"nuking",
"any",
"that",
"have",
"been",
"around",
"too",
"long",
"without",
"being",
"serviced",
"."
] | void
yp_prune_dnsq(void)
{
struct circleq_dnsentry *q, *n;
q = TAILQ_FIRST(&qhead);
while (q != NULL) {
q->ttl--;
n = TAILQ_NEXT(q, links);
if (!q->ttl) {
TAILQ_REMOVE(&qhead, q, links);
free(q->name);
free(q);
pending--;
}
q = n;
}
if (pending < 0)
pending = 0;
return;
} | [
"void",
"yp_prune_dnsq",
"(",
"void",
")",
"{",
"struct",
"circleq_dnsentry",
"*",
"q",
",",
"*",
"n",
";",
"q",
"=",
"TAILQ_FIRST",
"(",
"&",
"qhead",
")",
";",
"while",
"(",
"q",
"!=",
"NULL",
")",
"{",
"q",
"->",
"ttl",
"--",
";",
"n",
"=",
"TAILQ_NEXT",
"(",
"q",
",",
"links",
")",
";",
"if",
"(",
"!",
"q",
"->",
"ttl",
")",
"{",
"TAILQ_REMOVE",
"(",
"&",
"qhead",
",",
"q",
",",
"links",
")",
";",
"free",
"(",
"q",
"->",
"name",
")",
";",
"free",
"(",
"q",
")",
";",
"pending",
"--",
";",
"}",
"q",
"=",
"n",
";",
"}",
"if",
"(",
"pending",
"<",
"0",
")",
"pending",
"=",
"0",
";",
"return",
";",
"}"
] | Decrement TTL on all queue entries, possibly nuking
any that have been around too long without being serviced. | [
"Decrement",
"TTL",
"on",
"all",
"queue",
"entries",
"possibly",
"nuking",
"any",
"that",
"have",
"been",
"around",
"too",
"long",
"without",
"being",
"serviced",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
31e9badbb3b91ee15766b4d9e7f39f6c403bef3f | atrens/DragonFlyBSD-src | usr.sbin/ypserv/yp_dnslookup.c | [
"BSD-3-Clause"
] | C | yp_run_dnsq | void | void
yp_run_dnsq(void)
{
struct circleq_dnsentry *q;
char buf[sizeof(HEADER) + MAXPACKET];
struct sockaddr_in sin;
socklen_t len;
int rval;
HEADER *hptr;
struct hostent *hent;
if (debug)
yp_error("running dns queue");
bzero(buf, sizeof(buf));
len = sizeof(struct sockaddr_in);
rval = recvfrom(resfd, buf, sizeof(buf), 0,
(struct sockaddr *)&sin, &len);
if (rval == -1) {
yp_error("recvfrom failed: %s", strerror(errno));
return;
}
/*
* We may have data left in the socket that represents
* replies to earlier queries that we don't care about
* anymore. If there are no lookups pending or the packet
* ID doesn't match any of the queue IDs, just drop it
* on the floor.
*/
hptr = (HEADER *)&buf;
if (!pending ||
(q = yp_find_dnsqent(ntohs(hptr->id), BY_DNS_ID)) == NULL) {
/* ignore */
return;
}
if (debug)
yp_error("got dns reply from %s", inet_ntoa(sin.sin_addr));
hent = __dns_getanswer(buf, rval, q->name, q->type);
if (hent != NULL) {
if (q->type == T_PTR) {
hent->h_addr = (char *)q->addr;
hent->h_addrtype = q->addrtype;
hent->h_length = q->addrlen;
}
}
/* Got an answer ready for a client -- send it off. */
yp_send_dns_reply(q, parse(hent));
pending--;
TAILQ_REMOVE(&qhead, q, links);
free(q->name);
free(q);
/* Decrement TTLs on other entries while we're here. */
yp_prune_dnsq();
return;
} | /*
* Data is pending on the DNS socket; check for valid replies
* to our queries and dispatch them to waiting clients.
*/ | Data is pending on the DNS socket; check for valid replies
to our queries and dispatch them to waiting clients. | [
"Data",
"is",
"pending",
"on",
"the",
"DNS",
"socket",
";",
"check",
"for",
"valid",
"replies",
"to",
"our",
"queries",
"and",
"dispatch",
"them",
"to",
"waiting",
"clients",
"."
] | void
yp_run_dnsq(void)
{
struct circleq_dnsentry *q;
char buf[sizeof(HEADER) + MAXPACKET];
struct sockaddr_in sin;
socklen_t len;
int rval;
HEADER *hptr;
struct hostent *hent;
if (debug)
yp_error("running dns queue");
bzero(buf, sizeof(buf));
len = sizeof(struct sockaddr_in);
rval = recvfrom(resfd, buf, sizeof(buf), 0,
(struct sockaddr *)&sin, &len);
if (rval == -1) {
yp_error("recvfrom failed: %s", strerror(errno));
return;
}
hptr = (HEADER *)&buf;
if (!pending ||
(q = yp_find_dnsqent(ntohs(hptr->id), BY_DNS_ID)) == NULL) {
return;
}
if (debug)
yp_error("got dns reply from %s", inet_ntoa(sin.sin_addr));
hent = __dns_getanswer(buf, rval, q->name, q->type);
if (hent != NULL) {
if (q->type == T_PTR) {
hent->h_addr = (char *)q->addr;
hent->h_addrtype = q->addrtype;
hent->h_length = q->addrlen;
}
}
yp_send_dns_reply(q, parse(hent));
pending--;
TAILQ_REMOVE(&qhead, q, links);
free(q->name);
free(q);
yp_prune_dnsq();
return;
} | [
"void",
"yp_run_dnsq",
"(",
"void",
")",
"{",
"struct",
"circleq_dnsentry",
"*",
"q",
";",
"char",
"buf",
"[",
"sizeof",
"(",
"HEADER",
")",
"+",
"MAXPACKET",
"]",
";",
"struct",
"sockaddr_in",
"sin",
";",
"socklen_t",
"len",
";",
"int",
"rval",
";",
"HEADER",
"*",
"hptr",
";",
"struct",
"hostent",
"*",
"hent",
";",
"if",
"(",
"debug",
")",
"yp_error",
"(",
"\"",
"\"",
")",
";",
"bzero",
"(",
"buf",
",",
"sizeof",
"(",
"buf",
")",
")",
";",
"len",
"=",
"sizeof",
"(",
"struct",
"sockaddr_in",
")",
";",
"rval",
"=",
"recvfrom",
"(",
"resfd",
",",
"buf",
",",
"sizeof",
"(",
"buf",
")",
",",
"0",
",",
"(",
"struct",
"sockaddr",
"*",
")",
"&",
"sin",
",",
"&",
"len",
")",
";",
"if",
"(",
"rval",
"==",
"-1",
")",
"{",
"yp_error",
"(",
"\"",
"\"",
",",
"strerror",
"(",
"errno",
")",
")",
";",
"return",
";",
"}",
"hptr",
"=",
"(",
"HEADER",
"*",
")",
"&",
"buf",
";",
"if",
"(",
"!",
"pending",
"||",
"(",
"q",
"=",
"yp_find_dnsqent",
"(",
"ntohs",
"(",
"hptr",
"->",
"id",
")",
",",
"BY_DNS_ID",
")",
")",
"==",
"NULL",
")",
"{",
"return",
";",
"}",
"if",
"(",
"debug",
")",
"yp_error",
"(",
"\"",
"\"",
",",
"inet_ntoa",
"(",
"sin",
".",
"sin_addr",
")",
")",
";",
"hent",
"=",
"__dns_getanswer",
"(",
"buf",
",",
"rval",
",",
"q",
"->",
"name",
",",
"q",
"->",
"type",
")",
";",
"if",
"(",
"hent",
"!=",
"NULL",
")",
"{",
"if",
"(",
"q",
"->",
"type",
"==",
"T_PTR",
")",
"{",
"hent",
"->",
"h_addr",
"=",
"(",
"char",
"*",
")",
"q",
"->",
"addr",
";",
"hent",
"->",
"h_addrtype",
"=",
"q",
"->",
"addrtype",
";",
"hent",
"->",
"h_length",
"=",
"q",
"->",
"addrlen",
";",
"}",
"}",
"yp_send_dns_reply",
"(",
"q",
",",
"parse",
"(",
"hent",
")",
")",
";",
"pending",
"--",
";",
"TAILQ_REMOVE",
"(",
"&",
"qhead",
",",
"q",
",",
"links",
")",
";",
"free",
"(",
"q",
"->",
"name",
")",
";",
"free",
"(",
"q",
")",
";",
"yp_prune_dnsq",
"(",
")",
";",
"return",
";",
"}"
] | Data is pending on the DNS socket; check for valid replies
to our queries and dispatch them to waiting clients. | [
"Data",
"is",
"pending",
"on",
"the",
"DNS",
"socket",
";",
"check",
"for",
"valid",
"replies",
"to",
"our",
"queries",
"and",
"dispatch",
"them",
"to",
"waiting",
"clients",
"."
] | [
"/*\n\t * We may have data left in the socket that represents\n\t * replies to earlier queries that we don't care about\n\t * anymore. If there are no lookups pending or the packet\n\t * ID doesn't match any of the queue IDs, just drop it\n\t * on the floor.\n\t */",
"/* ignore */",
"/* Got an answer ready for a client -- send it off. */",
"/* Decrement TTLs on other entries while we're here. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
31e9badbb3b91ee15766b4d9e7f39f6c403bef3f | atrens/DragonFlyBSD-src | usr.sbin/ypserv/yp_dnslookup.c | [
"BSD-3-Clause"
] | C | yp_async_lookup_name | ypstat | ypstat
yp_async_lookup_name(struct svc_req *rqstp, char *name, int af)
{
struct circleq_dnsentry *q;
socklen_t len;
int type;
/* Check for SOCK_DGRAM or SOCK_STREAM -- we need to know later */
type = -1;
len = sizeof(type);
if (getsockopt(rqstp->rq_xprt->xp_fd, SOL_SOCKET,
SO_TYPE, &type, &len) == -1) {
yp_error("getsockopt failed: %s", strerror(errno));
return(YP_YPERR);
}
/* Avoid transmitting dupe requests. */
if (type == SOCK_DGRAM &&
yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL)
return(YP_TRUE);
if ((q = yp_malloc_dnsent()) == NULL)
return(YP_YPERR);
q->type = (af == AF_INET) ? T_A : T_AAAA;
q->ttl = DEF_TTL;
q->xprt = rqstp->rq_xprt;
q->ypvers = rqstp->rq_vers;
q->prot_type = type;
if (q->prot_type == SOCK_DGRAM)
q->xid = svcudp_get_xid(q->xprt);
q->client_addr = q->xprt->xp_raddr;
q->domain = _res.dnsrch;
q->id = yp_send_dns_query(name, q->type);
if (q->id == 0) {
yp_error("DNS query failed");
free(q);
return(YP_YPERR);
}
q->name = strdup(name);
TAILQ_INSERT_HEAD(&qhead, q, links);
pending++;
if (debug)
yp_error("queueing async DNS name lookup (%lu)", q->id);
yp_prune_dnsq();
return(YP_TRUE);
} | /*
* Queue and transmit an asynchronous DNS hostname lookup.
*/ | Queue and transmit an asynchronous DNS hostname lookup. | [
"Queue",
"and",
"transmit",
"an",
"asynchronous",
"DNS",
"hostname",
"lookup",
"."
] | ypstat
yp_async_lookup_name(struct svc_req *rqstp, char *name, int af)
{
struct circleq_dnsentry *q;
socklen_t len;
int type;
type = -1;
len = sizeof(type);
if (getsockopt(rqstp->rq_xprt->xp_fd, SOL_SOCKET,
SO_TYPE, &type, &len) == -1) {
yp_error("getsockopt failed: %s", strerror(errno));
return(YP_YPERR);
}
if (type == SOCK_DGRAM &&
yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL)
return(YP_TRUE);
if ((q = yp_malloc_dnsent()) == NULL)
return(YP_YPERR);
q->type = (af == AF_INET) ? T_A : T_AAAA;
q->ttl = DEF_TTL;
q->xprt = rqstp->rq_xprt;
q->ypvers = rqstp->rq_vers;
q->prot_type = type;
if (q->prot_type == SOCK_DGRAM)
q->xid = svcudp_get_xid(q->xprt);
q->client_addr = q->xprt->xp_raddr;
q->domain = _res.dnsrch;
q->id = yp_send_dns_query(name, q->type);
if (q->id == 0) {
yp_error("DNS query failed");
free(q);
return(YP_YPERR);
}
q->name = strdup(name);
TAILQ_INSERT_HEAD(&qhead, q, links);
pending++;
if (debug)
yp_error("queueing async DNS name lookup (%lu)", q->id);
yp_prune_dnsq();
return(YP_TRUE);
} | [
"ypstat",
"yp_async_lookup_name",
"(",
"struct",
"svc_req",
"*",
"rqstp",
",",
"char",
"*",
"name",
",",
"int",
"af",
")",
"{",
"struct",
"circleq_dnsentry",
"*",
"q",
";",
"socklen_t",
"len",
";",
"int",
"type",
";",
"type",
"=",
"-1",
";",
"len",
"=",
"sizeof",
"(",
"type",
")",
";",
"if",
"(",
"getsockopt",
"(",
"rqstp",
"->",
"rq_xprt",
"->",
"xp_fd",
",",
"SOL_SOCKET",
",",
"SO_TYPE",
",",
"&",
"type",
",",
"&",
"len",
")",
"==",
"-1",
")",
"{",
"yp_error",
"(",
"\"",
"\"",
",",
"strerror",
"(",
"errno",
")",
")",
";",
"return",
"(",
"YP_YPERR",
")",
";",
"}",
"if",
"(",
"type",
"==",
"SOCK_DGRAM",
"&&",
"yp_find_dnsqent",
"(",
"svcudp_get_xid",
"(",
"rqstp",
"->",
"rq_xprt",
")",
",",
"BY_RPC_XID",
")",
"!=",
"NULL",
")",
"return",
"(",
"YP_TRUE",
")",
";",
"if",
"(",
"(",
"q",
"=",
"yp_malloc_dnsent",
"(",
")",
")",
"==",
"NULL",
")",
"return",
"(",
"YP_YPERR",
")",
";",
"q",
"->",
"type",
"=",
"(",
"af",
"==",
"AF_INET",
")",
"?",
"T_A",
":",
"T_AAAA",
";",
"q",
"->",
"ttl",
"=",
"DEF_TTL",
";",
"q",
"->",
"xprt",
"=",
"rqstp",
"->",
"rq_xprt",
";",
"q",
"->",
"ypvers",
"=",
"rqstp",
"->",
"rq_vers",
";",
"q",
"->",
"prot_type",
"=",
"type",
";",
"if",
"(",
"q",
"->",
"prot_type",
"==",
"SOCK_DGRAM",
")",
"q",
"->",
"xid",
"=",
"svcudp_get_xid",
"(",
"q",
"->",
"xprt",
")",
";",
"q",
"->",
"client_addr",
"=",
"q",
"->",
"xprt",
"->",
"xp_raddr",
";",
"q",
"->",
"domain",
"=",
"_res",
".",
"dnsrch",
";",
"q",
"->",
"id",
"=",
"yp_send_dns_query",
"(",
"name",
",",
"q",
"->",
"type",
")",
";",
"if",
"(",
"q",
"->",
"id",
"==",
"0",
")",
"{",
"yp_error",
"(",
"\"",
"\"",
")",
";",
"free",
"(",
"q",
")",
";",
"return",
"(",
"YP_YPERR",
")",
";",
"}",
"q",
"->",
"name",
"=",
"strdup",
"(",
"name",
")",
";",
"TAILQ_INSERT_HEAD",
"(",
"&",
"qhead",
",",
"q",
",",
"links",
")",
";",
"pending",
"++",
";",
"if",
"(",
"debug",
")",
"yp_error",
"(",
"\"",
"\"",
",",
"q",
"->",
"id",
")",
";",
"yp_prune_dnsq",
"(",
")",
";",
"return",
"(",
"YP_TRUE",
")",
";",
"}"
] | Queue and transmit an asynchronous DNS hostname lookup. | [
"Queue",
"and",
"transmit",
"an",
"asynchronous",
"DNS",
"hostname",
"lookup",
"."
] | [
"/* Check for SOCK_DGRAM or SOCK_STREAM -- we need to know later */",
"/* Avoid transmitting dupe requests. */"
] | [
{
"param": "rqstp",
"type": "struct svc_req"
},
{
"param": "name",
"type": "char"
},
{
"param": "af",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rqstp",
"type": "struct svc_req",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "af",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31e9badbb3b91ee15766b4d9e7f39f6c403bef3f | atrens/DragonFlyBSD-src | usr.sbin/ypserv/yp_dnslookup.c | [
"BSD-3-Clause"
] | C | yp_async_lookup_addr | ypstat | ypstat
yp_async_lookup_addr(struct svc_req *rqstp, char *addr, int af)
{
struct circleq_dnsentry *q;
char buf[MAXHOSTNAMELEN], *qp;
uint32_t abuf[4]; /* IPv4 or IPv6 */
u_char *uaddr = (u_char *)abuf;
socklen_t len;
int type, n;
/* Check for SOCK_DGRAM or SOCK_STREAM -- we need to know later */
type = -1;
len = sizeof(type);
if (getsockopt(rqstp->rq_xprt->xp_fd, SOL_SOCKET,
SO_TYPE, &type, &len) == -1) {
yp_error("getsockopt failed: %s", strerror(errno));
return(YP_YPERR);
}
/* Avoid transmitting dupe requests. */
if (type == SOCK_DGRAM &&
yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL)
return(YP_TRUE);
if ((q = yp_malloc_dnsent()) == NULL)
return(YP_YPERR);
switch (af) {
case AF_INET:
if (inet_aton(addr, (struct in_addr *)uaddr) != 1)
return(YP_NOKEY);
snprintf(buf, sizeof(buf), "%u.%u.%u.%u.in-addr.arpa",
(uaddr[3] & 0xff), (uaddr[2] & 0xff),
(uaddr[1] & 0xff), (uaddr[0] & 0xff));
len = INADDRSZ;
break;
case AF_INET6:
if (inet_pton(af, addr, uaddr) != 1)
return(YP_NOKEY);
qp = buf;
for (n = IN6ADDRSZ - 1; n >= 0; n--) {
qp += (size_t)sprintf(qp, "%x.%x.", uaddr[n] & 0xf,
(uaddr[n] >> 4) & 0xf);
}
strlcat(buf, "ip6.arpa", sizeof(buf));
len = IN6ADDRSZ;
break;
default:
return(YP_YPERR);
}
if (debug)
yp_error("DNS address is: %s", buf);
q->type = T_PTR;
q->ttl = DEF_TTL;
q->xprt = rqstp->rq_xprt;
q->ypvers = rqstp->rq_vers;
q->domain = NULL;
q->prot_type = type;
if (q->prot_type == SOCK_DGRAM)
q->xid = svcudp_get_xid(q->xprt);
q->client_addr = q->xprt->xp_raddr;
q->id = yp_send_dns_query(buf, q->type);
if (q->id == 0) {
yp_error("DNS query failed");
free(q);
return(YP_YPERR);
}
memcpy(q->addr, uaddr, len);
q->addrlen = len;
q->addrtype = af;
q->name = strdup(buf);
TAILQ_INSERT_HEAD(&qhead, q, links);
pending++;
if (debug)
yp_error("queueing async DNS address lookup (%lu)", q->id);
yp_prune_dnsq();
return(YP_TRUE);
} | /*
* Queue and transmit an asynchronous DNS IP address lookup.
*/ | Queue and transmit an asynchronous DNS IP address lookup. | [
"Queue",
"and",
"transmit",
"an",
"asynchronous",
"DNS",
"IP",
"address",
"lookup",
"."
] | ypstat
yp_async_lookup_addr(struct svc_req *rqstp, char *addr, int af)
{
struct circleq_dnsentry *q;
char buf[MAXHOSTNAMELEN], *qp;
uint32_t abuf[4];
u_char *uaddr = (u_char *)abuf;
socklen_t len;
int type, n;
type = -1;
len = sizeof(type);
if (getsockopt(rqstp->rq_xprt->xp_fd, SOL_SOCKET,
SO_TYPE, &type, &len) == -1) {
yp_error("getsockopt failed: %s", strerror(errno));
return(YP_YPERR);
}
if (type == SOCK_DGRAM &&
yp_find_dnsqent(svcudp_get_xid(rqstp->rq_xprt),BY_RPC_XID) != NULL)
return(YP_TRUE);
if ((q = yp_malloc_dnsent()) == NULL)
return(YP_YPERR);
switch (af) {
case AF_INET:
if (inet_aton(addr, (struct in_addr *)uaddr) != 1)
return(YP_NOKEY);
snprintf(buf, sizeof(buf), "%u.%u.%u.%u.in-addr.arpa",
(uaddr[3] & 0xff), (uaddr[2] & 0xff),
(uaddr[1] & 0xff), (uaddr[0] & 0xff));
len = INADDRSZ;
break;
case AF_INET6:
if (inet_pton(af, addr, uaddr) != 1)
return(YP_NOKEY);
qp = buf;
for (n = IN6ADDRSZ - 1; n >= 0; n--) {
qp += (size_t)sprintf(qp, "%x.%x.", uaddr[n] & 0xf,
(uaddr[n] >> 4) & 0xf);
}
strlcat(buf, "ip6.arpa", sizeof(buf));
len = IN6ADDRSZ;
break;
default:
return(YP_YPERR);
}
if (debug)
yp_error("DNS address is: %s", buf);
q->type = T_PTR;
q->ttl = DEF_TTL;
q->xprt = rqstp->rq_xprt;
q->ypvers = rqstp->rq_vers;
q->domain = NULL;
q->prot_type = type;
if (q->prot_type == SOCK_DGRAM)
q->xid = svcudp_get_xid(q->xprt);
q->client_addr = q->xprt->xp_raddr;
q->id = yp_send_dns_query(buf, q->type);
if (q->id == 0) {
yp_error("DNS query failed");
free(q);
return(YP_YPERR);
}
memcpy(q->addr, uaddr, len);
q->addrlen = len;
q->addrtype = af;
q->name = strdup(buf);
TAILQ_INSERT_HEAD(&qhead, q, links);
pending++;
if (debug)
yp_error("queueing async DNS address lookup (%lu)", q->id);
yp_prune_dnsq();
return(YP_TRUE);
} | [
"ypstat",
"yp_async_lookup_addr",
"(",
"struct",
"svc_req",
"*",
"rqstp",
",",
"char",
"*",
"addr",
",",
"int",
"af",
")",
"{",
"struct",
"circleq_dnsentry",
"*",
"q",
";",
"char",
"buf",
"[",
"MAXHOSTNAMELEN",
"]",
",",
"*",
"qp",
";",
"uint32_t",
"abuf",
"[",
"4",
"]",
";",
"u_char",
"*",
"uaddr",
"=",
"(",
"u_char",
"*",
")",
"abuf",
";",
"socklen_t",
"len",
";",
"int",
"type",
",",
"n",
";",
"type",
"=",
"-1",
";",
"len",
"=",
"sizeof",
"(",
"type",
")",
";",
"if",
"(",
"getsockopt",
"(",
"rqstp",
"->",
"rq_xprt",
"->",
"xp_fd",
",",
"SOL_SOCKET",
",",
"SO_TYPE",
",",
"&",
"type",
",",
"&",
"len",
")",
"==",
"-1",
")",
"{",
"yp_error",
"(",
"\"",
"\"",
",",
"strerror",
"(",
"errno",
")",
")",
";",
"return",
"(",
"YP_YPERR",
")",
";",
"}",
"if",
"(",
"type",
"==",
"SOCK_DGRAM",
"&&",
"yp_find_dnsqent",
"(",
"svcudp_get_xid",
"(",
"rqstp",
"->",
"rq_xprt",
")",
",",
"BY_RPC_XID",
")",
"!=",
"NULL",
")",
"return",
"(",
"YP_TRUE",
")",
";",
"if",
"(",
"(",
"q",
"=",
"yp_malloc_dnsent",
"(",
")",
")",
"==",
"NULL",
")",
"return",
"(",
"YP_YPERR",
")",
";",
"switch",
"(",
"af",
")",
"{",
"case",
"AF_INET",
":",
"if",
"(",
"inet_aton",
"(",
"addr",
",",
"(",
"struct",
"in_addr",
"*",
")",
"uaddr",
")",
"!=",
"1",
")",
"return",
"(",
"YP_NOKEY",
")",
";",
"snprintf",
"(",
"buf",
",",
"sizeof",
"(",
"buf",
")",
",",
"\"",
"\"",
",",
"(",
"uaddr",
"[",
"3",
"]",
"&",
"0xff",
")",
",",
"(",
"uaddr",
"[",
"2",
"]",
"&",
"0xff",
")",
",",
"(",
"uaddr",
"[",
"1",
"]",
"&",
"0xff",
")",
",",
"(",
"uaddr",
"[",
"0",
"]",
"&",
"0xff",
")",
")",
";",
"len",
"=",
"INADDRSZ",
";",
"break",
";",
"case",
"AF_INET6",
":",
"if",
"(",
"inet_pton",
"(",
"af",
",",
"addr",
",",
"uaddr",
")",
"!=",
"1",
")",
"return",
"(",
"YP_NOKEY",
")",
";",
"qp",
"=",
"buf",
";",
"for",
"(",
"n",
"=",
"IN6ADDRSZ",
"-",
"1",
";",
"n",
">=",
"0",
";",
"n",
"--",
")",
"{",
"qp",
"+=",
"(",
"size_t",
")",
"sprintf",
"(",
"qp",
",",
"\"",
"\"",
",",
"uaddr",
"[",
"n",
"]",
"&",
"0xf",
",",
"(",
"uaddr",
"[",
"n",
"]",
">>",
"4",
")",
"&",
"0xf",
")",
";",
"}",
"strlcat",
"(",
"buf",
",",
"\"",
"\"",
",",
"sizeof",
"(",
"buf",
")",
")",
";",
"len",
"=",
"IN6ADDRSZ",
";",
"break",
";",
"default",
":",
"return",
"(",
"YP_YPERR",
")",
";",
"}",
"if",
"(",
"debug",
")",
"yp_error",
"(",
"\"",
"\"",
",",
"buf",
")",
";",
"q",
"->",
"type",
"=",
"T_PTR",
";",
"q",
"->",
"ttl",
"=",
"DEF_TTL",
";",
"q",
"->",
"xprt",
"=",
"rqstp",
"->",
"rq_xprt",
";",
"q",
"->",
"ypvers",
"=",
"rqstp",
"->",
"rq_vers",
";",
"q",
"->",
"domain",
"=",
"NULL",
";",
"q",
"->",
"prot_type",
"=",
"type",
";",
"if",
"(",
"q",
"->",
"prot_type",
"==",
"SOCK_DGRAM",
")",
"q",
"->",
"xid",
"=",
"svcudp_get_xid",
"(",
"q",
"->",
"xprt",
")",
";",
"q",
"->",
"client_addr",
"=",
"q",
"->",
"xprt",
"->",
"xp_raddr",
";",
"q",
"->",
"id",
"=",
"yp_send_dns_query",
"(",
"buf",
",",
"q",
"->",
"type",
")",
";",
"if",
"(",
"q",
"->",
"id",
"==",
"0",
")",
"{",
"yp_error",
"(",
"\"",
"\"",
")",
";",
"free",
"(",
"q",
")",
";",
"return",
"(",
"YP_YPERR",
")",
";",
"}",
"memcpy",
"(",
"q",
"->",
"addr",
",",
"uaddr",
",",
"len",
")",
";",
"q",
"->",
"addrlen",
"=",
"len",
";",
"q",
"->",
"addrtype",
"=",
"af",
";",
"q",
"->",
"name",
"=",
"strdup",
"(",
"buf",
")",
";",
"TAILQ_INSERT_HEAD",
"(",
"&",
"qhead",
",",
"q",
",",
"links",
")",
";",
"pending",
"++",
";",
"if",
"(",
"debug",
")",
"yp_error",
"(",
"\"",
"\"",
",",
"q",
"->",
"id",
")",
";",
"yp_prune_dnsq",
"(",
")",
";",
"return",
"(",
"YP_TRUE",
")",
";",
"}"
] | Queue and transmit an asynchronous DNS IP address lookup. | [
"Queue",
"and",
"transmit",
"an",
"asynchronous",
"DNS",
"IP",
"address",
"lookup",
"."
] | [
"/* IPv4 or IPv6 */",
"/* Check for SOCK_DGRAM or SOCK_STREAM -- we need to know later */",
"/* Avoid transmitting dupe requests. */"
] | [
{
"param": "rqstp",
"type": "struct svc_req"
},
{
"param": "addr",
"type": "char"
},
{
"param": "af",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rqstp",
"type": "struct svc_req",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "addr",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "af",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
31e181da93db7b8187873efc2003a310540e2377 | atrens/DragonFlyBSD-src | sys/dev/drm/i915/dvo_tfp410.c | [
"BSD-3-Clause"
] | C | tfp410_init | bool | static bool tfp410_init(struct intel_dvo_device *dvo,
struct i2c_adapter *adapter)
{
/* this will detect the tfp410 chip on the specified i2c bus */
struct tfp410_priv *tfp;
int id;
tfp = kzalloc(sizeof(struct tfp410_priv), GFP_KERNEL);
if (tfp == NULL)
return false;
dvo->i2c_bus = adapter;
dvo->dev_priv = tfp;
tfp->quiet = true;
if ((id = tfp410_getid(dvo, TFP410_VID_LO)) != TFP410_VID) {
DRM_DEBUG_KMS("tfp410 not detected got VID %X: from %s "
"Slave %d.\n",
id, adapter->name, dvo->slave_addr);
goto out;
}
if ((id = tfp410_getid(dvo, TFP410_DID_LO)) != TFP410_DID) {
DRM_DEBUG_KMS("tfp410 not detected got DID %X: from %s "
"Slave %d.\n",
id, adapter->name, dvo->slave_addr);
goto out;
}
tfp->quiet = false;
return true;
out:
kfree(tfp);
return false;
} | /* Ti TFP410 driver for chip on i2c bus */ | Ti TFP410 driver for chip on i2c bus | [
"Ti",
"TFP410",
"driver",
"for",
"chip",
"on",
"i2c",
"bus"
] | static bool tfp410_init(struct intel_dvo_device *dvo,
struct i2c_adapter *adapter)
{
struct tfp410_priv *tfp;
int id;
tfp = kzalloc(sizeof(struct tfp410_priv), GFP_KERNEL);
if (tfp == NULL)
return false;
dvo->i2c_bus = adapter;
dvo->dev_priv = tfp;
tfp->quiet = true;
if ((id = tfp410_getid(dvo, TFP410_VID_LO)) != TFP410_VID) {
DRM_DEBUG_KMS("tfp410 not detected got VID %X: from %s "
"Slave %d.\n",
id, adapter->name, dvo->slave_addr);
goto out;
}
if ((id = tfp410_getid(dvo, TFP410_DID_LO)) != TFP410_DID) {
DRM_DEBUG_KMS("tfp410 not detected got DID %X: from %s "
"Slave %d.\n",
id, adapter->name, dvo->slave_addr);
goto out;
}
tfp->quiet = false;
return true;
out:
kfree(tfp);
return false;
} | [
"static",
"bool",
"tfp410_init",
"(",
"struct",
"intel_dvo_device",
"*",
"dvo",
",",
"struct",
"i2c_adapter",
"*",
"adapter",
")",
"{",
"struct",
"tfp410_priv",
"*",
"tfp",
";",
"int",
"id",
";",
"tfp",
"=",
"kzalloc",
"(",
"sizeof",
"(",
"struct",
"tfp410_priv",
")",
",",
"GFP_KERNEL",
")",
";",
"if",
"(",
"tfp",
"==",
"NULL",
")",
"return",
"false",
";",
"dvo",
"->",
"i2c_bus",
"=",
"adapter",
";",
"dvo",
"->",
"dev_priv",
"=",
"tfp",
";",
"tfp",
"->",
"quiet",
"=",
"true",
";",
"if",
"(",
"(",
"id",
"=",
"tfp410_getid",
"(",
"dvo",
",",
"TFP410_VID_LO",
")",
")",
"!=",
"TFP410_VID",
")",
"{",
"DRM_DEBUG_KMS",
"(",
"\"",
"\"",
"\"",
"\\n",
"\"",
",",
"id",
",",
"adapter",
"->",
"name",
",",
"dvo",
"->",
"slave_addr",
")",
";",
"goto",
"out",
";",
"}",
"if",
"(",
"(",
"id",
"=",
"tfp410_getid",
"(",
"dvo",
",",
"TFP410_DID_LO",
")",
")",
"!=",
"TFP410_DID",
")",
"{",
"DRM_DEBUG_KMS",
"(",
"\"",
"\"",
"\"",
"\\n",
"\"",
",",
"id",
",",
"adapter",
"->",
"name",
",",
"dvo",
"->",
"slave_addr",
")",
";",
"goto",
"out",
";",
"}",
"tfp",
"->",
"quiet",
"=",
"false",
";",
"return",
"true",
";",
"out",
":",
"kfree",
"(",
"tfp",
")",
";",
"return",
"false",
";",
"}"
] | Ti TFP410 driver for chip on i2c bus | [
"Ti",
"TFP410",
"driver",
"for",
"chip",
"on",
"i2c",
"bus"
] | [
"/* this will detect the tfp410 chip on the specified i2c bus */"
] | [
{
"param": "dvo",
"type": "struct intel_dvo_device"
},
{
"param": "adapter",
"type": "struct i2c_adapter"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dvo",
"type": "struct intel_dvo_device",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "adapter",
"type": "struct i2c_adapter",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8ee95e934de87b598bbd9dc836933d6e17fbd661 | atrens/DragonFlyBSD-src | contrib/mpfr/src/sin_cos.c | [
"BSD-3-Clause"
] | C | reduce | mpfr_prec_t | static mpfr_prec_t
reduce (mpz_t Q, mpz_srcptr R, mpfr_prec_t prec)
{
mpfr_prec_t l = mpz_sizeinbase (R, 2);
l = (l > prec) ? l - prec : 0;
mpz_fdiv_q_2exp (Q, R, l);
return l;
} | /* truncate Q from R to at most prec bits.
Return the number of truncated bits.
*/ | truncate Q from R to at most prec bits.
Return the number of truncated bits. | [
"truncate",
"Q",
"from",
"R",
"to",
"at",
"most",
"prec",
"bits",
".",
"Return",
"the",
"number",
"of",
"truncated",
"bits",
"."
] | static mpfr_prec_t
reduce (mpz_t Q, mpz_srcptr R, mpfr_prec_t prec)
{
mpfr_prec_t l = mpz_sizeinbase (R, 2);
l = (l > prec) ? l - prec : 0;
mpz_fdiv_q_2exp (Q, R, l);
return l;
} | [
"static",
"mpfr_prec_t",
"reduce",
"(",
"mpz_t",
"Q",
",",
"mpz_srcptr",
"R",
",",
"mpfr_prec_t",
"prec",
")",
"{",
"mpfr_prec_t",
"l",
"=",
"mpz_sizeinbase",
"(",
"R",
",",
"2",
")",
";",
"l",
"=",
"(",
"l",
">",
"prec",
")",
"?",
"l",
"-",
"prec",
":",
"0",
";",
"mpz_fdiv_q_2exp",
"(",
"Q",
",",
"R",
",",
"l",
")",
";",
"return",
"l",
";",
"}"
] | truncate Q from R to at most prec bits. | [
"truncate",
"Q",
"from",
"R",
"to",
"at",
"most",
"prec",
"bits",
"."
] | [] | [
{
"param": "Q",
"type": "mpz_t"
},
{
"param": "R",
"type": "mpz_srcptr"
},
{
"param": "prec",
"type": "mpfr_prec_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "Q",
"type": "mpz_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "R",
"type": "mpz_srcptr",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "prec",
"type": "mpfr_prec_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8ee95e934de87b598bbd9dc836933d6e17fbd661 | atrens/DragonFlyBSD-src | contrib/mpfr/src/sin_cos.c | [
"BSD-3-Clause"
] | C | reduce2 | null | static unsigned long
reduce2 (mpz_t S, mpz_t C, mpfr_prec_t prec)
{
unsigned long ls = mpz_sizeinbase (S, 2);
unsigned long lc = mpz_sizeinbase (C, 2);
unsigned long l;
l = (ls < lc) ? ls : lc; /* smaller length */
l = (l > prec) ? l - prec : 0;
mpz_fdiv_q_2exp (S, S, l);
mpz_fdiv_q_2exp (C, C, l);
return l;
} | /* truncate S and C so that the smaller has prec bits.
Return the number of truncated bits.
*/ | truncate S and C so that the smaller has prec bits.
Return the number of truncated bits. | [
"truncate",
"S",
"and",
"C",
"so",
"that",
"the",
"smaller",
"has",
"prec",
"bits",
".",
"Return",
"the",
"number",
"of",
"truncated",
"bits",
"."
] | static unsigned long
reduce2 (mpz_t S, mpz_t C, mpfr_prec_t prec)
{
unsigned long ls = mpz_sizeinbase (S, 2);
unsigned long lc = mpz_sizeinbase (C, 2);
unsigned long l;
l = (ls < lc) ? ls : lc;
l = (l > prec) ? l - prec : 0;
mpz_fdiv_q_2exp (S, S, l);
mpz_fdiv_q_2exp (C, C, l);
return l;
} | [
"static",
"unsigned",
"long",
"reduce2",
"(",
"mpz_t",
"S",
",",
"mpz_t",
"C",
",",
"mpfr_prec_t",
"prec",
")",
"{",
"unsigned",
"long",
"ls",
"=",
"mpz_sizeinbase",
"(",
"S",
",",
"2",
")",
";",
"unsigned",
"long",
"lc",
"=",
"mpz_sizeinbase",
"(",
"C",
",",
"2",
")",
";",
"unsigned",
"long",
"l",
";",
"l",
"=",
"(",
"ls",
"<",
"lc",
")",
"?",
"ls",
":",
"lc",
";",
"l",
"=",
"(",
"l",
">",
"prec",
")",
"?",
"l",
"-",
"prec",
":",
"0",
";",
"mpz_fdiv_q_2exp",
"(",
"S",
",",
"S",
",",
"l",
")",
";",
"mpz_fdiv_q_2exp",
"(",
"C",
",",
"C",
",",
"l",
")",
";",
"return",
"l",
";",
"}"
] | truncate S and C so that the smaller has prec bits. | [
"truncate",
"S",
"and",
"C",
"so",
"that",
"the",
"smaller",
"has",
"prec",
"bits",
"."
] | [
"/* smaller length */"
] | [
{
"param": "S",
"type": "mpz_t"
},
{
"param": "C",
"type": "mpz_t"
},
{
"param": "prec",
"type": "mpfr_prec_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "S",
"type": "mpz_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "C",
"type": "mpz_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "prec",
"type": "mpfr_prec_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8ee95e934de87b598bbd9dc836933d6e17fbd661 | atrens/DragonFlyBSD-src | contrib/mpfr/src/sin_cos.c | [
"BSD-3-Clause"
] | C | sincos_aux | int | static int
sincos_aux (mpfr_t s, mpfr_t c, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
{
mpfr_prec_t prec_s, sh;
mpz_t Q, S, C, Q2, S2, C2, y;
mpfr_t x2;
unsigned long l, l2, j, err;
MPFR_ASSERTD(MPFR_PREC(s) == MPFR_PREC(c));
prec_s = MPFR_PREC(s);
mpfr_init2 (x2, MPFR_PREC(x));
mpz_init (Q);
mpz_init (S);
mpz_init (C);
mpz_init (Q2);
mpz_init (S2);
mpz_init (C2);
mpz_init (y);
mpfr_set (x2, x, MPFR_RNDN); /* exact */
mpz_set_ui (Q, 1);
l = 0;
mpz_set_ui (S, 0); /* sin(0) = S/(2^l*Q), exact */
mpz_set_ui (C, 1); /* cos(0) = C/(2^l*Q), exact */
/* Invariant: x = X + x2/2^(sh-1), where the part X was already treated,
S/(2^l*Q) ~ sin(X), C/(2^l*Q) ~ cos(X), and x2/2^(sh-1) < Pi/4.
'sh-1' is the number of already shifted bits in x2.
*/
for (sh = 1, j = 0; mpfr_cmp_ui (x2, 0) != 0 && sh <= prec_s; sh <<= 1, j++)
{
if (sh > prec_s / 2) /* sin(x) = x + O(x^3), cos(x) = 1 + O(x^2) */
{
l2 = -mpfr_get_z_2exp (S2, x2); /* S2/2^l2 = x2 */
l2 += sh - 1;
mpz_set_ui (Q2, 1);
mpz_set_ui (C2, 1);
mpz_mul_2exp (C2, C2, l2);
mpfr_set_ui (x2, 0, MPFR_RNDN);
}
else
{
/* y <- trunc(x2 * 2^sh) = trunc(x * 2^(2*sh-1)) */
mpfr_mul_2exp (x2, x2, sh, MPFR_RNDN); /* exact */
mpfr_get_z (y, x2, MPFR_RNDZ); /* round towards zero: now
0 <= x2 < 2^sh, thus
0 <= x2/2^(sh-1) < 2^(1-sh) */
if (mpz_cmp_ui (y, 0) == 0)
continue;
mpfr_sub_z (x2, x2, y, MPFR_RNDN); /* should be exact */
l2 = sin_bs_aux (Q2, S2, C2, y, 2 * sh - 1, prec_s);
/* we now have |S2/Q2/2^l2 - sin(X)| <= 9*2^(prec_s)
and |C2/Q2/2^l2 - cos(X)| <= 6*2^(prec_s), with X=y/2^(2sh-1) */
}
if (sh == 1) /* S=0, C=1 */
{
l = l2;
mpz_swap (Q, Q2);
mpz_swap (S, S2);
mpz_swap (C, C2);
}
else
{
/* s <- s*c2+c*s2, c <- c*c2-s*s2, using Karatsuba:
a = s+c, b = s2+c2, t = a*b, d = s*s2, e = c*c2,
s <- t - d - e, c <- e - d */
mpz_add (y, S, C); /* a */
mpz_mul (C, C, C2); /* e */
mpz_add (C2, C2, S2); /* b */
mpz_mul (S2, S, S2); /* d */
mpz_mul (y, y, C2); /* a*b */
mpz_sub (S, y, S2); /* t - d */
mpz_sub (S, S, C); /* t - d - e */
mpz_sub (C, C, S2); /* e - d */
mpz_mul (Q, Q, Q2);
/* after j loops, the error is <= (11j-2)*2^(prec_s) */
l += l2;
/* reduce Q to prec_s bits */
l += reduce (Q, Q, prec_s);
/* reduce S,C to prec_s bits, error <= 11*j*2^(prec_s) */
l -= reduce2 (S, C, prec_s);
}
}
j = 11 * j;
for (err = 0; j > 1; j = (j + 1) / 2, err ++);
mpfr_set_z (s, S, MPFR_RNDN);
mpfr_div_z (s, s, Q, MPFR_RNDN);
mpfr_div_2exp (s, s, l, MPFR_RNDN);
mpfr_set_z (c, C, MPFR_RNDN);
mpfr_div_z (c, c, Q, MPFR_RNDN);
mpfr_div_2exp (c, c, l, MPFR_RNDN);
mpz_clear (Q);
mpz_clear (S);
mpz_clear (C);
mpz_clear (Q2);
mpz_clear (S2);
mpz_clear (C2);
mpz_clear (y);
mpfr_clear (x2);
return err;
} | /* Put in s and c approximations of sin(x) and cos(x) respectively.
Assumes 0 < x < Pi/4 and PREC(s) = PREC(c) >= 10.
Return err such that the relative error is bounded by 2^err ulps.
*/ | Put in s and c approximations of sin(x) and cos(x) respectively. | [
"Put",
"in",
"s",
"and",
"c",
"approximations",
"of",
"sin",
"(",
"x",
")",
"and",
"cos",
"(",
"x",
")",
"respectively",
"."
] | static int
sincos_aux (mpfr_t s, mpfr_t c, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
{
mpfr_prec_t prec_s, sh;
mpz_t Q, S, C, Q2, S2, C2, y;
mpfr_t x2;
unsigned long l, l2, j, err;
MPFR_ASSERTD(MPFR_PREC(s) == MPFR_PREC(c));
prec_s = MPFR_PREC(s);
mpfr_init2 (x2, MPFR_PREC(x));
mpz_init (Q);
mpz_init (S);
mpz_init (C);
mpz_init (Q2);
mpz_init (S2);
mpz_init (C2);
mpz_init (y);
mpfr_set (x2, x, MPFR_RNDN);
mpz_set_ui (Q, 1);
l = 0;
mpz_set_ui (S, 0);
mpz_set_ui (C, 1);
for (sh = 1, j = 0; mpfr_cmp_ui (x2, 0) != 0 && sh <= prec_s; sh <<= 1, j++)
{
if (sh > prec_s / 2)
{
l2 = -mpfr_get_z_2exp (S2, x2);
l2 += sh - 1;
mpz_set_ui (Q2, 1);
mpz_set_ui (C2, 1);
mpz_mul_2exp (C2, C2, l2);
mpfr_set_ui (x2, 0, MPFR_RNDN);
}
else
{
mpfr_mul_2exp (x2, x2, sh, MPFR_RNDN);
mpfr_get_z (y, x2, MPFR_RNDZ);
if (mpz_cmp_ui (y, 0) == 0)
continue;
mpfr_sub_z (x2, x2, y, MPFR_RNDN);
l2 = sin_bs_aux (Q2, S2, C2, y, 2 * sh - 1, prec_s);
}
if (sh == 1)
{
l = l2;
mpz_swap (Q, Q2);
mpz_swap (S, S2);
mpz_swap (C, C2);
}
else
{
mpz_add (y, S, C);
mpz_mul (C, C, C2);
mpz_add (C2, C2, S2);
mpz_mul (S2, S, S2);
mpz_mul (y, y, C2);
mpz_sub (S, y, S2);
mpz_sub (S, S, C);
mpz_sub (C, C, S2);
mpz_mul (Q, Q, Q2);
l += l2;
l += reduce (Q, Q, prec_s);
l -= reduce2 (S, C, prec_s);
}
}
j = 11 * j;
for (err = 0; j > 1; j = (j + 1) / 2, err ++);
mpfr_set_z (s, S, MPFR_RNDN);
mpfr_div_z (s, s, Q, MPFR_RNDN);
mpfr_div_2exp (s, s, l, MPFR_RNDN);
mpfr_set_z (c, C, MPFR_RNDN);
mpfr_div_z (c, c, Q, MPFR_RNDN);
mpfr_div_2exp (c, c, l, MPFR_RNDN);
mpz_clear (Q);
mpz_clear (S);
mpz_clear (C);
mpz_clear (Q2);
mpz_clear (S2);
mpz_clear (C2);
mpz_clear (y);
mpfr_clear (x2);
return err;
} | [
"static",
"int",
"sincos_aux",
"(",
"mpfr_t",
"s",
",",
"mpfr_t",
"c",
",",
"mpfr_srcptr",
"x",
",",
"mpfr_rnd_t",
"rnd_mode",
")",
"{",
"mpfr_prec_t",
"prec_s",
",",
"sh",
";",
"mpz_t",
"Q",
",",
"S",
",",
"C",
",",
"Q2",
",",
"S2",
",",
"C2",
",",
"y",
";",
"mpfr_t",
"x2",
";",
"unsigned",
"long",
"l",
",",
"l2",
",",
"j",
",",
"err",
";",
"MPFR_ASSERTD",
"(",
"MPFR_PREC",
"(",
"s",
")",
"==",
"MPFR_PREC",
"(",
"c",
")",
")",
";",
"prec_s",
"=",
"MPFR_PREC",
"(",
"s",
")",
";",
"mpfr_init2",
"(",
"x2",
",",
"MPFR_PREC",
"(",
"x",
")",
")",
";",
"mpz_init",
"(",
"Q",
")",
";",
"mpz_init",
"(",
"S",
")",
";",
"mpz_init",
"(",
"C",
")",
";",
"mpz_init",
"(",
"Q2",
")",
";",
"mpz_init",
"(",
"S2",
")",
";",
"mpz_init",
"(",
"C2",
")",
";",
"mpz_init",
"(",
"y",
")",
";",
"mpfr_set",
"(",
"x2",
",",
"x",
",",
"MPFR_RNDN",
")",
";",
"mpz_set_ui",
"(",
"Q",
",",
"1",
")",
";",
"l",
"=",
"0",
";",
"mpz_set_ui",
"(",
"S",
",",
"0",
")",
";",
"mpz_set_ui",
"(",
"C",
",",
"1",
")",
";",
"for",
"(",
"sh",
"=",
"1",
",",
"j",
"=",
"0",
";",
"mpfr_cmp_ui",
"(",
"x2",
",",
"0",
")",
"!=",
"0",
"&&",
"sh",
"<=",
"prec_s",
";",
"sh",
"<<=",
"1",
",",
"j",
"++",
")",
"{",
"if",
"(",
"sh",
">",
"prec_s",
"/",
"2",
")",
"{",
"l2",
"=",
"-",
"mpfr_get_z_2exp",
"(",
"S2",
",",
"x2",
")",
";",
"l2",
"+=",
"sh",
"-",
"1",
";",
"mpz_set_ui",
"(",
"Q2",
",",
"1",
")",
";",
"mpz_set_ui",
"(",
"C2",
",",
"1",
")",
";",
"mpz_mul_2exp",
"(",
"C2",
",",
"C2",
",",
"l2",
")",
";",
"mpfr_set_ui",
"(",
"x2",
",",
"0",
",",
"MPFR_RNDN",
")",
";",
"}",
"else",
"{",
"mpfr_mul_2exp",
"(",
"x2",
",",
"x2",
",",
"sh",
",",
"MPFR_RNDN",
")",
";",
"mpfr_get_z",
"(",
"y",
",",
"x2",
",",
"MPFR_RNDZ",
")",
";",
"if",
"(",
"mpz_cmp_ui",
"(",
"y",
",",
"0",
")",
"==",
"0",
")",
"continue",
";",
"mpfr_sub_z",
"(",
"x2",
",",
"x2",
",",
"y",
",",
"MPFR_RNDN",
")",
";",
"l2",
"=",
"sin_bs_aux",
"(",
"Q2",
",",
"S2",
",",
"C2",
",",
"y",
",",
"2",
"*",
"sh",
"-",
"1",
",",
"prec_s",
")",
";",
"}",
"if",
"(",
"sh",
"==",
"1",
")",
"{",
"l",
"=",
"l2",
";",
"mpz_swap",
"(",
"Q",
",",
"Q2",
")",
";",
"mpz_swap",
"(",
"S",
",",
"S2",
")",
";",
"mpz_swap",
"(",
"C",
",",
"C2",
")",
";",
"}",
"else",
"{",
"mpz_add",
"(",
"y",
",",
"S",
",",
"C",
")",
";",
"mpz_mul",
"(",
"C",
",",
"C",
",",
"C2",
")",
";",
"mpz_add",
"(",
"C2",
",",
"C2",
",",
"S2",
")",
";",
"mpz_mul",
"(",
"S2",
",",
"S",
",",
"S2",
")",
";",
"mpz_mul",
"(",
"y",
",",
"y",
",",
"C2",
")",
";",
"mpz_sub",
"(",
"S",
",",
"y",
",",
"S2",
")",
";",
"mpz_sub",
"(",
"S",
",",
"S",
",",
"C",
")",
";",
"mpz_sub",
"(",
"C",
",",
"C",
",",
"S2",
")",
";",
"mpz_mul",
"(",
"Q",
",",
"Q",
",",
"Q2",
")",
";",
"l",
"+=",
"l2",
";",
"l",
"+=",
"reduce",
"(",
"Q",
",",
"Q",
",",
"prec_s",
")",
";",
"l",
"-=",
"reduce2",
"(",
"S",
",",
"C",
",",
"prec_s",
")",
";",
"}",
"}",
"j",
"=",
"11",
"*",
"j",
";",
"for",
"(",
"err",
"=",
"0",
";",
"j",
">",
"1",
";",
"j",
"=",
"(",
"j",
"+",
"1",
")",
"/",
"2",
",",
"err",
"++",
")",
";",
"mpfr_set_z",
"(",
"s",
",",
"S",
",",
"MPFR_RNDN",
")",
";",
"mpfr_div_z",
"(",
"s",
",",
"s",
",",
"Q",
",",
"MPFR_RNDN",
")",
";",
"mpfr_div_2exp",
"(",
"s",
",",
"s",
",",
"l",
",",
"MPFR_RNDN",
")",
";",
"mpfr_set_z",
"(",
"c",
",",
"C",
",",
"MPFR_RNDN",
")",
";",
"mpfr_div_z",
"(",
"c",
",",
"c",
",",
"Q",
",",
"MPFR_RNDN",
")",
";",
"mpfr_div_2exp",
"(",
"c",
",",
"c",
",",
"l",
",",
"MPFR_RNDN",
")",
";",
"mpz_clear",
"(",
"Q",
")",
";",
"mpz_clear",
"(",
"S",
")",
";",
"mpz_clear",
"(",
"C",
")",
";",
"mpz_clear",
"(",
"Q2",
")",
";",
"mpz_clear",
"(",
"S2",
")",
";",
"mpz_clear",
"(",
"C2",
")",
";",
"mpz_clear",
"(",
"y",
")",
";",
"mpfr_clear",
"(",
"x2",
")",
";",
"return",
"err",
";",
"}"
] | Put in s and c approximations of sin(x) and cos(x) respectively. | [
"Put",
"in",
"s",
"and",
"c",
"approximations",
"of",
"sin",
"(",
"x",
")",
"and",
"cos",
"(",
"x",
")",
"respectively",
"."
] | [
"/* exact */",
"/* sin(0) = S/(2^l*Q), exact */",
"/* cos(0) = C/(2^l*Q), exact */",
"/* Invariant: x = X + x2/2^(sh-1), where the part X was already treated,\n S/(2^l*Q) ~ sin(X), C/(2^l*Q) ~ cos(X), and x2/2^(sh-1) < Pi/4.\n 'sh-1' is the number of already shifted bits in x2.\n */",
"/* sin(x) = x + O(x^3), cos(x) = 1 + O(x^2) */",
"/* S2/2^l2 = x2 */",
"/* y <- trunc(x2 * 2^sh) = trunc(x * 2^(2*sh-1)) */",
"/* exact */",
"/* round towards zero: now\n 0 <= x2 < 2^sh, thus\n 0 <= x2/2^(sh-1) < 2^(1-sh) */",
"/* should be exact */",
"/* we now have |S2/Q2/2^l2 - sin(X)| <= 9*2^(prec_s)\n and |C2/Q2/2^l2 - cos(X)| <= 6*2^(prec_s), with X=y/2^(2sh-1) */",
"/* S=0, C=1 */",
"/* s <- s*c2+c*s2, c <- c*c2-s*s2, using Karatsuba:\n a = s+c, b = s2+c2, t = a*b, d = s*s2, e = c*c2,\n s <- t - d - e, c <- e - d */",
"/* a */",
"/* e */",
"/* b */",
"/* d */",
"/* a*b */",
"/* t - d */",
"/* t - d - e */",
"/* e - d */",
"/* after j loops, the error is <= (11j-2)*2^(prec_s) */",
"/* reduce Q to prec_s bits */",
"/* reduce S,C to prec_s bits, error <= 11*j*2^(prec_s) */"
] | [
{
"param": "s",
"type": "mpfr_t"
},
{
"param": "c",
"type": "mpfr_t"
},
{
"param": "x",
"type": "mpfr_srcptr"
},
{
"param": "rnd_mode",
"type": "mpfr_rnd_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": "mpfr_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "c",
"type": "mpfr_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": "mpfr_srcptr",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rnd_mode",
"type": "mpfr_rnd_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8e3f0ac2d948011cfd2c00f6bb2957f63a87b8fc | atrens/DragonFlyBSD-src | usr.bin/at/parsetime.c | [
"BSD-3-Clause"
] | C | parse_token | int | static int
parse_token(char *arg)
{
size_t i;
for (i=0; i<(sizeof Specials/sizeof Specials[0]); i++)
if (strcasecmp(Specials[i].name, arg) == 0) {
sc_tokplur = Specials[i].plural;
return sc_tokid = Specials[i].value;
}
/* not special - must be some random id */
return ID;
} | /*
* parse a token, checking if it's something special to us
*/ | parse a token, checking if it's something special to us | [
"parse",
"a",
"token",
"checking",
"if",
"it",
"'",
"s",
"something",
"special",
"to",
"us"
] | static int
parse_token(char *arg)
{
size_t i;
for (i=0; i<(sizeof Specials/sizeof Specials[0]); i++)
if (strcasecmp(Specials[i].name, arg) == 0) {
sc_tokplur = Specials[i].plural;
return sc_tokid = Specials[i].value;
}
return ID;
} | [
"static",
"int",
"parse_token",
"(",
"char",
"*",
"arg",
")",
"{",
"size_t",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"(",
"sizeof",
"Specials",
"/",
"sizeof",
"Specials",
"[",
"0",
"]",
")",
";",
"i",
"++",
")",
"if",
"(",
"strcasecmp",
"(",
"Specials",
"[",
"i",
"]",
".",
"name",
",",
"arg",
")",
"==",
"0",
")",
"{",
"sc_tokplur",
"=",
"Specials",
"[",
"i",
"]",
".",
"plural",
";",
"return",
"sc_tokid",
"=",
"Specials",
"[",
"i",
"]",
".",
"value",
";",
"}",
"return",
"ID",
";",
"}"
] | parse a token, checking if it's something special to us | [
"parse",
"a",
"token",
"checking",
"if",
"it",
"'",
"s",
"something",
"special",
"to",
"us"
] | [
"/* not special - must be some random id */"
] | [
{
"param": "arg",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "arg",
"type": "char",
"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.