From: Alex Lorenz Date: Fri, 14 Aug 2015 19:07:07 +0000 (+0000) Subject: MIR Serialization: Serialize the 'internal' register operand flag. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=6ad9b2163c9d706deb9a7c69b7a02a4ad97d69c7;p=oota-llvm.git MIR Serialization: Serialize the 'internal' register operand flag. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245085 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/MIRParser/MILexer.cpp b/lib/CodeGen/MIRParser/MILexer.cpp index 5ae1b10afd6..e15a4d1e753 100644 --- a/lib/CodeGen/MIRParser/MILexer.cpp +++ b/lib/CodeGen/MIRParser/MILexer.cpp @@ -191,6 +191,7 @@ static MIToken::TokenKind getIdentifierKind(StringRef Identifier) { .Case("dead", MIToken::kw_dead) .Case("killed", MIToken::kw_killed) .Case("undef", MIToken::kw_undef) + .Case("internal", MIToken::kw_internal) .Case("early-clobber", MIToken::kw_early_clobber) .Case("debug-use", MIToken::kw_debug_use) .Case("frame-setup", MIToken::kw_frame_setup) diff --git a/lib/CodeGen/MIRParser/MILexer.h b/lib/CodeGen/MIRParser/MILexer.h index 2f55ae4f0db..e7abbb2dd89 100644 --- a/lib/CodeGen/MIRParser/MILexer.h +++ b/lib/CodeGen/MIRParser/MILexer.h @@ -52,6 +52,7 @@ struct MIToken { kw_dead, kw_killed, kw_undef, + kw_internal, kw_early_clobber, kw_debug_use, kw_frame_setup, @@ -138,7 +139,8 @@ public: bool isRegisterFlag() const { return Kind == kw_implicit || Kind == kw_implicit_define || Kind == kw_dead || Kind == kw_killed || Kind == kw_undef || - Kind == kw_early_clobber || Kind == kw_debug_use; + Kind == kw_internal || Kind == kw_early_clobber || + Kind == kw_debug_use; } bool isMemoryOperandFlag() const { diff --git a/lib/CodeGen/MIRParser/MIParser.cpp b/lib/CodeGen/MIRParser/MIParser.cpp index 36b34395d4d..7984116efcb 100644 --- a/lib/CodeGen/MIRParser/MIParser.cpp +++ b/lib/CodeGen/MIRParser/MIParser.cpp @@ -777,13 +777,15 @@ bool MIParser::parseRegisterFlag(unsigned &Flags) { case MIToken::kw_undef: Flags |= RegState::Undef; break; + case MIToken::kw_internal: + Flags |= RegState::InternalRead; + break; case MIToken::kw_early_clobber: Flags |= RegState::EarlyClobber; break; case MIToken::kw_debug_use: Flags |= RegState::Debug; break; - // TODO: parse the other register flags. default: llvm_unreachable("The current token should be a register flag"); } @@ -828,7 +830,8 @@ bool MIParser::parseRegisterOperand(MachineOperand &Dest, bool IsDef) { Dest = MachineOperand::CreateReg( Reg, Flags & RegState::Define, Flags & RegState::Implicit, Flags & RegState::Kill, Flags & RegState::Dead, Flags & RegState::Undef, - Flags & RegState::EarlyClobber, SubReg, Flags & RegState::Debug); + Flags & RegState::EarlyClobber, SubReg, Flags & RegState::Debug, + Flags & RegState::InternalRead); return false; } @@ -1235,6 +1238,7 @@ bool MIParser::parseMachineOperand(MachineOperand &Dest) { case MIToken::kw_dead: case MIToken::kw_killed: case MIToken::kw_undef: + case MIToken::kw_internal: case MIToken::kw_early_clobber: case MIToken::kw_debug_use: case MIToken::underscore: diff --git a/lib/CodeGen/MIRPrinter.cpp b/lib/CodeGen/MIRPrinter.cpp index 8bb5203c507..957cb20eace 100644 --- a/lib/CodeGen/MIRPrinter.cpp +++ b/lib/CodeGen/MIRPrinter.cpp @@ -617,9 +617,11 @@ void MIPrinter::print(const MachineOperand &Op, const TargetRegisterInfo *TRI) { printTargetFlags(Op); switch (Op.getType()) { case MachineOperand::MO_Register: - // TODO: Print the other register flags. + // FIXME: Serialize the tied register. if (Op.isImplicit()) OS << (Op.isDef() ? "implicit-def " : "implicit "); + if (Op.isInternalRead()) + OS << "internal "; if (Op.isDead()) OS << "dead "; if (Op.isKill()) diff --git a/test/CodeGen/MIR/ARM/bundled-instructions.mir b/test/CodeGen/MIR/ARM/bundled-instructions.mir index a13d18748c1..814c4e188ea 100644 --- a/test/CodeGen/MIR/ARM/bundled-instructions.mir +++ b/test/CodeGen/MIR/ARM/bundled-instructions.mir @@ -1,6 +1,6 @@ # RUN: llc -mtriple thumbv7-apple-ios -start-after block-placement -stop-after block-placement -o /dev/null %s | FileCheck %s # This test ensures that the MIR parser parses the bundled machine instructions -# correctly. +# and 'internal' register flags correctly. --- | @@ -32,7 +32,7 @@ body: | ; CHECK-NEXT: t2CMNri killed %r0, 78, 14, _, implicit-def %cpsr ; CHECK-NEXT: BUNDLE implicit-def dead %itstate, implicit-def %r1, implicit killed %cpsr { ; CHECK-NEXT: t2IT 12, 8, implicit-def %itstate - ; CHECK-NEXT: %r1 = t2MOVi 1, 12, killed %cpsr, _ + ; CHECK-NEXT: %r1 = t2MOVi 1, 12, killed %cpsr, _, implicit internal killed %itstate ; CHECK-NEXT: } ; CHECK-NEXT: %r0 = tMOVr killed %r1, 14, _ ; CHECK-NEXT: tBX_RET 14, _, implicit killed %r0 @@ -40,7 +40,7 @@ body: | t2CMNri killed %r0, 78, 14, _, implicit-def %cpsr BUNDLE implicit-def dead %itstate, implicit-def %r1, implicit killed %cpsr { t2IT 12, 8, implicit-def %itstate - %r1 = t2MOVi 1, 12, killed %cpsr, _ + %r1 = t2MOVi 1, 12, killed %cpsr, _, implicit internal killed %itstate } %r0 = tMOVr killed %r1, 14, _ tBX_RET 14, _, implicit killed %r0 @@ -62,14 +62,14 @@ body: | ; CHECK-NEXT: t2CMNri killed %r0, 78, 14, _, implicit-def %cpsr ; CHECK-NEXT: BUNDLE implicit-def dead %itstate, implicit-def %r1, implicit killed %cpsr { ; CHECK-NEXT: t2IT 12, 8, implicit-def %itstate - ; CHECK-NEXT: %r1 = t2MOVi 1, 12, killed %cpsr, _ + ; CHECK-NEXT: %r1 = t2MOVi 1, 12, killed %cpsr, _, implicit internal killed %itstate ; CHECK-NEXT: } ; CHECK-NEXT: %r0 = tMOVr killed %r1, 14, _ ; CHECK-NEXT: tBX_RET 14, _, implicit killed %r0 %r1 = t2MOVi 0, 14, _, _ t2CMNri killed %r0, 78, 14, _, implicit-def %cpsr BUNDLE implicit-def dead %itstate, implicit-def %r1, implicit killed %cpsr { t2IT 12, 8, implicit-def %itstate - %r1 = t2MOVi 1, 12, killed %cpsr, _ + %r1 = t2MOVi 1, 12, killed %cpsr, _, internal implicit killed %itstate } %r0 = tMOVr killed %r1, 14, _ tBX_RET 14, _, implicit killed %r0 ...