1183370Simp/*
2183370SimpCopyright (c) 2003-2006 Hewlett-Packard Development Company, L.P.
3183370SimpPermission is hereby granted, free of charge, to any person
4183370Simpobtaining a copy of this software and associated documentation
5183370Simpfiles (the "Software"), to deal in the Software without
6183370Simprestriction, including without limitation the rights to use,
7183370Simpcopy, modify, merge, publish, distribute, sublicense, and/or sell
8183370Simpcopies of the Software, and to permit persons to whom the
9183370SimpSoftware is furnished to do so, subject to the following
10183370Simpconditions:
11183370Simp
12183370SimpThe above copyright notice and this permission notice shall be
13183370Simpincluded in all copies or substantial portions of the Software.
14183370Simp
15183370SimpTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16183370SimpEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17183370SimpOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18183370SimpNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19183370SimpHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20183370SimpWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21183370SimpFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22183370SimpOTHER DEALINGS IN THE SOFTWARE.
23183370Simp*/
24183370Simp
25183370Simp#define NSB_SPECIAL	9
26183370Simp#define NSB_GR		4
27183370Simp#define NSB_BR		5
28183370Simp#define NSB_FR		20
29183370Simp
30183370Simp#define SBREG_RP	0
31183370Simp#define SBREG_PSP	1
32183370Simp#define SBREG_PFS	2
33183370Simp#define SBREG_PREDS	3
34183370Simp#define SBREG_UNAT	4
35183370Simp#define SBREG_PRIUNAT	5
36183370Simp#define SBREG_RNAT	6
37183370Simp#define SBREG_LC	7
38183370Simp#define SBREG_FPSR	8
39183370Simp#define SBREG_GR	(0 + NSB_SPECIAL)
40183370Simp#define SBREG_BR	(SBREG_GR + NSB_GR)
41183370Simp#define SBREG_FR	(SBREG_BR + NSB_BR)
42183370Simp
43183370Simp#define NSBREG_NOFR	(NSB_SPECIAL + NSB_GR + NSB_BR)
44183370Simp#define NSBREG		(NSB_SPECIAL + NSB_GR + NSB_BR + NSB_FR)
45183370Simp
46183370Simpstruct uwx_scoreboard {
47183370Simp    struct uwx_scoreboard *nextused;
48183370Simp    struct uwx_scoreboard *nextfree;
49183374Simp    struct uwx_scoreboard *nextstack;
50183370Simp    struct uwx_scoreboard *nextlabel;
51183370Simp    uint64_t rstate[NSBREG];
52183370Simp    int label;
53183376Simp    int id;
54183376Simp    int prealloc;
55183376Simp};
56183370Simp
57183376Simpextern void uwx_prealloc_scoreboard(
58183376Simp    struct uwx_env *env,
59183376Simp    struct uwx_scoreboard *sb);
60183376Simp
61183376Simpextern struct uwx_scoreboard *uwx_alloc_scoreboard(struct uwx_env *env);
62183370Simp
63183370Simpextern struct uwx_scoreboard *uwx_init_scoreboards(struct uwx_env *env);
64183370Simp
65183370Simpextern struct uwx_scoreboard *uwx_new_scoreboard(
66183370Simp    struct uwx_env *env,
67183370Simp    struct uwx_scoreboard *prevsb);
68183370Simp
69183370Simpextern struct uwx_scoreboard *uwx_pop_scoreboards(
70183370Simp    struct uwx_env *env,
71183370Simp    struct uwx_scoreboard *sb,
72183370Simp    int ecount);
73183370Simp
74183370Simpextern int uwx_label_scoreboard(
75183370Simp    struct uwx_env *env,
76183370Simp    struct uwx_scoreboard *sb,
77183370Simp    int label);
78183370Simp
79183370Simpextern int uwx_copy_scoreboard(
80183370Simp    struct uwx_env *env,
81183370Simp    struct uwx_scoreboard *sb,
82183370Simp    int label);
83183370Simp
84183370Simpextern void uwx_free_scoreboards(struct uwx_env *env);
85183370Simp