[NFCI] Move DEBUG_TYPE definition below #includes
authorMindong Chen <chenmindong1@huawei.com>
Sun, 30 May 2021 09:13:48 +0000 (17:13 +0800)
committerMindong Chen <chenmindong1@huawei.com>
Sun, 30 May 2021 09:31:01 +0000 (17:31 +0800)
When you try to define a new DEBUG_TYPE in a header file, DEBUG_TYPE
definition defined around the #includes in files include it could
result in redefinition warnings even compile errors.

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D102594

22 files changed:
llvm/lib/Analysis/AssumeBundleQueries.cpp
llvm/lib/Target/AArch64/AArch64PBQPRegAlloc.cpp
llvm/lib/Target/ARC/ARCBranchFinalize.cpp
llvm/lib/Target/AVR/MCTargetDesc/AVRMCELFStreamer.cpp
llvm/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
llvm/lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
llvm/lib/Target/Hexagon/HexagonBranchRelaxation.cpp
llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp
llvm/lib/Target/Hexagon/HexagonGenMux.cpp
llvm/lib/Target/Hexagon/HexagonSplitDouble.cpp
llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCShuffler.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonShuffler.cpp
llvm/lib/Target/Lanai/Disassembler/LanaiDisassembler.h
llvm/lib/Target/M68k/M68kRegisterInfo.cpp
llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
llvm/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp
llvm/lib/Transforms/Scalar/Float2Int.cpp
llvm/lib/Transforms/Scalar/LoopDataPrefetch.cpp
llvm/utils/TableGen/DFAEmitter.cpp
llvm/utils/TableGen/DFAPacketizerEmitter.cpp

index ae36dd1..11f3e03 100644 (file)
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "assume-queries"
-
 #include "llvm/Analysis/AssumeBundleQueries.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/AssumptionCache.h"
@@ -18,6 +16,8 @@
 #include "llvm/IR/PatternMatch.h"
 #include "llvm/Support/DebugCounter.h"
 
+#define DEBUG_TYPE "assume-queries"
+
 using namespace llvm;
 using namespace llvm::PatternMatch;
 
index d503c39..367594f 100644 (file)
@@ -14,8 +14,6 @@
 // independent, non-quadword FP/ASIMD floating-point multiply-accumulates.
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "aarch64-pbqp"
-
 #include "AArch64PBQPRegAlloc.h"
 #include "AArch64.h"
 #include "AArch64RegisterInfo.h"
@@ -28,6 +26,8 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 
+#define DEBUG_TYPE "aarch64-pbqp"
+
 using namespace llvm;
 
 namespace {
index 2f05ac4..0e3e4d3 100644 (file)
@@ -10,8 +10,6 @@
 // range conditional branches.
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "arc-branch-finalize"
-
 #include "ARCInstrInfo.h"
 #include "ARCTargetMachine.h"
 #include "MCTargetDesc/ARCInfo.h"
@@ -24,6 +22,8 @@
 #include "llvm/Support/Debug.h"
 #include <vector>
 
+#define DEBUG_TYPE "arc-branch-finalize"
+
 using namespace llvm;
 
 namespace llvm {
index 77b4993..0743344 100644 (file)
 // instructions on to the real streamer.
 //
 //===----------------------------------------------------------------------===//
-#define DEBUG_TYPE "avrmcelfstreamer"
-
 #include "MCTargetDesc/AVRMCELFStreamer.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/MC/MCObjectWriter.h"
 
+#define DEBUG_TYPE "avrmcelfstreamer"
+
 using namespace llvm;
 
 void AVRMCELFStreamer::emitValueForModiferKind(
index b6763fd..8047aa5 100644 (file)
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "mcasmparser"
-
 #include "HexagonTargetStreamer.h"
 #include "MCTargetDesc/HexagonMCChecker.h"
 #include "MCTargetDesc/HexagonMCELFStreamer.h"
@@ -58,6 +56,8 @@
 #include <string>
 #include <utility>
 
+#define DEBUG_TYPE "mcasmparser"
+
 using namespace llvm;
 
 static cl::opt<bool> WarnMissingParenthesis(
index aeaeac6..80a987c 100644 (file)
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "hexagon-disassembler"
-
 #include "MCTargetDesc/HexagonBaseInfo.h"
 #include "MCTargetDesc/HexagonMCChecker.h"
 #include "MCTargetDesc/HexagonMCInstrInfo.h"
@@ -32,6 +30,8 @@
 #include <cstdint>
 #include <memory>
 
+#define DEBUG_TYPE "hexagon-disassembler"
+
 using namespace llvm;
 using namespace Hexagon;
 
index 6891455..faa4821 100644 (file)
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "hexagon-brelax"
-
 #include "Hexagon.h"
 #include "HexagonInstrInfo.h"
 #include "HexagonSubtarget.h"
@@ -29,6 +27,8 @@
 #include <cstdlib>
 #include <iterator>
 
+#define DEBUG_TYPE "hexagon-brelax"
+
 using namespace llvm;
 
 // Since we have no exact knowledge of code layout, allow some safety buffer
index 4a2b060..954e615 100644 (file)
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "hcp"
-
 #include "HexagonInstrInfo.h"
 #include "HexagonRegisterInfo.h"
 #include "HexagonSubtarget.h"
@@ -45,6 +43,8 @@
 #include <utility>
 #include <vector>
 
+#define DEBUG_TYPE "hcp"
+
 using namespace llvm;
 
 namespace {
index 9585b14..07f85e6 100644 (file)
@@ -19,8 +19,6 @@
 // the predicate register, they cannot use the .new form. In such cases it
 // is better to collapse them back to a single MUX instruction.
 
-#define DEBUG_TYPE "hexmux"
-
 #include "HexagonInstrInfo.h"
 #include "HexagonRegisterInfo.h"
 #include "HexagonSubtarget.h"
@@ -47,6 +45,8 @@
 #include <limits>
 #include <utility>
 
+#define DEBUG_TYPE "hexmux"
+
 using namespace llvm;
 
 namespace llvm {
index 9c60a2d..52452e9 100644 (file)
@@ -6,8 +6,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "hsdr"
-
 #include "HexagonInstrInfo.h"
 #include "HexagonRegisterInfo.h"
 #include "HexagonSubtarget.h"
@@ -42,6 +40,8 @@
 #include <utility>
 #include <vector>
 
+#define DEBUG_TYPE "hsdr"
+
 using namespace llvm;
 
 namespace llvm {
index 595cf94..2546678 100644 (file)
@@ -10,8 +10,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "hexagon-sdata"
-
 #include "HexagonTargetObjectFile.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
@@ -32,6 +30,8 @@
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
 
+#define DEBUG_TYPE "hexagon-sdata"
+
 using namespace llvm;
 
 static cl::opt<unsigned> SmallDataThreshold("hexagon-small-data-threshold",
index 53e76a8..0624214 100644 (file)
@@ -10,7 +10,6 @@
 // instructions on to the real streamer.
 //
 //===----------------------------------------------------------------------===//
-#define DEBUG_TYPE "hexagonmcelfstreamer"
 
 #include "MCTargetDesc/HexagonMCELFStreamer.h"
 #include "MCTargetDesc/HexagonMCInstrInfo.h"
@@ -37,6 +36,8 @@
 #include <cassert>
 #include <cstdint>
 
+#define DEBUG_TYPE "hexagonmcelfstreamer"
+
 using namespace llvm;
 
 static cl::opt<unsigned> GPSize
index 7d45b4f..d38b77b 100644 (file)
@@ -11,8 +11,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "hexagon-shuffle"
-
 #include "MCTargetDesc/HexagonMCShuffler.h"
 #include "MCTargetDesc/HexagonMCInstrInfo.h"
 #include "MCTargetDesc/HexagonShuffler.h"
@@ -24,6 +22,8 @@
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 
+#define DEBUG_TYPE "hexagon-shuffle"
+
 using namespace llvm;
 
 static cl::opt<bool>
index 8a44ba3..1fce90b 100644 (file)
@@ -11,8 +11,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "hexagon-shuffle"
-
 #include "MCTargetDesc/HexagonShuffler.h"
 #include "MCTargetDesc/HexagonBaseInfo.h"
 #include "MCTargetDesc/HexagonMCInstrInfo.h"
@@ -33,6 +31,8 @@
 #include <utility>
 #include <vector>
 
+#define DEBUG_TYPE "hexagon-shuffle"
+
 using namespace llvm;
 
 namespace {
index 6ca9b1d..8aa2841 100644 (file)
 #ifndef LLVM_LIB_TARGET_LANAI_DISASSEMBLER_LANAIDISASSEMBLER_H
 #define LLVM_LIB_TARGET_LANAI_DISASSEMBLER_LANAIDISASSEMBLER_H
 
-#define DEBUG_TYPE "lanai-disassembler"
-
 #include "llvm/MC/MCDisassembler/MCDisassembler.h"
 
+#define DEBUG_TYPE "lanai-disassembler"
+
 namespace llvm {
 
 class LanaiDisassembler : public MCDisassembler {
index 7d3f6a1..69d1603 100644 (file)
@@ -11,8 +11,6 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "m68k-reg-info"
-
 #include "M68kRegisterInfo.h"
 
 #include "M68k.h"
@@ -32,6 +30,8 @@
 #define GET_REGINFO_TARGET_DESC
 #include "M68kGenRegisterInfo.inc"
 
+#define DEBUG_TYPE "m68k-reg-info"
+
 using namespace llvm;
 
 static cl::opt<bool> EnableBasePointer(
index c242409..e7bebdb 100644 (file)
@@ -41,8 +41,6 @@
 //      *++p = c;
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "ppc-loop-instr-form-prep"
-
 #include "PPC.h"
 #include "PPCSubtarget.h"
 #include "PPCTargetMachine.h"
@@ -79,6 +77,8 @@
 #include <iterator>
 #include <utility>
 
+#define DEBUG_TYPE "ppc-loop-instr-form-prep"
+
 using namespace llvm;
 
 static cl::opt<unsigned> MaxVarsPrep("ppc-formprep-max-vars",
index b0e60aa..5a8eeed 100644 (file)
@@ -17,8 +17,6 @@
 
 #include "llvm/IR/Instructions.h"
 #include "llvm/InitializePasses.h"
-#define AA_NAME "alignment-from-assumptions"
-#define DEBUG_TYPE AA_NAME
 #include "llvm/Transforms/Scalar/AlignmentFromAssumptions.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/Statistic.h"
@@ -37,6 +35,9 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Scalar.h"
+
+#define AA_NAME "alignment-from-assumptions"
+#define DEBUG_TYPE AA_NAME
 using namespace llvm;
 
 STATISTIC(NumLoadAlignChanged,
index f1e6eaa..8a5d4f5 100644 (file)
@@ -13,8 +13,6 @@
 
 #include "llvm/InitializePasses.h"
 #include "llvm/Support/CommandLine.h"
-#define DEBUG_TYPE "float2int"
-
 #include "llvm/Transforms/Scalar/Float2Int.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
@@ -31,6 +29,9 @@
 #include "llvm/Transforms/Scalar.h"
 #include <deque>
 #include <functional> // For std::function
+
+#define DEBUG_TYPE "float2int"
+
 using namespace llvm;
 
 // The algorithm is simple. Start at instructions that convert from the
index 45cdcb2..a5d7835 100644 (file)
@@ -13,7 +13,6 @@
 #include "llvm/Transforms/Scalar/LoopDataPrefetch.h"
 #include "llvm/InitializePasses.h"
 
-#define DEBUG_TYPE "loop-data-prefetch"
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/AssumptionCache.h"
@@ -33,6 +32,9 @@
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
+
+#define DEBUG_TYPE "loop-data-prefetch"
+
 using namespace llvm;
 
 // By default, we limit this to creating 16 PHIs (which is a little over half
index a5cba04..27161d2 100644 (file)
@@ -19,7 +19,6 @@
 // to the NFA.
 //
 //===----------------------------------------------------------------------===//
-#define DEBUG_TYPE "dfa-emitter"
 
 #include "DFAEmitter.h"
 #include "CodeGenTarget.h"
@@ -39,6 +38,8 @@
 #include <string>
 #include <vector>
 
+#define DEBUG_TYPE "dfa-emitter"
+
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
index 0772f7e..9cbdbc1 100644 (file)
@@ -14,8 +14,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-#define DEBUG_TYPE "dfa-emitter"
-
 #include "CodeGenSchedule.h"
 #include "CodeGenTarget.h"
 #include "DFAEmitter.h"
@@ -34,6 +32,8 @@
 #include <unordered_map>
 #include <vector>
 
+#define DEBUG_TYPE "dfa-emitter"
+
 using namespace llvm;
 
 // We use a uint64_t to represent a resource bitmask.