All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christopher Li <sparse@chrisli.org>,
	linux-sparse@vger.kernel.org, Jeff Garzik <jeff@garzik.org>,
	Josh Triplett <josh@joshtriplett.org>
Subject: Re: [ANNOUNCE] LLVM backend for Sparse
Date: Mon, 29 Aug 2011 10:41:23 +0300	[thread overview]
Message-ID: <CAOJsxLE-3CLPrLhphaVLs6CoWi0JYA02=Ny_fRrn8wqS2o0NcQ@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFymNRxwWMVPwhWKGB7T2UXduGccjW1FgKYGCb8QH9QAhg@mail.gmail.com>

On Sun, Aug 28, 2011 at 7:01 AM, Pekka Enberg <penberg@kernel.org> wrote:
>> It's lack of PSEUDO_SYM support. I haven't quite figured out what kind of
>> code to generate for that because, frankly, I'm not completely sure what
>> it's all about. ;-)

On Sun, Aug 28, 2011 at 7:54 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> So "PSEUDO_SYM" is just a "link-time constant".
>
> IOW, it's nothing but a pointer to an in-memory variable, and from a
> code generation standpoint generating the symbol should be just about
> the same as generating a constant, except rather than an actual value,
> it's now a linker reference.
>
> Of course, what complicates them is that you also need to generate the
> symbol definition itself (somewhere else). In particular, the
> sym->initializer points to the initializer of a symbol, and they can
> be *complicated*. Generating the output for some symbols can be a
> major pain in the *ss, just think about a complex structure array
> initializer.
>
> The PSEUDO_SYM you hit for the "hello world" program is trivial,
> though. It's an unnamed symbol of type "char []", and it has a trivial
> initializer (the string itself). So symbols can be hard to generate,
> but there are simple cases.
>
> So for a PSUEDO_SYM, you need to look up "struct symbol" for it
> (pseudo->sym), which then has:
>
>  - name of the symbol (sym->ident). Of course, some symbols don't have
> names, like the constant string example.
>
>  - type/size/alignment information (sym->ctype)
>
>  - initializer information (sym->initializer - which can be a really
> complex expression). Of course, for external symbols - or symbols with
> no initializer - this is just empty.
>
> There's way more to symbol types in sparse than that, but apart from
> the initializer expression, most of the symbol complexity has been
> handled by earlier stages (ie a *lot* of the front-end of sparse is
> about symbols and their types).

Right. Will the "link time constant" 'struct symbol' be part of the
symbol_list? If it is, then we already do LLVMAddGlobal in
output_data() on it and could probably just stash that into a ->priv
member in 'struct symbol' and use that in pseudo_to_value().
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-08-29  7:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-28  6:08 [ANNOUNCE] LLVM backend for Sparse Pekka Enberg
2011-08-28  8:51 ` Christopher Li
2011-08-28 13:51   ` Pekka Enberg
2011-08-28 14:01   ` Pekka Enberg
2011-08-28 16:54     ` Linus Torvalds
2011-08-29  7:41       ` Pekka Enberg [this message]
2011-08-29  9:19         ` Christopher Li
2011-08-29 11:05           ` Pekka Enberg
2011-08-29 14:22   ` Pekka Enberg
2011-08-29 15:14     ` Derek M Jones
2011-08-29 15:33       ` Jeff Garzik
2011-08-29 15:42         ` Derek M Jones
2011-08-29 15:45           ` Pekka Enberg
2011-08-29 16:58       ` Linus Torvalds
2011-08-29 15:27     ` Jeff Garzik

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='CAOJsxLE-3CLPrLhphaVLs6CoWi0JYA02=Ny_fRrn8wqS2o0NcQ@mail.gmail.com' \
    --to=penberg@kernel.org \
    --cc=jeff@garzik.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.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 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.