CIRCT 23.0.0git
Loading...
Searching...
No Matches
RTGPassPipelines.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
14#include "mlir/Pass/PassManager.h"
15#include "mlir/Transforms/Passes.h"
16
17using namespace mlir;
18
19//===----------------------------------------------------------------------===//
20// Pipeline implementation.
21//===----------------------------------------------------------------------===//
22
24 OpPassManager &pm, const RandomizationPipelineOptions &options) {
25 {
26 ElaborationPassOptions passOptions;
27 passOptions.seed = options.seed;
28 pm.addPass(rtg::createElaborationPass(passOptions));
29 }
30 pm.addPass(rtg::createInlineSequencesPass());
31 pm.addPass(createSymbolDCEPass());
32 {
33 auto &testPm = pm.nest<rtg::TestOp>();
34 MemoryAllocationPassOptions passOptions;
35 passOptions.useImmediates = options.memoriesAsImmediates;
36 testPm.addPass(rtg::createMemoryAllocationPass(passOptions));
37 }
38}
39
41 OpPassManager &pm, const EmissionPipelineOptions &options) {
42 {
43 InsertTestToFileMappingPassOptions passOptions;
44 passOptions.splitOutput = options.splitOutput;
45 passOptions.path = options.path;
46 pm.addPass(rtg::createInsertTestToFileMappingPass(passOptions));
47 }
48 pm.addPass(rtg::createSimpleTestInlinerPass());
49 {
50 auto &testPm = pm.nest<emit::FileOp>();
51 testPm.addPass(rtg::createUniqueValidateOpsPass());
52 testPm.addPass(rtg::createLinearScanRegisterAllocationPass());
53 }
54 {
55 auto &anyPm = pm.nestAny();
56 anyPm.addPass(mlir::createCSEPass());
57 anyPm.addPass(createSimpleCanonicalizerPass());
58 }
59 pm.addPass(rtg::createLowerValidateToLabelsPass());
60 {
61 auto &filePm = pm.nest<emit::FileOp>();
62 filePm.addPass(rtg::createLowerUniqueLabelsPass());
63 filePm.addPass(rtg::createEmitRTGISAAssemblyPass());
64 }
65}
66
67//===----------------------------------------------------------------------===//
68// Pipeline registration.
69//===----------------------------------------------------------------------===//
70
72 PassPipelineRegistration<RandomizationPipelineOptions>(
73 "rtg-randomization-pipeline",
74 "The default pipeline for randomizing RTG tests.",
76 PassPipelineRegistration<EmissionPipelineOptions>(
77 "rtg-emission-pipeline", "The default pipeline for emitting RTG tests.",
79}
static std::unique_ptr< Pass > createSimpleCanonicalizerPass()
Create a simple canonicalizer pass.
void populateEmissionPipeline(mlir::OpPassManager &pm, const EmissionPipelineOptions &options)
Adds the emission pipeline to the OpPassManager.
void registerPipelines()
Registers all pipelines for the rtg dialect.
void populateRandomizationPipeline(mlir::OpPassManager &pm, const RandomizationPipelineOptions &options)
Adds the randomization pipeline to the OpPassManager.