[llvm-commits] [llvm] r145894 - in /llvm/trunk/lib/Target: Mips/MCTargetDesc/MipsAsmBackend.cpp PowerPC/MCTargetDesc/PPCAsmBackend.cpp

Jim Grosbach grosbach at apple.com
Mon Dec 5 21:18:44 PST 2011


On Dec 5, 2011, at 6:06 PM, David Blaikie wrote:

> On Tue, Dec 6, 2011 at 1:48 AM, NAKAMURA Takumi <geek4civic at gmail.com> wrote:
>> Author: chapuni
>> Date: Mon Dec  5 19:48:32 2011
>> New Revision: 145894
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=145894&view=rev
>> Log:
>> MipsAsmBackend.cpp, PPCAsmBackend.cpp: Fix -Asserts build to appease msvc.
>> 
>> Modified:
>>    llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
>>    llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
>> 
>> Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp?rev=145894&r1=145893&r2=145894&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp (original)
>> +++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp Mon Dec  5 19:48:32 2011
>> @@ -181,6 +181,7 @@
>>                             const MCAsmLayout &Layout) const {
>>     // FIXME.
>>     assert(0 && "RelaxInstruction() unimplemented");
>> +    return false;
> 
> Does llvm_unreachable also (as an alternative, not in addition to) silence MSVC?

It probably would, but I believe the change to add a 'return false' is the better one in this instance.

These functions are reachable in the sense that they are target hooks for an MC feature (branch relaxation). That feature is not used by these targets, however, so there's an assert in the hooks so if the code somehow gets there, a contract is being violated. In a release build, they just return "nothing to do here, please move along," instead, which is reasonable non-crashing behavior.

Sorry for the MSVC breakage, btw. Thank you for the fix!

-Jim

> 
>>   }
>> 
>>   /// RelaxInstruction - Relax the instruction in the given fragment
>> 
>> Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp?rev=145894&r1=145893&r2=145894&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp (original)
>> +++ llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp Mon Dec  5 19:48:32 2011
>> @@ -100,6 +100,7 @@
>>                             const MCAsmLayout &Layout) const {
>>     // FIXME.
>>     assert(0 && "RelaxInstruction() unimplemented");
>> +    return false;
>>   }
>> 
>> 
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> _______________________________________________
> 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