From: David Woodhouse <dwmw2@infradead.org>
To: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
Cc: The development of GRUB 2 <grub-devel@gnu.org>, llvmdev@cs.uiuc.edu
Subject: Re: clang .code16 with -Os producing larger code that it needs to
Date: Fri, 20 Feb 2015 16:18:24 +0000 [thread overview]
Message-ID: <1424449104.5437.64.camel@infradead.org> (raw)
In-Reply-To: <1424448308.5437.57.camel@infradead.org>
[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]
On Fri, 2015-02-20 at 16:05 +0000, David Woodhouse wrote:
>
> It's been a while since I looked at this... but I think for the short
> jumps we just emit the 8-bit version and there's a fixup which can go
> back and re-emit the instruction in 32-bit mode if it finds it doesn't
> fit?
>
> Do we just need to support a similar fixup for promoting 16-bit to
> 32-bit relocations?
OK, the term I was looking for was 'relaxation'. Look in
lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp for
X86AsmBackend::relaxInstruction() and related methods.
Observe that it will cope with 'relaxing' 8-bit PC-relative relocations
to 32-bit PC-relative, but it doesn't cope with anything else.
Your task, should you choose to accept it, is to make it cope with other
forms of relaxation where necessary.
Note that the existing cases end up emitting a new instruction with a
*new* opcode. In your case it won't be doing that. It's the *same*
opcode, but you'll have to set a flag to tell the emitter to use the
32-bit addressing mode (for data and/or addr as appropriate) this time.
And while you're doing that, you should note that that's the *same* flag
that'll be needed to support explicit addr32/data32 prefixes in the asm
source. So you might as well support those too. I might suggest doing
them *first*, in fact.
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5745 bytes --]
next prev parent reply other threads:[~2015-02-20 18:40 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 [this message]
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
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=1424449104.5437.64.camel@infradead.org \
--to=dwmw2@infradead.org \
--cc=grub-devel@gnu.org \
--cc=llvmdev@cs.uiuc.edu \
--cc=phcoder@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.