14#include "mlir/Dialect/Func/IR/FuncOps.h"
15#include "mlir/IR/BuiltinAttributes.h"
16#include "mlir/IR/Region.h"
21#include "llvm/ADT/SmallVector.h"
22#include "llvm/ADT/StringMap.h"
23#include "llvm/ADT/StringRef.h"
24#include "llvm/ADT/StringSet.h"
25#include "llvm/ADT/Twine.h"
26#include "llvm/Support/ErrorHandling.h"
27#include "llvm/Support/Path.h"
34#define GEN_PASS_DEF_LIBOPT
35#include "clang/CIR/Dialect/Passes.h.inc"
40struct LibOptPass :
public impl::LibOptBase<LibOptPass> {
41 LibOptPass() =
default;
43 initializeOptions(llvm::StringRef options,
44 llvm::function_ref<mlir::LogicalResult(
const llvm::Twine &)>
45 errorHandler)
override;
46 void runOnOperation()
override;
50 std::string optimizationOptions;
57mlir::LogicalResult LibOptPass::initializeOptions(
58 llvm::StringRef options,
59 llvm::function_ref<mlir::LogicalResult(
const llvm::Twine &)> errorHandler) {
61 optimizationOptions = options.str();
64 return mlir::success();
67void LibOptPass::runOnOperation() {
68 auto *op = getOperation();
69 if (isa<::mlir::ModuleOp>(op))
70 theModule = cast<::mlir::ModuleOp>(op);
74 return std::make_unique<LibOptPass>();
Defines the clang::Module class, which describes a module in the source code.
std::unique_ptr< Pass > createLibOptPass()