LLVM  8.0.0svn
Namespaces | Enumerations | Functions | Variables
AsmParser.cpp File Reference
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeView.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCParser/AsmCond.h"
#include "llvm/MC/MCParser/AsmLexer.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
#include "llvm/MC/MCParser/MCAsmParserExtension.h"
#include "llvm/MC/MCParser/MCAsmParserUtils.h"
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <deque>
#include <memory>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

Go to the source code of this file.

Namespaces

 llvm
 This class represents lattice values for constants.
 
 llvm::MCParserUtils
 

Enumerations

enum  { DEFAULT_ADDRSPACE = 0 }
 

Functions

MCAsmParserExtensionllvm::createDarwinAsmParser ()
 
MCAsmParserExtensionllvm::createELFAsmParser ()
 
MCAsmParserExtensionllvm::createCOFFAsmParser ()
 
MCAsmParserExtensionllvm::createWasmAsmParser ()
 
static bool isAltmacroString (SMLoc &StrLoc, SMLoc &EndLoc)
 This function checks if the next token is <string> type or arithmetic. More...
 
static std::string altMacroString (StringRef AltMacroStr)
 creating a string without the escape characters '!'. More...
 
static unsigned getDarwinBinOpPrecedence (AsmToken::TokenKind K, MCBinaryExpr::Opcode &Kind, bool ShouldUseLogicalShr)
 
static unsigned getGNUBinOpPrecedence (AsmToken::TokenKind K, MCBinaryExpr::Opcode &Kind, bool ShouldUseLogicalShr)
 
static bool isIdentifierChar (char c)
 
static bool isOperator (AsmToken::TokenKind kind)
 
static bool parseHexOcta (AsmParser &Asm, uint64_t &hi, uint64_t &lo)
 
static bool isValidEncoding (int64_t Encoding)
 
static int rewritesSort (const AsmRewrite *AsmRewriteA, const AsmRewrite *AsmRewriteB)
 
static bool llvm::MCParserUtils::isSymbolUsedInExpression (const MCSymbol *Sym, const MCExpr *Value)
 Returns whether the given symbol is used anywhere in the given expression, or subexpressions. More...
 
bool llvm::MCParserUtils::parseAssignmentExpression (StringRef Name, bool allow_redef, MCAsmParser &Parser, MCSymbol *&Symbol, const MCExpr *&Value)
 Parse a value expression and return whether it can be assigned to a symbol with the given name. More...
 

Variables

static cl::opt< unsignedAsmMacroMaxNestingDepth ("asm-macro-max-nesting-depth", cl::init(20), cl::Hidden, cl::desc("The maximum nesting depth allowed for assembly macros."))
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
DEFAULT_ADDRSPACE 

Definition at line 682 of file AsmParser.cpp.

Function Documentation

◆ altMacroString()

static std::string altMacroString ( StringRef  AltMacroStr)
static

◆ getDarwinBinOpPrecedence()

static unsigned getDarwinBinOpPrecedence ( AsmToken::TokenKind  K,
MCBinaryExpr::Opcode Kind,
bool  ShouldUseLogicalShr 
)
static

◆ getGNUBinOpPrecedence()

static unsigned getGNUBinOpPrecedence ( AsmToken::TokenKind  K,
MCBinaryExpr::Opcode Kind,
bool  ShouldUseLogicalShr 
)
static

Definition at line 1526 of file AsmParser.cpp.

References llvm::MCBinaryExpr::Add, llvm::MCStreamer::AddBlankLine(), llvm::AsmToken::Amp, llvm::AsmToken::AmpAmp, llvm::MCBinaryExpr::And, llvm::AOK_EVEN, llvm::AOK_Label, llvm::AOK_Skip, llvm::MCBinaryExpr::AShr, assert(), llvm::AsmToken::Caret, llvm::AsmToken::Colon, Context, llvm::MCBinaryExpr::create(), llvm::MCContext::createDirectionalLocalSymbol(), llvm::MCBinaryExpr::Div, llvm::SourceMgr::DK_Note, llvm::AsmToken::Dot, llvm::NVPTXISD::Dummy, DWARF2_FLAG_IS_STMT, DWARF2_LINE_DEFAULT_IS_STMT, llvm::MCStreamer::EmitLabel(), llvm::SmallVectorImpl< T >::emplace_back(), llvm::StringRef::empty(), llvm::AsmToken::EndOfStatement, llvm::MCBinaryExpr::EQ, llvm::AsmToken::Equal, llvm::AsmToken::EqualEqual, llvm::Error, llvm::errs(), llvm::AsmToken::ExclaimEqual, llvm::SourceMgr::FindBufferContainingLoc(), llvm::SourceMgr::FindLineNumber(), llvm::SMDiagnostic::getColumnNo(), getDarwinBinOpPrecedence(), llvm::MCAsmLexer::getKind(), llvm::SMDiagnostic::getKind(), llvm::SMDiagnostic::getLineContents(), llvm::AsmToken::getLoc(), llvm::MCAsmLexer::getLoc(), llvm::SMDiagnostic::getLoc(), llvm::SourceMgr::getMainFileID(), llvm::SMDiagnostic::getMessage(), llvm::SourceMgr::getParentIncludeLoc(), llvm::SMLoc::getPointer(), llvm::SMDiagnostic::getRanges(), llvm::SMDiagnostic::getSourceMgr(), llvm::AsmToken::Greater, llvm::AsmToken::GreaterEqual, llvm::AsmToken::GreaterGreater, llvm::MCBinaryExpr::GT, llvm::MCBinaryExpr::GTE, llvm::AsmToken::Hash, llvm::AsmToken::HashDirective, llvm::APFloatBase::IEEEdouble(), llvm::APFloatBase::IEEEsingle(), llvm::AsmCond::Ignore, llvm::AsmToken::Integer, llvm::MCAsmLexer::is(), llvm::MCAsmLexer::isNot(), Kind, llvm::MCBinaryExpr::LAnd, llvm::AsmToken::LCurly, llvm::AsmToken::Less, llvm::AsmToken::LessEqual, llvm::AsmToken::LessGreater, llvm::AsmToken::LessLess, llvm::MCAsmLexer::Lex(), llvm::StringMap< ValueTy, AllocatorTy >::lookup(), llvm::MCAsmParserSemaCallback::LookupInlineAsmLabel(), llvm::MCBinaryExpr::LOr, llvm::StringRef::lower(), llvm::MCBinaryExpr::LShr, llvm::MCBinaryExpr::LT, llvm::MCBinaryExpr::LTE, llvm::MCGenDwarfLabelEntry::Make(), llvm::MCSA_Global, llvm::MCSA_LazyReference, llvm::MCSA_NoDeadStrip, llvm::MCSA_PrivateExtern, llvm::MCSA_Reference, llvm::MCSA_SymbolResolver, llvm::MCSA_WeakDefAutoPrivate, llvm::MCSA_WeakDefinition, llvm::MCSA_WeakReference, llvm::AsmToken::Minus, llvm::MCBinaryExpr::Mod, llvm::MCBinaryExpr::Mul, llvm::MCBinaryExpr::NE, llvm::MCBinaryExpr::Or, llvm::AsmToken::Percent, llvm::AsmToken::Pipe, llvm::AsmToken::PipePipe, llvm::AsmToken::Plus, llvm::SMDiagnostic::print(), llvm::SourceMgr::PrintIncludeStack(), llvm::AsmToken::RCurly, llvm::MCBinaryExpr::Shl, llvm::MCAsmInfo::shouldUseLogicalShr(), SI, llvm::StringRef::size(), llvm::AsmToken::Slash, llvm::AsmToken::Space, llvm::AsmToken::Star, llvm::StringRef::startswith(), llvm::raw_svector_ostream::str(), llvm::AsmToken::String, llvm::MCBinaryExpr::Sub, llvm::StringRef::substr(), llvm::MCAsmLexer::UnLex(), and llvm::MCBinaryExpr::Xor.

◆ isAltmacroString()

static bool isAltmacroString ( SMLoc StrLoc,
SMLoc EndLoc 
)
static

This function checks if the next token is <string> type or arithmetic.

string that begin with character '<' must end with character '>'. otherwise it is arithmetics. If the function returns a 'true' value, the End argument will be filled with the last location pointed to the '>' character. There is a gap between the AltMacro's documentation and the single quote implementation. GCC does not fully support this feature and so we will not support it. TODO: Adding single quote as a string.

Definition at line 1331 of file AsmParser.cpp.

References assert(), llvm::SMLoc::getFromPointer(), and llvm::SMLoc::getPointer().

Referenced by isOperator().

◆ isIdentifierChar()

static bool isIdentifierChar ( char  c)
static

◆ isOperator()

static bool isOperator ( AsmToken::TokenKind  kind)
static

Definition at line 2482 of file AsmParser.cpp.

References llvm::SourceMgr::AddNewSourceBuffer(), llvm::AsmToken::Amp, llvm::AsmToken::AmpAmp, AsmMacroMaxNestingDepth, assert(), llvm::AsmToken::At, llvm::MCAsmMacro::Body, llvm::AsmToken::Caret, llvm::AsmToken::Comma, llvm::MCExpr::Constant, llvm::Data, llvm::AsmToken::Dollar, llvm::AsmToken::Dot, llvm::MCStreamer::EmitAssignment(), llvm::MCStreamer::EmitSymbolAttribute(), llvm::StringRef::empty(), llvm::empty(), llvm::AsmToken::EndOfStatement, llvm::AsmToken::Eof, llvm::AsmToken::Equal, llvm::AsmToken::EqualEqual, llvm::Error, llvm::MCExpr::evaluateAsRelocatable(), llvm::AsmToken::Exclaim, llvm::AsmToken::ExclaimEqual, llvm::MemoryBuffer::getBuffer(), llvm::AsmToken::getIdentifier(), llvm::MCExpr::getKind(), llvm::MCAsmLexer::getKind(), llvm::AsmToken::getLoc(), llvm::MCAsmLexer::getLoc(), llvm::MemoryBuffer::getMemBufferCopy(), llvm::SourceMgr::getMemoryBuffer(), llvm::SMLoc::getPointer(), llvm::MCTargetAsmParser::getSTI(), llvm::MCAsmLexer::getTok(), llvm::AsmToken::Greater, llvm::AsmToken::GreaterEqual, llvm::AsmToken::GreaterGreater, llvm::AsmToken::Identifier, llvm::AsmToken::Integer, llvm::AsmToken::is(), llvm::MCAsmLexer::is(), isAltmacroString(), llvm::isIntN(), llvm::MCAsmLexer::isNot(), llvm::isUIntN(), llvm::AsmToken::Less, llvm::AsmToken::LessEqual, llvm::AsmToken::LessGreater, llvm::AsmToken::LessLess, llvm::MCAsmLexer::Lex(), llvm::AsmToken::LParen, llvm::MCSA_NoDeadStrip, MI, llvm::AsmToken::Minus, llvm::MCAsmMacroParameter::Name, llvm::MCAsmMacro::Name, Name, llvm::MCAsmMacro::Parameters, llvm::MCParserUtils::parseAssignmentExpression(), llvm::MCAsmLexer::peekTok(), llvm::AsmLexer::peekTokens(), llvm::AsmToken::Percent, llvm::AsmToken::Pipe, llvm::AsmToken::PipePipe, llvm::AsmToken::Plus, llvm::SmallVectorImpl< T >::resize(), llvm::AsmToken::RParen, llvm::AsmLexer::setBuffer(), llvm::MCAsmLexer::setSkipSpace(), Size, llvm::SmallVectorBase::size(), llvm::StringRef::size(), llvm::AsmToken::Slash, llvm::AsmToken::Space, llvm::AsmToken::Star, llvm::raw_svector_ostream::str(), llvm::AsmToken::String, llvm::MCExpr::SymbolRef, llvm::AsmToken::Tilde, and llvm::MCAsmMacroParameter::Value.

◆ isValidEncoding()

static bool isValidEncoding ( int64_t  Encoding)
static

◆ parseHexOcta()

static bool parseHexOcta ( AsmParser &  Asm,
uint64_t &  hi,
uint64_t &  lo 
)
static

Definition at line 3009 of file AsmParser.cpp.

References llvm::MCContext::allocate(), assert(), llvm::AsmToken::BigNum, llvm::APFloat::bitcastToAPInt(), llvm::MD5::MD5Result::Bytes, llvm::APFloat::changeSign(), llvm::lltok::ChecksumKind, llvm::AsmToken::Comma, llvm::StringRef::compare_lower(), llvm::APFloat::convertFromString(), llvm::Data, Debug, DWARF2_FLAG_BASIC_BLOCK, DWARF2_FLAG_EPILOGUE_BEGIN, DWARF2_FLAG_IS_STMT, DWARF2_FLAG_PROLOGUE_END, DWARF2_LINE_DEFAULT_IS_STMT, llvm::StringRef::empty(), llvm::AsmToken::EndOfStatement, llvm::AsmToken::Error, llvm::Error, llvm::fromHex(), llvm::Expected< T >::get(), llvm::APInt::getBitWidth(), llvm::MCContext::getDwarfVersion(), llvm::MCAsmLexer::getErr(), llvm::MCContext::getGenDwarfForAssembly(), llvm::APInt::getHiBits(), llvm::APFloat::getInf(), llvm::APInt::getLimitedValue(), llvm::APInt::getLoBits(), llvm::MCAsmLexer::getLoc(), llvm::AsmLexer::getMAI(), llvm::MCContext::getMCDwarfLineTable(), llvm::APFloat::getNaN(), llvm::MCAsmInfo::getTextAlignFillValue(), llvm::APInt::getZExtValue(), llvm::AsmToken::Identifier, llvm::AsmToken::Integer, llvm::MCAsmLexer::is(), llvm::MCContext::isDwarfMD5UsageConsistent(), llvm::APInt::isIntN(), llvm::MCAsmInfo::isLittleEndian(), llvm::MCAsmLexer::isNot(), llvm::isPowerOf2_64(), llvm::isUInt< 32 >(), llvm::SMLoc::isValid(), llvm::MCAsmLexer::Lex(), llvm::AsmToken::Minus, Name, llvm::APFloatBase::opInvalidOp, llvm::AsmToken::Plus, llvm::AsmToken::Real, Register, llvm::MCDwarfLineTable::resetRootFile(), llvm::APFloatBase::rmNearestTiesToEven, llvm::ARMBuildAttrs::Section, llvm::MCContext::setGenDwarfForAssembly(), llvm::Sched::Source, llvm::AsmToken::String, llvm::Expected< T >::takeError(), llvm::toString(), llvm::MCSection::UseCodeAlign(), and llvm::Warning.

◆ rewritesSort()

static int rewritesSort ( const AsmRewrite AsmRewriteA,
const AsmRewrite AsmRewriteB 
)
static

Variable Documentation

◆ AsmMacroMaxNestingDepth

cl::opt<unsigned> AsmMacroMaxNestingDepth("asm-macro-max-nesting-depth", cl::init(20), cl::Hidden, cl::desc("The maximum nesting depth allowed for assembly macros."))
static

Referenced by isOperator().