Modularize driver subcommands and prune unused dependencies (#7658)

- Subdivide toolchain/driver:driver into granular subcommand targets
(compile_subcommand, format_subcommand, lld_subcommand, etc.) to enable
independent compilation and linking.
- Decouple Target and TargetMachine options from driver headers.
- Prune unused direct dependencies across toolchain BUILD files.

Assisted-by: Antigravity with Gemini
This commit is contained in:
Chandler Carruth
2026-08-20 13:32:46 +00:00
committed by GitHub
parent 9c486de2de
commit 631f8fb6d2
10 changed files with 298 additions and 93 deletions
+7
View File
@@ -19,11 +19,14 @@
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Passes/OptimizationLevel.h"
#include "llvm/Passes/PassBuilder.h"
#include "llvm/Passes/StandardInstrumentations.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Target/TargetMachine.h"
#include "toolchain/base/clang_invocation.h"
#include "toolchain/base/timings.h"
#include "toolchain/check/check.h"
@@ -62,6 +65,8 @@ CompilationUnit::CompilationUnit(
}
}
CompilationUnit::~CompilationUnit() = default;
auto CompilationUnit::IncludeInDumps() -> bool {
return cache_->include_in_dumps().Get(check_ir_id_);
}
@@ -421,6 +426,8 @@ auto CompilationUnit::LogCall(llvm::StringLiteral logging_label,
CompileDriver::CompileDriver(CompileOptions* options) : options_(options) {}
CompileDriver::~CompileDriver() = default;
auto CompileDriver::Initialize(
DriverEnv& driver_env,
llvm::function_ref<auto(llvm::StringRef)->std::string> map_input) -> bool {