[llvm] r175021 - [ms-inline-asm] Make sure the AsmRewrite list is sorted in lexical order.
Chris Lattner
clattner at apple.com
Tue Feb 12 20:56:54 PST 2013
On Feb 12, 2013, at 5:03 PM, Chad Rosier <mcrosier at apple.com> wrote:
> Author: mcrosier
> Date: Tue Feb 12 19:03:13 2013
> New Revision: 175021
>
> URL: http://llvm.org/viewvc/llvm-project?rev=175021&view=rev
> Log:
> [ms-inline-asm] Make sure the AsmRewrite list is sorted in lexical order.
> rdar://13202662
Hi Chad,
Please use array_pod_sort instead of std::sort. It compiles to far less code, basically boiling down to a call to qsort.
-Chris
>
> Modified:
> llvm/trunk/lib/MC/MCParser/AsmParser.cpp
>
> Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=175021&r1=175020&r2=175021&view=diff
> ==============================================================================
> --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
> +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Tue Feb 12 19:03:13 2013
> @@ -4029,6 +4029,10 @@ bool AsmParser::ParseDirectiveMSAlign(SM
> return false;
> }
>
> +bool AsmStringSort (AsmRewrite A, AsmRewrite B) {
> + return A.Loc.getPointer() < B.Loc.getPointer();
> +}
> +
> bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString,
> unsigned &NumOutputs, unsigned &NumInputs,
> SmallVectorImpl<std::pair<void *, bool> > &OpDecls,
> @@ -4153,6 +4157,7 @@ bool AsmParser::ParseMSInlineAsm(void *A
> AsmRewriteKind PrevKind = AOK_Imm;
> raw_string_ostream OS(AsmStringIR);
> const char *Start = SrcMgr.getMemoryBuffer(0)->getBufferStart();
> + std::sort (AsmStrRewrites.begin(), AsmStrRewrites.end(), AsmStringSort);
> for (SmallVectorImpl<struct AsmRewrite>::iterator
> I = AsmStrRewrites.begin(), E = AsmStrRewrites.end(); I != E; ++I) {
> const char *Loc = (*I).Loc.getPointer();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list