[llvm] r244071 - MIR Serialization: Serialize the 'debug-use' register operand flag.

Alex Lorenz arphaman at gmail.com
Wed Aug 5 10:41:17 PDT 2015


Author: arphaman
Date: Wed Aug  5 12:41:17 2015
New Revision: 244071

URL: http://llvm.org/viewvc/llvm-project?rev=244071&view=rev
Log:
MIR Serialization: Serialize the 'debug-use' register operand flag.

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

Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp?rev=244071&r1=244070&r2=244071&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp Wed Aug  5 12:41:17 2015
@@ -146,6 +146,7 @@ static MIToken::TokenKind getIdentifierK
       .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)

Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.h?rev=244071&r1=244070&r2=244071&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.h (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.h Wed Aug  5 12:41:17 2015
@@ -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; }

Modified: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp?rev=244071&r1=244070&r2=244071&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp Wed Aug  5 12:41:17 2015
@@ -490,6 +490,9 @@ bool MIParser::parseRegisterFlag(unsigne
   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(Mach
   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(Machi
   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:

Modified: llvm/trunk/lib/CodeGen/MIRPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRPrinter.cpp?rev=244071&r1=244070&r2=244071&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRPrinter.cpp Wed Aug  5 12:41:17 2015
@@ -529,6 +529,8 @@ void MIPrinter::print(const MachineOpera
       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)

Modified: llvm/trunk/test/CodeGen/MIR/X86/instructions-debug-location.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/instructions-debug-location.mir?rev=244071&r1=244070&r2=244071&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/MIR/X86/instructions-debug-location.mir (original)
+++ llvm/trunk/test/CodeGen/MIR/X86/instructions-debug-location.mir Wed Aug  5 12:41:17 2015
@@ -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'




More information about the llvm-commits mailing list