-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
782 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(IR) | ||
add_subdirectory(Transforms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set(LLVM_TARGET_DEFINITIONS RTGPasses.td) | ||
mlir_tablegen(RTGPasses.h.inc -gen-pass-decls) | ||
add_public_tablegen_target(CIRCTRTGTransformsIncGen) | ||
|
||
# Generate Pass documentation. | ||
add_circt_doc(RTGPasses RTGPasses -gen-pass-doc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//===- RTGPasses.h - RTG pass entry points ----------------------*- 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 header file defines prototypes that expose pass constructors. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CIRCT_DIALECT_RTG_RTGPASSES_H | ||
#define CIRCT_DIALECT_RTG_RTGPASSES_H | ||
|
||
#include "mlir/Pass/Pass.h" | ||
#include <memory> | ||
#include <optional> | ||
|
||
namespace circt { | ||
namespace rtg { | ||
|
||
/// Options for the ElaborationPass | ||
struct ElaborationOptions { | ||
/// The seed for any RNG constructs used in the pass. If `std::nullopt` is | ||
/// passed, no seed is used and thus the IR after each invocation of this pass | ||
/// will be different non-deterministically. However, if a nubmer is provided, | ||
/// the pass is guaranteed to produce the same IR every time. | ||
std::optional<unsigned> seed; | ||
|
||
/// When in debug mode the pass queries the values that would otherwise be | ||
/// provided by the RNG from an attribute attached to the operation called | ||
/// 'rtg.elaboration'. | ||
bool debugMode = false; | ||
}; | ||
|
||
std::unique_ptr<mlir::Pass> createElaborationPass(); | ||
std::unique_ptr<mlir::Pass> | ||
createElaborationPass(const ElaborationOptions &options); | ||
|
||
/// Generate the code for registering passes. | ||
#define GEN_PASS_REGISTRATION | ||
#include "circt/Dialect/RTG/Transforms/RTGPasses.h.inc" | ||
#undef GEN_PASS_REGISTRATION | ||
|
||
} // namespace rtg | ||
} // namespace circt | ||
|
||
#endif // CIRCT_DIALECT_RTG_RTGPASSES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//===-- RTGPasses.td - RTG pass definition file ------------*- tablegen -*-===// | ||
// | ||
// 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 passes that operate on the RTG dialect. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef CIRCT_DIALECT_RTG_RTGPASSES_TD | ||
#define CIRCT_DIALECT_RTG_RTGPASSES_TD | ||
|
||
include "mlir/Pass/PassBase.td" | ||
|
||
def ElaborationPass : Pass<"rtg-elaborate", "mlir::ModuleOp"> { | ||
let summary = "elaborate the randomization parts"; | ||
let description = [{ | ||
This pass interprets most RTG operations to perform the represented | ||
randomization and in the process get rid of those operations. This means, | ||
after this pass the IR does not contain any random constructs within tests | ||
anymore. | ||
}]; | ||
|
||
// Define a custom constructor to have more control over the pass options | ||
// (e.g., std::optional options are not handled very well). | ||
let constructor = "::circt::rtg::createElaborationPass()"; | ||
} | ||
|
||
#endif // CIRCT_DIALECT_RTG_RTGPASSES_TD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
add_subdirectory(IR) | ||
add_subdirectory(Transforms) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
add_circt_dialect_library(CIRCTRTGTransforms | ||
ElaborationPass.cpp | ||
|
||
DEPENDS | ||
CIRCTRTGTransformsIncGen | ||
|
||
LINK_COMPONENTS | ||
Support | ||
|
||
LINK_LIBS PRIVATE | ||
CIRCTRTGDialect | ||
MLIRIR | ||
MLIRPass | ||
) | ||
|
Oops, something went wrong.