Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 1 | // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef V8_COMPILER_NODE_PROPERTIES_H_ |
| 6 | #define V8_COMPILER_NODE_PROPERTIES_H_ |
| 7 | |
| 8 | #include "src/compiler/node.h" |
| 9 | #include "src/types.h" |
| 10 | |
| 11 | namespace v8 { |
| 12 | namespace internal { |
| 13 | namespace compiler { |
| 14 | |
| 15 | class Operator; |
| 16 | |
| 17 | // A facade that simplifies access to the different kinds of inputs to a node. |
| 18 | class NodeProperties { |
| 19 | public: |
| 20 | static inline Node* GetValueInput(Node* node, int index); |
| 21 | static inline Node* GetContextInput(Node* node); |
| 22 | static inline Node* GetFrameStateInput(Node* node); |
| 23 | static inline Node* GetEffectInput(Node* node, int index = 0); |
| 24 | static inline Node* GetControlInput(Node* node, int index = 0); |
| 25 | |
| 26 | static inline int GetFrameStateIndex(Node* node); |
| 27 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 28 | static inline bool IsValueEdge(Edge edge); |
| 29 | static inline bool IsContextEdge(Edge edge); |
| 30 | static inline bool IsEffectEdge(Edge edge); |
| 31 | static inline bool IsControlEdge(Edge edge); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 32 | |
| 33 | static inline bool IsControl(Node* node); |
| 34 | |
| 35 | static inline void ReplaceControlInput(Node* node, Node* control); |
| 36 | static inline void ReplaceEffectInput(Node* node, Node* effect, |
| 37 | int index = 0); |
| 38 | static inline void ReplaceFrameStateInput(Node* node, Node* frame_state); |
| 39 | static inline void RemoveNonValueInputs(Node* node); |
| 40 | static inline void ReplaceWithValue(Node* node, Node* value, |
| 41 | Node* effect = NULL); |
| 42 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 43 | static inline bool IsTyped(Node* node); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 44 | static inline Bounds GetBounds(Node* node); |
| 45 | static inline void SetBounds(Node* node, Bounds bounds); |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 46 | static inline void RemoveBounds(Node* node); |
| 47 | static inline bool AllValueInputsAreTyped(Node* node); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 48 | |
| 49 | static inline int FirstValueIndex(Node* node); |
| 50 | static inline int FirstContextIndex(Node* node); |
| 51 | static inline int FirstFrameStateIndex(Node* node); |
| 52 | static inline int FirstEffectIndex(Node* node); |
| 53 | static inline int FirstControlIndex(Node* node); |
| 54 | static inline int PastValueIndex(Node* node); |
| 55 | static inline int PastContextIndex(Node* node); |
| 56 | static inline int PastFrameStateIndex(Node* node); |
| 57 | static inline int PastEffectIndex(Node* node); |
| 58 | static inline int PastControlIndex(Node* node); |
| 59 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 60 | static inline bool IsInputRange(Edge edge, int first, int count); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | } // namespace compiler |
| 64 | } // namespace internal |
| 65 | } // namespace v8 |
| 66 | |
| 67 | #endif // V8_COMPILER_NODE_PROPERTIES_H_ |