Skip to content

Commit c058aba

Browse files
authored
Migrate the target folder structure (#154)
Move the mock target directory `mock_target` to `targets/systems/mock`. This allows us to maintain various (and future) targets more easily.
1 parent fff2174 commit c058aba

26 files changed

+25
-25
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ set(QSSC_TARGET_TEST_DIRS
146146
if(QSSC_WITH_MOCK_TARGET)
147147
set(QSSC_TARGET_DIRS
148148
${QSSC_TARGET_DIRS}
149-
${CMAKE_CURRENT_SOURCE_DIR}/mock_target
149+
${CMAKE_CURRENT_SOURCE_DIR}/targets/systems/mock
150150
)
151151
set(QSSC_TARGET_TEST_DIRS
152152
${QSSC_TARGET_TEST_DIRS}
153-
${CMAKE_CURRENT_SOURCE_DIR}/mock_target/test
153+
${CMAKE_CURRENT_SOURCE_DIR}/targets/systems/mock/test
154154
)
155155
endif()
156156

File renamed without changes.

mock_target/Conversion/QUIRToStandard/QUIRToStandard.cpp renamed to targets/systems/mock/Conversion/QUIRToStandard/QUIRToStandard.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
using namespace mlir;
4444

45-
namespace qssc::targets::mock::conversion {
45+
namespace qssc::targets::systems::mock::conversion {
4646
struct ReturnConversionPat : public OpConversionPattern<mlir::ReturnOp> {
4747

4848
explicit ReturnConversionPat(MLIRContext *ctx, TypeConverter &typeConverter)
@@ -269,4 +269,4 @@ llvm::StringRef MockQUIRToStdPass::getDescription() const {
269269
return "Convert QUIR ops to std dialect";
270270
}
271271

272-
} // namespace qssc::targets::mock::conversion
272+
} // namespace qssc::targets::systems::mock::conversion

mock_target/Conversion/QUIRToStandard/QUIRToStandard.h renamed to targets/systems/mock/Conversion/QUIRToStandard/QUIRToStandard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "mlir/IR/BuiltinOps.h"
2929
#include "mlir/Pass/Pass.h"
3030

31-
namespace qssc::targets::mock::conversion {
31+
namespace qssc::targets::systems::mock::conversion {
3232
struct MockQUIRToStdPass
3333
: public mlir::PassWrapper<
3434
MockQUIRToStdPass,
@@ -44,6 +44,6 @@ struct MockQUIRToStdPass
4444
llvm::StringRef getArgument() const override;
4545
llvm::StringRef getDescription() const override;
4646
};
47-
} // namespace qssc::targets::mock::conversion
47+
} // namespace qssc::targets::systems::mock::conversion
4848

4949
#endif // MOCK_CONVERSION_QUIRTOSTD_H

mock_target/MockTarget.cpp renamed to targets/systems/mock/MockTarget.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ using namespace mlir;
5555
using namespace mlir::quir;
5656

5757
using namespace qssc::hal;
58-
using namespace qssc::targets::mock;
58+
using namespace qssc::targets::systems::mock;
5959

6060
// The space below at the front of the string causes this category to be printed
6161
// first
@@ -64,7 +64,7 @@ static llvm::cl::OptionCategory
6464
"Options that control Mock-specific behavior of the Mock QSS "
6565
"Compiler target");
6666

67-
int qssc::targets::mock::init() {
67+
int qssc::targets::systems::mock::init() {
6868
bool registered = registry::TargetSystemRegistry::registerPlugin<MockSystem>(
6969
"mock", "Mock system for testing the targeting infrastructure.",
7070
[](llvm::Optional<llvm::StringRef> configurationPath)
@@ -154,8 +154,8 @@ MockSystem::MockSystem(std::unique_ptr<MockConfig> config)
154154
} // MockSystem
155155

156156
llvm::Error MockSystem::registerTargetPasses() {
157-
mlir::PassRegistration<qssc::targets::mock::MockFunctionLocalizationPass>();
158-
mlir::PassRegistration<qssc::targets::mock::MockQubitLocalizationPass>();
157+
mlir::PassRegistration<MockFunctionLocalizationPass>();
158+
mlir::PassRegistration<MockQubitLocalizationPass>();
159159
mlir::PassRegistration<conversion::MockQUIRToStdPass>(
160160
[]() -> std::unique_ptr<conversion::MockQUIRToStdPass> {
161161
return std::make_unique<conversion::MockQUIRToStdPass>(false);

mock_target/MockTarget.h renamed to targets/systems/mock/MockTarget.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <memory>
3030
#include <unordered_map>
3131

32-
namespace qssc::targets::mock {
32+
namespace qssc::targets::systems::mock {
3333

3434
// Register the mock target.
3535
int init();
@@ -121,6 +121,6 @@ class MockDrive : public qssc::hal::TargetInstrument {
121121
auto getModule(mlir::ModuleOp topModuleOp) -> mlir::ModuleOp;
122122
}; // class MockDrive
123123

124-
} // namespace qssc::targets::mock
124+
} // namespace qssc::targets::systems::mock
125125

126126
#endif // HAL_TARGETS_MOCK_MOCKTARGET_H

mock_target/MockUtils.cpp renamed to targets/systems/mock/MockUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323
#include <mlir/IR/BuiltinOps.h>
2424

25-
using namespace qssc::targets::mock;
25+
using namespace qssc::targets::systems::mock;
2626
using namespace mlir;
2727

28-
auto qssc::targets::mock::getControllerModule(ModuleOp topModuleOp)
28+
auto qssc::targets::systems::mock::getControllerModule(ModuleOp topModuleOp)
2929
-> ModuleOp {
3030
ModuleOp retOp = nullptr;
3131
topModuleOp->walk([&](ModuleOp walkOp) {
@@ -39,7 +39,7 @@ auto qssc::targets::mock::getControllerModule(ModuleOp topModuleOp)
3939
return retOp;
4040
}
4141

42-
auto qssc::targets::mock::getActuatorModules(ModuleOp topModuleOp)
42+
auto qssc::targets::systems::mock::getActuatorModules(ModuleOp topModuleOp)
4343
-> std::vector<ModuleOp> {
4444
std::vector<ModuleOp> retVec;
4545
topModuleOp->walk([&](ModuleOp walkOp) {

mock_target/MockUtils.h renamed to targets/systems/mock/MockUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace mlir {
2727
class ModuleOp;
2828
} // end namespace mlir
2929

30-
namespace qssc::targets::mock {
30+
namespace qssc::targets::systems::mock {
3131

3232
// Looks for and returns the Controller submodule if it exists
3333
// Returns nullptr otherwise
@@ -36,6 +36,6 @@ auto getControllerModule(mlir::ModuleOp topModuleOp) -> mlir::ModuleOp;
3636
auto getActuatorModules(mlir::ModuleOp topModuleOp)
3737
-> std::vector<mlir::ModuleOp>;
3838

39-
} // end namespace qssc::targets::mock
39+
} // namespace qssc::targets::systems::mock
4040

4141
#endif // HAL_MOCKUTILS_H

mock_target/Target.inc renamed to targets/systems/mock/Target.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
#include "MockTarget.h"
2626

27-
namespace qssc::targets::mock {
27+
namespace qssc::targets::systems::mock {
2828

2929
[[maybe_unused]] int registrar = init();
3030

31-
} // namespace qssc::targets::mock
31+
} // namespace qssc::targets::systems::mock
3232

3333
#endif // HAL_TARGETS_MOCK_TARGET_H

mock_target/Transforms/FunctionLocalization.cpp renamed to targets/systems/mock/Transforms/FunctionLocalization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
using namespace mlir;
4242
using namespace mlir::quir;
43-
using namespace qssc::targets::mock;
43+
using namespace qssc::targets::systems::mock;
4444

4545
namespace {
4646
// This map is from quir.orig_func_name to a list of functions that have that

0 commit comments

Comments
 (0)