Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Legacy ThinLTO] NFC: Move helper class to an "Impl" namespace #112846

Conversation

hubert-reinterpretcast
Copy link
Collaborator

::llvm::TargetMachineBuilder is only a helper class for
ThinLTOCodeGenerator and not a real facility. Move it into an "Impl"
namespace.

@hubert-reinterpretcast hubert-reinterpretcast added the LTO Link time optimization (regular/full LTO or ThinLTO) label Oct 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2024

@llvm/pr-subscribers-lto

Author: Hubert Tong (hubert-reinterpretcast)

Changes

::llvm::TargetMachineBuilder is only a helper class for
ThinLTOCodeGenerator and not a real facility. Move it into an "Impl"
namespace.


Full diff: https://github.com/llvm/llvm-project/pull/112846.diff

2 Files Affected:

  • (modified) llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h (+9-2)
  • (modified) llvm/lib/LTO/ThinLTOCodeGenerator.cpp (+1)
diff --git a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
index 7eb30d56e10c10..676d4e179bed4b 100644
--- a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
@@ -31,8 +31,15 @@ namespace llvm {
 class StringRef;
 class TargetMachine;
 
+/// ThinLTOCodeGeneratorImpl - Namespace used for ThinLTOCodeGenerator
+/// implementation details. It should be considered private to the
+/// implementation.
+namespace ThinLTOCodeGeneratorImpl {
+struct TargetMachineBuilder;
+}
+
 /// Helper to gather options relevant to the target machine creation
-struct TargetMachineBuilder {
+struct ThinLTOCodeGeneratorImpl::TargetMachineBuilder {
   Triple TheTriple;
   std::string MCpu;
   std::string MAttr;
@@ -301,7 +308,7 @@ class ThinLTOCodeGenerator {
 
 private:
   /// Helper factory to build a TargetMachine
-  TargetMachineBuilder TMBuilder;
+  ThinLTOCodeGeneratorImpl::TargetMachineBuilder TMBuilder;
 
   /// Vector holding the in-memory buffer containing the produced binaries, when
   /// SavedObjectsDirectoryPath isn't set.
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 8074f8690cc1ce..311510ed9fabc2 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -70,6 +70,7 @@
 #endif
 
 using namespace llvm;
+using namespace ThinLTOCodeGeneratorImpl;
 
 #define DEBUG_TYPE "thinlto"
 

`::llvm::TargetMachineBuilder` is only a helper class for
`ThinLTOCodeGenerator` and not a real facility. Move it into an "Impl"
namespace.
@hubert-reinterpretcast hubert-reinterpretcast force-pushed the users/hubert-reinterpretcast/LegacyThinLTO-MoveTargetMachineBuilder branch from 0061e5c to 30f67f3 Compare October 18, 2024 06:46
@hubert-reinterpretcast hubert-reinterpretcast merged commit 76bdc60 into main Oct 23, 2024
6 of 8 checks passed
@hubert-reinterpretcast hubert-reinterpretcast deleted the users/hubert-reinterpretcast/LegacyThinLTO-MoveTargetMachineBuilder branch October 23, 2024 22:28
@frobtech frobtech mentioned this pull request Oct 25, 2024
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
…112846)

`::llvm::TargetMachineBuilder` is only a helper class for
`ThinLTOCodeGenerator` and not a real facility. Move it into an "Impl"
namespace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTO Link time optimization (regular/full LTO or ThinLTO)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants