aa
CEProjNode.java
Go to the documentation of this file.
1
package
com.cliffc.aa.node;
2
3
import
com
.
cliffc
.
aa
.
GVNGCM
;
4
import
com
.
cliffc
.
aa
.
type
.*;
5
6
// Proj control
7
public
class
CEProjNode
extends
CProjNode
{
8
final
TypeFunSig
_sig
;
9
public
CEProjNode
(
CallNode
call,
TypeFunSig
sig ) { super(call);
_sig
= sig; }
10
@Override
public
String
xstr
() {
return
"CEProj"
; }
11
@Override
public
Type
value
(
GVNGCM
.
Mode
opt_mode) {
12
if
(
_uses
._len<1 )
return
Type
.
CTRL
;
13
return
good_call
(
val
(0),
_uses
.at(0)) ?
Type
.
CTRL
:
Type
.
XCTRL
;
14
}
15
16
// Never equal to another CEProj, since Call-Graph *edges* are unique
17
@Override
public
int
hashCode
() {
return
super.hashCode()+(
_sig
==
null
? 0 :
_sig
.
_hash
); }
18
@Override
public
boolean
equals
(Object o) {
return
this
==o; }
19
20
static
boolean
good_call
(
Type
tcall,
Node
ftun ) {
21
if
( !(tcall instanceof
TypeTuple
) )
return
!tcall.
above_center
();
22
TypeTuple
ttcall = (
TypeTuple
)tcall;
// Call type tuple
23
if
( ttcall.
at
(0)!=
Type
.
CTRL
)
return
false
;
// Call not executing
24
if
( ftun instanceof
ThunkNode
)
return
true
;
// Thunk call is OK by design
25
FunNode
fun = (
FunNode
)ftun;
26
if
( fun.
_thunk_rhs
)
return
true
;
// Thunk call is OK by design
27
TypeFunPtr
tfp =
CallNode
.
ttfp
(ttcall);
28
if
( tfp.
fidxs
().
above_center
() )
return
false
;
// Call not executing yet
29
if
( !tfp.
fidxs
().
test_recur
(fun.
_fidx
) )
30
return
false
;
// Call not executing this wired path
31
32
// Argument count mismatch
33
TypeTuple
formals = fun.
_sig
.
_formals
;
34
if
( ttcall.
len
()-2
/*minus fun, minus esc*/
!= formals.
len
() )
return
false
;
35
36
// Cannot use the obvious argument check "actual.isa(formal)"!!!!!
37
38
// If the actual is higher than formal (not even above_center), but then
39
// falls during Opto, this type would LIFT from Ctrl to XCTRL. Can only
40
// test for static properties (e.g. argument count, or constant ALL
41
// arguments).
42
43
45
//TypeMem tmem = (TypeMem)ttcall.at(AA.MEM_IDX);
46
//for( int i=AA.MEM_IDX; i<formals.len(); i++ ) {
47
// Type formal = formals.at(i);
48
// Type actual0= ttcall.at(i);
49
// if( actual0==Type.ANY ) continue; // Allow ignored args
50
// Type actual = tmem.sharptr(actual0);
51
// if( formal.isa(actual) ) continue; // Low but sane
52
// if( actual.isa(formal) &&
53
// (!actual.above_center() ||
54
// actual==Type.XNIL ||
55
// formal.dual().isa(actual)) )
56
// continue;
57
// return false;
58
//}
59
return
true
;
60
}
61
}
com.cliffc.aa.node.CEProjNode.good_call
static boolean good_call(Type tcall, Node ftun)
Definition:
CEProjNode.java:20
com.cliffc.aa.type.TypeFunPtr
Definition:
TypeFunPtr.java:23
com.cliffc.aa.node.CEProjNode.xstr
String xstr()
Definition:
CEProjNode.java:10
com.cliffc
com.cliffc.aa.type.Type._hash
int _hash
Definition:
Type.java:97
com.cliffc.aa.node.CEProjNode.CEProjNode
CEProjNode(CallNode call, TypeFunSig sig)
Definition:
CEProjNode.java:9
com.cliffc.aa.node.Node
Definition:
Node.java:16
com.cliffc.aa.type.Type
an implementation of language AA
Definition:
Type.java:94
com.cliffc.aa.node.CProjNode
Definition:
CProjNode.java:10
com.cliffc.aa.type.TypeTuple
Definition:
TypeTuple.java:11
com.cliffc.aa.type.TypeFunPtr.fidxs
BitsFun fidxs()
Definition:
TypeFunPtr.java:127
com.cliffc.aa.type.Bits.test_recur
boolean test_recur(int i)
Definition:
Bits.java:232
com.cliffc.aa.node.CallNode
Definition:
CallNode.java:86
com.cliffc.aa.type.Bits.above_center
boolean above_center()
Definition:
Bits.java:204
com.cliffc.aa.type.Type.above_center
boolean above_center()
Definition:
Type.java:741
com.cliffc.aa.node.FunNode._fidx
int _fidx
Definition:
FunNode.java:61
com.cliffc.aa.type.Type.CTRL
static final Type CTRL
Definition:
Type.java:326
com.cliffc.aa.type.TypeTuple.len
int len()
Definition:
TypeTuple.java:183
com.cliffc.aa.node.CEProjNode.hashCode
int hashCode()
Definition:
CEProjNode.java:17
com.cliffc.aa.type.Type.XCTRL
static final Type XCTRL
Definition:
Type.java:327
com.cliffc.aa.GVNGCM
Definition:
GVNGCM.java:12
com.cliffc.aa.node.CEProjNode
Definition:
CEProjNode.java:7
com.cliffc.aa.node.CEProjNode.equals
boolean equals(Object o)
Definition:
CEProjNode.java:18
com.cliffc.aa.node.Node._uses
Ary< Node > _uses
Definition:
Node.java:245
com.cliffc.aa.node.CEProjNode._sig
final TypeFunSig _sig
Definition:
CEProjNode.java:8
com.cliffc.aa.node.Node.val
Type val(int idx)
Definition:
Node.java:470
com.cliffc.aa
Definition:
AA.java:1
com.cliffc.aa.node.FunNode._sig
TypeFunSig _sig
Definition:
FunNode.java:62
com.cliffc.aa.node.CallNode.ttfp
static TypeFunPtr ttfp(Type tcall)
Definition:
CallNode.java:157
com.cliffc.aa.node.CEProjNode.value
Type value(GVNGCM.Mode opt_mode)
Definition:
CEProjNode.java:11
com.cliffc.aa.type.TypeTuple.at
Type at(int idx)
Definition:
TypeTuple.java:182
com.cliffc.aa.type.TypeFunSig
Definition:
TypeFunSig.java:10
com.cliffc.aa.node.ThunkNode
Definition:
ThunkNode.java:16
com.cliffc.aa.node.FunNode
Definition:
FunNode.java:58
com
com.cliffc.aa.type
Definition:
Bits.java:1
com.cliffc.aa.node.FunNode._thunk_rhs
final boolean _thunk_rhs
Definition:
FunNode.java:68
com.cliffc.aa.GVNGCM.Mode
Definition:
GVNGCM.java:14
com.cliffc.aa.type.TypeFunSig._formals
TypeTuple _formals
Definition:
TypeFunSig.java:15
src
main
java
com
cliffc
aa
node
CEProjNode.java
Generated by
1.8.18