1 /*
2 * Copyright (c) 2006, 2007, 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 //------------------------------OptoReg----------------------------------------
26 // We eventually need Registers for the Real World. Registers are essentially
27 // non-SSA names. A Register is represented as a number. Non-regular values
28 // (e.g., Control, Memory, I/O) use the Special register. The actual machine
29 // registers (as described in the ADL file for a machine) start at zero.
30 // Stack-slots (spill locations) start at the nest Chunk past the last machine
31 // register.
32 //
33 // Note that stack spill-slots are treated as a very large register set.
34 // They have all the correct properties for a Register: not aliased (unique
35 // named). There is some simple mapping from a stack-slot register number
36 // to the actual location on the stack; this mapping depends on the calling
37 // conventions and is described in the ADL.
38 //
39 // Note that Name is not enum. C++ standard defines that the range of enum
40 // is the range of smallest bit-field that can represent all enumerators
41 // declared in the enum. The result of assigning a value to enum is undefined
42 // if the value is outside the enumeration's valid range. OptoReg::Name is
43 // typedef'ed as int, because it needs to be able to represent spill-slots.
44 //
175 public:
176 void set_bad ( ) { _second = OptoReg::Bad; _first = OptoReg::Bad; }
177 void set1 ( OptoReg::Name n ) { _second = OptoReg::Bad; _first = n; }
178 void set2 ( OptoReg::Name n ) { _second = n + 1; _first = n; }
179 void set_pair( OptoReg::Name second, OptoReg::Name first ) { _second= second; _first= first; }
180 void set_ptr ( OptoReg::Name ptr ) {
181 #ifdef _LP64
182 _second = ptr+1;
183 #else
184 _second = OptoReg::Bad;
185 #endif
186 _first = ptr;
187 }
188
189 OptoReg::Name second() const { return _second; }
190 OptoReg::Name first() const { return _first; }
191 OptoRegPair(OptoReg::Name second, OptoReg::Name first) { _second = second; _first = first; }
192 OptoRegPair(OptoReg::Name f) { _second = OptoReg::Bad; _first = f; }
193 OptoRegPair() { _second = OptoReg::Bad; _first = OptoReg::Bad; }
194 };
|
1 /*
2 * Copyright (c) 2006, 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_OPTOREG_HPP
26 #define SHARE_VM_OPTO_OPTOREG_HPP
27
28 //------------------------------OptoReg----------------------------------------
29 // We eventually need Registers for the Real World. Registers are essentially
30 // non-SSA names. A Register is represented as a number. Non-regular values
31 // (e.g., Control, Memory, I/O) use the Special register. The actual machine
32 // registers (as described in the ADL file for a machine) start at zero.
33 // Stack-slots (spill locations) start at the nest Chunk past the last machine
34 // register.
35 //
36 // Note that stack spill-slots are treated as a very large register set.
37 // They have all the correct properties for a Register: not aliased (unique
38 // named). There is some simple mapping from a stack-slot register number
39 // to the actual location on the stack; this mapping depends on the calling
40 // conventions and is described in the ADL.
41 //
42 // Note that Name is not enum. C++ standard defines that the range of enum
43 // is the range of smallest bit-field that can represent all enumerators
44 // declared in the enum. The result of assigning a value to enum is undefined
45 // if the value is outside the enumeration's valid range. OptoReg::Name is
46 // typedef'ed as int, because it needs to be able to represent spill-slots.
47 //
178 public:
179 void set_bad ( ) { _second = OptoReg::Bad; _first = OptoReg::Bad; }
180 void set1 ( OptoReg::Name n ) { _second = OptoReg::Bad; _first = n; }
181 void set2 ( OptoReg::Name n ) { _second = n + 1; _first = n; }
182 void set_pair( OptoReg::Name second, OptoReg::Name first ) { _second= second; _first= first; }
183 void set_ptr ( OptoReg::Name ptr ) {
184 #ifdef _LP64
185 _second = ptr+1;
186 #else
187 _second = OptoReg::Bad;
188 #endif
189 _first = ptr;
190 }
191
192 OptoReg::Name second() const { return _second; }
193 OptoReg::Name first() const { return _first; }
194 OptoRegPair(OptoReg::Name second, OptoReg::Name first) { _second = second; _first = first; }
195 OptoRegPair(OptoReg::Name f) { _second = OptoReg::Bad; _first = f; }
196 OptoRegPair() { _second = OptoReg::Bad; _first = OptoReg::Bad; }
197 };
198
199 #endif // SHARE_VM_OPTO_OPTOREG_HPP
|