mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 22:24:28 +00:00
MIR Serialization: Serialize the 'dead' register machine operand flag.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241624 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -70,6 +70,7 @@ static MIToken::TokenKind getIdentifierKind(StringRef Identifier) {
|
|||||||
.Case("_", MIToken::underscore)
|
.Case("_", MIToken::underscore)
|
||||||
.Case("implicit", MIToken::kw_implicit)
|
.Case("implicit", MIToken::kw_implicit)
|
||||||
.Case("implicit-def", MIToken::kw_implicit_define)
|
.Case("implicit-def", MIToken::kw_implicit_define)
|
||||||
|
.Case("dead", MIToken::kw_dead)
|
||||||
.Default(MIToken::Identifier);
|
.Default(MIToken::Identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ struct MIToken {
|
|||||||
// Keywords
|
// Keywords
|
||||||
kw_implicit,
|
kw_implicit,
|
||||||
kw_implicit_define,
|
kw_implicit_define,
|
||||||
|
kw_dead,
|
||||||
|
|
||||||
// Identifier tokens
|
// Identifier tokens
|
||||||
Identifier,
|
Identifier,
|
||||||
@ -74,7 +75,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isRegisterFlag() const {
|
bool isRegisterFlag() const {
|
||||||
return Kind == kw_implicit || Kind == kw_implicit_define;
|
return Kind == kw_implicit || Kind == kw_implicit_define || Kind == kw_dead;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is(TokenKind K) const { return Kind == K; }
|
bool is(TokenKind K) const { return Kind == K; }
|
||||||
|
@ -305,6 +305,9 @@ bool MIParser::parseRegisterFlag(unsigned &Flags) {
|
|||||||
case MIToken::kw_implicit_define:
|
case MIToken::kw_implicit_define:
|
||||||
Flags |= RegState::ImplicitDefine;
|
Flags |= RegState::ImplicitDefine;
|
||||||
break;
|
break;
|
||||||
|
case MIToken::kw_dead:
|
||||||
|
Flags |= RegState::Dead;
|
||||||
|
break;
|
||||||
// TODO: report an error when we specify the same flag more than once.
|
// TODO: report an error when we specify the same flag more than once.
|
||||||
// TODO: parse the other register flags.
|
// TODO: parse the other register flags.
|
||||||
default:
|
default:
|
||||||
@ -328,7 +331,8 @@ bool MIParser::parseRegisterOperand(MachineOperand &Dest, bool IsDef) {
|
|||||||
lex();
|
lex();
|
||||||
// TODO: Parse subregister.
|
// TODO: Parse subregister.
|
||||||
Dest = MachineOperand::CreateReg(Reg, Flags & RegState::Define,
|
Dest = MachineOperand::CreateReg(Reg, Flags & RegState::Define,
|
||||||
Flags & RegState::Implicit);
|
Flags & RegState::Implicit, /*IsKill=*/false,
|
||||||
|
Flags & RegState::Dead);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,6 +416,7 @@ bool MIParser::parseMachineOperand(MachineOperand &Dest) {
|
|||||||
switch (Token.kind()) {
|
switch (Token.kind()) {
|
||||||
case MIToken::kw_implicit:
|
case MIToken::kw_implicit:
|
||||||
case MIToken::kw_implicit_define:
|
case MIToken::kw_implicit_define:
|
||||||
|
case MIToken::kw_dead:
|
||||||
case MIToken::underscore:
|
case MIToken::underscore:
|
||||||
case MIToken::NamedRegister:
|
case MIToken::NamedRegister:
|
||||||
return parseRegisterOperand(Dest);
|
return parseRegisterOperand(Dest);
|
||||||
|
@ -214,6 +214,8 @@ void MIPrinter::print(const MachineOperand &Op, const TargetRegisterInfo *TRI) {
|
|||||||
// TODO: Print the other register flags.
|
// TODO: Print the other register flags.
|
||||||
if (Op.isImplicit())
|
if (Op.isImplicit())
|
||||||
OS << (Op.isDef() ? "implicit-def " : "implicit ");
|
OS << (Op.isDef() ? "implicit-def " : "implicit ");
|
||||||
|
if (Op.isDead())
|
||||||
|
OS << "dead ";
|
||||||
printReg(Op.getReg(), OS, TRI);
|
printReg(Op.getReg(), OS, TRI);
|
||||||
// TODO: Print sub register.
|
// TODO: Print sub register.
|
||||||
break;
|
break;
|
||||||
|
26
test/CodeGen/MIR/X86/dead-register-flag.mir
Normal file
26
test/CodeGen/MIR/X86/dead-register-flag.mir
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
|
||||||
|
# This test ensures that the MIR parser parses the 'dead' register flags
|
||||||
|
# correctly.
|
||||||
|
|
||||||
|
--- |
|
||||||
|
|
||||||
|
define i32 @foo(i32 %a) #0 {
|
||||||
|
body:
|
||||||
|
%c = mul i32 %a, 11
|
||||||
|
ret i32 %c
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes #0 = { "no-frame-pointer-elim"="false" }
|
||||||
|
|
||||||
|
...
|
||||||
|
---
|
||||||
|
name: foo
|
||||||
|
body:
|
||||||
|
# CHECK: name: body
|
||||||
|
- id: 0
|
||||||
|
name: body
|
||||||
|
instructions:
|
||||||
|
# CHECK: - '%eax = IMUL32rri8 %edi, 11, implicit-def dead %eflags'
|
||||||
|
- '%eax = IMUL32rri8 %edi, 11, implicit-def dead %eflags'
|
||||||
|
- 'RETQ %eax'
|
||||||
|
...
|
Reference in New Issue
Block a user