llvm.org GIT mirror llvm / 6d5452d
Don't duplicate names in comments. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221665 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
1 changed file(s) with 31 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
4444 }
4545 };
4646
47 /// MCAsmParserSemaCallback - Generic Sema callback for assembly parser.
47 /// Generic Sema callback for assembly parser.
4848 class MCAsmParserSemaCallback {
4949 public:
5050 virtual ~MCAsmParserSemaCallback();
5858 unsigned &Offset) = 0;
5959 };
6060
61 /// MCAsmParser - Generic assembler parser interface, for use by target specific
62 /// assembly parsers.
61 /// Generic assembler parser interface, for use by target specific assembly
62 /// parsers.
6363 class MCAsmParser {
6464 public:
6565 typedef bool (*DirectiveHandler)(MCAsmParserExtension*, StringRef, SMLoc);
8989
9090 virtual MCContext &getContext() = 0;
9191
92 /// getStreamer - Return the output streamer for the assembler.
92 /// Return the output streamer for the assembler.
9393 virtual MCStreamer &getStreamer() = 0;
9494
9595 MCTargetAsmParser &getTargetParser() const { return *TargetParser; }
101101 bool getShowParsedOperands() const { return ShowParsedOperands; }
102102 void setShowParsedOperands(bool Value) { ShowParsedOperands = Value; }
103103
104 /// Run - Run the parser on the input source buffer.
104 /// Run the parser on the input source buffer.
105105 virtual bool Run(bool NoInitialTextSection, bool NoFinalize = false) = 0;
106106
107107 virtual void setParsingInlineAsm(bool V) = 0;
108108 virtual bool isParsingInlineAsm() = 0;
109109
110 /// parseMSInlineAsm - Parse ms-style inline assembly.
111 virtual bool parseMSInlineAsm(void *AsmLoc, std::string &AsmString,
112 unsigned &NumOutputs, unsigned &NumInputs,
113 SmallVectorImpl > &OpDecls,
114 SmallVectorImpl &Constraints,
115 SmallVectorImpl &Clobbers,
116 const MCInstrInfo *MII,
117 const MCInstPrinter *IP,
118 MCAsmParserSemaCallback &SI) = 0;
119
120 /// Note - Emit a note at the location \p L, with the message \p Msg.
110 /// Parse ms-style inline assembly.
111 virtual bool parseMSInlineAsm(
112 void *AsmLoc, std::string &AsmString, unsigned &NumOutputs,
113 unsigned &NumInputs, SmallVectorImpl> &OpDecls,
114 SmallVectorImpl &Constraints,
115 SmallVectorImpl &Clobbers, const MCInstrInfo *MII,
116 const MCInstPrinter *IP, MCAsmParserSemaCallback &SI) = 0;
117
118 /// Emit a note at the location \p L, with the message \p Msg.
121119 virtual void Note(SMLoc L, const Twine &Msg,
122120 ArrayRef Ranges = None) = 0;
123121
124 /// Warning - Emit a warning at the location \p L, with the message \p Msg.
122 /// Emit a warning at the location \p L, with the message \p Msg.
125123 ///
126124 /// \return The return value is true, if warnings are fatal.
127125 virtual bool Warning(SMLoc L, const Twine &Msg,
128126 ArrayRef Ranges = None) = 0;
129127
130 /// Error - Emit an error at the location \p L, with the message \p Msg.
128 /// Emit an error at the location \p L, with the message \p Msg.
131129 ///
132130 /// \return The return value is always true, as an idiomatic convenience to
133131 /// clients.
134132 virtual bool Error(SMLoc L, const Twine &Msg,
135133 ArrayRef Ranges = None) = 0;
136134
137 /// Lex - Get the next AsmToken in the stream, possibly handling file
138 /// inclusion first.
135 /// Get the next AsmToken in the stream, possibly handling file inclusion
136 /// first.
139137 virtual const AsmToken &Lex() = 0;
140138
141 /// getTok - Get the current AsmToken from the stream.
139 /// Get the current AsmToken from the stream.
142140 const AsmToken &getTok();
143141
144142 /// \brief Report an error at the current lexer location.
145143 bool TokError(const Twine &Msg, ArrayRef Ranges = None);
146144
147 /// parseIdentifier - Parse an identifier or string (as a quoted identifier)
148 /// and set \p Res to the identifier contents.
145 /// Parse an identifier or string (as a quoted identifier) and set \p Res to
146 /// the identifier contents.
149147 virtual bool parseIdentifier(StringRef &Res) = 0;
150148
151149 /// \brief Parse up to the end of statement and return the contents from the
153151 /// will be either the EndOfStatement or EOF.
154152 virtual StringRef parseStringToEndOfStatement() = 0;
155153
156 /// parseEscapedString - Parse the current token as a string which may include
157 /// escaped characters and return the string contents.
154 /// Parse the current token as a string which may include escaped characters
155 /// and return the string contents.
158156 virtual bool parseEscapedString(std::string &Data) = 0;
159157
160 /// eatToEndOfStatement - Skip to the end of the current statement, for error
161 /// recovery.
158 /// Skip to the end of the current statement, for error recovery.
162159 virtual void eatToEndOfStatement() = 0;
163160
164 /// parseExpression - Parse an arbitrary expression.
161 /// Parse an arbitrary expression.
165162 ///
166163 /// @param Res - The value of the expression. The result is undefined
167164 /// on error.
169166 virtual bool parseExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
170167 bool parseExpression(const MCExpr *&Res);
171168
172 /// parsePrimaryExpr - Parse a primary expression.
169 /// Parse a primary expression.
173170 ///
174171 /// @param Res - The value of the expression. The result is undefined
175172 /// on error.
176173 /// @result - False on success.
177174 virtual bool parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) = 0;
178175
179 /// parseParenExpression - Parse an arbitrary expression, assuming that an
180 /// initial '(' has already been consumed.
176 /// Parse an arbitrary expression, assuming that an initial '(' has already
177 /// been consumed.
181178 ///
182179 /// @param Res - The value of the expression. The result is undefined
183180 /// on error.
184181 /// @result - False on success.
185182 virtual bool parseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) = 0;
186183
187 /// parseAbsoluteExpression - Parse an expression which must evaluate to an
188 /// absolute value.
184 /// Parse an expression which must evaluate to an absolute value.
189185 ///
190186 /// @param Res - The value of the absolute expression. The result is undefined
191187 /// on error.
192188 /// @result - False on success.
193189 virtual bool parseAbsoluteExpression(int64_t &Res) = 0;
194190
195 /// checkForValidSection - Ensure that we have a valid section set in the
196 /// streamer. Otherwise, report an error and switch to .text.
191 /// Ensure that we have a valid section set in the streamer. Otherwise, report
192 /// an error and switch to .text.
197193 virtual void checkForValidSection() = 0;
198194 };
199195