mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
MIR Serialization: Serialize the jump table index operands.
Reviewers: Duncan P. N. Exon Smith git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242358 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -115,6 +115,23 @@ static Cursor maybeLexMachineBasicBlock(
|
||||
return C;
|
||||
}
|
||||
|
||||
static Cursor maybeLexIndex(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();
|
||||
Token = MIToken(Kind, Range.upto(C), APSInt(NumberRange.upto(C)));
|
||||
return C;
|
||||
}
|
||||
|
||||
static Cursor maybeLexJumpTableIndex(Cursor C, MIToken &Token) {
|
||||
return maybeLexIndex(C, Token, "%jump-table.", MIToken::JumpTableIndex);
|
||||
}
|
||||
|
||||
static Cursor lexVirtualRegister(Cursor C, MIToken &Token) {
|
||||
auto Range = C;
|
||||
C.advance(); // Skip '%'
|
||||
@@ -209,6 +226,8 @@ StringRef llvm::lexMIToken(
|
||||
return R.remaining();
|
||||
if (Cursor R = maybeLexMachineBasicBlock(C, Token, ErrorCallback))
|
||||
return R.remaining();
|
||||
if (Cursor R = maybeLexJumpTableIndex(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