LLVM
8.0.1
|
#include "MILexer.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <string>
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 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 | lexNamedVirtualRegister (Cursor C, MIToken &Token) |
static Cursor | maybeLexRegister (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback) |
static Cursor | maybeLexGlobalValue (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback) |
static Cursor | maybeLexExternalSymbol (Cursor C, MIToken &Token, ErrorCallbackType ErrorCallback) |
static Cursor | maybeLexMCSymbol (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) |
|
static |
Definition at line 182 of file MILexer.cpp.
References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), llvm::MIToken::Identifier, llvm::MIToken::kw_address_taken, llvm::MIToken::kw_addrspace, llvm::MIToken::kw_afn, llvm::MIToken::kw_align, llvm::MIToken::kw_arcp, llvm::MIToken::kw_blockaddress, llvm::MIToken::kw_call_entry, llvm::MIToken::kw_cfi_aarch64_negate_ra_sign_state, llvm::MIToken::kw_cfi_adjust_cfa_offset, llvm::MIToken::kw_cfi_def_cfa, llvm::MIToken::kw_cfi_def_cfa_offset, llvm::MIToken::kw_cfi_def_cfa_register, llvm::MIToken::kw_cfi_escape, llvm::MIToken::kw_cfi_offset, llvm::MIToken::kw_cfi_register, llvm::MIToken::kw_cfi_rel_offset, llvm::MIToken::kw_cfi_remember_state, llvm::MIToken::kw_cfi_restore, llvm::MIToken::kw_cfi_restore_state, llvm::MIToken::kw_cfi_same_value, llvm::MIToken::kw_cfi_undefined, llvm::MIToken::kw_cfi_window_save, llvm::MIToken::kw_constant_pool, llvm::MIToken::kw_contract, 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_exact, llvm::MIToken::kw_float, llvm::MIToken::kw_floatpred, llvm::MIToken::kw_fp128, llvm::MIToken::kw_frame_destroy, 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_ninf, llvm::MIToken::kw_nnan, llvm::MIToken::kw_non_temporal, llvm::MIToken::kw_nsw, llvm::MIToken::kw_nsz, llvm::MIToken::kw_nuw, llvm::MIToken::kw_post_instr_symbol, llvm::MIToken::kw_ppc_fp128, llvm::MIToken::kw_pre_instr_symbol, llvm::MIToken::kw_reassoc, llvm::MIToken::kw_renamable, 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_unknown_size, llvm::MIToken::kw_volatile, llvm::MIToken::kw_x86_fp80, and llvm::MIToken::underscore.
Referenced by maybeLexIdentifier().
|
static |
Definition at line 573 of file MILexer.cpp.
References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), llvm::MIToken::Error, llvm::MIToken::md_alias_scope, llvm::MIToken::md_diexpr, llvm::MIToken::md_dilocation, llvm::MIToken::md_noalias, llvm::MIToken::md_range, and llvm::MIToken::md_tbaa.
Referenced by maybeLexExlaim().
Return true if the given character satisfies the following regular expression: [-a-zA-Z$._0-9].
Definition at line 110 of file MILexer.cpp.
Referenced by isRegisterChar(), lexName(), maybeLexExlaim(), maybeLexIdentifier(), maybeLexIndexAndName(), and maybeLexMachineBasicBlock().
Definition at line 97 of file MILexer.cpp.
Referenced by lexStringConstant(), maybeLexEscapedIRValue(), maybeLexNewline(), and skipComment().
Returns true for a character allowed in a register name.
Definition at line 406 of file MILexer.cpp.
References isIdentifierChar().
Referenced by lexNamedVirtualRegister(), and maybeLexRegister().
Definition at line 517 of file MILexer.cpp.
Referenced by maybeLexHexadecimalLiteral().
|
static |
Definition at line 521 of file MILexer.cpp.
References C, llvm::MIToken::FloatingPointLiteral, and llvm::MIToken::reset().
Referenced by maybeLexNumericalLiteral().
|
static |
Definition at line 160 of file MILexer.cpp.
References C, llvm::StringRef::drop_front(), llvm::MIToken::Error, isIdentifierChar(), lexStringConstant(), llvm::MIToken::reset(), llvm::MIToken::setOwnedStringValue(), llvm::String, and unescapeQuotedString().
Referenced by maybeLexExternalSymbol(), maybeLexGlobalValue(), maybeLexIRBlock(), maybeLexIRValue(), maybeLexStringConstant(), and maybeLexSubRegisterIndex().
|
static |
Definition at line 410 of file MILexer.cpp.
References C, isRegisterChar(), llvm::MIToken::NamedVirtualRegister, and llvm::MIToken::reset().
Referenced by maybeLexRegister().
|
static |
Lex a string constant using the following regular expression: "[^"]*".
Definition at line 146 of file MILexer.cpp.
References assert(), C, isNewlineChar(), and llvm::None.
Referenced by lexName().
|
static |
Definition at line 394 of file MILexer.cpp.
References llvm::lltok::APSInt, C, llvm::MIToken::reset(), and llvm::MIToken::VirtualRegister.
Referenced by maybeLexRegister().
|
static |
Definition at line 353 of file MILexer.cpp.
References llvm::MIToken::ConstantPoolItem, and maybeLexIndex().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 660 of file MILexer.cpp.
References C, llvm::MIToken::Eof, llvm::MIToken::Error, isNewlineChar(), llvm::lexMIToken(), maybeLexConstantPoolItem(), maybeLexExlaim(), maybeLexExternalSymbol(), maybeLexFixedStackObject(), maybeLexGlobalValue(), maybeLexHexadecimalLiteral(), maybeLexIdentifier(), maybeLexIRBlock(), maybeLexIRValue(), maybeLexJumpTableIndex(), maybeLexMachineBasicBlock(), maybeLexMCSymbol(), maybeLexNewline(), maybeLexNumericalLiteral(), maybeLexRegister(), maybeLexStackObject(), maybeLexStringConstant(), maybeLexSubRegisterIndex(), maybeLexSymbol(), llvm::None, llvm::MIToken::QuotedIRValue, llvm::MIToken::reset(), skipComment(), skipWhitespace(), and llvm::Sched::Source.
|
static |
Definition at line 584 of file MILexer.cpp.
References C, llvm::MIToken::exclaim, getMetadataKeywordKind(), llvm::MIToken::isError(), isIdentifierChar(), llvm::MIToken::location(), llvm::None, llvm::MIToken::reset(), and llvm::tgtok::StrVal.
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 462 of file MILexer.cpp.
References llvm::MIToken::ExternalSymbol, lexName(), and llvm::None.
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 349 of file MILexer.cpp.
References llvm::MIToken::FixedStackObject, and maybeLexIndex().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 445 of file MILexer.cpp.
References llvm::lltok::APSInt, C, llvm::MIToken::GlobalValue, lexName(), llvm::MIToken::NamedGlobalValue, llvm::None, and llvm::MIToken::reset().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 537 of file MILexer.cpp.
References C, llvm::MIToken::FloatingPointLiteral, llvm::MIToken::HexLiteral, isValidHexFloatingPointPrefix(), llvm::None, llvm::MIToken::reset(), llvm::StringRef::size(), and llvm::tgtok::StrVal.
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 258 of file MILexer.cpp.
References C, getIdentifierKind(), isIdentifierChar(), llvm::None, llvm::MIToken::reset(), and llvm::MIToken::setStringValue().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 305 of file MILexer.cpp.
References llvm::lltok::APSInt, C, llvm::None, llvm::MIToken::reset(), and llvm::StringRef::size().
Referenced by maybeLexConstantPoolItem(), maybeLexFixedStackObject(), maybeLexIRBlock(), maybeLexIRValue(), and maybeLexJumpTableIndex().
|
static |
Definition at line 318 of file MILexer.cpp.
References llvm::lltok::APSInt, C, isIdentifierChar(), llvm::None, llvm::Number, llvm::MIToken::reset(), and llvm::StringRef::size().
Referenced by maybeLexStackObject().
|
static |
Definition at line 366 of file MILexer.cpp.
References llvm::MIToken::IRBlock, lexName(), maybeLexIndex(), llvm::MIToken::NamedIRBlock, llvm::None, and llvm::StringRef::size().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 376 of file MILexer.cpp.
References llvm::MIToken::IRValue, lexName(), maybeLexIndex(), llvm::MIToken::NamedIRValue, llvm::None, and llvm::StringRef::size().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 341 of file MILexer.cpp.
References llvm::MIToken::JumpTableIndex, and maybeLexIndex().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 270 of file MILexer.cpp.
References llvm::lltok::APSInt, C, llvm::MIToken::Error, isIdentifierChar(), llvm::MIToken::MachineBasicBlock, llvm::MIToken::MachineBasicBlockLabel, llvm::None, llvm::Number, llvm::MIToken::reset(), and llvm::StringRef::size().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 470 of file MILexer.cpp.
References llvm::None.
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 651 of file MILexer.cpp.
References C, isNewlineChar(), llvm::MIToken::Newline, llvm::None, and llvm::MIToken::reset().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 559 of file MILexer.cpp.
References llvm::lltok::APSInt, C, llvm::MIToken::IntegerLiteral, lexFloatingPointLiteral(), llvm::None, llvm::MIToken::reset(), llvm::MIToken::setIntegerValue(), and llvm::tgtok::StrVal.
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 420 of file MILexer.cpp.
References assert(), C, isRegisterChar(), lexNamedVirtualRegister(), lexVirtualRegister(), llvm::MIToken::NamedRegister, llvm::None, and llvm::MIToken::reset().
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 345 of file MILexer.cpp.
References maybeLexIndexAndName(), and llvm::MIToken::StackObject.
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 386 of file MILexer.cpp.
References lexName(), llvm::None, and llvm::MIToken::StringConstant.
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 357 of file MILexer.cpp.
References lexName(), llvm::None, llvm::StringRef::size(), and llvm::MIToken::SubRegisterIndex.
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 635 of file MILexer.cpp.
References C, llvm::MIToken::coloncolon, llvm::MIToken::Error, Kind, llvm::None, llvm::MIToken::reset(), and symbolToken().
Referenced by maybeLexEscapedIRValue().
|
static |
Skip a line comment and return the updated cursor.
Definition at line 100 of file MILexer.cpp.
References C, and isNewlineChar().
Referenced by maybeLexEscapedIRValue().
|
static |
Skip the leading whitespace characters and return the updated cursor.
Definition at line 91 of file MILexer.cpp.
References C.
Referenced by maybeLexEscapedIRValue().
|
static |
Definition at line 604 of file MILexer.cpp.
References llvm::MIToken::colon, llvm::MIToken::comma, llvm::MIToken::dot, llvm::MIToken::equal, llvm::MIToken::Error, llvm::MIToken::greater, llvm::MIToken::lbrace, llvm::MIToken::less, llvm::MIToken::lparen, llvm::MIToken::minus, llvm::MIToken::plus, llvm::MIToken::rbrace, and llvm::MIToken::rparen.
Referenced by maybeLexSymbol().
|
static |
Unescapes the given string value.
Expects the string value to be quoted.
Definition at line 118 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().