LLVM  mainline
Defines | Functions | Variables
LLParser.cpp File Reference
#include "LLParser.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/AsmParser/SlotMapping.h"
#include "llvm/IR/AutoUpgrade.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/Metadata.def"
Include dependency graph for LLParser.cpp:

Go to the source code of this file.

Defines

#define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS)
#define DECLARE_FIELD(NAME, TYPE, INIT)   TYPE NAME INIT
#define NOP_FIELD(NAME, TYPE, INIT)
#define REQUIRE_FIELD(NAME, TYPE, INIT)
#define PARSE_MD_FIELD(NAME, TYPE, DEFAULT)
#define PARSE_MD_FIELDS()
#define GET_OR_DISTINCT(CLASS, ARGS)   (IsDistinct ? CLASS::getDistinct ARGS : CLASS::get ARGS)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)
#define VISIT_MD_FIELDS(OPTIONAL, REQUIRED)

Functions

static std::string getTypeString (Type *T)
static bool isValidVisibilityForLinkage (unsigned V, unsigned L)
static GlobalValuecreateGlobalFwdRef (Module *M, PointerType *PTy, const std::string &Name)
 if (!EatIfPresent(lltok::kw_thread_local)) return false
 if (Lex.getKind()==lltok::lparen)
 if (!EatIfPresent(lltok::kw_addrspace)) return false
 F (f)
 FunctionNumber (functionNumber)

Variables

 __pad0__
 ParseOptionalThreadLocal := /*empty.
 TLM = GlobalVariable::GeneralDynamicTLSModel
return false
 __pad1__
 ParseOptionalAddrSpace := /*empty.

Define Documentation

#define DECLARE_FIELD (   NAME,
  TYPE,
  INIT 
)    TYPE NAME INIT
#define GET_OR_DISTINCT (   CLASS,
  ARGS 
)    (IsDistinct ? CLASS::getDistinct ARGS : CLASS::get ARGS)
#define HANDLE_SPECIALIZED_MDNODE_LEAF (   CLASS)
Value:
if (Lex.getStrVal() == #CLASS)                                               \
    return Parse##CLASS(N, IsDistinct);
#define NOP_FIELD (   NAME,
  TYPE,
  INIT 
)
#define PARSE_MD_FIELD (   NAME,
  TYPE,
  DEFAULT 
)
Value:
if (Lex.getStrVal() == #NAME)                                                \
    return ParseMDField(#NAME, NAME);
#define PARSE_MD_FIELDS ( )
Value:
VISIT_MD_FIELDS(DECLARE_FIELD, DECLARE_FIELD)                                \
  do {                                                                         \
    LocTy ClosingLoc;                                                          \
    if (ParseMDFieldsImpl([&]() -> bool {                                      \
      VISIT_MD_FIELDS(PARSE_MD_FIELD, PARSE_MD_FIELD)                          \
      return TokError(Twine("invalid field '") + Lex.getStrVal() + "'");       \
    }, ClosingLoc))                                                            \
      return true;                                                             \
    VISIT_MD_FIELDS(NOP_FIELD, REQUIRE_FIELD)                                  \
  } while (false)
#define REQUIRE_FIELD (   NAME,
  TYPE,
  INIT 
)
Value:
if (!NAME.Seen)                                                              \
    return Error(ClosingLoc, "missing required field '" #NAME "'");
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
OPTIONAL(line, LineField, );                                                 \
  OPTIONAL(column, ColumnField, );                                             \
  REQUIRED(scope, MDField, (/* AllowNull */ false));                           \
  OPTIONAL(inlinedAt, MDField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(tag, DwarfTagField, );                                              \
  OPTIONAL(header, MDStringField, );                                           \
  OPTIONAL(operands, MDFieldList, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(count, MDSignedField, (-1, -1, INT64_MAX));                         \
  OPTIONAL(lowerBound, MDSignedField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(name, MDStringField, );                                             \
  REQUIRED(value, MDSignedField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
OPTIONAL(tag, DwarfTagField, (dwarf::DW_TAG_base_type));                     \
  OPTIONAL(name, MDStringField, );                                             \
  OPTIONAL(size, MDUnsignedField, (0, UINT64_MAX));                            \
  OPTIONAL(align, MDUnsignedField, (0, UINT64_MAX));                           \
  OPTIONAL(encoding, DwarfAttEncodingField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(tag, DwarfTagField, );                                              \
  OPTIONAL(name, MDStringField, );                                             \
  OPTIONAL(file, MDField, );                                                   \
  OPTIONAL(line, LineField, );                                                 \
  OPTIONAL(scope, MDField, );                                                  \
  REQUIRED(baseType, MDField, );                                               \
  OPTIONAL(size, MDUnsignedField, (0, UINT64_MAX));                            \
  OPTIONAL(align, MDUnsignedField, (0, UINT64_MAX));                           \
  OPTIONAL(offset, MDUnsignedField, (0, UINT64_MAX));                          \
  OPTIONAL(flags, DIFlagField, );                                              \
  OPTIONAL(extraData, MDField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(tag, DwarfTagField, );                                              \
  OPTIONAL(name, MDStringField, );                                             \
  OPTIONAL(file, MDField, );                                                   \
  OPTIONAL(line, LineField, );                                                 \
  OPTIONAL(scope, MDField, );                                                  \
  OPTIONAL(baseType, MDField, );                                               \
  OPTIONAL(size, MDUnsignedField, (0, UINT64_MAX));                            \
  OPTIONAL(align, MDUnsignedField, (0, UINT64_MAX));                           \
  OPTIONAL(offset, MDUnsignedField, (0, UINT64_MAX));                          \
  OPTIONAL(flags, DIFlagField, );                                              \
  OPTIONAL(elements, MDField, );                                               \
  OPTIONAL(runtimeLang, DwarfLangField, );                                     \
  OPTIONAL(vtableHolder, MDField, );                                           \
  OPTIONAL(templateParams, MDField, );                                         \
  OPTIONAL(identifier, MDStringField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
OPTIONAL(flags, DIFlagField, );                                              \
  REQUIRED(types, MDField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(filename, MDStringField, );                                         \
  REQUIRED(directory, MDStringField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(language, DwarfLangField, );                                        \
  REQUIRED(file, MDField, (/* AllowNull */ false));                            \
  OPTIONAL(producer, MDStringField, );                                         \
  OPTIONAL(isOptimized, MDBoolField, );                                        \
  OPTIONAL(flags, MDStringField, );                                            \
  OPTIONAL(runtimeVersion, MDUnsignedField, (0, UINT32_MAX));                  \
  OPTIONAL(splitDebugFilename, MDStringField, );                               \
  OPTIONAL(emissionKind, MDUnsignedField, (0, UINT32_MAX));                    \
  OPTIONAL(enums, MDField, );                                                  \
  OPTIONAL(retainedTypes, MDField, );                                          \
  OPTIONAL(subprograms, MDField, );                                            \
  OPTIONAL(globals, MDField, );                                                \
  OPTIONAL(imports, MDField, );                                                \
  OPTIONAL(macros, MDField, );                                                 \
  OPTIONAL(dwoId, MDUnsignedField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
OPTIONAL(scope, MDField, );                                                  \
  OPTIONAL(name, MDStringField, );                                             \
  OPTIONAL(linkageName, MDStringField, );                                      \
  OPTIONAL(file, MDField, );                                                   \
  OPTIONAL(line, LineField, );                                                 \
  OPTIONAL(type, MDField, );                                                   \
  OPTIONAL(isLocal, MDBoolField, );                                            \
  OPTIONAL(isDefinition, MDBoolField, (true));                                 \
  OPTIONAL(scopeLine, LineField, );                                            \
  OPTIONAL(containingType, MDField, );                                         \
  OPTIONAL(virtuality, DwarfVirtualityField, );                                \
  OPTIONAL(virtualIndex, MDUnsignedField, (0, UINT32_MAX));                    \
  OPTIONAL(flags, DIFlagField, );                                              \
  OPTIONAL(isOptimized, MDBoolField, );                                        \
  OPTIONAL(templateParams, MDField, );                                         \
  OPTIONAL(declaration, MDField, );                                            \
  OPTIONAL(variables, MDField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(scope, MDField, (/* AllowNull */ false));                           \
  OPTIONAL(file, MDField, );                                                   \
  OPTIONAL(line, LineField, );                                                 \
  OPTIONAL(column, ColumnField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(scope, MDField, (/* AllowNull */ false));                           \
  OPTIONAL(file, MDField, );                                                   \
  REQUIRED(discriminator, MDUnsignedField, (0, UINT32_MAX));
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(scope, MDField, );                                                  \
  OPTIONAL(file, MDField, );                                                   \
  OPTIONAL(name, MDStringField, );                                             \
  OPTIONAL(line, LineField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(type, DwarfMacinfoTypeField, );                                     \
  REQUIRED(line, LineField, );                                                 \
  REQUIRED(name, MDStringField, );                                             \
  OPTIONAL(value, MDStringField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
OPTIONAL(type, DwarfMacinfoTypeField, (dwarf::DW_MACINFO_start_file));       \
  REQUIRED(line, LineField, );                                                 \
  REQUIRED(file, MDField, );                                                   \
  OPTIONAL(nodes, MDField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(scope, MDField, );                                                  \
  REQUIRED(name, MDStringField, );                                             \
  OPTIONAL(configMacros, MDStringField, );                                     \
  OPTIONAL(includePath, MDStringField, );                                      \
  OPTIONAL(isysroot, MDStringField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
OPTIONAL(name, MDStringField, );                                             \
  REQUIRED(type, MDField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
OPTIONAL(tag, DwarfTagField, (dwarf::DW_TAG_template_value_parameter));      \
  OPTIONAL(name, MDStringField, );                                             \
  OPTIONAL(type, MDField, );                                                   \
  REQUIRED(value, MDField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(name, MDStringField, (/* AllowEmpty */ false));                     \
  OPTIONAL(scope, MDField, );                                                  \
  OPTIONAL(linkageName, MDStringField, );                                      \
  OPTIONAL(file, MDField, );                                                   \
  OPTIONAL(line, LineField, );                                                 \
  OPTIONAL(type, MDField, );                                                   \
  OPTIONAL(isLocal, MDBoolField, );                                            \
  OPTIONAL(isDefinition, MDBoolField, (true));                                 \
  OPTIONAL(variable, MDConstant, );                                            \
  OPTIONAL(declaration, MDField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(scope, MDField, (/* AllowNull */ false));                           \
  OPTIONAL(name, MDStringField, );                                             \
  OPTIONAL(arg, MDUnsignedField, (0, UINT16_MAX));                             \
  OPTIONAL(file, MDField, );                                                   \
  OPTIONAL(line, LineField, );                                                 \
  OPTIONAL(type, MDField, );                                                   \
  OPTIONAL(flags, DIFlagField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
OPTIONAL(name, MDStringField, );                                             \
  OPTIONAL(file, MDField, );                                                   \
  OPTIONAL(line, LineField, );                                                 \
  OPTIONAL(setter, MDStringField, );                                           \
  OPTIONAL(getter, MDStringField, );                                           \
  OPTIONAL(attributes, MDUnsignedField, (0, UINT32_MAX));                      \
  OPTIONAL(type, MDField, );
#define VISIT_MD_FIELDS (   OPTIONAL,
  REQUIRED 
)
Value:
REQUIRED(tag, DwarfTagField, );                                              \
  REQUIRED(scope, MDField, );                                                  \
  OPTIONAL(entity, MDField, );                                                 \
  OPTIONAL(line, LineField, );                                                 \
  OPTIONAL(name, MDStringField, );

Function Documentation

static GlobalValue* createGlobalFwdRef ( Module M,
PointerType PTy,
const std::string &  Name 
) [inline, static]
F ( )
FunctionNumber ( functionNumber  )

Definition at line 2279 of file LLParser.cpp.

References A, llvm::Function::args(), and P.

Referenced by PrintParentLoopComment().

static std::string getTypeString ( Type T) [static]

Definition at line 36 of file LLParser.cpp.

References llvm::raw_string_ostream::str(), and T.

if ( EatIfPresentlltok::kw_thread_local)
if ( Lex.  getKind() = = lltok::lparen)

Definition at line 1244 of file LLParser.cpp.

References llvm::LLLexer::Lex(), and llvm::lltok::rparen.

if ( EatIfPresentlltok::kw_addrspace)
static bool isValidVisibilityForLinkage ( unsigned  V,
unsigned  L 
) [static]

Variable Documentation

ParseOptionalThreadLocal := /*empty.

Definition at line 1239 of file LLParser.cpp.

ParseOptionalAddrSpace := /*empty.

Definition at line 1256 of file LLParser.cpp.

return false

Definition at line 1249 of file LLParser.cpp.

TLM = GlobalVariable::GeneralDynamicTLSModel

Definition at line 1243 of file LLParser.cpp.