public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Anthony Green <green@moxielogic.com>
To: FX MOREL <fxmorel.gcc@gmail.com>
Cc: gcc@gcc.gnu.org
Subject: Re: [LM-32] Code generation for address loading
Date: Tue, 25 Feb 2014 00:09:00 -0000	[thread overview]
Message-ID: <87ios4xddt.fsf@moxielogic.com> (raw)
In-Reply-To: <CA+x5mr-t13wQG9XwMhw+PCHYWWbODwd74QP26wW0owYCRFYNDA@mail.gmail.com>	(FX MOREL's message of "Tue, 18 Feb 2014 15:04:32 +0100")

FX MOREL <fxmorel.gcc@gmail.com> writes:

> Hi everyone,
>
> I am developing on a custom design using the LatticeMico32
> architecture and I use gcc 4.5.1 to compile C code for this arch.
>
> In this architecture, the loading of an address 0xHHHHLLLL always
> takes two assembly instructions to fetch the address because
> immediates are on 16 bits :
>     mvhi r1, 0xHHHH
>     ori r1, r1, 0xLLLL
>     ...
>     lw r2, r1
>
> In my situation, nearly all the symbols are located in the same 64kB
> region and their address share the same hi-part, so I am trying to
> minimize the overload of always using two instructions when only one
> is needed.
>

[additional details deleted]

> Because the symbol mapping phase is done during linking, I have little
> chance to know the future symbol address at code generation but is
> there some way I could make this work ?
> If I affect the symbol to a dedicated section (with the __attribute__
> ((section())) directive ), is there a way to know its section during
> code generation ?
>
> I understand that I am asking for a very 'dangerous' advice but again,
> this will only be a custom optimization for a custom design.

Have you considered doing this through custom GNU linker relaxation
work?  I would try this before hacking away at the compiler.

AG


>
> Thank you.
>
> F-X Morel

  reply	other threads:[~2014-02-25  0:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-18 14:05 FX MOREL
2014-02-25  0:09 ` Anthony Green [this message]
2014-02-26 11:53   ` FX MOREL

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=87ios4xddt.fsf@moxielogic.com \
    --to=green@moxielogic.com \
    --cc=fxmorel.gcc@gmail.com \
    --cc=gcc@gcc.gnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).