mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 06:24:57 +00:00
IR: Add COMDATs to the IR
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
This commit is contained in:
@ -20,7 +20,7 @@
|
||||
#include "llvm/IR/GlobalValue.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class Comdat;
|
||||
class Module;
|
||||
|
||||
class GlobalObject : public GlobalValue {
|
||||
@ -29,11 +29,12 @@ class GlobalObject : public GlobalValue {
|
||||
protected:
|
||||
GlobalObject(Type *Ty, ValueTy VTy, Use *Ops, unsigned NumOps,
|
||||
LinkageTypes Linkage, const Twine &Name)
|
||||
: GlobalValue(Ty, VTy, Ops, NumOps, Linkage, Name) {
|
||||
: GlobalValue(Ty, VTy, Ops, NumOps, Linkage, Name), ObjComdat(nullptr) {
|
||||
setGlobalValueSubClassData(0);
|
||||
}
|
||||
|
||||
std::string Section; // Section to emit this into, empty means default
|
||||
Comdat *ObjComdat;
|
||||
public:
|
||||
unsigned getAlignment() const {
|
||||
return (1u << getGlobalValueSubClassData()) >> 1;
|
||||
@ -44,6 +45,11 @@ public:
|
||||
const char *getSection() const { return Section.c_str(); }
|
||||
void setSection(StringRef S);
|
||||
|
||||
bool hasComdat() const { return getComdat() != nullptr; }
|
||||
const Comdat *getComdat() const { return ObjComdat; }
|
||||
Comdat *getComdat() { return ObjComdat; }
|
||||
void setComdat(Comdat *C) { ObjComdat = C; }
|
||||
|
||||
void copyAttributesFrom(const GlobalValue *Src) override;
|
||||
|
||||
// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
|
Reference in New Issue
Block a user