//===- llvm/Analysis/LockStepAnalysisEvaluator.h -------------------------*- C++
//-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// This file defines the pass for running lockstep analysis for a random set
// values of a function.
//===----------------------------------------------------------------------===//

#ifndef LLVM_ANALYSIS_LOCKSTEP_EVALUATOR_H
#define LLVM_ANALYSIS_LOCKSTEP_EVALUATOR_H
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/CallSiteAnalysis.h"
#include "llvm/Analysis/TBAATypeReconstruction.h"
#include "llvm/Analysis/FunctionCallsInfoAnalysis.h"
#include "llvm/IR/PassManager.h"

using namespace std;

namespace llvm {

class Function;
class FunctionPass;

class LockStepEvaluationAnalysis
    : public AnalysisInfoMixin<LockStepEvaluationAnalysis> {
  friend AnalysisInfoMixin<LockStepEvaluationAnalysis>;
  static AnalysisKey Key;

private:
  SmallVector<Value *, 2> localDefs;
  void computeLocalDefs(Function &F);
  void evaluateLockStepAnalysis(Function &F, TBAATypeReconstruction &TypeRecon,
                                aocc::CSFunctionProperty &CS,
                                FunctionAnalysisManager &FAM, FunctionCallsInfo &FC);

public:
  LockStepEvaluationAnalysis() = default;

public:
  PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};

} // namespace llvm

#endif // LLVM_ANALYSIS_LOCKSTEP_EVALUATOR_H
