LLVM  5.0.0
Functions
MILexer.cpp File Reference
#include "MILexer.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include <cctype>
Include dependency graph for MILexer.cpp:

Go to the source code of this file.

Functions

static Cursor skipWhitespace (Cursor C)
 Skip the leading whitespace characters and return the updated cursor. More...
 
static bool isNewlineChar (char C)
 
static Cursor skipComment (Cursor C)
 Skip a line comment and return the updated cursor. More...
 
static bool isIdentifierChar (char C)
 Return true if the given character satisfies the following regular expression: [-a-zA-Z$._0-9]. More...
 
static std::string unescapeQuotedString (StringRef Value)
 Unescapes the given string value. More...
 
static Cursor lexStringConstant (Cursor C, ErrorCallbackType ErrorCallback)
 Lex a string constant using the following regular expression: "[^"]*". More...
 
static Cursor lexName (Cursor C, MIToken &Token, MIToken::TokenKind Type, unsigned PrefixLength, ErrorCallbackType ErrorCallback)
 
static Cursor maybeLexIntegerOrScalarType (Cursor C, MIToken &Token)
 
static MIToken::TokenKind getIdentifierKind (StringRef Identifier)
 
static Cursor maybeLexIdentifier (Cursor C, MIToken &Token)
 
static Cursor maybeLexMachineBasicBlock (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
 
static Cursor maybeLexIndex (Cursor C, MIToken &Token, StringRef Rule, MIToken::TokenKind Kind)
 
static Cursor maybeLexIndexAndName (Cursor C, MIToken &Token, StringRef Rule, MIToken::TokenKind Kind)
 
static Cursor maybeLexJumpTableIndex (Cursor C, MIToken &Token)
 
static Cursor maybeLexStackObject (Cursor C, MIToken &Token)
 
static Cursor maybeLexFixedStackObject (Cursor C, MIToken &Token)
 
static Cursor maybeLexConstantPoolItem (Cursor C, MIToken &Token)
 
static Cursor maybeLexSubRegisterIndex (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
 
static Cursor maybeLexIRBlock (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
 
static Cursor maybeLexIRValue (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
 
static Cursor maybeLexStringConstant (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
 
static Cursor lexVirtualRegister (Cursor C, MIToken &Token)
 
static bool isRegisterChar (char C)
 Returns true for a character allowed in a register name. More...
 
static Cursor maybeLexRegister (Cursor C, MIToken &Token)
 
static Cursor maybeLexGlobalValue (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
 
static Cursor maybeLexExternalSymbol (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
 
static bool isValidHexFloatingPointPrefix (char C)
 
static Cursor lexFloatingPointLiteral (Cursor Range, Cursor C, MIToken &Token)
 
static Cursor maybeLexHexadecimalLiteral (Cursor C, MIToken &Token)
 
static Cursor maybeLexNumericalLiteral (Cursor C, MIToken &Token)
 
static MIToken::TokenKind getMetadataKeywordKind (StringRef Identifier)
 
static Cursor maybeLexExlaim (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
 
static MIToken::TokenKind symbolToken (char C)
 
static Cursor maybeLexSymbol (Cursor C, MIToken &Token)
 
static Cursor maybeLexNewline (Cursor C, MIToken &Token)
 
static Cursor maybeLexEscapedIRValue (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback)
 

Function Documentation

static MIToken::TokenKind getIdentifierKind ( StringRef  Identifier)
static

Definition at line 193 of file MILexer.cpp.

References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), llvm::object::Identifier, llvm::MIToken::Identifier, llvm::MIToken::kw_address_taken, llvm::MIToken::kw_align, llvm::MIToken::kw_blockaddress, llvm::MIToken::kw_call_entry, llvm::MIToken::kw_cfi_def_cfa, llvm::MIToken::kw_cfi_def_cfa_offset, llvm::MIToken::kw_cfi_def_cfa_register, llvm::MIToken::kw_cfi_offset, llvm::MIToken::kw_cfi_same_value, llvm::MIToken::kw_constant_pool, llvm::MIToken::kw_dead, llvm::MIToken::kw_debug_location, llvm::MIToken::kw_debug_use, llvm::MIToken::kw_def, llvm::MIToken::kw_dereferenceable, llvm::MIToken::kw_double, llvm::MIToken::kw_early_clobber, llvm::MIToken::kw_float, llvm::MIToken::kw_floatpred, llvm::MIToken::kw_fp128, llvm::MIToken::kw_frame_setup, llvm::MIToken::kw_got, llvm::MIToken::kw_half, llvm::MIToken::kw_implicit, llvm::MIToken::kw_implicit_define, llvm::MIToken::kw_internal, llvm::MIToken::kw_intpred, llvm::MIToken::kw_intrinsic, llvm::MIToken::kw_invariant, llvm::MIToken::kw_jump_table, llvm::MIToken::kw_killed, llvm::MIToken::kw_landing_pad, llvm::MIToken::kw_liveins, llvm::MIToken::kw_liveout, llvm::MIToken::kw_non_temporal, llvm::MIToken::kw_ppc_fp128, llvm::MIToken::kw_stack, llvm::MIToken::kw_successors, llvm::MIToken::kw_target_flags, llvm::MIToken::kw_target_index, llvm::MIToken::kw_tied_def, llvm::MIToken::kw_undef, llvm::MIToken::kw_volatile, llvm::MIToken::kw_x86_fp80, and llvm::MIToken::underscore.

Referenced by maybeLexIdentifier().

static MIToken::TokenKind getMetadataKeywordKind ( StringRef  Identifier)
static
static bool isIdentifierChar ( char  C)
static

Return true if the given character satisfies the following regular expression: [-a-zA-Z$._0-9].

Definition at line 104 of file MILexer.cpp.

Referenced by isRegisterChar(), lexName(), maybeLexExlaim(), maybeLexIdentifier(), maybeLexIndexAndName(), and maybeLexMachineBasicBlock().

static bool isNewlineChar ( char  C)
static
static bool isRegisterChar ( char  C)
static

Returns true for a character allowed in a register name.

Definition at line 388 of file MILexer.cpp.

References isIdentifierChar().

Referenced by maybeLexRegister().

static bool isValidHexFloatingPointPrefix ( char  C)
static

Definition at line 431 of file MILexer.cpp.

Referenced by maybeLexHexadecimalLiteral().

static Cursor lexFloatingPointLiteral ( Cursor  Range,
Cursor  C,
MIToken &  Token 
)
static

Definition at line 435 of file MILexer.cpp.

References C, llvm::MIToken::FloatingPointLiteral, and llvm::MIToken::reset().

Referenced by maybeLexNumericalLiteral().

static Cursor lexName ( Cursor  C,
MIToken &  Token,
MIToken::TokenKind  Type,
unsigned  PrefixLength,
ErrorCallbackType  ErrorCallback 
)
static
static Cursor lexStringConstant ( Cursor  C,
ErrorCallbackType  ErrorCallback 
)
static

Lex a string constant using the following regular expression: "[^"]*".

Definition at line 140 of file MILexer.cpp.

References assert(), C, isNewlineChar(), and llvm::None.

Referenced by lexName().

static Cursor lexVirtualRegister ( Cursor  C,
MIToken &  Token 
)
static

Definition at line 376 of file MILexer.cpp.

References llvm::lltok::APSInt, C, llvm::MIToken::reset(), and llvm::MIToken::VirtualRegister.

Referenced by maybeLexRegister().

static Cursor maybeLexConstantPoolItem ( Cursor  C,
MIToken &  Token 
)
static

Definition at line 335 of file MILexer.cpp.

References llvm::MIToken::ConstantPoolItem, and maybeLexIndex().

static Cursor maybeLexEscapedIRValue ( Cursor  C,
MIToken &  Token,
ErrorCallbackType  ErrorCallback 
)
static
static Cursor maybeLexExlaim ( Cursor  C,
MIToken &  Token,
ErrorCallbackType  ErrorCallback 
)
static
static Cursor maybeLexExternalSymbol ( Cursor  C,
MIToken &  Token,
ErrorCallbackType  ErrorCallback 
)
static

Definition at line 423 of file MILexer.cpp.

References llvm::MIToken::ExternalSymbol, lexName(), and llvm::None.

static Cursor maybeLexFixedStackObject ( Cursor  C,
MIToken &  Token 
)
static

Definition at line 331 of file MILexer.cpp.

References llvm::MIToken::FixedStackObject, and maybeLexIndex().

static Cursor maybeLexGlobalValue ( Cursor  C,
MIToken &  Token,
ErrorCallbackType  ErrorCallback 
)
static
static Cursor maybeLexHexadecimalLiteral ( Cursor  C,
MIToken &  Token 
)
static
static Cursor maybeLexIdentifier ( Cursor  C,
MIToken &  Token 
)
static
static Cursor maybeLexIndex ( Cursor  C,
MIToken &  Token,
StringRef  Rule,
MIToken::TokenKind  Kind 
)
static
static Cursor maybeLexIndexAndName ( Cursor  C,
MIToken &  Token,
StringRef  Rule,
MIToken::TokenKind  Kind 
)
static
static Cursor maybeLexIntegerOrScalarType ( Cursor  C,
MIToken &  Token 
)
static
static Cursor maybeLexIRBlock ( Cursor  C,
MIToken &  Token,
ErrorCallbackType  ErrorCallback 
)
static
static Cursor maybeLexIRValue ( Cursor  C,
MIToken &  Token,
ErrorCallbackType  ErrorCallback 
)
static
static Cursor maybeLexJumpTableIndex ( Cursor  C,
MIToken &  Token 
)
static

Definition at line 323 of file MILexer.cpp.

References llvm::MIToken::JumpTableIndex, and maybeLexIndex().

static Cursor maybeLexMachineBasicBlock ( Cursor  C,
MIToken &  Token,
ErrorCallbackType  ErrorCallback 
)
static
static Cursor maybeLexNewline ( Cursor  C,
MIToken &  Token 
)
static

Definition at line 563 of file MILexer.cpp.

References C, isNewlineChar(), llvm::MIToken::Newline, llvm::None, and llvm::MIToken::reset().

static Cursor maybeLexNumericalLiteral ( Cursor  C,
MIToken &  Token 
)
static
static Cursor maybeLexRegister ( Cursor  C,
MIToken &  Token 
)
static
static Cursor maybeLexStackObject ( Cursor  C,
MIToken &  Token 
)
static

Definition at line 327 of file MILexer.cpp.

References maybeLexIndexAndName(), and llvm::MIToken::StackObject.

static Cursor maybeLexStringConstant ( Cursor  C,
MIToken &  Token,
ErrorCallbackType  ErrorCallback 
)
static

Definition at line 368 of file MILexer.cpp.

References lexName(), llvm::None, and llvm::MIToken::StringConstant.

static Cursor maybeLexSubRegisterIndex ( Cursor  C,
MIToken &  Token,
ErrorCallbackType  ErrorCallback 
)
static
static Cursor maybeLexSymbol ( Cursor  C,
MIToken &  Token 
)
static
static Cursor skipComment ( Cursor  C)
static

Skip a line comment and return the updated cursor.

Definition at line 94 of file MILexer.cpp.

References C, and isNewlineChar().

static Cursor skipWhitespace ( Cursor  C)
static

Skip the leading whitespace characters and return the updated cursor.

Definition at line 85 of file MILexer.cpp.

References C.

static MIToken::TokenKind symbolToken ( char  C)
static
static std::string unescapeQuotedString ( StringRef  Value)
static

Unescapes the given string value.

Expects the string value to be quoted.

Definition at line 112 of file MILexer.cpp.

References assert(), llvm::StringRef::back(), C, llvm::StringRef::front(), llvm::hexDigitValue(), llvm::StringRef::size(), and llvm::StringRef::substr().

Referenced by lexName().