MIR Serialization: Serialize the 'debug-use' register operand flag.
authorAlex Lorenz <arphaman@gmail.com>
Wed, 5 Aug 2015 17:41:17 +0000 (17:41 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 5 Aug 2015 17:41:17 +0000 (17:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244071 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MIRParser/MILexer.cpp
lib/CodeGen/MIRParser/MILexer.h
lib/CodeGen/MIRParser/MIParser.cpp
lib/CodeGen/MIRPrinter.cpp
test/CodeGen/MIR/X86/instructions-debug-location.mir

index 624ef664620dddda164717f61aaae85b35e50a80..5134da9d455feab844faef9b6fecdbf7e3af974c 100644 (file)
@@ -146,6 +146,7 @@ static MIToken::TokenKind getIdentifierKind(StringRef Identifier) {
       .Case("dead", MIToken::kw_dead)
       .Case("killed", MIToken::kw_killed)
       .Case("undef", MIToken::kw_undef)
+      .Case("debug-use", MIToken::kw_debug_use)
       .Case("frame-setup", MIToken::kw_frame_setup)
       .Case("debug-location", MIToken::kw_debug_location)
       .Case(".cfi_offset", MIToken::kw_cfi_offset)
index f72897a5217bcb16f7f9c0c4f876f7fbe06b5b97..9a403496351d49f4953da85ea612294b5ef867e2 100644 (file)
@@ -47,6 +47,7 @@ struct MIToken {
     kw_dead,
     kw_killed,
     kw_undef,
+    kw_debug_use,
     kw_frame_setup,
     kw_debug_location,
     kw_cfi_offset,
@@ -118,7 +119,8 @@ public:
 
   bool isRegisterFlag() const {
     return Kind == kw_implicit || Kind == kw_implicit_define ||
-           Kind == kw_dead || Kind == kw_killed || Kind == kw_undef;
+           Kind == kw_dead || Kind == kw_killed || Kind == kw_undef ||
+           Kind == kw_debug_use;
   }
 
   bool isMemoryOperandFlag() const { return Kind == kw_volatile; }
index 149e4dd1b61d336435104592cc2dad51b81d3ec3..7b9e45ea7f57a69ccab89b9a109444cfec38dd59 100644 (file)
@@ -490,6 +490,9 @@ bool MIParser::parseRegisterFlag(unsigned &Flags) {
   case MIToken::kw_undef:
     Flags |= RegState::Undef;
     break;
+  case MIToken::kw_debug_use:
+    Flags |= RegState::Debug;
+    break;
   // TODO: report an error when we specify the same flag more than once.
   // TODO: parse the other register flags.
   default:
@@ -532,7 +535,7 @@ 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,
-      /*isEarlyClobber=*/false, SubReg);
+      /*isEarlyClobber=*/false, SubReg, Flags & RegState::Debug);
   return false;
 }
 
@@ -882,6 +885,7 @@ bool MIParser::parseMachineOperand(MachineOperand &Dest) {
   case MIToken::kw_dead:
   case MIToken::kw_killed:
   case MIToken::kw_undef:
+  case MIToken::kw_debug_use:
   case MIToken::underscore:
   case MIToken::NamedRegister:
   case MIToken::VirtualRegister:
index fb5a36ce9a799486c5ff7e0babf7807fd35b5698..2eb5cbfc6ce9e9666517de50252bc61a4b8e3b3e 100644 (file)
@@ -529,6 +529,8 @@ void MIPrinter::print(const MachineOperand &Op, const TargetRegisterInfo *TRI) {
       OS << "killed ";
     if (Op.isUndef())
       OS << "undef ";
+    if (Op.isDebug())
+      OS << "debug-use ";
     printReg(Op.getReg(), OS, TRI);
     // Print the sub register.
     if (Op.getSubReg() != 0)
index 247009a7b5449e15f62a394ffb0a5c76df8b8302..ca5f77d2a323ae437a8da5ba4a8dad172c6a724d 100644 (file)
@@ -55,11 +55,11 @@ body:
     name:         entry
     liveins:      [ '%edi' ]
     instructions:
-      # CHECK: DBG_VALUE _, 0, !12, !13, debug-location !14
+      # CHECK: DBG_VALUE debug-use _, 0, !12, !13, debug-location !14
       # CHECK: %eax = COPY %0, debug-location !15
       # CHECK: RETQ %eax, debug-location !15
       - '%0 = COPY %edi'
-      - 'DBG_VALUE _, 0, !12, !13, debug-location !14'
+      - 'DBG_VALUE debug-use _, 0, !12, !13, debug-location !14'
       - 'MOV32mr %stack.0.x.addr, 1, _, 0, _, %0'
       - '%eax = COPY %0, debug-location !15'
       - 'RETQ %eax, debug-location !15'