-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New IR in place of old IR - New DDG is used in place of old scheduler - Various code improvements (e.g. return result instead of modify reference parameter)
- Loading branch information
Showing
44 changed files
with
1,302 additions
and
3,261 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
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
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,33 @@ | ||
#include "ql/ir/ir.h" | ||
|
||
namespace ql { | ||
namespace com { | ||
namespace map { | ||
|
||
class ReferenceUpdater : public ir::RecursiveVisitor { | ||
public: | ||
using Callback = std::function<void(utils::UInt)>; | ||
|
||
ReferenceUpdater(ir::PlatformRef p, const utils::Vec<utils::UInt> &m, | ||
Callback c = {}) : platform(p), mapping(m), callback(c) {} | ||
|
||
void visit_node(ir::Node &node) override {}; | ||
|
||
void visit_reference(ir::Reference &ref) override; | ||
|
||
// Gate operands may be virtual qubits, but in the instruction type it's always real qubit indices. | ||
void visit_instruction_type(ir::InstructionType &t) override {}; | ||
|
||
private: | ||
ir::PlatformRef platform; | ||
const utils::Vec<utils::UInt> &mapping; | ||
Callback callback{}; | ||
}; | ||
|
||
void mapInstruction(const ir::PlatformRef &platform, const utils::Vec<utils::UInt> &mapping, const ir::CustomInstructionRef &instr, ReferenceUpdater::Callback callback = {}); | ||
|
||
void mapProgram(const ir::PlatformRef &platform, const utils::Vec<utils::UInt> &mapping, const ir::ProgramRef &program); | ||
|
||
} | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include "ql/utils/num.h" | ||
|
||
namespace ql { | ||
namespace ir { | ||
|
||
struct SwapParameters { | ||
utils::Bool part_of_swap = false; | ||
// at the end of the swap r0 stores v0 and r1 stores v1 | ||
utils::Int r0 = -1; | ||
utils::Int r1 = -1; | ||
utils::Int v0 = -1; | ||
utils::Int v1 = -1; | ||
|
||
// default constructor | ||
SwapParameters() {} | ||
|
||
// initializer list | ||
SwapParameters(utils::Bool _part_of_swap, utils::Int _r0, utils::Int _r1, utils::Int _v0, utils::Int _v1) | ||
: part_of_swap(_part_of_swap), r0(_r0), r1(_r1), v0(_v0), v1(_v1) | ||
{} | ||
}; | ||
|
||
} | ||
} |
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
Oops, something went wrong.