mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
c8a1169c93
This new IR facility allows us to represent the object-file semantic of a COMDAT group. COMDATs allow us to tie together sections and make the inclusion of one dependent on another. This is required to implement features like MS ABI VFTables and optimizing away certain kinds of initialization in C++. This functionality is only representable in COFF and ELF, Mach-O has no similar mechanism. Differential Revision: http://reviews.llvm.org/D4178 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211920 91177308-0d34-0410-b5e6-96231b3b80d8
64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
//===- Linker.h - Module Linker Interface -----------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_LINKER_LINKER_H
|
|
#define LLVM_LINKER_LINKER_H
|
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
|
#include <string>
|
|
|
|
namespace llvm {
|
|
|
|
class Comdat;
|
|
class GlobalValue;
|
|
class Module;
|
|
class StringRef;
|
|
class StructType;
|
|
|
|
/// This class provides the core functionality of linking in LLVM. It keeps a
|
|
/// pointer to the merged module so far. It doesn't take ownership of the
|
|
/// module since it is assumed that the user of this class will want to do
|
|
/// something with it after the linking.
|
|
class Linker {
|
|
public:
|
|
enum LinkerMode {
|
|
DestroySource = 0, // Allow source module to be destroyed.
|
|
PreserveSource = 1 // Preserve the source module.
|
|
};
|
|
|
|
Linker(Module *M, bool SuppressWarnings=false);
|
|
~Linker();
|
|
|
|
Module *getModule() const { return Composite; }
|
|
void deleteModule();
|
|
|
|
/// \brief Link \p Src into the composite. The source is destroyed if
|
|
/// \p Mode is DestroySource and preserved if it is PreserveSource.
|
|
/// If \p ErrorMsg is not null, information about any error is written
|
|
/// to it.
|
|
/// Returns true on error.
|
|
bool linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg);
|
|
bool linkInModule(Module *Src, std::string *ErrorMsg) {
|
|
return linkInModule(Src, Linker::DestroySource, ErrorMsg);
|
|
}
|
|
|
|
static bool LinkModules(Module *Dest, Module *Src, unsigned Mode,
|
|
std::string *ErrorMsg);
|
|
|
|
private:
|
|
Module *Composite;
|
|
SmallPtrSet<StructType*, 32> IdentifiedStructTypes;
|
|
|
|
bool SuppressWarnings;
|
|
};
|
|
|
|
} // End llvm namespace
|
|
|
|
#endif
|