mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-04 18:24:38 +00:00
Added llvm-mc support for parsing the .desc directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75645 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -526,6 +526,8 @@ bool AsmParser::ParseStatement() {
|
||||
return ParseDirectiveComm(/*IsLocal=*/true);
|
||||
if (!strcmp(IDVal, ".zerofill"))
|
||||
return ParseDirectiveDarwinZerofill();
|
||||
if (!strcmp(IDVal, ".desc"))
|
||||
return ParseDirectiveDarwinSymbolDesc();
|
||||
|
||||
if (!strcmp(IDVal, ".subsections_via_symbols"))
|
||||
return ParseDirectiveDarwinSubsectionsViaSymbols();
|
||||
@ -909,6 +911,37 @@ bool AsmParser::ParseDirectiveSymbolAttribute(MCStreamer::SymbolAttr Attr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseDirectiveDarwinSymbolDesc
|
||||
/// ::= .desc identifier , expression
|
||||
bool AsmParser::ParseDirectiveDarwinSymbolDesc() {
|
||||
if (Lexer.isNot(asmtok::Identifier))
|
||||
return TokError("expected identifier in directive");
|
||||
|
||||
// handle the identifier as the key symbol.
|
||||
SMLoc IDLoc = Lexer.getLoc();
|
||||
MCSymbol *Sym = Ctx.GetOrCreateSymbol(Lexer.getCurStrVal());
|
||||
Lexer.Lex();
|
||||
|
||||
if (Lexer.isNot(asmtok::Comma))
|
||||
return TokError("unexpected token in '.desc' directive");
|
||||
Lexer.Lex();
|
||||
|
||||
SMLoc DescLoc = Lexer.getLoc();
|
||||
int64_t DescValue;
|
||||
if (ParseAbsoluteExpression(DescValue))
|
||||
return true;
|
||||
|
||||
if (Lexer.isNot(asmtok::EndOfStatement))
|
||||
return TokError("unexpected token in '.desc' directive");
|
||||
|
||||
Lexer.Lex();
|
||||
|
||||
// Set the n_desc field of this Symbol to this DescValue
|
||||
Out.EmitSymbolDesc(Sym, DescValue);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// ParseDirectiveComm
|
||||
/// ::= ( .comm | .lcomm ) identifier , size_expression [ , align_expression ]
|
||||
bool AsmParser::ParseDirectiveComm(bool IsLocal) {
|
||||
|
Reference in New Issue
Block a user