LLVM
8.0.1
lib
MC
MCParser
MCAsmLexer.cpp
Go to the documentation of this file.
1
//===- MCAsmLexer.cpp - Abstract Asm Lexer Interface ----------------------===//
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
#include "
llvm/MC/MCParser/MCAsmLexer.h
"
11
#include "
llvm/ADT/StringRef.h
"
12
#include "
llvm/Support/SMLoc.h
"
13
#include "
llvm/Support/Debug.h
"
14
#include "
llvm/Support/raw_ostream.h
"
15
16
using namespace
llvm
;
17
18
MCAsmLexer::MCAsmLexer
() {
19
CurTok.emplace_back(
AsmToken::Space
,
StringRef
());
20
}
21
22
MCAsmLexer::~MCAsmLexer
() =
default
;
23
24
SMLoc
MCAsmLexer::getLoc
()
const
{
25
return
SMLoc::getFromPointer
(
TokStart
);
26
}
27
28
SMLoc
AsmToken::getLoc
()
const
{
29
return
SMLoc::getFromPointer
(Str.data());
30
}
31
32
SMLoc
AsmToken::getEndLoc
()
const
{
33
return
SMLoc::getFromPointer
(Str.data() + Str.size());
34
}
35
36
SMRange
AsmToken::getLocRange
()
const
{
37
return
SMRange
(
getLoc
(), getEndLoc());
38
}
39
40
void
AsmToken::dump
(
raw_ostream
&OS)
const
{
41
switch
(
Kind
) {
42
case
AsmToken::Error
:
43
OS <<
"error"
;
44
break
;
45
case
AsmToken::Identifier
:
46
OS <<
"identifier: "
<< getString();
47
break
;
48
case
AsmToken::Integer
:
49
OS <<
"int: "
<< getString();
50
break
;
51
case
AsmToken::Real
:
52
OS <<
"real: "
<< getString();
53
break
;
54
case
AsmToken::String
:
55
OS <<
"string: "
<< getString();
56
break
;
57
58
case
AsmToken::Amp
: OS <<
"Amp"
;
break
;
59
case
AsmToken::AmpAmp
: OS <<
"AmpAmp"
;
break
;
60
case
AsmToken::At
: OS <<
"At"
;
break
;
61
case
AsmToken::BackSlash
: OS <<
"BackSlash"
;
break
;
62
case
AsmToken::BigNum
: OS <<
"BigNum"
;
break
;
63
case
AsmToken::Caret
: OS <<
"Caret"
;
break
;
64
case
AsmToken::Colon
: OS <<
"Colon"
;
break
;
65
case
AsmToken::Comma
: OS <<
"Comma"
;
break
;
66
case
AsmToken::Comment
: OS <<
"Comment"
;
break
;
67
case
AsmToken::Dollar
: OS <<
"Dollar"
;
break
;
68
case
AsmToken::Dot
: OS <<
"Dot"
;
break
;
69
case
AsmToken::EndOfStatement
: OS <<
"EndOfStatement"
;
break
;
70
case
AsmToken::Eof
: OS <<
"Eof"
;
break
;
71
case
AsmToken::Equal
: OS <<
"Equal"
;
break
;
72
case
AsmToken::EqualEqual
: OS <<
"EqualEqual"
;
break
;
73
case
AsmToken::Exclaim
: OS <<
"Exclaim"
;
break
;
74
case
AsmToken::ExclaimEqual
: OS <<
"ExclaimEqual"
;
break
;
75
case
AsmToken::Greater
: OS <<
"Greater"
;
break
;
76
case
AsmToken::GreaterEqual
: OS <<
"GreaterEqual"
;
break
;
77
case
AsmToken::GreaterGreater
: OS <<
"GreaterGreater"
;
break
;
78
case
AsmToken::Hash
: OS <<
"Hash"
;
break
;
79
case
AsmToken::HashDirective
: OS <<
"HashDirective"
;
break
;
80
case
AsmToken::LBrac
: OS <<
"LBrac"
;
break
;
81
case
AsmToken::LCurly
: OS <<
"LCurly"
;
break
;
82
case
AsmToken::LParen
: OS <<
"LParen"
;
break
;
83
case
AsmToken::Less
: OS <<
"Less"
;
break
;
84
case
AsmToken::LessEqual
: OS <<
"LessEqual"
;
break
;
85
case
AsmToken::LessGreater
: OS <<
"LessGreater"
;
break
;
86
case
AsmToken::LessLess
: OS <<
"LessLess"
;
break
;
87
case
AsmToken::Minus
: OS <<
"Minus"
;
break
;
88
case
AsmToken::MinusGreater
: OS <<
"MinusGreater"
;
break
;
89
case
AsmToken::Percent
: OS <<
"Percent"
;
break
;
90
case
AsmToken::Pipe
: OS <<
"Pipe"
;
break
;
91
case
AsmToken::PipePipe
: OS <<
"PipePipe"
;
break
;
92
case
AsmToken::Plus
: OS <<
"Plus"
;
break
;
93
case
AsmToken::RBrac
: OS <<
"RBrac"
;
break
;
94
case
AsmToken::RCurly
: OS <<
"RCurly"
;
break
;
95
case
AsmToken::RParen
: OS <<
"RParen"
;
break
;
96
case
AsmToken::Slash
: OS <<
"Slash"
;
break
;
97
case
AsmToken::Space
: OS <<
"Space"
;
break
;
98
case
AsmToken::Star
: OS <<
"Star"
;
break
;
99
case
AsmToken::Tilde
: OS <<
"Tilde"
;
break
;
100
case
AsmToken::PercentCall16
: OS <<
"PercentCall16"
;
break
;
101
case
AsmToken::PercentCall_Hi
: OS <<
"PercentCall_Hi"
;
break
;
102
case
AsmToken::PercentCall_Lo
: OS <<
"PercentCall_Lo"
;
break
;
103
case
AsmToken::PercentDtprel_Hi
: OS <<
"PercentDtprel_Hi"
;
break
;
104
case
AsmToken::PercentDtprel_Lo
: OS <<
"PercentDtprel_Lo"
;
break
;
105
case
AsmToken::PercentGot
: OS <<
"PercentGot"
;
break
;
106
case
AsmToken::PercentGot_Disp
: OS <<
"PercentGot_Disp"
;
break
;
107
case
AsmToken::PercentGot_Hi
: OS <<
"PercentGot_Hi"
;
break
;
108
case
AsmToken::PercentGot_Lo
: OS <<
"PercentGot_Lo"
;
break
;
109
case
AsmToken::PercentGot_Ofst
: OS <<
"PercentGot_Ofst"
;
break
;
110
case
AsmToken::PercentGot_Page
: OS <<
"PercentGot_Page"
;
break
;
111
case
AsmToken::PercentGottprel
: OS <<
"PercentGottprel"
;
break
;
112
case
AsmToken::PercentGp_Rel
: OS <<
"PercentGp_Rel"
;
break
;
113
case
AsmToken::PercentHi
: OS <<
"PercentHi"
;
break
;
114
case
AsmToken::PercentHigher
: OS <<
"PercentHigher"
;
break
;
115
case
AsmToken::PercentHighest
: OS <<
"PercentHighest"
;
break
;
116
case
AsmToken::PercentLo
: OS <<
"PercentLo"
;
break
;
117
case
AsmToken::PercentNeg
: OS <<
"PercentNeg"
;
break
;
118
case
AsmToken::PercentPcrel_Hi
: OS <<
"PercentPcrel_Hi"
;
break
;
119
case
AsmToken::PercentPcrel_Lo
: OS <<
"PercentPcrel_Lo"
;
break
;
120
case
AsmToken::PercentTlsgd
: OS <<
"PercentTlsgd"
;
break
;
121
case
AsmToken::PercentTlsldm
: OS <<
"PercentTlsldm"
;
break
;
122
case
AsmToken::PercentTprel_Hi
: OS <<
"PercentTprel_Hi"
;
break
;
123
case
AsmToken::PercentTprel_Lo
: OS <<
"PercentTprel_Lo"
;
break
;
124
}
125
126
// Print the token string.
127
OS <<
" (\""
;
128
OS.
write_escaped
(getString());
129
OS <<
"\")"
;
130
}
llvm::AsmToken::dump
void dump() const
Definition:
MCAsmMacro.h:128
llvm::SMRange
Represents a range in source code.
Definition:
SMLoc.h:49
llvm::AsmToken::String
Definition:
MCAsmMacro.h:30
llvm::AsmToken::PercentGot_Page
Definition:
MCAsmMacro.h:60
llvm
This class represents lattice values for constants.
Definition:
AllocatorList.h:24
llvm::AsmToken::Star
Definition:
MCAsmMacro.h:50
Debug.h
llvm::AsmToken::PercentTlsldm
Definition:
MCAsmMacro.h:62
llvm::AsmToken::MinusGreater
Definition:
MCAsmMacro.h:55
llvm::AsmToken::PipePipe
Definition:
MCAsmMacro.h:52
llvm::AsmToken::GreaterEqual
Definition:
MCAsmMacro.h:55
llvm::AsmToken::PercentTprel_Lo
Definition:
MCAsmMacro.h:63
llvm::AsmToken::Dollar
Definition:
MCAsmMacro.h:50
llvm::AsmToken::PercentCall16
Definition:
MCAsmMacro.h:58
llvm::AsmToken::getLocRange
SMRange getLocRange() const
Definition:
MCAsmLexer.cpp:36
llvm::AsmToken::Equal
Definition:
MCAsmMacro.h:50
llvm::AsmToken::PercentHi
Definition:
MCAsmMacro.h:60
llvm::MCAsmLexer::getLoc
SMLoc getLoc() const
Get the current source location.
Definition:
MCAsmLexer.cpp:24
llvm::AsmToken::Amp
Definition:
MCAsmMacro.h:53
llvm::AsmToken::PercentLo
Definition:
MCAsmMacro.h:61
llvm::AsmToken::PercentGot_Hi
Definition:
MCAsmMacro.h:59
llvm::AsmToken::PercentTprel_Hi
Definition:
MCAsmMacro.h:62
llvm::AsmToken::Real
Definition:
MCAsmMacro.h:37
llvm::AsmToken::PercentGot_Lo
Definition:
MCAsmMacro.h:59
llvm::AsmToken::PercentGp_Rel
Definition:
MCAsmMacro.h:60
llvm::AsmToken::Caret
Definition:
MCAsmMacro.h:52
llvm::AsmToken::PercentGottprel
Definition:
MCAsmMacro.h:60
llvm::AsmToken::PercentDtprel_Lo
Definition:
MCAsmMacro.h:59
SMLoc.h
llvm::AsmToken::HashDirective
Definition:
MCAsmMacro.h:41
llvm::AsmToken::getLoc
SMLoc getLoc() const
Definition:
MCAsmLexer.cpp:28
llvm::AsmToken::RCurly
Definition:
MCAsmMacro.h:49
llvm::MCAsmLexer::MCAsmLexer
MCAsmLexer()
Definition:
MCAsmLexer.cpp:18
llvm::AsmToken::PercentPcrel_Hi
Definition:
MCAsmMacro.h:61
llvm::AsmToken::Eof
Definition:
MCAsmMacro.h:26
llvm::AsmToken::LessGreater
Definition:
MCAsmMacro.h:54
llvm::AsmToken::Tilde
Definition:
MCAsmMacro.h:46
llvm::AsmToken::getEndLoc
SMLoc getEndLoc() const
Definition:
MCAsmLexer.cpp:32
llvm::AsmToken::PercentGot_Ofst
Definition:
MCAsmMacro.h:60
llvm::AsmToken::RBrac
Definition:
MCAsmMacro.h:49
llvm::AsmToken::PercentCall_Hi
Definition:
MCAsmMacro.h:58
llvm::MCAsmLexer::TokStart
const char * TokStart
Definition:
MCAsmLexer.h:49
llvm::AsmToken::PercentPcrel_Lo
Definition:
MCAsmMacro.h:62
llvm::AsmToken::LCurly
Definition:
MCAsmMacro.h:49
llvm::AsmToken::PercentNeg
Definition:
MCAsmMacro.h:61
llvm::AsmToken::Minus
Definition:
MCAsmMacro.h:46
llvm::AsmToken::PercentGot
Definition:
MCAsmMacro.h:59
llvm::AsmToken::BackSlash
Definition:
MCAsmMacro.h:48
llvm::AsmToken::RParen
Definition:
MCAsmMacro.h:49
llvm::raw_ostream::write_escaped
raw_ostream & write_escaped(StringRef Str, bool UseHexEscapes=false)
Output Str, turning '\', '', ' ', '"', and anything that doesn't satisfy llvm::isPrint into an escape...
Definition:
raw_ostream.cpp:147
llvm::AsmToken::Colon
Definition:
MCAsmMacro.h:44
StringRef.h
llvm::AsmToken::Slash
Definition:
MCAsmMacro.h:47
llvm::AsmToken::At
Definition:
MCAsmMacro.h:55
llvm::AsmToken::Percent
Definition:
MCAsmMacro.h:53
llvm::AsmToken::PercentCall_Lo
Definition:
MCAsmMacro.h:58
llvm::AsmToken::Error
Definition:
MCAsmMacro.h:26
llvm::SMLoc::getFromPointer
static SMLoc getFromPointer(const char *Ptr)
Definition:
SMLoc.h:37
llvm::AsmToken::PercentDtprel_Hi
Definition:
MCAsmMacro.h:58
llvm::AsmToken::LessEqual
Definition:
MCAsmMacro.h:54
llvm::AsmToken::Space
Definition:
MCAsmMacro.h:45
llvm::AsmToken::AmpAmp
Definition:
MCAsmMacro.h:53
llvm::AsmToken::Dot
Definition:
MCAsmMacro.h:50
llvm::AsmToken::EndOfStatement
Definition:
MCAsmMacro.h:43
llvm::AsmToken::LBrac
Definition:
MCAsmMacro.h:49
llvm::AsmToken::Greater
Definition:
MCAsmMacro.h:55
llvm::AsmToken::Comment
Definition:
MCAsmMacro.h:40
llvm::AsmToken::LParen
Definition:
MCAsmMacro.h:49
llvm::AsmToken::Integer
Definition:
MCAsmMacro.h:33
llvm::AsmToken::Identifier
Definition:
MCAsmMacro.h:29
llvm::AsmToken::BigNum
Definition:
MCAsmMacro.h:34
llvm::AsmToken::PercentGot_Disp
Definition:
MCAsmMacro.h:59
llvm::AsmToken::GreaterGreater
Definition:
MCAsmMacro.h:55
llvm::AsmToken::Hash
Definition:
MCAsmMacro.h:53
Kind
const unsigned Kind
Definition:
ARMAsmParser.cpp:10586
llvm::AsmToken::PercentTlsgd
Definition:
MCAsmMacro.h:62
llvm::MCAsmLexer::~MCAsmLexer
virtual ~MCAsmLexer()
llvm::AsmToken::PercentHigher
Definition:
MCAsmMacro.h:61
llvm::AsmToken::EqualEqual
Definition:
MCAsmMacro.h:50
llvm::AsmToken::Exclaim
Definition:
MCAsmMacro.h:53
llvm::AsmToken::Pipe
Definition:
MCAsmMacro.h:52
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition:
raw_ostream.h:46
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:
StringRef.h:49
llvm::AsmToken::Comma
Definition:
MCAsmMacro.h:50
llvm::AsmToken::Plus
Definition:
MCAsmMacro.h:46
raw_ostream.h
llvm::AsmToken::PercentHighest
Definition:
MCAsmMacro.h:61
MCAsmLexer.h
llvm::AsmToken::ExclaimEqual
Definition:
MCAsmMacro.h:53
llvm::SMLoc
Represents a location in source code.
Definition:
SMLoc.h:24
llvm::AsmToken::Less
Definition:
MCAsmMacro.h:54
llvm::AsmToken::LessLess
Definition:
MCAsmMacro.h:54
Generated on Sun Dec 20 2020 13:55:46 for LLVM by
1.8.13