LLVM  5.0.0
LLParser.h
Go to the documentation of this file.
1 //===-- LLParser.h - Parser Class -------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the parser class for .ll files.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_ASMPARSER_LLPARSER_H
15 #define LLVM_LIB_ASMPARSER_LLPARSER_H
16 
17 #include "LLLexer.h"
18 #include "llvm/ADT/Optional.h"
19 #include "llvm/ADT/StringMap.h"
20 #include "llvm/IR/Attributes.h"
21 #include "llvm/IR/Instructions.h"
22 #include "llvm/IR/Module.h"
23 #include "llvm/IR/Operator.h"
24 #include "llvm/IR/Type.h"
25 #include "llvm/IR/ValueHandle.h"
26 #include <map>
27 
28 namespace llvm {
29  class Module;
30  class OpaqueType;
31  class Function;
32  class Value;
33  class BasicBlock;
34  class Instruction;
35  class Constant;
36  class GlobalValue;
37  class Comdat;
38  class MDString;
39  class MDNode;
40  struct SlotMapping;
41  class StructType;
42 
43  /// ValID - Represents a reference of a definition of some sort with no type.
44  /// There are several cases where we have to parse the value but where the
45  /// type can depend on later context. This may either be a numeric reference
46  /// or a symbolic (%var) reference. This is just a discriminated union.
47  struct ValID {
48  enum {
49  t_LocalID, t_GlobalID, // ID in UIntVal.
50  t_LocalName, t_GlobalName, // Name in StrVal.
51  t_APSInt, t_APFloat, // Value in APSIntVal/APFloatVal.
52  t_Null, t_Undef, t_Zero, t_None, // No value.
53  t_EmptyArray, // No value: []
54  t_Constant, // Value in ConstantVal.
55  t_InlineAsm, // Value in FTy/StrVal/StrVal2/UIntVal.
56  t_ConstantStruct, // Value in ConstantStructElts.
57  t_PackedConstantStruct // Value in ConstantStructElts.
58  } Kind = t_LocalID;
59 
61  unsigned UIntVal;
62  FunctionType *FTy = nullptr;
63  std::string StrVal, StrVal2;
67  std::unique_ptr<Constant *[]> ConstantStructElts;
68 
69  ValID() = default;
70  ValID(const ValID &RHS)
71  : Kind(RHS.Kind), Loc(RHS.Loc), UIntVal(RHS.UIntVal), FTy(RHS.FTy),
75  }
76 
77  bool operator<(const ValID &RHS) const {
78  if (Kind == t_LocalID || Kind == t_GlobalID)
79  return UIntVal < RHS.UIntVal;
82  "Ordering not defined for this ValID kind yet");
83  return StrVal < RHS.StrVal;
84  }
85  };
86 
87  class LLParser {
88  public:
90  private:
91  LLVMContext &Context;
92  LLLexer Lex;
93  Module *M;
94  SlotMapping *Slots;
95 
96  // Instruction metadata resolution. Each instruction can have a list of
97  // MDRef info associated with them.
98  //
99  // The simpler approach of just creating temporary MDNodes and then calling
100  // RAUW on them when the definition is processed doesn't work because some
101  // instruction metadata kinds, such as dbg, get stored in the IR in an
102  // "optimized" format which doesn't participate in the normal value use
103  // lists. This means that RAUW doesn't work, even on temporary MDNodes
104  // which otherwise support RAUW. Instead, we defer resolving MDNode
105  // references until the definitions have been processed.
106  struct MDRef {
107  SMLoc Loc;
108  unsigned MDKind, MDSlot;
109  };
110 
111  SmallVector<Instruction*, 64> InstsWithTBAATag;
112 
113  // Type resolution handling data structures. The location is set when we
114  // have processed a use of the type but not a definition yet.
116  std::map<unsigned, std::pair<Type*, LocTy> > NumberedTypes;
117 
118  std::map<unsigned, TrackingMDNodeRef> NumberedMetadata;
119  std::map<unsigned, std::pair<TempMDTuple, LocTy>> ForwardRefMDNodes;
120 
121  // Global Value reference information.
122  std::map<std::string, std::pair<GlobalValue*, LocTy> > ForwardRefVals;
123  std::map<unsigned, std::pair<GlobalValue*, LocTy> > ForwardRefValIDs;
124  std::vector<GlobalValue*> NumberedVals;
125 
126  // Comdat forward reference information.
127  std::map<std::string, LocTy> ForwardRefComdats;
128 
129  // References to blockaddress. The key is the function ValID, the value is
130  // a list of references to blocks in that function.
131  std::map<ValID, std::map<ValID, GlobalValue *>> ForwardRefBlockAddresses;
132  class PerFunctionState;
133  /// Reference to per-function state to allow basic blocks to be
134  /// forward-referenced by blockaddress instructions within the same
135  /// function.
136  PerFunctionState *BlockAddressPFS;
137 
138  // Attribute builder reference information.
139  std::map<Value*, std::vector<unsigned> > ForwardRefAttrGroups;
140  std::map<unsigned, AttrBuilder> NumberedAttrBuilders;
141 
142  public:
144  SlotMapping *Slots = nullptr)
145  : Context(M->getContext()), Lex(F, SM, Err, M->getContext()), M(M),
146  Slots(Slots), BlockAddressPFS(nullptr) {}
147  bool Run();
148 
149  bool parseStandaloneConstantValue(Constant *&C, const SlotMapping *Slots);
150 
151  bool parseTypeAtBeginning(Type *&Ty, unsigned &Read,
152  const SlotMapping *Slots);
153 
155 
156  private:
157 
158  bool Error(LocTy L, const Twine &Msg) const {
159  return Lex.Error(L, Msg);
160  }
161  bool TokError(const Twine &Msg) const {
162  return Error(Lex.getLoc(), Msg);
163  }
164 
165  /// Restore the internal name and slot mappings using the mappings that
166  /// were created at an earlier parsing stage.
167  void restoreParsingState(const SlotMapping *Slots);
168 
169  /// GetGlobalVal - Get a value with the specified name or ID, creating a
170  /// forward reference record if needed. This can return null if the value
171  /// exists but does not have the right type.
172  GlobalValue *GetGlobalVal(const std::string &N, Type *Ty, LocTy Loc);
173  GlobalValue *GetGlobalVal(unsigned ID, Type *Ty, LocTy Loc);
174 
175  /// Get a Comdat with the specified name, creating a forward reference
176  /// record if needed.
177  Comdat *getComdat(const std::string &N, LocTy Loc);
178 
179  // Helper Routines.
180  bool ParseToken(lltok::Kind T, const char *ErrMsg);
181  bool EatIfPresent(lltok::Kind T) {
182  if (Lex.getKind() != T) return false;
183  Lex.Lex();
184  return true;
185  }
186 
187  FastMathFlags EatFastMathFlagsIfPresent() {
188  FastMathFlags FMF;
189  while (true)
190  switch (Lex.getKind()) {
191  case lltok::kw_fast: FMF.setUnsafeAlgebra(); Lex.Lex(); continue;
192  case lltok::kw_nnan: FMF.setNoNaNs(); Lex.Lex(); continue;
193  case lltok::kw_ninf: FMF.setNoInfs(); Lex.Lex(); continue;
194  case lltok::kw_nsz: FMF.setNoSignedZeros(); Lex.Lex(); continue;
195  case lltok::kw_arcp: FMF.setAllowReciprocal(); Lex.Lex(); continue;
196  case lltok::kw_contract:
197  FMF.setAllowContract(true);
198  Lex.Lex();
199  continue;
200  default: return FMF;
201  }
202  return FMF;
203  }
204 
205  bool ParseOptionalToken(lltok::Kind T, bool &Present,
206  LocTy *Loc = nullptr) {
207  if (Lex.getKind() != T) {
208  Present = false;
209  } else {
210  if (Loc)
211  *Loc = Lex.getLoc();
212  Lex.Lex();
213  Present = true;
214  }
215  return false;
216  }
217  bool ParseStringConstant(std::string &Result);
218  bool ParseUInt32(unsigned &Val);
219  bool ParseUInt32(unsigned &Val, LocTy &Loc) {
220  Loc = Lex.getLoc();
221  return ParseUInt32(Val);
222  }
223  bool ParseUInt64(uint64_t &Val);
224  bool ParseUInt64(uint64_t &Val, LocTy &Loc) {
225  Loc = Lex.getLoc();
226  return ParseUInt64(Val);
227  }
228 
229  bool ParseStringAttribute(AttrBuilder &B);
230 
231  bool ParseTLSModel(GlobalVariable::ThreadLocalMode &TLM);
232  bool ParseOptionalThreadLocal(GlobalVariable::ThreadLocalMode &TLM);
233  bool ParseOptionalUnnamedAddr(GlobalVariable::UnnamedAddr &UnnamedAddr);
234  bool ParseOptionalAddrSpace(unsigned &AddrSpace);
235  bool ParseOptionalParamAttrs(AttrBuilder &B);
236  bool ParseOptionalReturnAttrs(AttrBuilder &B);
237  bool ParseOptionalLinkage(unsigned &Linkage, bool &HasLinkage,
238  unsigned &Visibility, unsigned &DLLStorageClass);
239  void ParseOptionalVisibility(unsigned &Visibility);
240  void ParseOptionalDLLStorageClass(unsigned &DLLStorageClass);
241  bool ParseOptionalCallingConv(unsigned &CC);
242  bool ParseOptionalAlignment(unsigned &Alignment);
243  bool ParseOptionalDerefAttrBytes(lltok::Kind AttrKind, uint64_t &Bytes);
244  bool ParseScopeAndOrdering(bool isAtomic, SyncScope::ID &SSID,
245  AtomicOrdering &Ordering);
246  bool ParseScope(SyncScope::ID &SSID);
247  bool ParseOrdering(AtomicOrdering &Ordering);
248  bool ParseOptionalStackAlignment(unsigned &Alignment);
249  bool ParseOptionalCommaAlign(unsigned &Alignment, bool &AteExtraComma);
250  bool ParseOptionalCommaAddrSpace(unsigned &AddrSpace, LocTy &Loc,
251  bool &AteExtraComma);
252  bool ParseOptionalCommaInAlloca(bool &IsInAlloca);
253  bool parseAllocSizeArguments(unsigned &ElemSizeArg,
254  Optional<unsigned> &HowManyArg);
255  bool ParseIndexList(SmallVectorImpl<unsigned> &Indices,
256  bool &AteExtraComma);
257  bool ParseIndexList(SmallVectorImpl<unsigned> &Indices) {
258  bool AteExtraComma;
259  if (ParseIndexList(Indices, AteExtraComma)) return true;
260  if (AteExtraComma)
261  return TokError("expected index");
262  return false;
263  }
264 
265  // Top-Level Entities
266  bool ParseTopLevelEntities();
267  bool ValidateEndOfModule();
268  bool ParseTargetDefinition();
269  bool ParseModuleAsm();
270  bool ParseSourceFileName();
271  bool ParseDepLibs(); // FIXME: Remove in 4.0.
272  bool ParseUnnamedType();
273  bool ParseNamedType();
274  bool ParseDeclare();
275  bool ParseDefine();
276 
277  bool ParseGlobalType(bool &IsConstant);
278  bool ParseUnnamedGlobal();
279  bool ParseNamedGlobal();
280  bool ParseGlobal(const std::string &Name, LocTy Loc, unsigned Linkage,
281  bool HasLinkage, unsigned Visibility,
282  unsigned DLLStorageClass,
284  GlobalVariable::UnnamedAddr UnnamedAddr);
285  bool parseIndirectSymbol(const std::string &Name, LocTy Loc,
286  unsigned Linkage, unsigned Visibility,
287  unsigned DLLStorageClass,
289  GlobalVariable::UnnamedAddr UnnamedAddr);
290  bool parseComdat();
291  bool ParseStandaloneMetadata();
292  bool ParseNamedMetadata();
293  bool ParseMDString(MDString *&Result);
294  bool ParseMDNodeID(MDNode *&Result);
295  bool ParseUnnamedAttrGrp();
296  bool ParseFnAttributeValuePairs(AttrBuilder &B,
297  std::vector<unsigned> &FwdRefAttrGrps,
298  bool inAttrGrp, LocTy &BuiltinLoc);
299 
300  // Type Parsing.
301  bool ParseType(Type *&Result, const Twine &Msg, bool AllowVoid = false);
302  bool ParseType(Type *&Result, bool AllowVoid = false) {
303  return ParseType(Result, "expected type", AllowVoid);
304  }
305  bool ParseType(Type *&Result, const Twine &Msg, LocTy &Loc,
306  bool AllowVoid = false) {
307  Loc = Lex.getLoc();
308  return ParseType(Result, Msg, AllowVoid);
309  }
310  bool ParseType(Type *&Result, LocTy &Loc, bool AllowVoid = false) {
311  Loc = Lex.getLoc();
312  return ParseType(Result, AllowVoid);
313  }
314  bool ParseAnonStructType(Type *&Result, bool Packed);
315  bool ParseStructBody(SmallVectorImpl<Type*> &Body);
316  bool ParseStructDefinition(SMLoc TypeLoc, StringRef Name,
317  std::pair<Type*, LocTy> &Entry,
318  Type *&ResultTy);
319 
320  bool ParseArrayVectorType(Type *&Result, bool isVector);
321  bool ParseFunctionType(Type *&Result);
322 
323  // Function Semantic Analysis.
324  class PerFunctionState {
325  LLParser &P;
326  Function &F;
327  std::map<std::string, std::pair<Value*, LocTy> > ForwardRefVals;
328  std::map<unsigned, std::pair<Value*, LocTy> > ForwardRefValIDs;
329  std::vector<Value*> NumberedVals;
330 
331  /// FunctionNumber - If this is an unnamed function, this is the slot
332  /// number of it, otherwise it is -1.
333  int FunctionNumber;
334  public:
335  PerFunctionState(LLParser &p, Function &f, int FunctionNumber);
336  ~PerFunctionState();
337 
338  Function &getFunction() const { return F; }
339 
340  bool FinishFunction();
341 
342  /// GetVal - Get a value with the specified name or ID, creating a
343  /// forward reference record if needed. This can return null if the value
344  /// exists but does not have the right type.
345  Value *GetVal(const std::string &Name, Type *Ty, LocTy Loc);
346  Value *GetVal(unsigned ID, Type *Ty, LocTy Loc);
347 
348  /// SetInstName - After an instruction is parsed and inserted into its
349  /// basic block, this installs its name.
350  bool SetInstName(int NameID, const std::string &NameStr, LocTy NameLoc,
351  Instruction *Inst);
352 
353  /// GetBB - Get a basic block with the specified name or ID, creating a
354  /// forward reference record if needed. This can return null if the value
355  /// is not a BasicBlock.
356  BasicBlock *GetBB(const std::string &Name, LocTy Loc);
357  BasicBlock *GetBB(unsigned ID, LocTy Loc);
358 
359  /// DefineBB - Define the specified basic block, which is either named or
360  /// unnamed. If there is an error, this returns null otherwise it returns
361  /// the block being defined.
362  BasicBlock *DefineBB(const std::string &Name, LocTy Loc);
363 
364  bool resolveForwardRefBlockAddresses();
365  };
366 
367  bool ConvertValIDToValue(Type *Ty, ValID &ID, Value *&V,
368  PerFunctionState *PFS);
369 
370  bool parseConstantValue(Type *Ty, Constant *&C);
371  bool ParseValue(Type *Ty, Value *&V, PerFunctionState *PFS);
372  bool ParseValue(Type *Ty, Value *&V, PerFunctionState &PFS) {
373  return ParseValue(Ty, V, &PFS);
374  }
375 
376  bool ParseValue(Type *Ty, Value *&V, LocTy &Loc,
377  PerFunctionState &PFS) {
378  Loc = Lex.getLoc();
379  return ParseValue(Ty, V, &PFS);
380  }
381 
382  bool ParseTypeAndValue(Value *&V, PerFunctionState *PFS);
383  bool ParseTypeAndValue(Value *&V, PerFunctionState &PFS) {
384  return ParseTypeAndValue(V, &PFS);
385  }
386  bool ParseTypeAndValue(Value *&V, LocTy &Loc, PerFunctionState &PFS) {
387  Loc = Lex.getLoc();
388  return ParseTypeAndValue(V, PFS);
389  }
390  bool ParseTypeAndBasicBlock(BasicBlock *&BB, LocTy &Loc,
391  PerFunctionState &PFS);
392  bool ParseTypeAndBasicBlock(BasicBlock *&BB, PerFunctionState &PFS) {
393  LocTy Loc;
394  return ParseTypeAndBasicBlock(BB, Loc, PFS);
395  }
396 
397 
398  struct ParamInfo {
399  LocTy Loc;
400  Value *V;
401  AttributeSet Attrs;
402  ParamInfo(LocTy loc, Value *v, AttributeSet attrs)
403  : Loc(loc), V(v), Attrs(attrs) {}
404  };
405  bool ParseParameterList(SmallVectorImpl<ParamInfo> &ArgList,
406  PerFunctionState &PFS,
407  bool IsMustTailCall = false,
408  bool InVarArgsFunc = false);
409 
410  bool
411  ParseOptionalOperandBundles(SmallVectorImpl<OperandBundleDef> &BundleList,
412  PerFunctionState &PFS);
413 
414  bool ParseExceptionArgs(SmallVectorImpl<Value *> &Args,
415  PerFunctionState &PFS);
416 
417  // Constant Parsing.
418  bool ParseValID(ValID &ID, PerFunctionState *PFS = nullptr);
419  bool ParseGlobalValue(Type *Ty, Constant *&V);
420  bool ParseGlobalTypeAndValue(Constant *&V);
421  bool ParseGlobalValueVector(SmallVectorImpl<Constant *> &Elts,
422  Optional<unsigned> *InRangeOp = nullptr);
423  bool parseOptionalComdat(StringRef GlobalName, Comdat *&C);
424  bool ParseMetadataAsValue(Value *&V, PerFunctionState &PFS);
425  bool ParseValueAsMetadata(Metadata *&MD, const Twine &TypeMsg,
426  PerFunctionState *PFS);
427  bool ParseMetadata(Metadata *&MD, PerFunctionState *PFS);
428  bool ParseMDTuple(MDNode *&MD, bool IsDistinct = false);
429  bool ParseMDNode(MDNode *&MD);
430  bool ParseMDNodeTail(MDNode *&MD);
431  bool ParseMDNodeVector(SmallVectorImpl<Metadata *> &MDs);
432  bool ParseMetadataAttachment(unsigned &Kind, MDNode *&MD);
433  bool ParseInstructionMetadata(Instruction &Inst);
434  bool ParseGlobalObjectMetadataAttachment(GlobalObject &GO);
435  bool ParseOptionalFunctionMetadata(Function &F);
436 
437  template <class FieldTy>
438  bool ParseMDField(LocTy Loc, StringRef Name, FieldTy &Result);
439  template <class FieldTy> bool ParseMDField(StringRef Name, FieldTy &Result);
440  template <class ParserTy>
441  bool ParseMDFieldsImplBody(ParserTy parseField);
442  template <class ParserTy>
443  bool ParseMDFieldsImpl(ParserTy parseField, LocTy &ClosingLoc);
444  bool ParseSpecializedMDNode(MDNode *&N, bool IsDistinct = false);
445 
446 #define HANDLE_SPECIALIZED_MDNODE_LEAF(CLASS) \
447  bool Parse##CLASS(MDNode *&Result, bool IsDistinct);
448 #include "llvm/IR/Metadata.def"
449 
450  // Function Parsing.
451  struct ArgInfo {
452  LocTy Loc;
453  Type *Ty;
454  AttributeSet Attrs;
455  std::string Name;
456  ArgInfo(LocTy L, Type *ty, AttributeSet Attr, const std::string &N)
457  : Loc(L), Ty(ty), Attrs(Attr), Name(N) {}
458  };
459  bool ParseArgumentList(SmallVectorImpl<ArgInfo> &ArgList, bool &isVarArg);
460  bool ParseFunctionHeader(Function *&Fn, bool isDefine);
461  bool ParseFunctionBody(Function &Fn);
462  bool ParseBasicBlock(PerFunctionState &PFS);
463 
464  enum TailCallType { TCT_None, TCT_Tail, TCT_MustTail };
465 
466  // Instruction Parsing. Each instruction parsing routine can return with a
467  // normal result, an error result, or return having eaten an extra comma.
468  enum InstResult { InstNormal = 0, InstError = 1, InstExtraComma = 2 };
469  int ParseInstruction(Instruction *&Inst, BasicBlock *BB,
470  PerFunctionState &PFS);
471  bool ParseCmpPredicate(unsigned &Pred, unsigned Opc);
472 
473  bool ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS);
474  bool ParseBr(Instruction *&Inst, PerFunctionState &PFS);
475  bool ParseSwitch(Instruction *&Inst, PerFunctionState &PFS);
476  bool ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS);
477  bool ParseInvoke(Instruction *&Inst, PerFunctionState &PFS);
478  bool ParseResume(Instruction *&Inst, PerFunctionState &PFS);
479  bool ParseCleanupRet(Instruction *&Inst, PerFunctionState &PFS);
480  bool ParseCatchRet(Instruction *&Inst, PerFunctionState &PFS);
481  bool ParseCatchSwitch(Instruction *&Inst, PerFunctionState &PFS);
482  bool ParseCatchPad(Instruction *&Inst, PerFunctionState &PFS);
483  bool ParseCleanupPad(Instruction *&Inst, PerFunctionState &PFS);
484 
485  bool ParseArithmetic(Instruction *&I, PerFunctionState &PFS, unsigned Opc,
486  unsigned OperandType);
487  bool ParseLogical(Instruction *&I, PerFunctionState &PFS, unsigned Opc);
488  bool ParseCompare(Instruction *&I, PerFunctionState &PFS, unsigned Opc);
489  bool ParseCast(Instruction *&I, PerFunctionState &PFS, unsigned Opc);
490  bool ParseSelect(Instruction *&I, PerFunctionState &PFS);
491  bool ParseVA_Arg(Instruction *&I, PerFunctionState &PFS);
492  bool ParseExtractElement(Instruction *&I, PerFunctionState &PFS);
493  bool ParseInsertElement(Instruction *&I, PerFunctionState &PFS);
494  bool ParseShuffleVector(Instruction *&I, PerFunctionState &PFS);
495  int ParsePHI(Instruction *&I, PerFunctionState &PFS);
496  bool ParseLandingPad(Instruction *&I, PerFunctionState &PFS);
497  bool ParseCall(Instruction *&I, PerFunctionState &PFS,
498  CallInst::TailCallKind IsTail);
499  int ParseAlloc(Instruction *&I, PerFunctionState &PFS);
500  int ParseLoad(Instruction *&I, PerFunctionState &PFS);
501  int ParseStore(Instruction *&I, PerFunctionState &PFS);
502  int ParseCmpXchg(Instruction *&I, PerFunctionState &PFS);
503  int ParseAtomicRMW(Instruction *&I, PerFunctionState &PFS);
504  int ParseFence(Instruction *&I, PerFunctionState &PFS);
505  int ParseGetElementPtr(Instruction *&I, PerFunctionState &PFS);
506  int ParseExtractValue(Instruction *&I, PerFunctionState &PFS);
507  int ParseInsertValue(Instruction *&I, PerFunctionState &PFS);
508 
509  // Use-list order directives.
510  bool ParseUseListOrder(PerFunctionState *PFS = nullptr);
511  bool ParseUseListOrderBB();
512  bool ParseUseListOrderIndexes(SmallVectorImpl<unsigned> &Indexes);
513  bool sortUseListOrder(Value *V, ArrayRef<unsigned> Indexes, SMLoc Loc);
514  };
515 } // End llvm namespace
516 
517 #endif
MachineLoop * L
LLLexer::LocTy Loc
Definition: LLParser.h:60
bool parseStandaloneConstantValue(Constant *&C, const SlotMapping *Slots)
Definition: LLParser.cpp:78
enum llvm::ValID::@272 Kind
LLVMContext & Context
Various leaf nodes.
Definition: ISDOpcodes.h:60
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
LLVMContext & getContext()
Definition: LLParser.h:154
bool parseTypeAtBeginning(Type *&Ty, unsigned &Read, const SlotMapping *Slots)
Definition: LLParser.cpp:91
unsigned UIntVal
Definition: LLParser.h:61
ELFYAML::ELF_STV Visibility
Definition: ELFYAML.cpp:662
bool Run()
Run: module ::= toplevelentity*.
Definition: LLParser.cpp:65
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
This file contains the simple types necessary to represent the attributes associated with functions a...
lltok::Kind Lex()
Definition: LLLexer.h:49
AtomicOrdering
Atomic ordering for LLVM's memory model.
ValID(const ValID &RHS)
Definition: LLParser.h:70
Class to represent function types.
Definition: DerivedTypes.h:103
#define F(x, y, z)
Definition: MD5.cpp:55
#define T
bool operator<(const ValID &RHS) const
Definition: LLParser.h:77
std::string StrVal
Definition: LLParser.h:63
const char * Name
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
#define P(N)
std::string ErrMsg
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
This is an important base class in LLVM.
Definition: Constant.h:42
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Constant * ConstantVal
Definition: LLParser.h:66
LocTy getLoc() const
Definition: LLLexer.h:54
APFloat APFloatVal
Definition: LLParser.h:65
This owns the files read by a parser, handles include stacks, and handles diagnostic wrangling...
Definition: SourceMgr.h:41
bool Error(LocTy L, const Twine &Msg) const
Definition: LLLexer.cpp:29
static bool isAtomic(Instruction *I)
LLParser(StringRef F, SourceMgr &SM, SMDiagnostic &Err, Module *M, SlotMapping *Slots=nullptr)
Definition: LLParser.h:143
APSInt APSIntVal
Definition: LLParser.h:64
#define B
Definition: LargeTest.cpp:24
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
Module.h This file contains the declarations for the Module class.
bool isVector(MCInstrInfo const &MCII, MCInst const &MCI)
const size_t N
ValID()=default
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
Definition: StringMap.h:220
This struct contains the mappings from the slot numbers to unnamed metadata nodes, global values and types.
Definition: SlotMapping.h:33
FunctionNumber(functionNumber)
Definition: LLParser.cpp:2511
ValID - Represents a reference of a definition of some sort with no type.
Definition: LLParser.h:47
OperandType
Types of operands to CF instructions.
#define C
Definition: LargeTest.cpp:25
#define I(x, y, z)
Definition: MD5.cpp:58
lltok::Kind getKind() const
Definition: LLLexer.h:55
std::unique_ptr< Constant *[]> ConstantStructElts
Definition: LLParser.h:67
FunctionType * FTy
Definition: LLParser.h:62
const unsigned Kind
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
std::string StrVal2
Definition: LLParser.h:63
LLLexer::LocTy LocTy
Definition: LLParser.h:89
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Represents a location in source code.
Definition: SMLoc.h:24
TLM
Definition: LLParser.cpp:1335
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition: SourceMgr.h:232
static bool parseField(amd_kernel_code_t &C, MCAsmParser &MCParser, raw_ostream &Err)