/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * 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 ART_COMPILER_OPTIMIZING_LOAD_STORE_ELIMINATION_H_
#define ART_COMPILER_OPTIMIZING_LOAD_STORE_ELIMINATION_H_

#include "base/macros.h"
#include "optimization.h"

namespace art HIDDEN {

class SideEffectsAnalysis;

class LoadStoreElimination : public HOptimization {
 public:
  // Whether or not we should attempt partial Load-store-elimination which
  // requires additional blocks and predicated instructions.
  static constexpr bool kEnablePartialLSE = false;

  // Controls whether to enable VLOG(compiler) logs explaining the transforms taking place.
  static constexpr bool kVerboseLoggingMode = false;

  LoadStoreElimination(HGraph* graph,
                       OptimizingCompilerStats* stats,
                       const char* name = kLoadStoreEliminationPassName)
      : HOptimization(graph, name, stats) {}

  bool Run() override {
    return Run(kEnablePartialLSE);
  }

  // Exposed for testing.
  bool Run(bool enable_partial_lse);

  static constexpr const char* kLoadStoreEliminationPassName = "load_store_elimination";

 private:
  DISALLOW_COPY_AND_ASSIGN(LoadStoreElimination);
};

}  // namespace art

#endif  // ART_COMPILER_OPTIMIZING_LOAD_STORE_ELIMINATION_H_
