summaryrefslogtreecommitdiff
path: root/lib/AsmParser/LLParser.h
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-06-27 18:19:56 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-06-27 18:19:56 +0000
commitc8a1169c935ad9d3dfbdd4f72d80abf8f5acb03c (patch)
treeba02374e6ebac3aeaa3c234be27d92c6224cf34f /lib/AsmParser/LLParser.h
parent4a295dfbf9c5e8a71b8345484eff200058522b4e (diff)
downloadllvm-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/AsmParser/LLParser.h')
-rw-r--r--lib/AsmParser/LLParser.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h
index f7d69d267d..2efb260d66 100644
--- a/lib/AsmParser/LLParser.h
+++ b/lib/AsmParser/LLParser.h
@@ -34,6 +34,7 @@ namespace llvm {
class Instruction;
class Constant;
class GlobalValue;
+ class Comdat;
class MDString;
class MDNode;
class StructType;
@@ -122,6 +123,9 @@ namespace llvm {
std::map<unsigned, std::pair<GlobalValue*, LocTy> > ForwardRefValIDs;
std::vector<GlobalValue*> NumberedVals;
+ // Comdat forward reference information.
+ std::map<std::string, LocTy> ForwardRefComdats;
+
// References to blockaddress. The key is the function ValID, the value is
// a list of references to blocks in that function.
std::map<ValID, std::vector<std::pair<ValID, GlobalValue*> > >
@@ -154,6 +158,10 @@ namespace llvm {
GlobalValue *GetGlobalVal(const std::string &N, Type *Ty, LocTy Loc);
GlobalValue *GetGlobalVal(unsigned ID, Type *Ty, LocTy Loc);
+ /// Get a Comdat with the specified name, creating a forward reference
+ /// record if needed.
+ Comdat *getComdat(const std::string &N, LocTy Loc);
+
// Helper Routines.
bool ParseToken(lltok::Kind T, const char *ErrMsg);
bool EatIfPresent(lltok::Kind T) {
@@ -247,6 +255,7 @@ namespace llvm {
bool ParseAlias(const std::string &Name, LocTy Loc, unsigned Visibility,
unsigned DLLStorageClass,
GlobalVariable::ThreadLocalMode TLM, bool UnnamedAddr);
+ bool parseComdat();
bool ParseStandaloneMetadata();
bool ParseNamedMetadata();
bool ParseMDString(MDString *&Result);
@@ -358,6 +367,7 @@ namespace llvm {
bool ParseGlobalValue(Type *Ty, Constant *&V);
bool ParseGlobalTypeAndValue(Constant *&V);
bool ParseGlobalValueVector(SmallVectorImpl<Constant*> &Elts);
+ bool parseOptionalComdat(Comdat *&C);
bool ParseMetadataListValue(ValID &ID, PerFunctionState *PFS);
bool ParseMetadataValue(ValID &ID, PerFunctionState *PFS);
bool ParseMDNodeVector(SmallVectorImpl<Value*> &, PerFunctionState *PFS);