All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Pekka Enberg <penberg@kernel.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: Sun, 28 Aug 2011 09:54:03 -0700	[thread overview]
Message-ID: <CA+55aFymNRxwWMVPwhWKGB7T2UXduGccjW1FgKYGCb8QH9QAhg@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1108281700030.7991@localhost6.localdomain6>

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. ;-)

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).

                          Linus

  reply	other threads:[~2011-08-28 16:54 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 [this message]
2011-08-29  7:41       ` Pekka Enberg
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=CA+55aFymNRxwWMVPwhWKGB7T2UXduGccjW1FgKYGCb8QH9QAhg@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=jeff@garzik.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=sparse@chrisli.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.