<div dir="ltr">Sorry about that. I usually try to keep moves and other refactorings in separate NFC pre-commits, but I wasn't sure if the move justified its own commit in this case.<div><br><div>Alex</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-12 14:27 GMT-07:00 Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
> On 2015-Aug-12, at 13:33, Alex Lorenz via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: arphaman<br>
> Date: Wed Aug 12 15:33:26 2015<br>
> New Revision: 244803<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=244803&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=244803&view=rev</a><br>
> Log:<br>
> MIR Serialization: Serialize the constant pool pseudo source values.<br>
><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>
> llvm/trunk/test/CodeGen/MIR/X86/memory-operands.mir<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp?rev=244803&r1=244802&r2=244803&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp?rev=244803&r1=244802&r2=244803&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.cpp Wed Aug 12 15:33:26 2015<br>
> @@ -201,6 +201,7 @@ static MIToken::TokenKind getIdentifierK<br>
> .Case("non-temporal", MIToken::kw_non_temporal)<br>
> .Case("invariant", MIToken::kw_invariant)<br>
> .Case("align", MIToken::kw_align)<br>
> + .Case("constant-pool", MIToken::kw_constant_pool)<br>
> .Case("liveout", MIToken::kw_liveout)<br>
> .Default(MIToken::Identifier);<br>
> }<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/MIRParser/MILexer.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.h?rev=244803&r1=244802&r2=244803&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MILexer.h?rev=244803&r1=244802&r2=244803&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/MIRParser/MILexer.h (original)<br>
> +++ llvm/trunk/lib/CodeGen/MIRParser/MILexer.h Wed Aug 12 15:33:26 2015<br>
> @@ -70,6 +70,7 @@ struct MIToken {<br>
> kw_non_temporal,<br>
> kw_invariant,<br>
> kw_align,<br>
> + kw_constant_pool,<br>
> kw_liveout,<br>
><br>
> // Identifier tokens<br>
><br>
> Modified: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp?rev=244803&r1=244802&r2=244803&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp?rev=244803&r1=244802&r2=244803&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp Wed Aug 12 15:33:26 2015<br>
> @@ -128,6 +128,8 @@ public:<br>
> bool parseOperandsOffset(MachineOperand &Op);<br>
> bool parseIRValue(Value *&V);<br>
> bool parseMemoryOperandFlag(unsigned &Flags);<br>
> + bool parseMemoryPseudoSourceValue(const PseudoSourceValue *&PSV);<br>
> + bool parseMachinePointerInfo(MachinePointerInfo &Dest);<br>
> bool parseMachineMemoryOperand(MachineMemOperand *&Dest);<br>
><br>
> private:<br>
> @@ -1117,6 +1119,45 @@ bool MIParser::parseMemoryOperandFlag(un<br>
> return false;<br>
> }<br>
><br>
> +bool MIParser::parseMemoryPseudoSourceValue(const PseudoSourceValue *&PSV) {<br>
> + switch (Token.kind()) {<br>
> + case MIToken::kw_constant_pool:<br>
> + PSV = MF.getPSVManager().getConstantPool();<br>
> + break;<br>
> + // TODO: Parse the other pseudo source values.<br>
> + default:<br>
> + llvm_unreachable("The current token should be pseudo source value");<br>
> + }<br>
> + lex();<br>
> + return false;<br>
> +}<br>
> +<br>
> +bool MIParser::parseMachinePointerInfo(MachinePointerInfo &Dest) {<br>
> + if (Token.is(MIToken::kw_constant_pool)) {<br>
> + const PseudoSourceValue *PSV = nullptr;<br>
> + if (parseMemoryPseudoSourceValue(PSV))<br>
> + return true;<br>
> + int64_t Offset = 0;<br>
> + if (parseOffset(Offset))<br>
> + return true;<br>
> + Dest = MachinePointerInfo(PSV, Offset);<br>
> + return false;<br>
> + }<br>
> + if (Token.isNot(MIToken::NamedIRValue))<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>
> + int64_t Offset = 0;<br>
> + if (parseOffset(Offset))<br>
> + return true;<br>
> + Dest = MachinePointerInfo(V, Offset);<br>
> + return false;<br>
> +}<br>
> +<br>
> bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {<br>
> if (expectAndConsume(MIToken::lparen))<br>
> return true;<br>
> @@ -1146,17 +1187,8 @@ bool MIParser::parseMachineMemoryOperand<br>
> return error(Twine("expected '") + Word + "'");<br>
> lex();<br>
><br>
> - // TODO: Parse pseudo source values.<br>
> - if (Token.isNot(MIToken::NamedIRValue))<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>
> - int64_t Offset = 0;<br>
> - if (parseOffset(Offset))<br>
> + MachinePointerInfo Ptr = MachinePointerInfo();<br>
> + if (parseMachinePointerInfo(Ptr))<br>
<br>
</div></div>For next time: it'd be easier to read this patch -- to see what's<br>
changed -- if you'd moved the code to a helper function in a<br>
preparatory NFC commit.<br>
<br>
</blockquote></div><br></div>