1115013Smarcel/*
2160157SmarcelCopyright (c) 2003-2006 Hewlett-Packard Development Company, L.P.
3121642SmarcelPermission is hereby granted, free of charge, to any person
4121642Smarcelobtaining a copy of this software and associated documentation
5121642Smarcelfiles (the "Software"), to deal in the Software without
6121642Smarcelrestriction, including without limitation the rights to use,
7121642Smarcelcopy, modify, merge, publish, distribute, sublicense, and/or sell
8121642Smarcelcopies of the Software, and to permit persons to whom the
9121642SmarcelSoftware is furnished to do so, subject to the following
10121642Smarcelconditions:
11115013Smarcel
12121642SmarcelThe above copyright notice and this permission notice shall be
13121642Smarcelincluded in all copies or substantial portions of the Software.
14121642Smarcel
15121642SmarcelTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16121642SmarcelEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17121642SmarcelOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18121642SmarcelNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19121642SmarcelHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20121642SmarcelWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21121642SmarcelFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22121642SmarcelOTHER DEALINGS IN THE SOFTWARE.
23121642Smarcel*/
24121642Smarcel
25115013Smarcel#define NSB_SPECIAL	9
26115013Smarcel#define NSB_GR		4
27115013Smarcel#define NSB_BR		5
28115013Smarcel#define NSB_FR		20
29115013Smarcel
30115013Smarcel#define SBREG_RP	0
31115013Smarcel#define SBREG_PSP	1
32115013Smarcel#define SBREG_PFS	2
33115013Smarcel#define SBREG_PREDS	3
34115013Smarcel#define SBREG_UNAT	4
35115013Smarcel#define SBREG_PRIUNAT	5
36115013Smarcel#define SBREG_RNAT	6
37115013Smarcel#define SBREG_LC	7
38115013Smarcel#define SBREG_FPSR	8
39115013Smarcel#define SBREG_GR	(0 + NSB_SPECIAL)
40115013Smarcel#define SBREG_BR	(SBREG_GR + NSB_GR)
41115013Smarcel#define SBREG_FR	(SBREG_BR + NSB_BR)
42115013Smarcel
43115013Smarcel#define NSBREG_NOFR	(NSB_SPECIAL + NSB_GR + NSB_BR)
44115013Smarcel#define NSBREG		(NSB_SPECIAL + NSB_GR + NSB_BR + NSB_FR)
45115013Smarcel
46115013Smarcelstruct uwx_scoreboard {
47115013Smarcel    struct uwx_scoreboard *nextused;
48115013Smarcel    struct uwx_scoreboard *nextfree;
49115013Smarcel    struct uwx_scoreboard *nextstack;
50115013Smarcel    struct uwx_scoreboard *nextlabel;
51115013Smarcel    uint64_t rstate[NSBREG];
52115013Smarcel    int label;
53115013Smarcel    int id;
54160157Smarcel    int prealloc;
55115013Smarcel};
56115013Smarcel
57160157Smarcelextern void uwx_prealloc_scoreboard(
58160157Smarcel    struct uwx_env *env,
59160157Smarcel    struct uwx_scoreboard *sb);
60160157Smarcel
61115013Smarcelextern struct uwx_scoreboard *uwx_alloc_scoreboard(struct uwx_env *env);
62115013Smarcel
63115013Smarcelextern struct uwx_scoreboard *uwx_init_scoreboards(struct uwx_env *env);
64115013Smarcel
65115013Smarcelextern struct uwx_scoreboard *uwx_new_scoreboard(
66115013Smarcel    struct uwx_env *env,
67115013Smarcel    struct uwx_scoreboard *prevsb);
68115013Smarcel
69115013Smarcelextern struct uwx_scoreboard *uwx_pop_scoreboards(
70115013Smarcel    struct uwx_env *env,
71115013Smarcel    struct uwx_scoreboard *sb,
72115013Smarcel    int ecount);
73115013Smarcel
74115013Smarcelextern int uwx_label_scoreboard(
75115013Smarcel    struct uwx_env *env,
76115013Smarcel    struct uwx_scoreboard *sb,
77115013Smarcel    int label);
78115013Smarcel
79115013Smarcelextern int uwx_copy_scoreboard(
80115013Smarcel    struct uwx_env *env,
81115013Smarcel    struct uwx_scoreboard *sb,
82115013Smarcel    int label);
83115013Smarcel
84115013Smarcelextern void uwx_free_scoreboards(struct uwx_env *env);
85