LLVM 20.0.0git
|
#include "MILexer.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#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. | |
static bool | isNewlineChar (char C) |
static Cursor | skipComment (Cursor C) |
Skip a line comment and return the updated cursor. | |
static Cursor | skipMachineOperandComment (Cursor C) |
Machine operands can have comments, enclosed between /* and /. | |
static bool | isIdentifierChar (char C) |
Return true if the given character satisfies the following regular expression: [-a-zA-Z$._0-9]. | |
static std::string | unescapeQuotedString (StringRef Value) |
Unescapes the given string value. | |
static Cursor | lexStringConstant (Cursor C, ErrorCallbackType ErrorCallback) |
Lex a string constant using the following regular expression: "[^"]*". | |
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. | |
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 | maybeLexExclaim (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 190 of file MILexer.cpp.
References llvm::StringSwitch< T, R >::Case(), llvm::StringSwitch< T, R >::Default(), llvm::MIToken::Identifier, llvm::MIToken::kw_addrspace, llvm::MIToken::kw_afn, llvm::MIToken::kw_align, llvm::MIToken::kw_arcp, llvm::MIToken::kw_basealign, llvm::MIToken::kw_bb_id, llvm::MIToken::kw_bbsections, llvm::MIToken::kw_bfloat, llvm::MIToken::kw_blockaddress, llvm::MIToken::kw_call_entry, llvm::MIToken::kw_call_frame_size, llvm::MIToken::kw_cfi_aarch64_negate_ra_sign_state, llvm::MIToken::kw_cfi_aarch64_negate_ra_sign_state_with_pc, 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_llvm_def_aspace_cfa, 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_type, llvm::MIToken::kw_cfi_undefined, llvm::MIToken::kw_cfi_window_save, llvm::MIToken::kw_constant_pool, llvm::MIToken::kw_contract, llvm::MIToken::kw_custom, llvm::MIToken::kw_dbg_instr_ref, llvm::MIToken::kw_dead, llvm::MIToken::kw_debug_instr_number, llvm::MIToken::kw_debug_location, llvm::MIToken::kw_debug_use, llvm::MIToken::kw_def, llvm::MIToken::kw_dereferenceable, llvm::MIToken::kw_disjoint, llvm::MIToken::kw_distinct, llvm::MIToken::kw_double, llvm::MIToken::kw_early_clobber, llvm::MIToken::kw_ehfunclet_entry, 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_heap_alloc_marker, llvm::MIToken::kw_implicit, llvm::MIToken::kw_implicit_define, llvm::MIToken::kw_inlineasm_br_indirect_target, llvm::MIToken::kw_internal, llvm::MIToken::kw_intpred, llvm::MIToken::kw_intrinsic, llvm::MIToken::kw_invariant, llvm::MIToken::kw_ir_block_address_taken, 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_machine_block_address_taken, llvm::MIToken::kw_ninf, llvm::MIToken::kw_nnan, llvm::MIToken::kw_nneg, llvm::MIToken::kw_noconvergent, llvm::MIToken::kw_nofpexcept, llvm::MIToken::kw_non_temporal, llvm::MIToken::kw_nsw, llvm::MIToken::kw_nsz, llvm::MIToken::kw_nusw, llvm::MIToken::kw_nuw, llvm::MIToken::kw_pcsections, 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_samesign, llvm::MIToken::kw_shufflemask, 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_address, llvm::MIToken::kw_unknown_size, llvm::MIToken::kw_unpredictable, llvm::MIToken::kw_volatile, llvm::MIToken::kw_x86_fp80, and llvm::MIToken::underscore.
Referenced by maybeLexIdentifier().
|
static |
Definition at line 611 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 maybeLexExclaim().
Return true if the given character satisfies the following regular expression: [-a-zA-Z$._0-9].
Definition at line 118 of file MILexer.cpp.
References llvm::CallingConv::C.
Referenced by isRegisterChar(), lexName(), maybeLexExclaim(), maybeLexIdentifier(), maybeLexIndexAndName(), maybeLexMachineBasicBlock(), and maybeLexMCSymbol().
Definition at line 91 of file MILexer.cpp.
References llvm::CallingConv::C.
Referenced by lexStringConstant(), maybeLexEscapedIRValue(), maybeLexNewline(), and skipComment().
Returns true for a character allowed in a register name.
Definition at line 444 of file MILexer.cpp.
References llvm::CallingConv::C, and isIdentifierChar().
Referenced by lexNamedVirtualRegister(), and maybeLexRegister().
Definition at line 555 of file MILexer.cpp.
References llvm::CallingConv::C.
Referenced by maybeLexHexadecimalLiteral().
|
static |
Definition at line 559 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::FloatingPointLiteral, Range, and llvm::MIToken::reset().
Referenced by maybeLexNumericalLiteral().
|
static |
Definition at line 168 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::Error, isIdentifierChar(), lexStringConstant(), Range, llvm::MIToken::reset(), llvm::MIToken::setOwnedStringValue(), llvm::MIToken::setStringValue(), llvm::String, and unescapeQuotedString().
Referenced by maybeLexExternalSymbol(), maybeLexGlobalValue(), maybeLexIRBlock(), maybeLexIRValue(), maybeLexStringConstant(), and maybeLexSubRegisterIndex().
|
static |
Definition at line 448 of file MILexer.cpp.
References llvm::CallingConv::C, isRegisterChar(), llvm::MIToken::NamedVirtualRegister, Range, llvm::MIToken::reset(), and llvm::MIToken::setStringValue().
Referenced by maybeLexRegister().
|
static |
Lex a string constant using the following regular expression: "[^"]*".
Definition at line 154 of file MILexer.cpp.
References assert(), llvm::CallingConv::C, and isNewlineChar().
Referenced by lexName(), and maybeLexMCSymbol().
|
static |
Definition at line 432 of file MILexer.cpp.
References llvm::CallingConv::C, Range, llvm::MIToken::reset(), llvm::MIToken::setIntegerValue(), and llvm::MIToken::VirtualRegister.
Referenced by maybeLexRegister().
|
static |
Definition at line 391 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::ConstantPoolItem, and maybeLexIndex().
|
static |
Definition at line 698 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::Error, isNewlineChar(), llvm::MIToken::QuotedIRValue, Range, llvm::MIToken::reset(), and llvm::MIToken::setStringValue().
|
static |
Definition at line 622 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::exclaim, getMetadataKeywordKind(), llvm::MIToken::isError(), isIdentifierChar(), llvm::MIToken::location(), Range, and llvm::MIToken::reset().
|
static |
Definition at line 500 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::ExternalSymbol, and lexName().
|
static |
Definition at line 387 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::FixedStackObject, and maybeLexIndex().
|
static |
Definition at line 483 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::GlobalValue, lexName(), llvm::MIToken::NamedGlobalValue, Range, llvm::MIToken::reset(), and llvm::MIToken::setIntegerValue().
|
static |
Definition at line 575 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::FloatingPointLiteral, llvm::MIToken::HexLiteral, isValidHexFloatingPointPrefix(), Range, and llvm::MIToken::reset().
|
static |
Definition at line 296 of file MILexer.cpp.
References llvm::CallingConv::C, getIdentifierKind(), isIdentifierChar(), Range, llvm::MIToken::reset(), and llvm::MIToken::setStringValue().
|
static |
Definition at line 343 of file MILexer.cpp.
References llvm::CallingConv::C, Range, llvm::MIToken::reset(), llvm::MIToken::setIntegerValue(), and llvm::StringRef::size().
Referenced by maybeLexConstantPoolItem(), maybeLexFixedStackObject(), maybeLexIRBlock(), maybeLexIRValue(), and maybeLexJumpTableIndex().
|
static |
Definition at line 356 of file MILexer.cpp.
References llvm::CallingConv::C, isIdentifierChar(), llvm::Number, Range, llvm::MIToken::reset(), llvm::MIToken::setIntegerValue(), llvm::MIToken::setStringValue(), and llvm::StringRef::size().
Referenced by maybeLexStackObject().
|
static |
Definition at line 404 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::IRBlock, lexName(), maybeLexIndex(), llvm::MIToken::NamedIRBlock, and llvm::StringRef::size().
|
static |
Definition at line 414 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::IRValue, lexName(), maybeLexIndex(), llvm::MIToken::NamedIRValue, and llvm::StringRef::size().
|
static |
Definition at line 379 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::JumpTableIndex, and maybeLexIndex().
|
static |
Definition at line 308 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::Error, isIdentifierChar(), llvm::MIToken::MachineBasicBlock, llvm::MIToken::MachineBasicBlockLabel, llvm::Number, Range, llvm::MIToken::reset(), llvm::MIToken::setIntegerValue(), and llvm::MIToken::setStringValue().
|
static |
Definition at line 508 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::Error, isIdentifierChar(), lexStringConstant(), llvm::MIToken::MCSymbol, llvm::MIToken::reset(), llvm::MIToken::setOwnedStringValue(), llvm::MIToken::setStringValue(), llvm::StringRef::size(), llvm::String, and unescapeQuotedString().
|
static |
Definition at line 689 of file MILexer.cpp.
References llvm::CallingConv::C, isNewlineChar(), llvm::MIToken::Newline, Range, and llvm::MIToken::reset().
|
static |
Definition at line 597 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::IntegerLiteral, lexFloatingPointLiteral(), Range, llvm::MIToken::reset(), and llvm::MIToken::setIntegerValue().
|
static |
Definition at line 458 of file MILexer.cpp.
References assert(), llvm::CallingConv::C, isRegisterChar(), lexNamedVirtualRegister(), lexVirtualRegister(), llvm::MIToken::NamedRegister, Range, llvm::MIToken::reset(), and llvm::MIToken::setStringValue().
|
static |
Definition at line 383 of file MILexer.cpp.
References llvm::CallingConv::C, maybeLexIndexAndName(), and llvm::MIToken::StackObject.
|
static |
Definition at line 424 of file MILexer.cpp.
References llvm::CallingConv::C, lexName(), and llvm::MIToken::StringConstant.
|
static |
Definition at line 395 of file MILexer.cpp.
References llvm::CallingConv::C, lexName(), llvm::StringRef::size(), and llvm::MIToken::SubRegisterIndex.
|
static |
Definition at line 673 of file MILexer.cpp.
References llvm::CallingConv::C, llvm::MIToken::coloncolon, llvm::MIToken::Error, llvm::Length, Range, llvm::MIToken::reset(), and symbolToken().
|
static |
Skip a line comment and return the updated cursor.
Definition at line 94 of file MILexer.cpp.
References llvm::CallingConv::C, and isNewlineChar().
|
static |
Machine operands can have comments, enclosed between /* and /.
This eats up all tokens, including / and */.
Definition at line 104 of file MILexer.cpp.
References llvm::CallingConv::C.
|
static |
Skip the leading whitespace characters and return the updated cursor.
Definition at line 85 of file MILexer.cpp.
References llvm::CallingConv::C.
|
static |
Definition at line 642 of file MILexer.cpp.
References llvm::CallingConv::C, 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 126 of file MILexer.cpp.
References assert(), and llvm::CallingConv::C.
Referenced by lexName(), and maybeLexMCSymbol().