Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions mlir/include/mlir/Dialect/QC/Translation/TranslateQASM3ToQC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
* Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
* All rights reserved.
*
* SPDX-License-Identifier: MIT
*
* Licensed under the MIT License
*/

#pragma once

#include <mlir/IR/BuiltinOps.h>
#include <mlir/IR/MLIRContext.h>

#include <iosfwd>
#include <string>

namespace mlir::qc {

/**
* @brief Import a QASM3 program directly into the QC dialect.
*
* @details Bypasses qc::QuantumComputation: the parser produces an AST walked
* by an InstVisitor that emits QC dialect ops via QCProgramBuilder.
* Returns nullptr on failure (diagnostics written to llvm::errs()).
*/
[[nodiscard]] OwningOpRef<ModuleOp>
translateQASM3ToQC(MLIRContext* context, const std::string& filename);

[[nodiscard]] OwningOpRef<ModuleOp> translateQASM3ToQC(MLIRContext* context,
std::istream& input);

} // namespace mlir::qc
4 changes: 3 additions & 1 deletion mlir/lib/Dialect/QC/Translation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
add_mlir_library(
MLIRQCTranslation
TranslateQuantumComputationToQC.cpp
TranslateQASM3ToQC.cpp
LINK_LIBS
MLIRArithDialect
MLIRFuncDialect
MLIRSCFDialect
MLIRQCDialect
MLIRQCProgramBuilder
MQT::CoreIR)
MQT::CoreIR
MQT::CoreQASM)

mqt_mlir_target_use_project_options(MLIRQCTranslation)

Expand Down
Loading
Loading