inline int NodeProperties::PastValueIndex(Node* node) {
- return FirstValueIndex(node) +
- OperatorProperties::GetValueInputCount(node->op());
+ return FirstValueIndex(node) + node->op()->ValueInputCount();
}
inline int NodeProperties::PastContextIndex(Node* node) {
}
inline int NodeProperties::PastEffectIndex(Node* node) {
- return FirstEffectIndex(node) +
- OperatorProperties::GetEffectInputCount(node->op());
+ return FirstEffectIndex(node) + node->op()->EffectInputCount();
}
inline int NodeProperties::PastControlIndex(Node* node) {
- return FirstControlIndex(node) +
- OperatorProperties::GetControlInputCount(node->op());
+ return FirstControlIndex(node) + node->op()->ControlInputCount();
}
// Input accessors.
inline Node* NodeProperties::GetValueInput(Node* node, int index) {
- DCHECK(0 <= index &&
- index < OperatorProperties::GetValueInputCount(node->op()));
+ DCHECK(0 <= index && index < node->op()->ValueInputCount());
return node->InputAt(FirstValueIndex(node) + index);
}
}
inline Node* NodeProperties::GetEffectInput(Node* node, int index) {
- DCHECK(0 <= index &&
- index < OperatorProperties::GetEffectInputCount(node->op()));
+ DCHECK(0 <= index && index < node->op()->EffectInputCount());
return node->InputAt(FirstEffectIndex(node) + index);
}
inline Node* NodeProperties::GetControlInput(Node* node, int index) {
- DCHECK(0 <= index &&
- index < OperatorProperties::GetControlInputCount(node->op()));
+ DCHECK(0 <= index && index < node->op()->ControlInputCount());
return node->InputAt(FirstControlIndex(node) + index);
}
inline bool NodeProperties::IsValueEdge(Node::Edge edge) {
Node* node = edge.from();
return IsInputRange(edge, FirstValueIndex(node),
- OperatorProperties::GetValueInputCount(node->op()));
+ node->op()->ValueInputCount());
}
inline bool NodeProperties::IsContextEdge(Node::Edge edge) {
inline bool NodeProperties::IsEffectEdge(Node::Edge edge) {
Node* node = edge.from();
return IsInputRange(edge, FirstEffectIndex(node),
- OperatorProperties::GetEffectInputCount(node->op()));
+ node->op()->EffectInputCount());
}
inline bool NodeProperties::IsControlEdge(Node::Edge edge) {
Node* node = edge.from();
return IsInputRange(edge, FirstControlIndex(node),
- OperatorProperties::GetControlInputCount(node->op()));
+ node->op()->ControlInputCount());
}
inline void NodeProperties::ReplaceEffectInput(Node* node, Node* effect,
int index) {
- DCHECK(index < OperatorProperties::GetEffectInputCount(node->op()));
+ DCHECK(index < node->op()->EffectInputCount());
return node->ReplaceInput(FirstEffectIndex(node) + index, effect);
}
}
inline void NodeProperties::RemoveNonValueInputs(Node* node) {
- node->TrimInputCount(OperatorProperties::GetValueInputCount(node->op()));
+ node->TrimInputCount(node->op()->ValueInputCount());
}
// {effect}. If {effect == NULL}, then use the effect input to {node}.
inline void NodeProperties::ReplaceWithValue(Node* node, Node* value,
Node* effect) {
- DCHECK(!OperatorProperties::HasControlOutput(node->op()));
- if (effect == NULL && OperatorProperties::HasEffectInput(node->op())) {
+ DCHECK(node->op()->ControlOutputCount() == 0);
+ if (effect == NULL && node->op()->EffectInputCount() > 0) {
effect = NodeProperties::GetEffectInput(node);
}
// -----------------------------------------------------------------------------
// Type Bounds.
-inline Bounds NodeProperties::GetBounds(Node* node) { return node->bounds(); }
+inline bool NodeProperties::IsTyped(Node* node) {
+ Bounds bounds = node->bounds();
+ DCHECK((bounds.lower == NULL) == (bounds.upper == NULL));
+ return bounds.upper != NULL;
+}
+
+inline Bounds NodeProperties::GetBounds(Node* node) {
+ DCHECK(IsTyped(node));
+ return node->bounds();
+}
inline void NodeProperties::SetBounds(Node* node, Bounds b) {
+ DCHECK(b.lower != NULL && b.upper != NULL);
node->set_bounds(b);
}
+inline bool NodeProperties::AllValueInputsAreTyped(Node* node) {
+ int input_count = node->op()->ValueInputCount();
+ for (int i = 0; i < input_count; ++i) {
+ if (!IsTyped(GetValueInput(node, i))) return false;
+ }
+ return true;
+}
+
}
}