[llvm-commits] [llvm] r81202 - /llvm/trunk/lib/MC/MCExpr.cpp
Chris Lattner
sabre at nondot.org
Tue Sep 8 08:15:11 PDT 2009
Fixed on mainline (by Dan), sorry!
-Chris
On Sep 8, 2009, at 6:00 AM, Xerxes RĂ„nby wrote:
> Hi Chris!
>
> This change of yours triggered three failing regressions on all
> buildbot
> platforms:
>
> FAIL: /wd/buildbot/llvm-arm-linux/build/test/MC/AsmParser/
> conditional_asm.s
> Failed with exit(1) at line 1
> while running: llvm-mc -triple i386-unknown-unknown /wd/buildbot/
> llvm-arm-linux/build/test/MC/AsmParser/conditional_asm.s -I /wd/
> buildbot/llvm-arm-linux/build/test/MC/AsmParser | FileCheck /wd/
> buildbot/llvm-arm-linux/build/test/MC/AsmParser/conditional_asm.s
> /wd/buildbot/llvm-arm-linux/build/test/MC/AsmParser/
> conditional_asm.s:3:10: error: expected string not found in input
> # CHECK: .byte (1 + 1)
> ^
> <stdin>:1:1: note: scanning from here
> .section __TEXT,__text,regular,pure_instructions
> ^
>
> FAIL: /wd/buildbot/llvm-arm-linux/build/test/MC/AsmParser/labels.s
> Failed with exit(1) at line 1
> while running: llvm-mc -triple i686-apple-darwin10 /wd/buildbot/llvm-
> arm-linux/build/test/MC/AsmParser/labels.s | FileCheck /wd/buildbot/
> llvm-arm-linux/build/test/MC/AsmParser/labels.s
> /wd/buildbot/llvm-arm-linux/build/test/MC/AsmParser/labels.s:18:11:
> error: expected string not found in input
> // CHECK: addl $24, (a$b + 10)(%eax)
> ^
> <stdin>:12:1: note: scanning from here
> addl $24, a$b+10(%eax)
> ^
>
> FAIL: /wd/buildbot/llvm-arm-linux/build/test/MC/AsmParser/
> x86_operands.s
> Failed with exit(1) at line 1
> while running: llvm-mc -triple i386-unknown-unknown /wd/buildbot/
> llvm-arm-linux/build/test/MC/AsmParser/x86_operands.s | FileCheck /
> wd/buildbot/llvm-arm-linux/build/test/MC/AsmParser/x86_operands.s
> /wd/buildbot/llvm-arm-linux/build/test/MC/AsmParser/x86_operands.s:
> 8:10: error: expected string not found in input
> # CHECK: addl $(1 + 2), %eax
> ^
> <stdin>:3:1: note: scanning from here
> addl $1+2, %eax
> ^
>
> If these failures are OK then I guess you should update the testcase
> to reflect the change.
>
> Cheers and have a great day!
> Xerxes
>
> Chris Lattner skrev:
>> Author: lattner
>> Date: Tue Sep 8 01:34:07 2009
>> New Revision: 81202
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=81202&view=rev
>> Log:
>> make formatting of expressions more closely match the existing
>> asmprinter.
>>
>> Modified:
>> llvm/trunk/lib/MC/MCExpr.cpp
>>
>> Modified: llvm/trunk/lib/MC/MCExpr.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCExpr.cpp?rev=81202&r1=81201&r2=81202&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/lib/MC/MCExpr.cpp (original)
>> +++ llvm/trunk/lib/MC/MCExpr.cpp Tue Sep 8 01:34:07 2009
>> @@ -39,9 +39,16 @@
>>
>> case MCExpr::Binary: {
>> const MCBinaryExpr &BE = cast<MCBinaryExpr>(*this);
>> - OS << '(';
>> - BE.getLHS()->print(OS, MAI);
>> - OS << ' ';
>> +
>> + // Only print parens around the LHS if it is non-trivial.
>> + if (isa<MCConstantExpr>(BE.getLHS()) || isa<MCSymbolRefExpr>
>> (BE.getLHS())) {
>> + BE.getLHS()->print(OS, MAI);
>> + } else {
>> + OS << '(';
>> + BE.getLHS()->print(OS, MAI);
>> + OS << ')';
>> + }
>> +
>> switch (BE.getOpcode()) {
>> default: assert(0 && "Invalid opcode!");
>> case MCBinaryExpr::Add: OS << '+'; break;
>> @@ -63,9 +70,15 @@
>> case MCBinaryExpr::Sub: OS << '-'; break;
>> case MCBinaryExpr::Xor: OS << '^'; break;
>> }
>> - OS << ' ';
>> - BE.getRHS()->print(OS, MAI);
>> - OS << ')';
>> +
>> + // Only print parens around the LHS if it is non-trivial.
>> + if (isa<MCConstantExpr>(BE.getRHS()) || isa<MCSymbolRefExpr>
>> (BE.getRHS())) {
>> + BE.getRHS()->print(OS, MAI);
>> + } else {
>> + OS << '(';
>> + BE.getRHS()->print(OS, MAI);
>> + OS << ')';
>> + }
>> return;
>> }
>> }
>>
>>
>> _______________________________________________
>> 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