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 // Predefined classes 26 class ciField; 27 class ValueStack; 28 class InstructionPrinter; 29 class IRScope; 30 class LIR_OprDesc; 31 typedef LIR_OprDesc* LIR_Opr; 32 33 34 // Instruction class hierarchy 35 // 36 // All leaf classes in the class hierarchy are concrete classes 37 // (i.e., are instantiated). All other classes are abstract and 38 // serve factoring. 39 40 class Instruction; 41 class Phi; 42 class Local; 43 class Constant; 44 class AccessField; 2270 public: 2271 BlockPair(BlockBegin* from, BlockBegin* to): _from(from), _to(to) {} 2272 BlockBegin* from() const { return _from; } 2273 BlockBegin* to() const { return _to; } 2274 bool is_same(BlockBegin* from, BlockBegin* to) const { return _from == from && _to == to; } 2275 bool is_same(BlockPair* p) const { return _from == p->from() && _to == p->to(); } 2276 void set_to(BlockBegin* b) { _to = b; } 2277 void set_from(BlockBegin* b) { _from = b; } 2278 }; 2279 2280 2281 define_array(BlockPairArray, BlockPair*) 2282 define_stack(BlockPairList, BlockPairArray) 2283 2284 2285 inline int BlockBegin::number_of_sux() const { assert(_end == NULL || _end->number_of_sux() == _successors.length(), "mismatch"); return _successors.length(); } 2286 inline BlockBegin* BlockBegin::sux_at(int i) const { assert(_end == NULL || _end->sux_at(i) == _successors.at(i), "mismatch"); return _successors.at(i); } 2287 inline void BlockBegin::add_successor(BlockBegin* sux) { assert(_end == NULL, "Would create mismatch with successors of BlockEnd"); _successors.append(sux); } 2288 2289 #undef ASSERT_VALUES | 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_C1_C1_INSTRUCTION_HPP 26 #define SHARE_VM_C1_C1_INSTRUCTION_HPP 27 28 #include "c1/c1_Compilation.hpp" 29 #include "c1/c1_LIR.hpp" 30 #include "c1/c1_ValueType.hpp" 31 #include "ci/ciField.hpp" 32 33 // Predefined classes 34 class ciField; 35 class ValueStack; 36 class InstructionPrinter; 37 class IRScope; 38 class LIR_OprDesc; 39 typedef LIR_OprDesc* LIR_Opr; 40 41 42 // Instruction class hierarchy 43 // 44 // All leaf classes in the class hierarchy are concrete classes 45 // (i.e., are instantiated). All other classes are abstract and 46 // serve factoring. 47 48 class Instruction; 49 class Phi; 50 class Local; 51 class Constant; 52 class AccessField; 2278 public: 2279 BlockPair(BlockBegin* from, BlockBegin* to): _from(from), _to(to) {} 2280 BlockBegin* from() const { return _from; } 2281 BlockBegin* to() const { return _to; } 2282 bool is_same(BlockBegin* from, BlockBegin* to) const { return _from == from && _to == to; } 2283 bool is_same(BlockPair* p) const { return _from == p->from() && _to == p->to(); } 2284 void set_to(BlockBegin* b) { _to = b; } 2285 void set_from(BlockBegin* b) { _from = b; } 2286 }; 2287 2288 2289 define_array(BlockPairArray, BlockPair*) 2290 define_stack(BlockPairList, BlockPairArray) 2291 2292 2293 inline int BlockBegin::number_of_sux() const { assert(_end == NULL || _end->number_of_sux() == _successors.length(), "mismatch"); return _successors.length(); } 2294 inline BlockBegin* BlockBegin::sux_at(int i) const { assert(_end == NULL || _end->sux_at(i) == _successors.at(i), "mismatch"); return _successors.at(i); } 2295 inline void BlockBegin::add_successor(BlockBegin* sux) { assert(_end == NULL, "Would create mismatch with successors of BlockEnd"); _successors.append(sux); } 2296 2297 #undef ASSERT_VALUES 2298 2299 #endif // SHARE_VM_C1_C1_INSTRUCTION_HPP |