// Copyright 2022 The Tint Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef SRC_TINT_IR_IF_H_
#define SRC_TINT_IR_IF_H_

#include "src/tint/ir/block.h"
#include "src/tint/ir/branch.h"
#include "src/tint/ir/value.h"

// Forward declarations
namespace tint::ir {
class Block;
}  // namespace tint::ir

namespace tint::ir {

/// An if instruction
class If : public utils::Castable<If, Branch> {
  public:
    /// Constructor
    /// @param cond the if condition
    /// @param t the true block
    /// @param f the false block
    /// @param m the merge block
    explicit If(Value* cond, ir::Block* t, ir::Block* f, ir::Block* m);
    ~If() override;

    /// @returns the branch arguments
    utils::Slice<Value*> Args() const override { return utils::Slice<Value*>{}; }

    /// @returns the if condition
    const Value* Condition() const { return operands_[0]; }
    /// @returns the if condition
    Value* Condition() { return operands_[0]; }

    /// @returns the true branch block
    const ir::Block* True() const { return true_; }
    /// @returns the true branch block
    ir::Block* True() { return true_; }

    /// @returns the false branch block
    const ir::Block* False() const { return false_; }
    /// @returns the false branch block
    ir::Block* False() { return false_; }

    /// @returns the merge branch block
    const ir::Block* Merge() const { return merge_; }
    /// @returns the merge branch block
    ir::Block* Merge() { return merge_; }

  private:
    ir::Block* true_ = nullptr;
    ir::Block* false_ = nullptr;
    ir::Block* merge_ = nullptr;
};

}  // namespace tint::ir

#endif  // SRC_TINT_IR_IF_H_
