diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-06-27 18:19:56 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-06-27 18:19:56 +0000 |
commit | c8a1169c935ad9d3dfbdd4f72d80abf8f5acb03c (patch) | |
tree | ba02374e6ebac3aeaa3c234be27d92c6224cf34f /lib/IR/Comdat.cpp | |
parent | 4a295dfbf9c5e8a71b8345484eff200058522b4e (diff) | |
download | llvm-c8a1169c935ad9d3dfbdd4f72d80abf8f5acb03c.tar.gz llvm-c8a1169c935ad9d3dfbdd4f72d80abf8f5acb03c.tar.bz2 llvm-c8a1169c935ad9d3dfbdd4f72d80abf8f5acb03c.tar.xz |
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
Diffstat (limited to 'lib/IR/Comdat.cpp')
-rw-r--r-- | lib/IR/Comdat.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/IR/Comdat.cpp b/lib/IR/Comdat.cpp new file mode 100644 index 0000000000..80715ff40b --- /dev/null +++ b/lib/IR/Comdat.cpp @@ -0,0 +1,25 @@ +//===-- Comdat.cpp - Implement Metadata classes --------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the Comdat class. +// +//===----------------------------------------------------------------------===// + +#include "llvm/IR/Comdat.h" +#include "llvm/ADT/StringMap.h" +using namespace llvm; + +Comdat::Comdat(SelectionKind SK, StringMapEntry<Comdat> *Name) + : Name(Name), SK(SK) {} + +Comdat::Comdat(Comdat &&C) : Name(C.Name), SK(C.SK) {} + +Comdat::Comdat() : Name(nullptr), SK(Comdat::Any) {} + +StringRef Comdat::getName() const { return Name->first(); } |