From: "Christopher Li" <sparse@chrisli.org>
To: David Given <dg@cowlark.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: Writing compilers, and example.c vs compile-i386.c
Date: Fri, 20 Jun 2008 18:40:14 -0700 [thread overview]
Message-ID: <70318cbf0806201840k18a51f94rcaa413b36fcfbbea@mail.gmail.com> (raw)
In-Reply-To: <485C4150.2080508@cowlark.com>
On Fri, Jun 20, 2008 at 4:46 PM, David Given <dg@cowlark.com> wrote:
> - how do you determine the scalar type of a pseudo?
Depend on the pseudo type. If pseudo from a symbol,
pseudo->sym->ctype has the full type information.
If pseudo is from constant expression, pseduo->def->val
is the constant expression. using expr->ctype to get to the ctype.
If pseudo is from normal instruction result, the target type is
the same as any source type. The special case the OP_CAST
instruction, the type is in insn->cast_type.
I agree we should probability make the ctype into instruction so
make the back end easier.
> - if I wish to rewrite a basic block's instruction list --- for example,
> to decompose instructions that use a non-register pseudo into two
> instructions --- do I need to do anything other than iterate through the
> bb's list and insert instruction nodes? Is there any additional
> housekeeping to do? Naturally, I'd do this *before* calling
> track_pseudo_death()...
If you modify instructions in a existing instruction list. Make sure you
keep the pseudo in SSA form, including proper user list.
If you add basic block, you need to update the parent and child list.
> - what does expand_symbol() do?
Well, it expand symbols. That does help does it?
Sparse parsing have a few stage.
The tokenizer parse the source code and convert it into token list.
Pre-process stage expand the macro and handle include files etc.
Parsing stage consume the token list and parse into AST tree.
Evaluate stage does the type propagation, pointer degenerate etc.
Expand stage is mostly for some fix up. E.g. remove obvious dead code
like "#if 0".
The inline function get expanded in this stage.
Hope that helps.
Chris
next prev parent reply other threads:[~2008-06-21 1:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-16 23:04 Writing compilers, and example.c vs compile-i386.c David Given
2008-06-16 23:50 ` Mike Frysinger
2008-06-17 0:49 ` Christopher Li
2008-06-17 23:35 ` David Given
2008-06-18 0:41 ` Christopher Li
2008-06-20 23:46 ` David Given
2008-06-21 1:40 ` Christopher Li [this message]
2008-06-24 13:29 ` David Given
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=70318cbf0806201840k18a51f94rcaa413b36fcfbbea@mail.gmail.com \
--to=sparse@chrisli.org \
--cc=dg@cowlark.com \
--cc=linux-sparse@vger.kernel.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 NNTP newsgroup(s).