5 #ifndef V8_COMPILER_DIAMOND_H_ 6 #define V8_COMPILER_DIAMOND_H_ 8 #include "src/compiler/common-operator.h" 9 #include "src/compiler/graph.h" 10 #include "src/compiler/node.h" 26 BranchHint hint = BranchHint::kNone) {
29 branch = graph->NewNode(common->Branch(hint), cond, graph->start());
30 if_true = graph->NewNode(common->IfTrue(), branch);
31 if_false = graph->NewNode(common->IfFalse(), branch);
32 merge = graph->NewNode(common->Merge(2), if_true, if_false);
36 void Chain(
Diamond& that) { branch->ReplaceInput(1, that.merge); }
39 void Chain(
Node* that) { branch->ReplaceInput(1, that); }
42 void Nest(
Diamond& that,
bool if_true) {
44 branch->ReplaceInput(1, that.if_true);
45 that.merge->ReplaceInput(0, merge);
47 branch->ReplaceInput(1, that.if_false);
48 that.merge->ReplaceInput(1, merge);
52 Node* Phi(MachineRepresentation rep,
Node* tv,
Node* fv) {
53 return graph->NewNode(common->Phi(rep, 2), tv, fv, merge);
57 return graph->NewNode(common->EffectPhi(2), tv, fv, merge);
65 #endif // V8_COMPILER_DIAMOND_H_