comparison src/share/vm/opto/rootnode.cpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children c18cbe5936b8
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 1997-2005 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 #include "incls/_precompiled.incl"
26 #include "incls/_rootnode.cpp.incl"
27
28 //------------------------------Ideal------------------------------------------
29 // Remove dead inputs
30 Node *RootNode::Ideal(PhaseGVN *phase, bool can_reshape) {
31 for( uint i = 1; i < req(); i++ ) { // For all inputs
32 // Check for and remove dead inputs
33 if( phase->type(in(i)) == Type::TOP ) {
34 del_req(i--); // Delete TOP inputs
35 }
36 }
37
38 // I used to do tail-splitting in the Ideal graph here, but it does not
39 // work. The tail-splitting forces values live into the Return to be
40 // ready at a point which dominates the split returns. This forces Stores
41 // to be hoisted high. The "proper" fix would be to split Stores down
42 // each path, but this makes the split unprofitable. If we want to do this
43 // optimization, it needs to be done after allocation so we can count all
44 // the instructions needing to be cloned in the cost metric.
45
46 // There used to be a spoof here for caffeine marks which completely
47 // eliminated very simple self-recursion recursions, but it's not worth it.
48 // Deep inlining of self-calls gets nearly all of the same benefits.
49 // If we want to get the rest of the win later, we should pattern match
50 // simple recursive call trees to closed-form solutions.
51
52 return NULL; // No further opportunities exposed
53 }
54
55 //=============================================================================
56 HaltNode::HaltNode( Node *ctrl, Node *frameptr ) : Node(TypeFunc::Parms) {
57 Node* top = Compile::current()->top();
58 init_req(TypeFunc::Control, ctrl );
59 init_req(TypeFunc::I_O, top);
60 init_req(TypeFunc::Memory, top);
61 init_req(TypeFunc::FramePtr, frameptr );
62 init_req(TypeFunc::ReturnAdr,top);
63 }
64
65 const Type *HaltNode::bottom_type() const { return Type::BOTTOM; }
66
67 //------------------------------Ideal------------------------------------------
68 Node *HaltNode::Ideal(PhaseGVN *phase, bool can_reshape) {
69 return remove_dead_region(phase, can_reshape) ? this : NULL;
70 }
71
72 //------------------------------Value------------------------------------------
73 const Type *HaltNode::Value( PhaseTransform *phase ) const {
74 return ( phase->type(in(TypeFunc::Control)) == Type::TOP)
75 ? Type::TOP
76 : Type::BOTTOM;
77 }
78
79 const RegMask &HaltNode::out_RegMask() const {
80 return RegMask::Empty;
81 }