All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Pekka Enberg <penberg@kernel.org>
Cc: Christopher Li <sparse@chrisli.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: suggestion for Merging LLVM
Date: Tue, 22 Nov 2011 15:32:55 -0500	[thread overview]
Message-ID: <4ECC06F7.8040006@garzik.org> (raw)
In-Reply-To: <1321941674.1428.124.camel@jaguar>

On 11/22/2011 01:01 AM, Pekka Enberg wrote:
> On 11/21/2011 09:43 PM, Christopher Li wrote:
>> FWIW I am sorta stuck; cannot figure out how to make 'phi' operation in
>> LLVM work the way we need it to.  That is a crucial hurdle needed for
>> loops.  LLVM fundamentally should be able to do it, but I'm not sure
>> this works within the C API.  I was thinking my next step would be to
>> whine on the llvm list.
>>
>> A workaround is to resuscitate unssa() call, and all that entails.
>
> Did you check what kind of code http://llvm.org/demo/ generates for your
> test case? I've noticed that LLVM is really picky sometime in what it
> accepts as input. IIRC last time I looked at loops, there were some
> significant differences in the asm we generate.


The disassembler output is certainly sane and understandable.  Here's an 
example test case:

	extern int bar(int x);
	
	int foo (int x)
	{
	  int y = 0;
	  while (y < 1000) {
	    y += bar(x);
	  }
	
	  return y;
	}

The PHI operation in SSA being a union of control flows, we need to 
reference all input pseudos ... including pseudos generated by 
operations further down the in the code (i.e. pseudos not yet generated).

A classic forward reference is needed, and I cannot figure out how to do 
that in the LLVM C API, even though the forward reference is plain and 
obvious in the LLVM text disassembly.  My next step was going to trace 
through the front end to see how it generates forward refs, or be lazy 
and brain dump on an llvm mailing list somewhere.

Problems like this were the original motivation for my earlier LLVM 
backend to generate ASCII text.  I could work around this problem with 
an ugly string-based hack, if not using the C API... ;)

	Jeff





  reply	other threads:[~2011-11-22 20:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22  2:43 suggestion for Merging LLVM Christopher Li
2011-11-22  5:52 ` Jeff Garzik
2011-11-22  6:01   ` Pekka Enberg
2011-11-22 20:32     ` Jeff Garzik [this message]
2011-11-22 20:38       ` Pekka Enberg
2011-11-23  4:11         ` Jeff Garzik
2011-11-23  6:01         ` Jeff Garzik
2011-11-23  6:58           ` Pekka Enberg
2011-11-25  1:45     ` Christopher Li
2011-11-25  2:25       ` Jeff Garzik
2011-11-25  5:52         ` Pekka Enberg
2011-11-25  6:28           ` Christopher Li
2011-11-25  6:43             ` Pekka Enberg
2011-11-25  8:05               ` Christopher Li
2011-11-25  8:29                 ` Pekka Enberg
2011-11-25 17:52                 ` Jeff Garzik
2011-11-25 19:13                   ` Christopher Li
2011-11-25 20:18                     ` Jeff Garzik
2011-11-25 20:30                       ` Christopher Li
2011-12-13 20:29                         ` Pekka Enberg
2011-12-15 21:34                           ` Christopher Li
2011-12-20  8:53                             ` Pekka Enberg

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=4ECC06F7.8040006@garzik.org \
    --to=jeff@garzik.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=penberg@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.