[llvm] r244356 - MIR Serialization: Serialize the offsets for the machine memory operands.

Alex Lorenz via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 13:26:53 PDT 2015


Author: arphaman
Date: Fri Aug  7 15:26:52 2015
New Revision: 244356

URL: http://llvm.org/viewvc/llvm-project?rev=244356&view=rev
Log:
MIR Serialization: Serialize the offsets for the machine memory operands.

Modified:
    llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
    llvm/trunk/lib/CodeGen/MIRPrinter.cpp
    llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir

Modified: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp?rev=244356&r1=244355&r2=244356&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp Fri Aug  7 15:26:52 2015
@@ -1125,12 +1125,16 @@ bool MIParser::parseMachineMemoryOperand
   if (!V->getType()->isPointerTy())
     return error("expected a pointer IR value");
   lex();
+  int64_t Offset = 0;
+  if (parseOffset(Offset))
+    return true;
   // TODO: Parse the base alignment.
   // TODO: Parse the attached metadata nodes.
   if (expectAndConsume(MIToken::rparen))
     return true;
 
-  Dest = MF.getMachineMemOperand(MachinePointerInfo(V), Flags, Size, Size);
+  Dest =
+      MF.getMachineMemOperand(MachinePointerInfo(V, Offset), Flags, Size, Size);
   return false;
 }
 

Modified: llvm/trunk/lib/CodeGen/MIRPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRPrinter.cpp?rev=244356&r1=244355&r2=244356&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRPrinter.cpp Fri Aug  7 15:26:52 2015
@@ -678,6 +678,7 @@ void MIPrinter::print(const MachineMemOp
   if (const Value *Val = Op.getValue())
     printIRValueReference(*Val);
   // TODO: Print PseudoSourceValue.
+  printOffset(Op.getOffset());
   // TODO: Print the base alignment.
   // TODO: Print the metadata attributes.
   OS << ')';

Modified: llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir?rev=244356&r1=244355&r2=244356&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir (original)
+++ llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir Fri Aug  7 15:26:52 2015
@@ -43,6 +43,14 @@
 
   !1 = !{}
 
+  define void @memory_offset(<8 x float>* %vec) {
+  entry:
+    %v = load <8 x float>, <8 x float>* %vec
+    %v2 = insertelement <8 x float> %v, float 0.0, i32 4
+    store <8 x float> %v2, <8 x float>* %vec
+    ret void
+  }
+
 ...
 ---
 name:            test
@@ -123,3 +131,26 @@ body:
       - '%eax = MOV32rm killed %rdi, 1, _, 0, _ :: (invariant load 4 from %ir.x)'
       - 'RETQ %eax'
 ...
+---
+name:            memory_offset
+tracksRegLiveness: true
+liveins:
+  - { reg: '%rdi' }
+body:
+  - id:          0
+    name:        entry
+    liveins:     [ '%rdi' ]
+    instructions:
+# CHECK: name: memory_offset
+# CHECK:      %xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec)
+# CHECK-NEXT: %xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16)
+# CHECK:      MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec)
+# CHECK-NEXT: MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16)
+      - '%xmm0 = MOVAPSrm %rdi, 1, _, 0, _ :: (load 16 from %ir.vec)'
+      - '%xmm1 = MOVAPSrm %rdi, 1, _, 16, _ :: (load 16 from %ir.vec + 16)'
+      - '%xmm2 = FsFLD0SS'
+      - '%xmm1 = MOVSSrr killed %xmm1, killed %xmm2'
+      - 'MOVAPSmr %rdi, 1, _, 0, _, killed %xmm0 :: (store 16 into %ir.vec)'
+      - 'MOVAPSmr killed %rdi, 1, _, 16, _, killed %xmm1 :: (store 16 into %ir.vec + 16)'
+      - RETQ
+...




More information about the llvm-commits mailing list