[llvm] [BOLT] Only link and initialize supported targets (PR #127509)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 17 07:41:22 PST 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff b16ce8fc24f32aa0614562de0a2d0916118398fb 3a1a7b039f54de1fb4fb3fa2fd8513cac3b1a958 --extensions cpp -- bolt/tools/binary-analysis/binary-analysis.cpp bolt/tools/driver/llvm-bolt.cpp bolt/tools/heatmap/heatmap.cpp bolt/tools/llvm-bolt-fuzzer/llvm-bolt-fuzzer.cpp bolt/unittests/Core/BinaryContext.cpp bolt/unittests/Core/MCPlusBuilder.cpp bolt/unittests/Core/MemoryMaps.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/bolt/tools/binary-analysis/binary-analysis.cpp b/bolt/tools/binary-analysis/binary-analysis.cpp
index 779a097ff0..0e3584eeed 100644
--- a/bolt/tools/binary-analysis/binary-analysis.cpp
+++ b/bolt/tools/binary-analysis/binary-analysis.cpp
@@ -88,12 +88,12 @@ int main(int argc, char **argv) {
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
// Initialize targets and assembly printers/parsers.
-#define BOLT_TARGET(target) \
- LLVMInitialize##target##TargetInfo(); \
- LLVMInitialize##target##TargetMC(); \
- LLVMInitialize##target##AsmParser(); \
- LLVMInitialize##target##Disassembler(); \
- LLVMInitialize##target##Target(); \
+#define BOLT_TARGET(target) \
+ LLVMInitialize##target##TargetInfo(); \
+ LLVMInitialize##target##TargetMC(); \
+ LLVMInitialize##target##AsmParser(); \
+ LLVMInitialize##target##Disassembler(); \
+ LLVMInitialize##target##Target(); \
LLVMInitialize##target##AsmPrinter();
#include "bolt/Core/TargetConfig.def"
diff --git a/bolt/tools/driver/llvm-bolt.cpp b/bolt/tools/driver/llvm-bolt.cpp
index 0f29ea0d3c..6b6714723f 100644
--- a/bolt/tools/driver/llvm-bolt.cpp
+++ b/bolt/tools/driver/llvm-bolt.cpp
@@ -183,12 +183,12 @@ int main(int argc, char **argv) {
std::string ToolPath = llvm::sys::fs::getMainExecutable(argv[0], nullptr);
// Initialize targets and assembly printers/parsers.
-#define BOLT_TARGET(target) \
- LLVMInitialize##target##TargetInfo(); \
- LLVMInitialize##target##TargetMC(); \
- LLVMInitialize##target##AsmParser(); \
- LLVMInitialize##target##Disassembler(); \
- LLVMInitialize##target##Target(); \
+#define BOLT_TARGET(target) \
+ LLVMInitialize##target##TargetInfo(); \
+ LLVMInitialize##target##TargetMC(); \
+ LLVMInitialize##target##AsmParser(); \
+ LLVMInitialize##target##Disassembler(); \
+ LLVMInitialize##target##Target(); \
LLVMInitialize##target##AsmPrinter();
#include "bolt/Core/TargetConfig.def"
diff --git a/bolt/tools/heatmap/heatmap.cpp b/bolt/tools/heatmap/heatmap.cpp
index 4011548b5c..6add36cc67 100644
--- a/bolt/tools/heatmap/heatmap.cpp
+++ b/bolt/tools/heatmap/heatmap.cpp
@@ -76,12 +76,12 @@ int main(int argc, char **argv) {
opts::OutputFilename = "-";
// Initialize targets and assembly printers/parsers.
-#define BOLT_TARGET(target) \
- LLVMInitialize##target##TargetInfo(); \
- LLVMInitialize##target##TargetMC(); \
- LLVMInitialize##target##AsmParser(); \
- LLVMInitialize##target##Disassembler(); \
- LLVMInitialize##target##Target(); \
+#define BOLT_TARGET(target) \
+ LLVMInitialize##target##TargetInfo(); \
+ LLVMInitialize##target##TargetMC(); \
+ LLVMInitialize##target##AsmParser(); \
+ LLVMInitialize##target##Disassembler(); \
+ LLVMInitialize##target##Target(); \
LLVMInitialize##target##AsmPrinter();
#include "bolt/Core/TargetConfig.def"
diff --git a/bolt/tools/llvm-bolt-fuzzer/llvm-bolt-fuzzer.cpp b/bolt/tools/llvm-bolt-fuzzer/llvm-bolt-fuzzer.cpp
index 3c64e30653..09049788ae 100644
--- a/bolt/tools/llvm-bolt-fuzzer/llvm-bolt-fuzzer.cpp
+++ b/bolt/tools/llvm-bolt-fuzzer/llvm-bolt-fuzzer.cpp
@@ -59,12 +59,12 @@ extern "C" int LLVMFuzzerTestOneInput(const char *Data, size_t Size) {
extern "C" LLVM_ATTRIBUTE_USED int LLVMFuzzerInitialize(int *argc,
char ***argv) {
// Initialize targets and assembly printers/parsers.
-#define BOLT_TARGET(target) \
- LLVMInitialize##target##TargetInfo(); \
- LLVMInitialize##target##TargetMC(); \
- LLVMInitialize##target##AsmParser(); \
- LLVMInitialize##target##Disassembler(); \
- LLVMInitialize##target##Target(); \
+#define BOLT_TARGET(target) \
+ LLVMInitialize##target##TargetInfo(); \
+ LLVMInitialize##target##TargetMC(); \
+ LLVMInitialize##target##AsmParser(); \
+ LLVMInitialize##target##Disassembler(); \
+ LLVMInitialize##target##Target(); \
LLVMInitialize##target##AsmPrinter();
#include "bolt/Core/TargetConfig.def"
diff --git a/bolt/unittests/Core/BinaryContext.cpp b/bolt/unittests/Core/BinaryContext.cpp
index 0a58b079c3..09d1696633 100644
--- a/bolt/unittests/Core/BinaryContext.cpp
+++ b/bolt/unittests/Core/BinaryContext.cpp
@@ -27,13 +27,13 @@ struct BinaryContextTester : public testing::TestWithParam<Triple::ArchType> {
protected:
void initalizeLLVM() {
-#define BOLT_TARGET(target) \
- LLVMInitialize##target##TargetInfo(); \
- LLVMInitialize##target##TargetMC(); \
- LLVMInitialize##target##AsmParser(); \
- LLVMInitialize##target##Disassembler(); \
- LLVMInitialize##target##Target(); \
- LLVMInitialize##target##AsmPrinter();
+#define BOLT_TARGET(target) \
+ LLVMInitialize##target##TargetInfo(); \
+ LLVMInitialize##target##TargetMC(); \
+ LLVMInitialize##target##AsmParser(); \
+ LLVMInitialize##target##Disassembler(); \
+ LLVMInitialize##target##Target(); \
+ LLVMInitialize##target##AsmPrinter();
#include "bolt/Core/TargetConfig.def"
}
diff --git a/bolt/unittests/Core/MCPlusBuilder.cpp b/bolt/unittests/Core/MCPlusBuilder.cpp
index 06c5598da7..d367eb07f7 100644
--- a/bolt/unittests/Core/MCPlusBuilder.cpp
+++ b/bolt/unittests/Core/MCPlusBuilder.cpp
@@ -37,13 +37,13 @@ struct MCPlusBuilderTester : public testing::TestWithParam<Triple::ArchType> {
protected:
void initalizeLLVM() {
-#define BOLT_TARGET(target) \
- LLVMInitialize##target##TargetInfo(); \
- LLVMInitialize##target##TargetMC(); \
- LLVMInitialize##target##AsmParser(); \
- LLVMInitialize##target##Disassembler(); \
- LLVMInitialize##target##Target(); \
- LLVMInitialize##target##AsmPrinter();
+#define BOLT_TARGET(target) \
+ LLVMInitialize##target##TargetInfo(); \
+ LLVMInitialize##target##TargetMC(); \
+ LLVMInitialize##target##AsmParser(); \
+ LLVMInitialize##target##Disassembler(); \
+ LLVMInitialize##target##Target(); \
+ LLVMInitialize##target##AsmPrinter();
#include "bolt/Core/TargetConfig.def"
}
diff --git a/bolt/unittests/Core/MemoryMaps.cpp b/bolt/unittests/Core/MemoryMaps.cpp
index d823655e7a..2e1bc4d280 100644
--- a/bolt/unittests/Core/MemoryMaps.cpp
+++ b/bolt/unittests/Core/MemoryMaps.cpp
@@ -38,13 +38,13 @@ struct MemoryMapsTester : public testing::TestWithParam<Triple::ArchType> {
protected:
void initalizeLLVM() {
-#define BOLT_TARGET(target) \
- LLVMInitialize##target##TargetInfo(); \
- LLVMInitialize##target##TargetMC(); \
- LLVMInitialize##target##AsmParser(); \
- LLVMInitialize##target##Disassembler(); \
- LLVMInitialize##target##Target(); \
- LLVMInitialize##target##AsmPrinter();
+#define BOLT_TARGET(target) \
+ LLVMInitialize##target##TargetInfo(); \
+ LLVMInitialize##target##TargetMC(); \
+ LLVMInitialize##target##AsmParser(); \
+ LLVMInitialize##target##Disassembler(); \
+ LLVMInitialize##target##Target(); \
+ LLVMInitialize##target##AsmPrinter();
#include "bolt/Core/TargetConfig.def"
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/127509
More information about the llvm-commits
mailing list