1 /*
2 * Copyright (c) 2000, 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_REGALLOC_HPP
26 #define SHARE_VM_OPTO_REGALLOC_HPP
27
28 #include "code/vmreg.hpp"
29 #include "opto/block.hpp"
30 #include "opto/matcher.hpp"
31 #include "opto/phase.hpp"
32
33 class Node;
34 class Matcher;
35 class PhaseCFG;
36
37 #define MAX_REG_ALLOCATORS 10
38
39 //------------------------------PhaseRegAlloc------------------------------------
40 // Abstract register allocator
41 class PhaseRegAlloc : public Phase {
42 static void (*_alloc_statistics[MAX_REG_ALLOCATORS])();
43 static int _num_allocators;
44
45 protected:
46 OptoRegPair *_node_regs;
47 uint _node_regs_max_index;
48 VectorSet _node_oops; // Mapping from node indices to oopiness
49
50 void alloc_node_regs(int size); // allocate _node_regs table with at least "size" elements
51
52 PhaseRegAlloc( uint unique, PhaseCFG &cfg, Matcher &matcher,
53 void (*pr_stats)());
54 public:
55 PhaseCFG &_cfg; // Control flow graph
56 uint _framesize; // Size of frame in stack-slots. not counting preserve area
57 OptoReg::Name _max_reg; // Past largest register seen
58 Matcher &_matcher; // Convert Ideal to MachNodes
59 uint node_regs_max_index() const { return _node_regs_max_index; }
60
61 // Get the register associated with the Node
|
1 /*
2 * Copyright (c) 2000, 2011, 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_REGALLOC_HPP
26 #define SHARE_VM_OPTO_REGALLOC_HPP
27
28 #include "code/vmreg.hpp"
29 #include "opto/block.hpp"
30 #include "opto/matcher.hpp"
31 #include "opto/phase.hpp"
32
33 class Node;
34 class Matcher;
35 class PhaseCFG;
36
37 #define MAX_REG_ALLOCATORS 10
38
39 //------------------------------PhaseRegAlloc------------------------------------
40 // Abstract register allocator
41 class PhaseRegAlloc : public Phase {
42 friend class VMStructs;
43 static void (*_alloc_statistics[MAX_REG_ALLOCATORS])();
44 static int _num_allocators;
45
46 protected:
47 OptoRegPair *_node_regs;
48 uint _node_regs_max_index;
49 VectorSet _node_oops; // Mapping from node indices to oopiness
50
51 void alloc_node_regs(int size); // allocate _node_regs table with at least "size" elements
52
53 PhaseRegAlloc( uint unique, PhaseCFG &cfg, Matcher &matcher,
54 void (*pr_stats)());
55 public:
56 PhaseCFG &_cfg; // Control flow graph
57 uint _framesize; // Size of frame in stack-slots. not counting preserve area
58 OptoReg::Name _max_reg; // Past largest register seen
59 Matcher &_matcher; // Convert Ideal to MachNodes
60 uint node_regs_max_index() const { return _node_regs_max_index; }
61
62 // Get the register associated with the Node
|