aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Tooling
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-12 04:21:14 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-12 04:21:14 +0800
commit1775d50ba02dab033c639f5c8fedd46cb6613bef (patch)
treeb4ca387ff0015862cdf90a8652ad35402fa9af69 /backend/lib/Tooling
parent64c0360a6646dd1d3f75b8d1ed11ec4da825256b (diff)
downloadrcc-project-1775d50ba02dab033c639f5c8fedd46cb6613bef.tar.gz
rcc-project-1775d50ba02dab033c639f5c8fedd46cb6613bef.tar.xz
[Tooling] Adopt LLVM MIR command-line spellings
Diffstat (limited to 'backend/lib/Tooling')
-rw-r--r--backend/lib/Tooling/BackendDriver.cpp9
-rw-r--r--backend/lib/Tooling/PipelineDriver.cpp6
2 files changed, 9 insertions, 6 deletions
diff --git a/backend/lib/Tooling/BackendDriver.cpp b/backend/lib/Tooling/BackendDriver.cpp
index 2a2a500..fff58c5 100644
--- a/backend/lib/Tooling/BackendDriver.cpp
+++ b/backend/lib/Tooling/BackendDriver.cpp
@@ -49,9 +49,10 @@ namespace {
[[nodiscard]] Expected<std::vector<std::uint8_t>> printMIR(const mir::MIRDocument &Document,
const TargetDescription &Target,
- const BackendInvocation &Invocation) {
+ const BackendInvocation &Invocation,
+ bool Simplify) {
mir::MIRDocumentPrinterOptions Options;
- Options.Mode = mir::MIPrintMode::Complete;
+ Options.Mode = Simplify ? mir::MIPrintMode::Readable : mir::MIPrintMode::Complete;
Options.EmitEmbeddedIR = true;
Options.DataLayout = Invocation.DataLayout;
auto Printed = mir::printMIRDocument(Document, Target, std::move(Options));
@@ -103,6 +104,8 @@ Expected<BackendRunResult> runBackend(CanonicalMIR Input, const TargetDescriptio
Controls.StopAtStage = RequiredStage;
}
+ const bool SimplifyMIR = Controls.SimplifyMIR;
+
MachinePassInstrumentation LocalInstrumentation;
MachinePassInstrumentation *ActiveInstrumentation =
Instrumentation == nullptr ? &LocalInstrumentation : Instrumentation;
@@ -113,7 +116,7 @@ Expected<BackendRunResult> runBackend(CanonicalMIR Input, const TargetDescriptio
std::vector<std::uint8_t> Bytes;
if (isMIR(Output)) {
- auto Printed = printMIR(Input.Document, Target, Invocation);
+ auto Printed = printMIR(Input.Document, Target, Invocation, SimplifyMIR);
if (!Printed)
return std::unexpected(Printed.error());
Bytes = std::move(*Printed);
diff --git a/backend/lib/Tooling/PipelineDriver.cpp b/backend/lib/Tooling/PipelineDriver.cpp
index 4dab499..620367f 100644
--- a/backend/lib/Tooling/PipelineDriver.cpp
+++ b/backend/lib/Tooling/PipelineDriver.cpp
@@ -55,11 +55,11 @@ struct FunctionRunResult final {
}
[[nodiscard]] std::optional<BackendStage> stageAfterPass(std::string_view Pass) noexcept {
- if (Pass == "Legalizer")
+ if (Pass == "legalizer")
return BackendStage::LegalizedMIR;
- if (Pass == "RegisterBankSelect")
+ if (Pass == "regbankselect")
return BackendStage::RegisterBankMIR;
- if (Pass == "InstructionSelect")
+ if (Pass == "instruction-select")
return BackendStage::SelectedMIR;
if (Pass == "TwoAddressRewrite")
return BackendStage::PostSSAMIR;