[PATCH] Teach AsmPrinter how to print odd constants.

Jim Grosbach grosbach at apple.com
Fri Jun 7 11:00:33 PDT 2013


There’s some trailing whitespace in the patch, but other than that trivial detail, this LGTM.

-Jim

On Jun 7, 2013, at 9:18 AM, Quentin Colombet <qcolombet at apple.com> wrote:

> Ping?
> 
> -Quentin
> 
> On Jun 4, 2013, at 5:10 PM, Quentin Colombet <qcolombet at apple.com> wrote:
> 
>> Hi,
>> 
>> ** Context **
>> Currently, the compiler asserts if it encounters big constants whose bit width is not a multiple of 64-bits .
>> Although clang would never generate something like this, the backend should be able to handle any legal IR.
>> 
>> ** Proposal **
>> The proposed patch teaches the AsmPrinter how to emit such constants.
>> 
>> ** Implementation Details **
>> It emits the bytes, that will not be part of the 64-bits chunks, in a separate directive after the 64-bits chunks.
>> The chosen directive fills the gap in size between the emitted 64-bits chunks and the size expected by the target data layout.
>> 
>> The little endian case is straightforward as the extra bits are emitted at the end.
>> The big endian case requires more work. The left most bit of the first directive is expected to be the most significant one. Since the bit width of the data is not a multiple of 64-bits, the APInt does not expose nice 64-bits chunks.
>> The chosen approach is to shift the data so that the chunks are perfectly aligned. Then, the process is similar to little endian case.
>> See the comments in the patch for more details.
>> 
>> ** Test Cases **
>> The patch includes 3 test cases:
>> - X86_64: little endian, last directive is 64 bits.
>> - Mips: big endian, last directive is 64 bits.
>> - thumbv7: little endian, last directive is 32 bits. 
>> 
>> Thanks for the review,
>> 
>> -Quentin
>> <AsmPrinter-odd-cst.svndiff>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130607/3c14dd0d/attachment.html>


More information about the llvm-commits mailing list