mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-22 23:24:59 +00:00
MIR Serialization: Serialize the frame index machine operands.
Reviewers: Duncan P. N. Exon Smith git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242487 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -128,10 +128,39 @@ static Cursor maybeLexIndex(Cursor C, MIToken &Token, StringRef Rule,
|
||||
return C;
|
||||
}
|
||||
|
||||
static Cursor maybeLexIndexAndName(Cursor C, MIToken &Token, StringRef Rule,
|
||||
MIToken::TokenKind Kind) {
|
||||
if (!C.remaining().startswith(Rule) || !isdigit(C.peek(Rule.size())))
|
||||
return None;
|
||||
auto Range = C;
|
||||
C.advance(Rule.size());
|
||||
auto NumberRange = C;
|
||||
while (isdigit(C.peek()))
|
||||
C.advance();
|
||||
StringRef Number = NumberRange.upto(C);
|
||||
unsigned StringOffset = Rule.size() + Number.size();
|
||||
if (C.peek() == '.') {
|
||||
C.advance();
|
||||
++StringOffset;
|
||||
while (isIdentifierChar(C.peek()))
|
||||
C.advance();
|
||||
}
|
||||
Token = MIToken(Kind, Range.upto(C), APSInt(Number), StringOffset);
|
||||
return C;
|
||||
}
|
||||
|
||||
static Cursor maybeLexJumpTableIndex(Cursor C, MIToken &Token) {
|
||||
return maybeLexIndex(C, Token, "%jump-table.", MIToken::JumpTableIndex);
|
||||
}
|
||||
|
||||
static Cursor maybeLexStackObject(Cursor C, MIToken &Token) {
|
||||
return maybeLexIndexAndName(C, Token, "%stack.", MIToken::StackObject);
|
||||
}
|
||||
|
||||
static Cursor maybeLexFixedStackObject(Cursor C, MIToken &Token) {
|
||||
return maybeLexIndex(C, Token, "%fixed-stack.", MIToken::FixedStackObject);
|
||||
}
|
||||
|
||||
static Cursor lexVirtualRegister(Cursor C, MIToken &Token) {
|
||||
auto Range = C;
|
||||
C.advance(); // Skip '%'
|
||||
@@ -228,6 +257,10 @@ StringRef llvm::lexMIToken(
|
||||
return R.remaining();
|
||||
if (Cursor R = maybeLexJumpTableIndex(C, Token))
|
||||
return R.remaining();
|
||||
if (Cursor R = maybeLexStackObject(C, Token))
|
||||
return R.remaining();
|
||||
if (Cursor R = maybeLexFixedStackObject(C, Token))
|
||||
return R.remaining();
|
||||
if (Cursor R = maybeLexRegister(C, Token))
|
||||
return R.remaining();
|
||||
if (Cursor R = maybeLexGlobalValue(C, Token))
|
||||
|
Reference in New Issue
Block a user