mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
MC/AsmParser: Change ParseExpression to use ParseIdentifier(), to support
dollars in identifiers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111946 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -449,10 +449,17 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
|||||||
return true;
|
return true;
|
||||||
Res = MCUnaryExpr::CreateLNot(Res, getContext());
|
Res = MCUnaryExpr::CreateLNot(Res, getContext());
|
||||||
return false;
|
return false;
|
||||||
|
case AsmToken::Dollar:
|
||||||
case AsmToken::String:
|
case AsmToken::String:
|
||||||
case AsmToken::Identifier: {
|
case AsmToken::Identifier: {
|
||||||
|
EndLoc = Lexer.getLoc();
|
||||||
|
|
||||||
|
StringRef Identifier;
|
||||||
|
if (ParseIdentifier(Identifier))
|
||||||
|
return false;
|
||||||
|
|
||||||
// This is a symbol reference.
|
// This is a symbol reference.
|
||||||
std::pair<StringRef, StringRef> Split = getTok().getIdentifier().split('@');
|
std::pair<StringRef, StringRef> Split = Identifier.split('@');
|
||||||
MCSymbol *Sym = getContext().GetOrCreateSymbol(Split.first);
|
MCSymbol *Sym = getContext().GetOrCreateSymbol(Split.first);
|
||||||
|
|
||||||
// Mark the symbol as used in an expression.
|
// Mark the symbol as used in an expression.
|
||||||
@@ -460,12 +467,9 @@ bool AsmParser::ParsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
|||||||
|
|
||||||
// Lookup the symbol variant if used.
|
// Lookup the symbol variant if used.
|
||||||
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
|
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
|
||||||
if (Split.first.size() != getTok().getIdentifier().size())
|
if (Split.first.size() != Identifier.size())
|
||||||
Variant = MCSymbolRefExpr::getVariantKindForName(Split.second);
|
Variant = MCSymbolRefExpr::getVariantKindForName(Split.second);
|
||||||
|
|
||||||
EndLoc = Lexer.getLoc();
|
|
||||||
Lex(); // Eat identifier.
|
|
||||||
|
|
||||||
// If this is an absolute variable reference, substitute it now to preserve
|
// If this is an absolute variable reference, substitute it now to preserve
|
||||||
// semantics in the face of reassignment.
|
// semantics in the face of reassignment.
|
||||||
if (Sym->isVariable() && isa<MCConstantExpr>(Sym->getVariableValue())) {
|
if (Sym->isVariable() && isa<MCConstantExpr>(Sym->getVariableValue())) {
|
||||||
|
@@ -3,3 +3,5 @@
|
|||||||
|
|
||||||
// CHECK: .globl $foo
|
// CHECK: .globl $foo
|
||||||
.globl $foo
|
.globl $foo
|
||||||
|
// CHECK: .long ($foo)
|
||||||
|
.long ($foo)
|
||||||
|
Reference in New Issue
Block a user