Skip to content

Commit 6515d20

Browse files
authored
add bypass-pipeline option (#167)
Adds a `--bypass-pipeline` which will bypass the compile pipelines but still generate a payload.
1 parent 26fe16e commit 6515d20

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/API/api.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ static llvm::cl::opt<bool> includeSourceInPayload(
111111
"include-source", llvm::cl::desc("Write the input source into the payload"),
112112
llvm::cl::init(false), llvm::cl::cat(qssc::config::getQSSCCategory()));
113113

114+
static llvm::cl::opt<bool>
115+
bypassPipeline("bypass-pipeline", llvm::cl::desc("Bypass the pipeline"),
116+
llvm::cl::init(false),
117+
llvm::cl::cat(qssc::config::getQSSCCategory()));
118+
114119
namespace {
115120
enum InputType { NONE, QASM, MLIR, QOBJ };
116121
} // anonymous namespace
@@ -449,8 +454,9 @@ static llvm::Error generateQEM_(qssc::hal::TargetSystem &target,
449454
std::unique_ptr<qssc::payload::Payload> payload,
450455
mlir::ModuleOp moduleOp,
451456
llvm::raw_ostream *ostream) {
452-
if (auto err = target.addToPayload(moduleOp, *payload))
453-
return err;
457+
if (!bypassPipeline)
458+
if (auto err = target.addToPayload(moduleOp, *payload))
459+
return err;
454460

455461
if (plaintextPayload)
456462
payload->writePlain(*ostream);
@@ -667,7 +673,7 @@ compile_(int argc, char const **argv, std::string *outputString,
667673
std::move(err));
668674

669675
// Run the pipeline.
670-
if (failed(pm.run(moduleOp)))
676+
if (!bypassPipeline && failed(pm.run(moduleOp)))
671677
return llvm::createStringError(llvm::inconvertibleErrorCode(),
672678
"Problems running the compiler pipeline!");
673679

0 commit comments

Comments
 (0)