mirror of https://github.com/llvm/circt.git
[hlstool] add top-level-function option for calyx flow (#8434)
This commit is contained in:
parent
e123e5230a
commit
0ab7ab0366
|
@ -31,7 +31,8 @@ static constexpr std::string_view sPortNameAttr = "calyx.port_name";
|
|||
} // namespace scfToCalyx
|
||||
|
||||
/// Create an SCF to Calyx conversion pass.
|
||||
std::unique_ptr<OperationPass<ModuleOp>> createSCFToCalyxPass();
|
||||
std::unique_ptr<OperationPass<ModuleOp>>
|
||||
createSCFToCalyxPass(std::string topLevelFunction = "");
|
||||
|
||||
} // namespace circt
|
||||
|
||||
|
|
|
@ -2578,8 +2578,10 @@ using namespace circt::scftocalyx;
|
|||
//===----------------------------------------------------------------------===//
|
||||
class SCFToCalyxPass : public circt::impl::SCFToCalyxBase<SCFToCalyxPass> {
|
||||
public:
|
||||
SCFToCalyxPass()
|
||||
: SCFToCalyxBase<SCFToCalyxPass>(), partialPatternRes(success()) {}
|
||||
SCFToCalyxPass(std::string topLevelFunction)
|
||||
: SCFToCalyxBase<SCFToCalyxPass>(), partialPatternRes(success()) {
|
||||
this->topLevelFunctionOpt = topLevelFunction;
|
||||
}
|
||||
void runOnOperation() override;
|
||||
|
||||
LogicalResult setTopLevelFunction(mlir::ModuleOp moduleOp,
|
||||
|
@ -3042,8 +3044,9 @@ void SCFToCalyxPass::runOnOperation() {
|
|||
// Pass initialization
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
std::unique_ptr<OperationPass<ModuleOp>> createSCFToCalyxPass() {
|
||||
return std::make_unique<SCFToCalyxPass>();
|
||||
std::unique_ptr<OperationPass<ModuleOp>>
|
||||
createSCFToCalyxPass(std::string topLevelFunction) {
|
||||
return std::make_unique<SCFToCalyxPass>(topLevelFunction);
|
||||
}
|
||||
|
||||
} // namespace circt
|
||||
|
|
|
@ -5,3 +5,4 @@
|
|||
// CHECK: Generic Options
|
||||
// CHECK: hlstool Options
|
||||
// CHECK: --lowering-options=
|
||||
// CHECK: --top-level-function=
|
||||
|
|
|
@ -224,6 +224,14 @@ static cl::opt<bool> withDC("dc", cl::desc("Use the DC flow"), cl::init(false),
|
|||
|
||||
static LoweringOptionsOption loweringOptions(mainCategory);
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Calyx options
|
||||
// --------------------------------------------------------------------------
|
||||
static cl::opt<std::string> topLevelFunction("top-level-function",
|
||||
cl::desc("Top level function"),
|
||||
cl::init(""),
|
||||
cl::cat(mainCategory));
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// (Configurable) pass pipelines
|
||||
// --------------------------------------------------------------------------
|
||||
|
@ -412,8 +420,9 @@ static LogicalResult doHLSFlowCalyx(
|
|||
});
|
||||
|
||||
// Lower to Calyx
|
||||
addIRLevel(IRLevel::Core,
|
||||
[&]() { pm.addPass(circt::createSCFToCalyxPass()); });
|
||||
addIRLevel(IRLevel::Core, [&]() {
|
||||
pm.addPass(circt::createSCFToCalyxPass(topLevelFunction));
|
||||
});
|
||||
|
||||
// Run Calyx transforms
|
||||
addIRLevel(IRLevel::PostCompile, [&]() {
|
||||
|
|
Loading…
Reference in New Issue