From: David Woodhouse <dwmw2@infradead.org>
To: Craig Topper <craig.topper@gmail.com>
Cc: "The development of GRUB 2" <grub-devel@gnu.org>,
"LLVM Developers Mailing List" <llvmdev@cs.uiuc.edu>,
"Rafael Espíndola" <rafael.espindola@gmail.com>
Subject: Re: [LLVMdev] clang .code16 with -Os producing larger code that it needs to
Date: Tue, 24 Feb 2015 09:07:12 +0000 [thread overview]
Message-ID: <1424768832.5437.230.camel@infradead.org> (raw)
In-Reply-To: <CAF7ks-PkzPOgG0oaSQFqmaYawfOSX3goCt9c8-sc9OpznYgOcQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1848 bytes --]
On Tue, 2015-02-24 at 00:42 -0800, Craig Topper wrote:
> Does gas really relax from 16-bit addresses to 32-bit address as
> necessary? I played around briefly and it looks like gas will only
> emit 16-bit addresses in 16-bit mode unless addr32 is prefixed. Even
> for an external symbol it only emitted a 16-bit relocation type until
> I added addr32.
I believe you are correct. My use of 32-bit relocations in LLVM was
mostly because we didn't yet support addr32. Having code which is
correct but slightly larger than needed was better than having some
things which you just *couldn't* build, in the short term.
> I wonder if we shouldn't fix the x86 encoder to use 16-bit addresses
> in 16-bit mode.
Yes, we should. Having implemented the addr32 prefix first.
> (Actually I think we're emitting 0x67 prefix because the displacement
> size check in Is16BitMemOperand doesn't like cases where displacement
> isExpr instead of isImm). And maybe override the mode in SubTargetInfo
> around the EmitInstruction call for any that specifies "addr32" in
> 16-bit mode or "addr16" in 32-bit mode?
>
>
> That doesn't help with jumps though since they do need their opcode
> switched to JMP_2 instead of JMP_4. Again I can't prove that gas will
> further relax 2-byte to 4-byte without addr32. I think we either need
> to again change SubTargetInfo and pass it into relaxInstruction OR we
> could create new 16-bit mode only 1-byte jumps that we can parse based
> on mode and relax to the 2 byte form.
I don't think we need a new opcode for a 16-bit mode 1-byte jump, do we?
The mode is already stored in the MCInst because I needed to do that to
fix PR18303.
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5745 bytes --]
prev parent reply other threads:[~2015-02-24 9:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-20 14:58 clang .code16 with -Os producing larger code that it needs to Vladimir 'φ-coder/phcoder' Serbinenko
2015-02-20 15:26 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-02-20 15:38 ` David Woodhouse
2015-02-20 15:46 ` Vladimir 'φ-coder/phcoder' Serbinenko
2015-02-20 16:05 ` David Woodhouse
2015-02-20 16:18 ` David Woodhouse
2015-02-20 18:47 ` [LLVMdev] " Rafael Espíndola
2015-02-23 12:07 ` David Woodhouse
2015-02-24 8:42 ` Craig Topper
2015-02-24 9:07 ` David Woodhouse [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424768832.5437.230.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=craig.topper@gmail.com \
--cc=grub-devel@gnu.org \
--cc=llvmdev@cs.uiuc.edu \
--cc=rafael.espindola@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.