[PATCH v3 01/11] [x86] Fix ModR/M byte output for 16-bit addressing modes

David Woodhouse dwmw2 at infradead.org
Wed Jan 1 23:32:42 PST 2014


On Wed, 2014-01-01 at 20:23 -0600, Craig Topper wrote:
> Couple comments below. Otherwise LGTM.

Thanks.

>         
>         +      // R16Table[] is a lookup from the normal RegNo, to the row values from
>         +      // Table 2-1 for 16-bit addressing modes. Where zero means disallowed.
>         +      static const int R16Table[] = { 0, 0, 0, 7, 0, 6, 4, 5 };
> 
> 
> Why isn't this array unsigned?

Er, because the first iteration used -1 for "invalid", before I realised
zero would do just as well. Will fix.

>         
>         +      if (Disp.isImm() && isDisp8(Disp.getImm())) {
>         +        // Use [REG]+disp8 form if we can, and for [BP] which cannot be encoded.
>         +        if (BaseRegNo == N86::EBP || Disp.getImm() != 0) {
>         +          EmitByte(ModRMByte(1, RegOpcodeField, RMfield), CurByte, OS);
>         +          EmitImmediate(Disp, MI.getLoc(), 1, FK_Data_1, CurByte, OS, Fixups);
>         +          return;
> 
> 
> Don't put an else after a return.

Will fix that too; thanks.

-- 
dwmw2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140102/414e24a8/attachment.bin>


More information about the llvm-commits mailing list