46 this.value = value;
47 }
48
49 public DerivedScaledInductionVariable(LoopEx loop, InductionVariable base, NegateNode value) {
50 super(loop, base);
51 this.scale = ConstantNode.forIntegerStamp(value.stamp(NodeView.DEFAULT), -1, value.graph());
52 this.value = value;
53 }
54
55 public ValueNode getScale() {
56 return scale;
57 }
58
59 @Override
60 public ValueNode valueNode() {
61 return value;
62 }
63
64 @Override
65 public Direction direction() {
66 Stamp stamp = scale.stamp(NodeView.DEFAULT);
67 if (stamp instanceof IntegerStamp) {
68 IntegerStamp integerStamp = (IntegerStamp) stamp;
69 if (integerStamp.isStrictlyPositive()) {
70 return base.direction();
71 } else if (integerStamp.isStrictlyNegative()) {
72 return base.direction().opposite();
73 }
74 }
75 return null;
76 }
77
78 @Override
79 public ValueNode initNode() {
80 return mul(graph(), base.initNode(), scale);
81 }
82
83 @Override
84 public ValueNode strideNode() {
85 return mul(graph(), base.strideNode(), scale);
86 }
87
88 @Override
89 public boolean isConstantInit() {
90 return scale.isConstant() && base.isConstantInit();
91 }
92
|
46 this.value = value;
47 }
48
49 public DerivedScaledInductionVariable(LoopEx loop, InductionVariable base, NegateNode value) {
50 super(loop, base);
51 this.scale = ConstantNode.forIntegerStamp(value.stamp(NodeView.DEFAULT), -1, value.graph());
52 this.value = value;
53 }
54
55 public ValueNode getScale() {
56 return scale;
57 }
58
59 @Override
60 public ValueNode valueNode() {
61 return value;
62 }
63
64 @Override
65 public Direction direction() {
66 Direction baseDirection = base.direction();
67 if (baseDirection == null) {
68 return null;
69 }
70 Stamp stamp = scale.stamp(NodeView.DEFAULT);
71 if (stamp instanceof IntegerStamp) {
72 IntegerStamp integerStamp = (IntegerStamp) stamp;
73 if (integerStamp.isStrictlyPositive()) {
74 return baseDirection;
75 } else if (integerStamp.isStrictlyNegative()) {
76 return baseDirection.opposite();
77 }
78 }
79 return null;
80 }
81
82 @Override
83 public ValueNode initNode() {
84 return mul(graph(), base.initNode(), scale);
85 }
86
87 @Override
88 public ValueNode strideNode() {
89 return mul(graph(), base.strideNode(), scale);
90 }
91
92 @Override
93 public boolean isConstantInit() {
94 return scale.isConstant() && base.isConstantInit();
95 }
96
|