1 /*
2 * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // Some fun naming (textual) substitutions:
26 //
27 // RegMask::get_low_elem() ==> RegMask::find_first_elem()
28 // RegMask::Special ==> RegMask::Empty
29 // RegMask::_flags ==> RegMask::is_AllStack()
30 // RegMask::operator<<=() ==> RegMask::Insert()
31 // RegMask::operator>>=() ==> RegMask::Remove()
32 // RegMask::Union() ==> RegMask::OR
33 // RegMask::Inter() ==> RegMask::AND
34 //
35 // OptoRegister::RegName ==> OptoReg::Name
36 //
37 // OptoReg::stack0() ==> _last_Mach_Reg or ZERO in core version
38 //
39 // numregs in chaitin ==> proper degree in chaitin
40
41 //-------------Non-zero bit search methods used by RegMask---------------------
42 // Find lowest 1, or return 32 if empty
43 int find_lowest_bit( uint32 mask );
44 // Find highest 1, or return 32 if empty
245
246 // Compute size of register mask: number of bits
247 uint Size() const;
248
249 #ifndef PRODUCT
250 void print() const { dump(); }
251 void dump() const; // Print a mask
252 #endif
253
254 static const RegMask Empty; // Common empty mask
255
256 static bool can_represent(OptoReg::Name reg) {
257 // NOTE: -1 in computation reflects the usage of the last
258 // bit of the regmask as an infinite stack flag.
259 return (int)reg < (int)(CHUNK_SIZE-1);
260 }
261 };
262
263 // Do not use this constant directly in client code!
264 #undef RM_SIZE
|
1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OPTO_REGMASK_HPP
26 #define SHARE_VM_OPTO_REGMASK_HPP
27
28 #include "code/vmreg.hpp"
29 #include "libadt/port.hpp"
30 #include "opto/optoreg.hpp"
31 #ifdef TARGET_ARCH_MODEL_x86_32
32 # include "adfiles/adGlobals_x86_32.hpp"
33 #endif
34 #ifdef TARGET_ARCH_MODEL_x86_64
35 # include "adfiles/adGlobals_x86_64.hpp"
36 #endif
37 #ifdef TARGET_ARCH_MODEL_sparc
38 # include "adfiles/adGlobals_sparc.hpp"
39 #endif
40 #ifdef TARGET_ARCH_MODEL_zero
41 # include "adfiles/adGlobals_zero.hpp"
42 #endif
43
44 // Some fun naming (textual) substitutions:
45 //
46 // RegMask::get_low_elem() ==> RegMask::find_first_elem()
47 // RegMask::Special ==> RegMask::Empty
48 // RegMask::_flags ==> RegMask::is_AllStack()
49 // RegMask::operator<<=() ==> RegMask::Insert()
50 // RegMask::operator>>=() ==> RegMask::Remove()
51 // RegMask::Union() ==> RegMask::OR
52 // RegMask::Inter() ==> RegMask::AND
53 //
54 // OptoRegister::RegName ==> OptoReg::Name
55 //
56 // OptoReg::stack0() ==> _last_Mach_Reg or ZERO in core version
57 //
58 // numregs in chaitin ==> proper degree in chaitin
59
60 //-------------Non-zero bit search methods used by RegMask---------------------
61 // Find lowest 1, or return 32 if empty
62 int find_lowest_bit( uint32 mask );
63 // Find highest 1, or return 32 if empty
264
265 // Compute size of register mask: number of bits
266 uint Size() const;
267
268 #ifndef PRODUCT
269 void print() const { dump(); }
270 void dump() const; // Print a mask
271 #endif
272
273 static const RegMask Empty; // Common empty mask
274
275 static bool can_represent(OptoReg::Name reg) {
276 // NOTE: -1 in computation reflects the usage of the last
277 // bit of the regmask as an infinite stack flag.
278 return (int)reg < (int)(CHUNK_SIZE-1);
279 }
280 };
281
282 // Do not use this constant directly in client code!
283 #undef RM_SIZE
284
285 #endif // SHARE_VM_OPTO_REGMASK_HPP
|