Consistent use of header file for ICF and MarkLive

Previously wasm used a separate header to declare markLive
and ELF used to declare ICF.  This change makes each backend
consistently declare these in their own headers.

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

llvm-svn: 325631
This commit is contained in:
Sam Clegg 2018-02-20 22:09:59 +00:00
parent fd0630665b
commit f187c4d2e5
11 changed files with 80 additions and 12 deletions

View File

@ -9,7 +9,9 @@
#include "Driver.h"
#include "Config.h"
#include "ICF.h"
#include "InputFiles.h"
#include "MarkLive.h"
#include "MinGW.h"
#include "SymbolTable.h"
#include "Symbols.h"
@ -37,8 +39,8 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/ToolDrivers/llvm-lib/LibDriver.h"
#include <algorithm>
#include <memory>
#include <future>
#include <memory>
using namespace llvm;
using namespace llvm::object;

View File

@ -36,12 +36,6 @@ using llvm::COFF::MachineTypes;
using llvm::COFF::WindowsSubsystem;
using llvm::Optional;
// Implemented in MarkLive.cpp.
void markLive(ArrayRef<Chunk *> Chunks);
// Implemented in ICF.cpp.
void doICF(ArrayRef<Chunk *> Chunks);
class COFFOptTable : public llvm::opt::OptTable {
public:
COFFOptTable();

View File

@ -18,6 +18,7 @@
//
//===----------------------------------------------------------------------===//
#include "ICF.h"
#include "Chunks.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"

26
lld/COFF/ICF.h Normal file
View File

@ -0,0 +1,26 @@
//===- ICF.h --------------------------------------------------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_COFF_ICF_H
#define LLD_COFF_ICF_H
#include "lld/Common/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
namespace lld {
namespace coff {
class Chunk;
void doICF(ArrayRef<Chunk *> Chunks);
} // namespace coff
} // namespace lld
#endif

24
lld/COFF/MarkLive.h Normal file
View File

@ -0,0 +1,24 @@
//===- MarkLive.h -----------------------------------------------*- C++ -*-===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_COFF_MARKLIVE_H
#define LLD_COFF_MARKLIVE_H
#include "lld/Common/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
namespace lld {
namespace coff {
void markLive(ArrayRef<Chunk *> Chunks);
} // namespace coff
} // namespace lld
#endif // LLD_COFF_MARKLIVE_H

View File

@ -30,6 +30,7 @@
#include "InputFiles.h"
#include "InputSection.h"
#include "LinkerScript.h"
#include "MarkLive.h"
#include "OutputSections.h"
#include "ScriptParser.h"
#include "Strings.h"

View File

@ -12,8 +12,10 @@
namespace lld {
namespace elf {
template <class ELFT> void doIcf();
}
} // namespace elf
} // namespace lld
#endif

View File

@ -20,6 +20,7 @@
//
//===----------------------------------------------------------------------===//
#include "MarkLive.h"
#include "InputSection.h"
#include "LinkerScript.h"
#include "OutputSections.h"
@ -27,7 +28,6 @@
#include "SymbolTable.h"
#include "Symbols.h"
#include "Target.h"
#include "Writer.h"
#include "lld/Common/Memory.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Object/ELF.h"

21
lld/ELF/MarkLive.h Normal file
View File

@ -0,0 +1,21 @@
//===- MarkLive.h -----------------------------------------------*- C++ -*-===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_ELF_MARKLIVE_H
#define LLD_ELF_MARKLIVE_H
namespace lld {
namespace elf {
template <class ELFT> void markLive();
} // namespace elf
} // namespace lld
#endif // LLD_ELF_MARKLIVE_H

View File

@ -10,8 +10,6 @@
#include "Strings.h"
#include "Config.h"
#include "lld/Common/ErrorHandler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Demangle/Demangle.h"
#include <algorithm>

View File

@ -23,7 +23,6 @@ class InputSectionBase;
template <class ELFT> class ObjFile;
class SymbolTable;
template <class ELFT> void writeResult();
template <class ELFT> void markLive();
// This describes a program header entry.
// Each contains type, access flags and range of output sections that will be