aboutsummaryrefslogtreecommitdiff
path: root/backend/unittests
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-12 19:45:09 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-12 19:45:09 +0800
commit09e8ef3e0dae29be7aa21a6e22a118a3f545945f (patch)
treecfc5a7148aca9e768df16743c2c637e8c00a9d44 /backend/unittests
parent1775d50ba02dab033c639f5c8fedd46cb6613bef (diff)
downloadrcc-project-09e8ef3e0dae29be7aa21a6e22a118a3f545945f.tar.gz
rcc-project-09e8ef3e0dae29be7aa21a6e22a118a3f545945f.tar.xz
[Tooling] Complete the LLVM MIR command-line contract
Diffstat (limited to 'backend/unittests')
-rw-r--r--backend/unittests/Tooling/BackendManifestTest.cpp6
-rw-r--r--backend/unittests/Tooling/PipelineDriverTest.cpp22
2 files changed, 7 insertions, 21 deletions
diff --git a/backend/unittests/Tooling/BackendManifestTest.cpp b/backend/unittests/Tooling/BackendManifestTest.cpp
index 36a023c..2e2a04c 100644
--- a/backend/unittests/Tooling/BackendManifestTest.cpp
+++ b/backend/unittests/Tooling/BackendManifestTest.cpp
@@ -97,11 +97,11 @@ int main() {
if (!keyDiffers(Base, Changed, Input, *Fingerprint))
return tooling_test::fail("cache key must include the data layout");
Changed = Base;
- Changed.Relocation = rcc::tooling::RelocationModel::Static;
+ Changed.Relocation = rcc::RelocationModel::Static;
if (!keyDiffers(Base, Changed, Input, *Fingerprint))
return tooling_test::fail("cache key must include the relocation model");
Changed = Base;
- Changed.Code = rcc::tooling::CodeModel::Medium;
+ Changed.Code = rcc::CodeModel::Medium;
if (!keyDiffers(Base, Changed, Input, *Fingerprint))
return tooling_test::fail("cache key must include the code model");
Changed = Base;
@@ -121,7 +121,7 @@ int main() {
if (!keyDiffers(Base, Changed, Input, *Fingerprint))
return tooling_test::fail("cache key must include assembler options");
Changed = Base;
- Changed.Optimization = rcc::tooling::OptimizationLevel::O3;
+ Changed.Optimization = rcc::OptimizationLevel::O3;
if (!keyDiffers(Base, Changed, Input, *Fingerprint))
return tooling_test::fail("cache key must include the optimization level");
Changed = Base;
diff --git a/backend/unittests/Tooling/PipelineDriverTest.cpp b/backend/unittests/Tooling/PipelineDriverTest.cpp
index 273de52..473b444 100644
--- a/backend/unittests/Tooling/PipelineDriverTest.cpp
+++ b/backend/unittests/Tooling/PipelineDriverTest.cpp
@@ -195,7 +195,7 @@ int main() {
return tooling_test::fail(PrintInput.error().message());
rcc::tooling::PipelineControls PrintControls;
PrintControls.PrintBefore = {"legalizer"};
- PrintControls.PrintAfter = {"legalizer#1"};
+ PrintControls.PrintAfter = {"legalizer"};
auto PrintPoints =
rcc::tooling::runRV64GCPipeline(PrintInput->Document, *Target, Invocation, PrintControls);
if (!PrintPoints || PrintPoints->Snapshots.size() != 2 ||
@@ -209,7 +209,7 @@ int main() {
if (!StopInput)
return tooling_test::fail(StopInput.error().message());
rcc::tooling::PipelineControls StopControls;
- StopControls.StopAfter = "legalizer#1";
+ StopControls.StopAfter = "legalizer,0";
auto Stopped =
rcc::tooling::runRV64GCPipeline(StopInput->Document, *Target, Invocation, StopControls);
const rcc::MachineFunction *StoppedFunction = StopInput->Document.unit().functionAt(0);
@@ -221,9 +221,9 @@ int main() {
Stopped->ExecutedPasses[1].Pass != "legalizer") {
return tooling_test::fail("stop-after must stop at the selected pass occurrence");
}
- StopControls.StopAfter = "legalizer#0";
+ StopControls.StopAfter = "legalizer,-1";
if (rcc::tooling::runRV64GCPipeline(StopInput->Document, *Target, Invocation, StopControls))
- return tooling_test::fail("pipeline controls must reject occurrence zero");
+ return tooling_test::fail("pipeline controls must reject a negative pass instance");
rcc::tooling::BackendInvocation MixedPipeline = Invocation;
MixedPipeline.PassPipeline = {"default", "legalizer"};
@@ -234,20 +234,6 @@ int main() {
if (rcc::tooling::runRV64GCPipeline(MixedInput->Document, *Target, MixedPipeline))
return tooling_test::fail("named passes must not be mixed with the default pipeline marker");
- rcc::tooling::BackendInvocation NoPassInvocation = Invocation;
- NoPassInvocation.PassPipeline = {"none"};
- auto NoPassInput =
- rcc::tooling::parseAndCanonicalizeMIR("no-pass.mir", *Source, *Target, NoPassInvocation);
- if (!NoPassInput)
- return tooling_test::fail(NoPassInput.error().message());
- const std::string NoPassExpected = NoPassInput->Text;
- auto NoPassRun = rcc::tooling::runBackend(std::move(*NoPassInput), *Target, NoPassInvocation,
- rcc::tooling::BackendOutputKind::FinalMIR);
- if (!NoPassRun || !NoPassRun->Pipeline.ExecutedPasses.empty() ||
- NoPassRun->text() != NoPassExpected) {
- return tooling_test::fail("the LLVM-compatible none pass must preserve canonical MIR");
- }
-
if (!SelectedMIR)
return tooling_test::fail("selected MIR stage was not captured");
auto LaterInput =