LLVM 18.0.0git
MCTargetAsmParser.cpp
Go to the documentation of this file.
1//===-- MCTargetAsmParser.cpp - Target Assembly Parser --------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "llvm/MC/MCContext.h"
11
12using namespace llvm;
13
15 const MCSubtargetInfo &STI,
16 const MCInstrInfo &MII)
17 : MCOptions(MCOptions), STI(&STI), MII(MII) {}
18
20
23 STI = &STICopy;
24 return STICopy;
25}
26
28 return *STI;
29}
30
32 SMLoc StartTokLoc = getTok().getLoc();
33 // Delegate to ParseDirective by default for transition period. Once the
34 // transition is over, this method should just return NoMatch.
35 bool Res = ParseDirective(DirectiveID);
36
37 // Some targets erroneously report success after emitting an error.
38 if (getParser().hasPendingError())
40
41 // ParseDirective returns true if there was an error or if the directive is
42 // not target-specific. Disambiguate the two cases by comparing position of
43 // the lexer before and after calling the method: if no tokens were consumed,
44 // there was no match, otherwise there was a failure.
45 if (!Res)
47 if (getTok().getLoc() != StartTokLoc)
50}
Target independent representation for an assembler token.
Definition: MCAsmMacro.h:21
SMLoc getLoc() const
Definition: MCAsmLexer.cpp:26
MCSubtargetInfo & getSubtargetCopy(const MCSubtargetInfo &STI)
Definition: MCContext.cpp:879
Interface to description of machine instruction set.
Definition: MCInstrInfo.h:26
Generic base class for all target subtargets.
virtual ParseStatus parseDirective(AsmToken DirectiveID)
Parses a target-specific assembler directive.
MCSubtargetInfo & copySTI()
Create a copy of STI and return a non-const reference to it.
virtual bool ParseDirective(AsmToken DirectiveID)
ParseDirective - Parse a target specific assembler directive This method is deprecated,...
MCTargetAsmParser(MCTargetOptions const &, const MCSubtargetInfo &STI, const MCInstrInfo &MII)
const MCSubtargetInfo & getSTI() const
~MCTargetAsmParser() override
const MCSubtargetInfo * STI
Current STI.
Ternary parse status returned by various parse* methods.
static constexpr StatusTy Failure
static constexpr StatusTy Success
static constexpr StatusTy NoMatch
Represents a location in source code.
Definition: SMLoc.h:23
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18