[llvm] cdafe59 - TargetLoweringObjectFile.h - remove unnecessary includes. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue May 19 02:09:28 PDT 2020
Author: Simon Pilgrim
Date: 2020-05-19T09:28:13+01:00
New Revision: cdafe59f9528567df2e06c9f92f089791e3b9d5b
URL: https://github.com/llvm/llvm-project/commit/cdafe59f9528567df2e06c9f92f089791e3b9d5b
DIFF: https://github.com/llvm/llvm-project/commit/cdafe59f9528567df2e06c9f92f089791e3b9d5b.diff
LOG: TargetLoweringObjectFile.h - remove unnecessary includes. NFCI.
Replace with forward declarations and move includes down to source files where required.
I also needed to move the TargetLoweringObjectFile::SectionForGlobal wrapper implementation down into TargetLoweringObjectFile.cpp
Added:
Modified:
llvm/include/llvm/Target/TargetLoweringObjectFile.h
llvm/lib/CodeGen/GlobalMerge.cpp
llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h
llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp
llvm/lib/Target/TargetLoweringObjectFile.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Target/TargetLoweringObjectFile.h b/llvm/include/llvm/Target/TargetLoweringObjectFile.h
index b98332ecfaf9..f642977e3d8f 100644
--- a/llvm/include/llvm/Target/TargetLoweringObjectFile.h
+++ b/llvm/include/llvm/Target/TargetLoweringObjectFile.h
@@ -14,14 +14,15 @@
#ifndef LLVM_CODEGEN_TARGETLOWERINGOBJECTFILE_H
#define LLVM_CODEGEN_TARGETLOWERINGOBJECTFILE_H
-#include "llvm/ADT/StringRef.h"
-#include "llvm/IR/Module.h"
#include "llvm/MC/MCObjectFileInfo.h"
-#include "llvm/MC/SectionKind.h"
#include <cstdint>
namespace llvm {
+class Constant;
+class DataLayout;
+class Function;
+class GlobalObject;
class GlobalValue;
class MachineBasicBlock;
class MachineModuleInfo;
@@ -33,6 +34,9 @@ class MCSymbol;
class MCSymbolRefExpr;
class MCStreamer;
class MCValue;
+class Module;
+class SectionKind;
+class StringRef;
class TargetMachine;
class TargetLoweringObjectFile : public MCObjectFileInfo {
@@ -107,9 +111,7 @@ class TargetLoweringObjectFile : public MCObjectFileInfo {
/// variable or function definition. This should not be passed external (or
/// available externally) globals.
MCSection *SectionForGlobal(const GlobalObject *GO,
- const TargetMachine &TM) const {
- return SectionForGlobal(GO, getKindForGlobal(GO, TM), TM);
- }
+ const TargetMachine &TM) const;
virtual void getNameWithPrefix(SmallVectorImpl<char> &OutName,
const GlobalValue *GV,
diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp
index 600c717080b5..6d736aa981a3 100644
--- a/llvm/lib/CodeGen/GlobalMerge.cpp
+++ b/llvm/lib/CodeGen/GlobalMerge.cpp
@@ -83,6 +83,7 @@
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/InitializePasses.h"
+#include "llvm/MC/SectionKind.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp b/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
index 0af26255109c..cfc8ed813c92 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
@@ -22,6 +22,7 @@
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalVariable.h"
+#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/SectionKind.h"
diff --git a/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h b/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h
index b36282578950..550aac72346f 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h
+++ b/llvm/lib/Target/Hexagon/HexagonTargetObjectFile.h
@@ -13,6 +13,7 @@
#include "llvm/MC/MCSectionELF.h"
namespace llvm {
+ class Type;
class HexagonTargetObjectFile : public TargetLoweringObjectFileELF {
public:
diff --git a/llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp b/llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp
index 168630f55b24..d52c9f92bd1d 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetObjectFile.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "PPCTargetObjectFile.h"
+#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Mangler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp
index e7312e70cfb2..d48efef874a0 100644
--- a/llvm/lib/Target/TargetLoweringObjectFile.cpp
+++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp
@@ -19,10 +19,12 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Mangler.h"
+#include "llvm/IR/Module.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
+#include "llvm/MC/SectionKind.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
@@ -271,6 +273,15 @@ MCSection *TargetLoweringObjectFile::SectionForGlobal(
return SelectSectionForGlobal(GO, Kind, TM);
}
+/// This method computes the appropriate section to emit the specified global
+/// variable or function definition. This should not be passed external (or
+/// available externally) globals.
+MCSection *
+TargetLoweringObjectFile::SectionForGlobal(const GlobalObject *GO,
+ const TargetMachine &TM) const {
+ return SectionForGlobal(GO, getKindForGlobal(GO, TM), TM);
+}
+
MCSection *TargetLoweringObjectFile::getSectionForJumpTable(
const Function &F, const TargetMachine &TM) const {
unsigned Align = 0;
More information about the llvm-commits
mailing list