1/*
2Copyright (c) 2003-2006 Hewlett-Packard Development Company, L.P.
3Permission is hereby granted, free of charge, to any person
4obtaining a copy of this software and associated documentation
5files (the "Software"), to deal in the Software without
6restriction, including without limitation the rights to use,
7copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the
9Software is furnished to do so, subject to the following
10conditions:
11
12The above copyright notice and this permission notice shall be
13included in all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22OTHER DEALINGS IN THE SOFTWARE.
23*/
24
25#define NSB_SPECIAL	9
26#define NSB_GR		4
27#define NSB_BR		5
28#define NSB_FR		20
29
30#define SBREG_RP	0
31#define SBREG_PSP	1
32#define SBREG_PFS	2
33#define SBREG_PREDS	3
34#define SBREG_UNAT	4
35#define SBREG_PRIUNAT	5
36#define SBREG_RNAT	6
37#define SBREG_LC	7
38#define SBREG_FPSR	8
39#define SBREG_GR	(0 + NSB_SPECIAL)
40#define SBREG_BR	(SBREG_GR + NSB_GR)
41#define SBREG_FR	(SBREG_BR + NSB_BR)
42
43#define NSBREG_NOFR	(NSB_SPECIAL + NSB_GR + NSB_BR)
44#define NSBREG		(NSB_SPECIAL + NSB_GR + NSB_BR + NSB_FR)
45
46struct uwx_scoreboard {
47    struct uwx_scoreboard *nextused;
48    struct uwx_scoreboard *nextfree;
49    struct uwx_scoreboard *nextstack;
50    struct uwx_scoreboard *nextlabel;
51    uint64_t rstate[NSBREG];
52    int label;
53    int id;
54    int prealloc;
55};
56
57extern void uwx_prealloc_scoreboard(
58    struct uwx_env *env,
59    struct uwx_scoreboard *sb);
60
61extern struct uwx_scoreboard *uwx_alloc_scoreboard(struct uwx_env *env);
62
63extern struct uwx_scoreboard *uwx_init_scoreboards(struct uwx_env *env);
64
65extern struct uwx_scoreboard *uwx_new_scoreboard(
66    struct uwx_env *env,
67    struct uwx_scoreboard *prevsb);
68
69extern struct uwx_scoreboard *uwx_pop_scoreboards(
70    struct uwx_env *env,
71    struct uwx_scoreboard *sb,
72    int ecount);
73
74extern int uwx_label_scoreboard(
75    struct uwx_env *env,
76    struct uwx_scoreboard *sb,
77    int label);
78
79extern int uwx_copy_scoreboard(
80    struct uwx_env *env,
81    struct uwx_scoreboard *sb,
82    int label);
83
84extern void uwx_free_scoreboards(struct uwx_env *env);
85