<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 3, 2015 at 4:08 PM, Alex Lorenz <span dir="ltr"><<a href="mailto:arphaman@gmail.com" target="_blank">arphaman@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: arphaman<br>
Date: Mon Aug  3 18:08:19 2015<br>
New Revision: 243915<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D243915-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=USJTjY-K1zI1LCJzM0oHHhpNnJureq6tbqv3oa9hskw&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=243915&view=rev</a><br>
Log:<br>
MIR Serialization: Initial serialization of the machine memory operands.<br>
<br>
Reviewers: Duncan P. N. Exon Smith<br>
<br>
Added:<br>
    llvm/trunk/test/CodeGen/MIR/X86/expected-comma-after-memory-operand.mir<br>
    llvm/trunk/test/CodeGen/MIR/X86/expected-from-in-memory-operand.mir<br>
    llvm/trunk/test/CodeGen/MIR/X86/expected-load-or-store-in-memory-operand.mir<br>
    llvm/trunk/test/CodeGen/MIR/X86/expected-pointer-value-in-memory-operand.mir<br>
    llvm/trunk/test/CodeGen/MIR/X86/expected-size-integer-after-memory-operation.mir<br>
    llvm/trunk/test/CodeGen/MIR/X86/expected-value-in-memory-operand.mir<br>
    llvm/trunk/test/CodeGen/MIR/X86/large-size-in-memory-operand-error.mir<br>
    llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir<br>
    llvm/trunk/test/CodeGen/MIR/X86/undefined-value-in-memory-operand.mir<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp<br>
    llvm/trunk/lib/CodeGen/MIRParser/MILexer.h<br>
    llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp<br>
    llvm/trunk/lib/CodeGen/MIRPrinter.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_MIRParser_MILexer.cpp-3Frev-3D243915-26r1-3D243914-26r2-3D243915-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=_S3Qm2ebS8Ze3JGXgctam8im6hViNH2HSJBFTlZJo4w&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp?rev=243915&r1=243914&r2=243915&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp Mon Aug  3 18:08:19 2015<br>
@@ -260,6 +260,16 @@ static Cursor maybeLexIRBlock(<br>
                  Rule.size(), ErrorCallback);<br>
 }<br>
<br>
+static Cursor maybeLexIRValue(<br>
+    Cursor C, MIToken &Token,<br>
+    function_ref<void(StringRef::iterator Loc, const Twine &)> ErrorCallback) {<br>
+  const StringRef Rule = "%ir.";<br>
+  if (!C.remaining().startswith(Rule))<br>
+    return None;<br>
+  return lexName(C, Token, MIToken::NamedIRValue, MIToken::QuotedNamedIRValue,<br>
+                 Rule.size(), ErrorCallback);<br>
+}<br>
+<br>
 static Cursor lexVirtualRegister(Cursor C, MIToken &Token) {<br>
   auto Range = C;<br>
   C.advance(); // Skip '%'<br>
@@ -381,11 +391,17 @@ static MIToken::TokenKind symbolToken(ch<br>
 }<br>
<br>
 static Cursor maybeLexSymbol(Cursor C, MIToken &Token) {<br>
-  auto Kind = symbolToken(C.peek());<br>
+  MIToken::TokenKind Kind;<br>
+  unsigned Length = 1;<br>
+  if (C.peek() == ':' && C.peek(1) == ':') {<br>
+    Kind = MIToken::coloncolon;<br>
+    Length = 2;<br>
+  } else<br>
+    Kind = symbolToken(C.peek());<br>
   if (Kind == MIToken::Error)<br>
     return None;<br>
   auto Range = C;<br>
-  C.advance();<br>
+  C.advance(Length);<br>
   Token = MIToken(Kind, Range.upto(C));<br>
   return C;<br>
 }<br>
@@ -413,6 +429,8 @@ StringRef llvm::lexMIToken(<br>
     return R.remaining();<br>
   if (Cursor R = maybeLexIRBlock(C, Token, ErrorCallback))<br>
     return R.remaining();<br>
+  if (Cursor R = maybeLexIRValue(C, Token, ErrorCallback))<br>
+    return R.remaining();<br>
   if (Cursor R = maybeLexRegister(C, Token))<br>
     return R.remaining();<br>
   if (Cursor R = maybeLexGlobalValue(C, Token, ErrorCallback))<br>
<br>
Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.h<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_MIRParser_MILexer.h-3Frev-3D243915-26r1-3D243914-26r2-3D243915-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=fXaOSa6CBJiF8xwHhs9kENBDE204xyx6vRkQQeorZpo&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.h?rev=243915&r1=243914&r2=243915&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/MIRParser/MILexer.h (original)<br>
+++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.h Mon Aug  3 18:08:19 2015<br>
@@ -36,6 +36,7 @@ struct MIToken {<br>
     equal,<br>
     underscore,<br>
     colon,<br>
+    coloncolon,<br>
     exclaim,<br>
     lparen,<br>
     rparen,<br>
@@ -82,6 +83,8 @@ struct MIToken {<br>
     NamedIRBlock,<br>
     QuotedNamedIRBlock,<br>
     IRBlock,<br>
+    NamedIRValue,<br>
+    QuotedNamedIRValue,<br>
   };<br>
<br>
 private:<br>
@@ -120,7 +123,7 @@ public:<br>
<br>
   bool isStringValueQuoted() const {<br>
     return Kind == QuotedNamedGlobalValue || Kind == QuotedExternalSymbol ||<br>
-           Kind == QuotedNamedIRBlock;<br>
+           Kind == QuotedNamedIRBlock || Kind == QuotedNamedIRValue;<br>
   }<br></blockquote><div><br></div><div>Sorry I haven't been keeping up with your commits, but it seems weird to me that whether a thing is quoted or not is exposed outside the lexer. Part of the point of a lexer is to abstract away this distinction (which is purely lexical). I.e. from a client's perspective, they just call stringValue() and that gets them the right string value.</div><div><br></div><div>Is there a reason you don't have a `StrVal` inside of MIToken and just fill it in inside lexMIToken?</div><div>(if malloc traffic is a concern, StrVal can be a StringRef, and MIToken can contain a SmallVector buffer for storing unescaped "cleaned" strings but zero-copy is used if no unescaping is necessary).</div><div><br></div><div>Presumably if there is an identifier in the source, then its string value will always be needed anyway, so I don't think there's a benefit to computing it lazily on demand.</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
   /// Return the token's raw string value.<br>
<br>
Modified: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_MIRParser_MIParser.cpp-3Frev-3D243915-26r1-3D243914-26r2-3D243915-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=SjfIknSS3iZ-i7P0J16XiAAPIIj9g-dR7SM7lORIe0I&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp?rev=243915&r1=243914&r2=243915&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp Mon Aug  3 18:08:19 2015<br>
@@ -21,6 +21,7 @@<br>
 #include "llvm/CodeGen/MachineFrameInfo.h"<br>
 #include "llvm/CodeGen/MachineInstr.h"<br>
 #include "llvm/CodeGen/MachineInstrBuilder.h"<br>
+#include "llvm/CodeGen/MachineMemOperand.h"<br>
 #include "llvm/CodeGen/MachineModuleInfo.h"<br>
 #include "llvm/IR/Instructions.h"<br>
 #include "llvm/IR/Constants.h"<br>
@@ -133,6 +134,8 @@ public:<br>
   bool parseBlockAddressOperand(MachineOperand &Dest);<br>
   bool parseTargetIndexOperand(MachineOperand &Dest);<br>
   bool parseMachineOperand(MachineOperand &Dest);<br>
+  bool parseIRValue(Value *&V);<br>
+  bool parseMachineMemoryOperand(MachineMemOperand *&Dest);<br>
<br>
 private:<br>
   /// Convert the integer literal in the current token into an unsigned integer.<br>
@@ -140,6 +143,11 @@ private:<br>
   /// Return true if an error occurred.<br>
   bool getUnsigned(unsigned &Result);<br>
<br>
+  /// Convert the integer literal in the current token into an uint64.<br>
+  ///<br>
+  /// Return true if an error occurred.<br>
+  bool getUint64(uint64_t &Result);<br>
+<br>
   /// If the current token is of the given kind, consume it and return false.<br>
   /// Otherwise report an error and return true.<br>
   bool expectAndConsume(MIToken::TokenKind TokenKind);<br>
@@ -256,15 +264,16 @@ bool MIParser::parse(MachineInstr *&MI)<br>
   if (Token.isError() || parseInstruction(OpCode, Flags))<br>
     return true;<br>
<br>
-  // TODO: Parse the bundle instruction flags and memory operands.<br>
+  // TODO: Parse the bundle instruction flags.<br>
<br>
   // Parse the remaining machine operands.<br>
-  while (Token.isNot(MIToken::Eof) && Token.isNot(MIToken::kw_debug_location)) {<br>
+  while (Token.isNot(MIToken::Eof) && Token.isNot(MIToken::kw_debug_location) &&<br>
+         Token.isNot(MIToken::coloncolon)) {<br>
     auto Loc = Token.location();<br>
     if (parseMachineOperand(MO))<br>
       return true;<br>
     Operands.push_back(MachineOperandWithLocation(MO, Loc, Token.location()));<br>
-    if (Token.is(MIToken::Eof))<br>
+    if (Token.is(MIToken::Eof) || Token.is(MIToken::coloncolon))<br>
       break;<br>
     if (Token.isNot(MIToken::comma))<br>
       return error("expected ',' before the next machine operand");<br>
@@ -282,6 +291,23 @@ bool MIParser::parse(MachineInstr *&MI)<br>
     DebugLocation = DebugLoc(Node);<br>
   }<br>
<br>
+  // Parse the machine memory operands.<br>
+  SmallVector<MachineMemOperand *, 2> MemOperands;<br>
+  if (Token.is(MIToken::coloncolon)) {<br>
+    lex();<br>
+    while (Token.isNot(MIToken::Eof)) {<br>
+      MachineMemOperand *MemOp = nullptr;<br>
+      if (parseMachineMemoryOperand(MemOp))<br>
+        return true;<br>
+      MemOperands.push_back(MemOp);<br>
+      if (Token.is(MIToken::Eof))<br>
+        break;<br>
+      if (Token.isNot(MIToken::comma))<br>
+        return error("expected ',' before the next machine memory operand");<br>
+      lex();<br>
+    }<br>
+  }<br>
+<br>
   const auto &MCID = MF.getSubtarget().getInstrInfo()->get(OpCode);<br>
   if (!MCID.isVariadic()) {<br>
     // FIXME: Move the implicit operand verification to the machine verifier.<br>
@@ -294,6 +320,12 @@ bool MIParser::parse(MachineInstr *&MI)<br>
   MI->setFlags(Flags);<br>
   for (const auto &Operand : Operands)<br>
     MI->addOperand(MF, Operand.Operand);<br>
+  if (MemOperands.empty())<br>
+    return false;<br>
+  MachineInstr::mmo_iterator MemRefs =<br>
+      MF.allocateMemRefsArray(MemOperands.size());<br>
+  std::copy(MemOperands.begin(), MemOperands.end(), MemRefs);<br>
+  MI->setMemRefs(MemRefs, MemRefs + MemOperands.size());<br>
   return false;<br>
 }<br>
<br>
@@ -929,6 +961,77 @@ bool MIParser::parseMachineOperand(Machi<br>
   return false;<br>
 }<br>
<br>
+bool MIParser::parseIRValue(Value *&V) {<br>
+  switch (Token.kind()) {<br>
+  case MIToken::NamedIRValue:<br>
+  case MIToken::QuotedNamedIRValue: {<br>
+    StringValueUtility Name(Token);<br>
+    V = MF.getFunction()->getValueSymbolTable().lookup(Name);<br>
+    if (!V)<br>
+      return error(Twine("use of undefined IR value '%ir.") +<br>
+                   Token.rawStringValue() + "'");<br>
+    break;<br>
+  }<br>
+  // TODO: Parse unnamed IR value references.<br>
+  default:<br>
+    llvm_unreachable("The current token should be an IR block reference");<br>
+  }<br>
+  return false;<br>
+}<br>
+<br>
+bool MIParser::getUint64(uint64_t &Result) {<br>
+  assert(Token.hasIntegerValue());<br>
+  if (Token.integerValue().getActiveBits() > 64)<br>
+    return error("expected 64-bit integer (too large)");<br>
+  Result = Token.integerValue().getZExtValue();<br>
+  return false;<br>
+}<br>
+<br>
+bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {<br>
+  if (expectAndConsume(MIToken::lparen))<br>
+    return true;<br>
+  // TODO: Parse the operand's flags.<br>
+  if (Token.isNot(MIToken::Identifier) ||<br>
+      (Token.stringValue() != "load" && Token.stringValue() != "store"))<br>
+    return error("expected 'load' or 'store' memory operation");<br>
+  unsigned Flags = 0;<br>
+  if (Token.stringValue() == "load")<br>
+    Flags |= MachineMemOperand::MOLoad;<br>
+  else<br>
+    Flags |= MachineMemOperand::MOStore;<br>
+  lex();<br>
+<br>
+  if (Token.isNot(MIToken::IntegerLiteral))<br>
+    return error("expected the size integer literal after memory operation");<br>
+  uint64_t Size;<br>
+  if (getUint64(Size))<br>
+    return true;<br>
+  lex();<br>
+<br>
+  const char *Word = Flags & MachineMemOperand::MOLoad ? "from" : "into";<br>
+  if (Token.isNot(MIToken::Identifier) || Token.stringValue() != Word)<br>
+    return error(Twine("expected '") + Word + "'");<br>
+  lex();<br>
+<br>
+  // TODO: Parse pseudo source values.<br>
+  if (Token.isNot(MIToken::NamedIRValue) &&<br>
+      Token.isNot(MIToken::QuotedNamedIRValue))<br>
+    return error("expected an IR value reference");<br>
+  Value *V = nullptr;<br>
+  if (parseIRValue(V))<br>
+    return true;<br>
+  if (!V->getType()->isPointerTy())<br>
+    return error("expected a pointer IR value");<br>
+  lex();<br>
+  // TODO: Parse the base alignment.<br>
+  // TODO: Parse the attached metadata nodes.<br>
+  if (expectAndConsume(MIToken::rparen))<br>
+    return true;<br>
+<br>
+  Dest = MF.getMachineMemOperand(MachinePointerInfo(V), Flags, Size, Size);<br>
+  return false;<br>
+}<br>
+<br>
 void MIParser::initNames2InstrOpCodes() {<br>
   if (!Names2InstrOpCodes.empty())<br>
     return;<br>
<br>
Modified: llvm/trunk/lib/CodeGen/MIRPrinter.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_MIRPrinter.cpp-3Frev-3D243915-26r1-3D243914-26r2-3D243915-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=4-PNz4ODkZ56LPBBQcZwrEOipREkoS_P4Uj-VGzoQs0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRPrinter.cpp?rev=243915&r1=243914&r2=243915&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/MIRPrinter.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/MIRPrinter.cpp Mon Aug  3 18:08:19 2015<br>
@@ -17,6 +17,7 @@<br>
 #include "llvm/CodeGen/MachineConstantPool.h"<br>
 #include "llvm/CodeGen/MachineFunction.h"<br>
 #include "llvm/CodeGen/MachineFrameInfo.h"<br>
+#include "llvm/CodeGen/MachineMemOperand.h"<br>
 #include "llvm/CodeGen/MachineModuleInfo.h"<br>
 #include "llvm/CodeGen/MachineRegisterInfo.h"<br>
 #include "llvm/CodeGen/MIRYamlMapping.h"<br>
@@ -114,8 +115,10 @@ public:<br>
   void print(const MachineInstr &MI);<br>
   void printMBBReference(const MachineBasicBlock &MBB);<br>
   void printIRBlockReference(const BasicBlock &BB);<br>
+  void printIRValueReference(const Value &V);<br>
   void printStackObjectReference(int FrameIndex);<br>
   void print(const MachineOperand &Op, const TargetRegisterInfo *TRI);<br>
+  void print(const MachineMemOperand &Op);<br>
<br>
   void print(const MCCFIInstruction &CFI, const TargetRegisterInfo *TRI);<br>
 };<br>
@@ -426,7 +429,7 @@ void MIPrinter::print(const MachineInstr<br>
   if (MI.getFlag(MachineInstr::FrameSetup))<br>
     OS << "frame-setup ";<br>
   OS << TII->getName(MI.getOpcode());<br>
-  // TODO: Print the bundling instruction flags, machine mem operands.<br>
+  // TODO: Print the bundling instruction flags.<br>
   if (I < E)<br>
     OS << ' ';<br>
<br>
@@ -444,6 +447,17 @@ void MIPrinter::print(const MachineInstr<br>
     OS << " debug-location ";<br>
     MI.getDebugLoc()->printAsOperand(OS, MST);<br>
   }<br>
+<br>
+  if (!MI.memoperands_empty()) {<br>
+    OS << " :: ";<br>
+    bool NeedComma = false;<br>
+    for (const auto *Op : MI.memoperands()) {<br>
+      if (NeedComma)<br>
+        OS << ", ";<br>
+      print(*Op);<br>
+      NeedComma = true;<br>
+    }<br>
+  }<br>
 }<br>
<br>
 void MIPrinter::printMBBReference(const MachineBasicBlock &MBB) {<br>
@@ -467,6 +481,16 @@ void MIPrinter::printIRBlockReference(co<br>
     OS << Slot;<br>
 }<br>
<br>
+void MIPrinter::printIRValueReference(const Value &V) {<br>
+  OS << "%ir.";<br>
+  if (V.hasName()) {<br>
+    printLLVMNameWithoutPrefix(OS, V.getName());<br>
+    return;<br>
+  }<br>
+  // TODO: Serialize the unnamed IR value references.<br>
+  OS << "<unserializable ir value>";<br>
+}<br>
+<br>
 void MIPrinter::printStackObjectReference(int FrameIndex) {<br>
   auto ObjectInfo = StackObjectOperandMapping.find(FrameIndex);<br>
   assert(ObjectInfo != StackObjectOperandMapping.end() &&<br>
@@ -581,6 +605,24 @@ void MIPrinter::print(const MachineOpera<br>
   }<br>
 }<br>
<br>
+void MIPrinter::print(const MachineMemOperand &Op) {<br>
+  OS << '(';<br>
+  // TODO: Print operand's other flags.<br>
+  if (Op.isLoad())<br>
+    OS << "load ";<br>
+  else {<br>
+    assert(Op.isStore() && "Non load machine operand must be a store");<br>
+    OS << "store ";<br>
+  }<br>
+  OS << Op.getSize() << (Op.isLoad() ? " from " : " into ");<br>
+  if (const Value *Val = Op.getValue())<br>
+    printIRValueReference(*Val);<br>
+  // TODO: Print PseudoSourceValue.<br>
+  // TODO: Print the base alignment.<br>
+  // TODO: Print the metadata attributes.<br>
+  OS << ')';<br>
+}<br>
+<br>
 static void printCFIRegister(unsigned DwarfReg, raw_ostream &OS,<br>
                              const TargetRegisterInfo *TRI) {<br>
   int Reg = TRI->getLLVMRegNum(DwarfReg, true);<br>
<br>
Added: llvm/trunk/test/CodeGen/MIR/X86/expected-comma-after-memory-operand.mir<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_MIR_X86_expected-2Dcomma-2Dafter-2Dmemory-2Doperand.mir-3Frev-3D243915-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=4znkQSP6RC47yNf4RDNS0waJy6gvifTMBp__uZdJL6A&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/expected-comma-after-memory-operand.mir?rev=243915&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/MIR/X86/expected-comma-after-memory-operand.mir (added)<br>
+++ llvm/trunk/test/CodeGen/MIR/X86/expected-comma-after-memory-operand.mir Mon Aug  3 18:08:19 2015<br>
@@ -0,0 +1,27 @@<br>
+# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s<br>
+<br>
+--- |<br>
+<br>
+  define void @test(i32* %a) {<br>
+  entry2:<br>
+    %b = load i32, i32* %a<br>
+    %c = add i32 %b, 1<br>
+    store i32 %c, i32* %a<br>
+    ret void<br>
+  }<br>
+<br>
+...<br>
+---<br>
+name:            test<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry2<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK: [[@LINE+1]]:92: expected ',' before the next machine memory operand<br>
+      - 'INC32m killed %rdi, 1, _, 0, _, implicit-def dead %eflags :: (store 4 into %ir.a) (load 4 from %ir.a)'<br>
+      - RETQ<br>
+...<br>
<br>
Added: llvm/trunk/test/CodeGen/MIR/X86/expected-from-in-memory-operand.mir<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_MIR_X86_expected-2Dfrom-2Din-2Dmemory-2Doperand.mir-3Frev-3D243915-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=0xFsqx2XHDRRhGGtqu7yOJULIJACIZEcI4IIo1oOQps&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/expected-from-in-memory-operand.mir?rev=243915&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/MIR/X86/expected-from-in-memory-operand.mir (added)<br>
+++ llvm/trunk/test/CodeGen/MIR/X86/expected-from-in-memory-operand.mir Mon Aug  3 18:08:19 2015<br>
@@ -0,0 +1,26 @@<br>
+# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s<br>
+<br>
+--- |<br>
+<br>
+  define i32 @test(i32* %a) {<br>
+  entry:<br>
+    %b = load i32, i32* %a<br>
+    ret i32 %b<br>
+  }<br>
+<br>
+...<br>
+---<br>
+name:            test<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK: [[@LINE+1]]:60: expected 'from'<br>
+      - '%eax = MOV32rm killed %rdi, 1, _, 0, _ :: (load 4 %ir.a)'<br>
+      - 'RETQ %eax'<br>
+...<br>
+<br>
<br>
Added: llvm/trunk/test/CodeGen/MIR/X86/expected-load-or-store-in-memory-operand.mir<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_MIR_X86_expected-2Dload-2Dor-2Dstore-2Din-2Dmemory-2Doperand.mir-3Frev-3D243915-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=_VybHESfoutc9j0GuK4PpY4boPQiAhi-4mSDjlD8iP8&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/expected-load-or-store-in-memory-operand.mir?rev=243915&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/MIR/X86/expected-load-or-store-in-memory-operand.mir (added)<br>
+++ llvm/trunk/test/CodeGen/MIR/X86/expected-load-or-store-in-memory-operand.mir Mon Aug  3 18:08:19 2015<br>
@@ -0,0 +1,25 @@<br>
+# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s<br>
+<br>
+--- |<br>
+<br>
+  define i32 @test(i32* %a) {<br>
+  entry:<br>
+    %b = load i32, i32* %a<br>
+    ret i32 %b<br>
+  }<br>
+<br>
+...<br>
+---<br>
+name:            test<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK: [[@LINE+1]]:53: expected 'load' or 'store' memory operation<br>
+      - '%eax = MOV32rm killed %rdi, 1, _, 0, _ :: (4 from %ir.a)'<br>
+      - 'RETQ %eax'<br>
+...<br>
<br>
Added: llvm/trunk/test/CodeGen/MIR/X86/expected-pointer-value-in-memory-operand.mir<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_MIR_X86_expected-2Dpointer-2Dvalue-2Din-2Dmemory-2Doperand.mir-3Frev-3D243915-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=Zbf4JS5i3kQaE5J4YvPBIqeGi7xtFiQN44PT2J2Jl3U&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/expected-pointer-value-in-memory-operand.mir?rev=243915&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/MIR/X86/expected-pointer-value-in-memory-operand.mir (added)<br>
+++ llvm/trunk/test/CodeGen/MIR/X86/expected-pointer-value-in-memory-operand.mir Mon Aug  3 18:08:19 2015<br>
@@ -0,0 +1,26 @@<br>
+# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s<br>
+<br>
+--- |<br>
+<br>
+  define i32 @test(i32* %a) {<br>
+  entry:<br>
+    %b = load i32, i32* %a<br>
+    ret i32 %b<br>
+  }<br>
+<br>
+...<br>
+---<br>
+name:            test<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK: [[@LINE+1]]:65: expected a pointer IR value<br>
+      - '%eax = MOV32rm killed %rdi, 1, _, 0, _ :: (load 4 from %ir.b)'<br>
+      - 'RETQ %eax'<br>
+...<br>
+<br>
<br>
Added: llvm/trunk/test/CodeGen/MIR/X86/expected-size-integer-after-memory-operation.mir<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_MIR_X86_expected-2Dsize-2Dinteger-2Dafter-2Dmemory-2Doperation.mir-3Frev-3D243915-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=-ugG1X-JMNIHmUJ3rX1jHXr0Lc4xfxptkKVifZtn1Z8&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/expected-size-integer-after-memory-operation.mir?rev=243915&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/MIR/X86/expected-size-integer-after-memory-operation.mir (added)<br>
+++ llvm/trunk/test/CodeGen/MIR/X86/expected-size-integer-after-memory-operation.mir Mon Aug  3 18:08:19 2015<br>
@@ -0,0 +1,26 @@<br>
+# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s<br>
+<br>
+--- |<br>
+<br>
+  define i32 @test(i32* %a) {<br>
+  entry:<br>
+    %b = load i32, i32* %a<br>
+    ret i32 %b<br>
+  }<br>
+<br>
+...<br>
+---<br>
+name:            test<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK: [[@LINE+1]]:58: expected the size integer literal after memory operation<br>
+      - '%eax = MOV32rm killed %rdi, 1, _, 0, _ :: (load from %ir.a)'<br>
+      - 'RETQ %eax'<br>
+...<br>
+<br>
<br>
Added: llvm/trunk/test/CodeGen/MIR/X86/expected-value-in-memory-operand.mir<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_MIR_X86_expected-2Dvalue-2Din-2Dmemory-2Doperand.mir-3Frev-3D243915-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=CSx5BfhXw8nYKc2W2BGBeu1lATxvNFP2kaeDURaFN1E&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/expected-value-in-memory-operand.mir?rev=243915&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/MIR/X86/expected-value-in-memory-operand.mir (added)<br>
+++ llvm/trunk/test/CodeGen/MIR/X86/expected-value-in-memory-operand.mir Mon Aug  3 18:08:19 2015<br>
@@ -0,0 +1,26 @@<br>
+# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s<br>
+<br>
+--- |<br>
+<br>
+  define i32 @test(i32* %a) {<br>
+  entry:<br>
+    %b = load i32, i32* %a<br>
+    ret i32 %b<br>
+  }<br>
+<br>
+...<br>
+---<br>
+name:            test<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK: [[@LINE+1]]:65: expected an IR value reference<br>
+      - '%eax = MOV32rm killed %rdi, 1, _, 0, _ :: (load 4 from a)'<br>
+      - 'RETQ %eax'<br>
+...<br>
+<br>
<br>
Added: llvm/trunk/test/CodeGen/MIR/X86/large-size-in-memory-operand-error.mir<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_MIR_X86_large-2Dsize-2Din-2Dmemory-2Doperand-2Derror.mir-3Frev-3D243915-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=8szLujQeQpvftyi_t992l6KQ1YqgY0QnLfAKz81i1dQ&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/large-size-in-memory-operand-error.mir?rev=243915&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/MIR/X86/large-size-in-memory-operand-error.mir (added)<br>
+++ llvm/trunk/test/CodeGen/MIR/X86/large-size-in-memory-operand-error.mir Mon Aug  3 18:08:19 2015<br>
@@ -0,0 +1,26 @@<br>
+# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s<br>
+<br>
+--- |<br>
+<br>
+  define i32 @test(i32* %a) {<br>
+  entry:<br>
+    %b = load i32, i32* %a<br>
+    ret i32 %b<br>
+  }<br>
+<br>
+...<br>
+---<br>
+name:            test<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK: [[@LINE+1]]:58: expected 64-bit integer (too large)<br>
+      - '%eax = MOV32rm killed %rdi, 1, _, 0, _ :: (load 12345678912345678924218574857 from %ir.a)'<br>
+      - 'RETQ %eax'<br>
+...<br>
+<br>
<br>
Added: llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_MIR_X86_memory-2Doperands.mir-3Frev-3D243915-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=vz2CiAJsnzn2lZXaPdzXUiBBx56UCj6t-03u7QruJzs&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir?rev=243915&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir (added)<br>
+++ llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir Mon Aug  3 18:08:19 2015<br>
@@ -0,0 +1,52 @@<br>
+# RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s<br>
+# This test ensures that the MIR parser parses the machine memory operands<br>
+# correctly.<br>
+<br>
+--- |<br>
+<br>
+  define i32 @test(i32* %a) {<br>
+  entry:<br>
+    %b = load i32, i32* %a<br>
+    store i32 42, i32* %a<br>
+    ret i32 %b<br>
+  }<br>
+<br>
+  define void @test2(i32* %"a value") {<br>
+  entry2:<br>
+    %b = load i32, i32* %"a value"<br>
+    %c = add i32 %b, 1<br>
+    store i32 %c, i32* %"a value"<br>
+    ret void<br>
+  }<br>
+<br>
+...<br>
+---<br>
+name:            test<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK:      %eax = MOV32rm %rdi, 1, _, 0, _ :: (load 4 from %ir.a)<br>
+# CHECK-NEXT: MOV32mi killed %rdi, 1, _, 0, _, 42 :: (store 4 into %ir.a)<br>
+      - '%eax = MOV32rm %rdi, 1, _, 0, _ :: (load 4 from %ir.a)'<br>
+      - 'MOV32mi killed %rdi, 1, _, 0, _, 42 :: (store 4 into %ir.a)'<br>
+      - 'RETQ %eax'<br>
+...<br>
+---<br>
+name:            test2<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry2<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK: INC32m killed %rdi, 1, _, 0, _, implicit-def dead %eflags :: (store 4 into %ir."a value"), (load 4 from %ir."a value")<br>
+      - 'INC32m killed %rdi, 1, _, 0, _, implicit-def dead %eflags :: (store 4 into %ir."a value"), (load 4 from %ir."a value")'<br>
+      - RETQ<br>
+...<br>
<br>
Added: llvm/trunk/test/CodeGen/MIR/X86/undefined-value-in-memory-operand.mir<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_MIR_X86_undefined-2Dvalue-2Din-2Dmemory-2Doperand.mir-3Frev-3D243915-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=2wOXRVPltJaGgJRvBeWqofqppN5UepvVvU55DheoOgk&s=MMM5qnhRXfGyJlLzuBftT4nWEwYDdmC79PukZrY0qa8&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/undefined-value-in-memory-operand.mir?rev=243915&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/CodeGen/MIR/X86/undefined-value-in-memory-operand.mir (added)<br>
+++ llvm/trunk/test/CodeGen/MIR/X86/undefined-value-in-memory-operand.mir Mon Aug  3 18:08:19 2015<br>
@@ -0,0 +1,26 @@<br>
+# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s<br>
+<br>
+--- |<br>
+<br>
+  define i32 @test(i32* %a) {<br>
+  entry:<br>
+    %b = load i32, i32* %a<br>
+    ret i32 %b<br>
+  }<br>
+<br>
+...<br>
+---<br>
+name:            test<br>
+tracksRegLiveness: true<br>
+liveins:<br>
+  - { reg: '%rdi' }<br>
+body:<br>
+  - id:          0<br>
+    name:        entry<br>
+    liveins:     [ '%rdi' ]<br>
+    instructions:<br>
+# CHECK: [[@LINE+1]]:65: use of undefined IR value '%ir.c'<br>
+      - '%eax = MOV32rm killed %rdi, 1, _, 0, _ :: (load 4 from %ir.c)'<br>
+      - 'RETQ %eax'<br>
+...<br>
+<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>