llvm.org GIT mirror llvm / 78bc254
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 Alex Lorenz 5 years ago
5 changed file(s) with 37 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
6969 .Case("_", MIToken::underscore)
7070 .Case("implicit", MIToken::kw_implicit)
7171 .Case("implicit-def", MIToken::kw_implicit_define)
72 .Case("dead", MIToken::kw_dead)
7273 .Default(MIToken::Identifier);
7374 }
7475
3838 // Keywords
3939 kw_implicit,
4040 kw_implicit_define,
41 kw_dead,
4142
4243 // Identifier tokens
4344 Identifier,
7374 }
7475
7576 bool isRegisterFlag() const {
76 return Kind == kw_implicit || Kind == kw_implicit_define;
77 return Kind == kw_implicit || Kind == kw_implicit_define || Kind == kw_dead;
7778 }
7879
7980 bool is(TokenKind K) const { return Kind == K; }
304304 case MIToken::kw_implicit_define:
305305 Flags |= RegState::ImplicitDefine;
306306 break;
307 case MIToken::kw_dead:
308 Flags |= RegState::Dead;
309 break;
307310 // TODO: report an error when we specify the same flag more than once.
308311 // TODO: parse the other register flags.
309312 default:
327330 lex();
328331 // TODO: Parse subregister.
329332 Dest = MachineOperand::CreateReg(Reg, Flags & RegState::Define,
330 Flags & RegState::Implicit);
333 Flags & RegState::Implicit, /*IsKill=*/false,
334 Flags & RegState::Dead);
331335 return false;
332336 }
333337
411415 switch (Token.kind()) {
412416 case MIToken::kw_implicit:
413417 case MIToken::kw_implicit_define:
418 case MIToken::kw_dead:
414419 case MIToken::underscore:
415420 case MIToken::NamedRegister:
416421 return parseRegisterOperand(Dest);
213213 // TODO: Print the other register flags.
214214 if (Op.isImplicit())
215215 OS << (Op.isDef() ? "implicit-def " : "implicit ");
216 if (Op.isDead())
217 OS << "dead ";
216218 printReg(Op.getReg(), OS, TRI);
217219 // TODO: Print sub register.
218220 break;
0 # RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
1 # This test ensures that the MIR parser parses the 'dead' register flags
2 # correctly.
3
4 --- |
5
6 define i32 @foo(i32 %a) #0 {
7 body:
8 %c = mul i32 %a, 11
9 ret i32 %c
10 }
11
12 attributes #0 = { "no-frame-pointer-elim"="false" }
13
14 ...
15 ---
16 name: foo
17 body:
18 # CHECK: name: body
19 - id: 0
20 name: body
21 instructions:
22 # CHECK: - '%eax = IMUL32rri8 %edi, 11, implicit-def dead %eflags'
23 - '%eax = IMUL32rri8 %edi, 11, implicit-def dead %eflags'
24 - 'RETQ %eax'
25 ...