1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
//===- SPIRVLowerConstExpr.h - Lower constant expression --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/// \file SPIRVLowerConstExpr.h
///
/// This file declares SPIRVLowerConstExprPass that lowers constant expression.
///
//===----------------------------------------------------------------------===//
#ifndef SPIRV_LOWERCONSTEXPR_H
#define SPIRV_LOWERCONSTEXPR_H
#include "llvm/IR/PassManager.h"
namespace llvm {
class LLVMContext;
} // namespace llvm
namespace SPIRV {
class SPIRVLowerConstExprBase {
public:
SPIRVLowerConstExprBase() : M(nullptr), Ctx(nullptr) {}
bool runLowerConstExpr(llvm::Module &M);
bool visit(llvm::Module *M);
private:
llvm::Module *M;
llvm::LLVMContext *Ctx;
};
class SPIRVLowerConstExprPass
: public llvm::PassInfoMixin<SPIRVLowerConstExprPass>,
public SPIRVLowerConstExprBase {
public:
llvm::PreservedAnalyses run(llvm::Module &M,
llvm::ModuleAnalysisManager &MAM) {
return runLowerConstExpr(M) ? llvm::PreservedAnalyses::none()
: llvm::PreservedAnalyses::all();
}
static bool isRequired() { return true; }
};
} // namespace SPIRV
#endif // SPIRV_LOWERCONSTEXPR_H
|