Displaying 20 results from an estimated 20000 matches similar to: "[LLVMdev] First class function pointers"
2009 Feb 06
0
[LLVMdev] First class function pointers
On Feb 5, 2009, at 3:42 PM, Jon Harrop wrote:
>
> Unless I am mistaken, LLVM barfs if I try to pass an LLVM function
> to another
> function as an argument because functions are second class.
Huh? can you give an example as llvm IR? You can certainly pass
functions by-value as a function pointer.
-Chris
2009 Feb 06
1
[LLVMdev] First class function pointers
On Friday 06 February 2009 03:33:57 Chris Lattner wrote:
> On Feb 5, 2009, at 3:42 PM, Jon Harrop wrote:
> > Unless I am mistaken, LLVM barfs if I try to pass an LLVM function
> > to another
> > function as an argument because functions are second class.
>
> Huh? can you give an example as llvm IR? You can certainly pass
> functions by-value as a function pointer.
2009 Nov 25
3
[LLVMdev] Possible bug in TCO?
My compiler is generating a bunch of code including the following line:
%57 = call fastcc i32 @aux(%1* %0, %1 %1, %1 %46, i32 0, %4 %2) ; <i32>
[#uses=1]
ret i32 %57
The program works fine as long as this isn't a tail call. If I compile via
a .ll and insert "tail" by hand, the program segfaults. However, if I make it
a tail call and return an undef i8* or void instead
2009 Feb 24
4
[LLVMdev] Broke my tail (call)
On Tue, Feb 24, 2009 at 11:50 AM, Jon Harrop <jon at ffconsultancy.com> wrote:
> Thanks for the clarification. That makes a lot more sense!
>
> LLVM's support for structs is wonderful but I don't think they can be
> called "first-class structs" until all such arbitrary restrictions have been
> removed, even though the workaround (using sret form) is trivial
2009 Feb 22
3
[LLVMdev] Broke my tail (call)
I have written a variety tests of tail calls for my HLVM and all passed with
flying colors until I wrote this test (which is actually for algebraic
datatypes) and discovered that it segfaults after ~100k iterations through
what I think should be a tail call. Here's the IR:
define fastcc { { i8*, i8* }*, i8* } @init({ { i8*, i8* }*, i8* }, i32) {
entry:
%2 = alloca { i32, { { i8*,
2009 Nov 13
2
[LLVMdev] opt -std-compile-opts breaks tail calls
On Friday 13 November 2009 04:57:43 David Terei wrote:
> I've run into some issues with tail calls in the past, make sure you
> are doing the following:
>
> 1. Call should be marked with tail (obviously)
> 2. Next statement after tail call should be 'return void'
> 3. Use fast call convention for tail calls
> 4. Make sure the function you are calling doesn't
2009 Nov 20
2
[LLVMdev] llc barfing
I was playing with optimization switches to llc to see how fast I could get it
to compile but it keeps barfing. Tinkering indicates that llc barfs
particularly when -tailcallopt is given in combination with other flags. For
example, without -tailcallopt works in a couple of ways:
$ llc -O0 -f aout.bc -o aout.s
$ llc -O0 --regalloc=local -f aout.bc -o aout.s
But fails with -tailcallopt with
2009 Feb 23
3
[LLVMdev] Broke my tail (call)
On Mon, Feb 23, 2009 at 2:13 PM, Jon Harrop <jon at ffconsultancy.com> wrote:
> Moreover, I now have evidence that LLVM is not behaving as you expect:
>
> 3. Adjusting the return value from this function into sret form results in
> tail call elimination being performed correctly. Note that this is still
> passing a first-class struct by value as an argument to a function
2009 Mar 28
0
[LLVMdev] Broke my tail (call)
On Tuesday 24 February 2009 14:54:12 Arnold Schwaighofer wrote:
> On Tue, Feb 24, 2009 at 11:50 AM, Jon Harrop <jon at ffconsultancy.com> wrote:
> > Thanks for the clarification. That makes a lot more sense!
> >
> > LLVM's support for structs is wonderful but I don't think they can be
> > called "first-class structs" until all such arbitrary
2009 Feb 01
7
[LLVMdev] GEPping GEPs and first-class structs
As I understand it, first-class structs will allow structs to be passed as
function arguments and returned as results (i.e. multiple return values)
instead of passing pointers to structs. However, the GEP instruction only
handles pointer types. So I do not understand how you will be able to extract
the fields of a struct when it is received as a value type.
Will the GEP instruction be altered
2010 Jan 07
6
[LLVMdev] First-class aggregate semantics
On 01/07/2010 01:38 PM, David Greene wrote:
> The way this works on many targets is that the caller allocates stack
> space in its frame for the returned struct and passes a pointer to it
> as a first "hidden" argument to the callee. The callee then copies
> that data into the space pointed to by the address.
<nod>
> Long-term, first-class status means that
2010 Jan 08
0
[LLVMdev] First-class aggregate semantics
On Thursday 07 January 2010 21:56:11 Dustin Laurence wrote:
> On 01/07/2010 01:38 PM, David Greene wrote:
> > The way this works on many targets is that the caller allocates stack
> > space in its frame for the returned struct and passes a pointer to it
> > as a first "hidden" argument to the callee. The callee then copies
> > that data into the space pointed
2009 Feb 24
0
[LLVMdev] Broke my tail (call)
On Monday 23 February 2009 16:14:57 Arnold Schwaighofer wrote:
> The problem has to do with how struct returns are represented
> internally by llvm (in the SelectionDAG) and how the tail call
> optimization implementation checks if it may perform the tail call.
> The implementation checks that the <call> node is immediately followed
> by a <ret> node. A struct return
2009 Nov 13
0
[LLVMdev] opt -std-compile-opts breaks tail calls
On Nov 13, 2009, at 3:34 AM, Jon Harrop wrote:
>> Point 4 is the one that caused me trouble for some time.
>> Unfortunately
>> it causes a bad interaction with the optimiser, specifically the
>> 'simplifycfg' pass. What seems to happen is that since the function
>> you are calling is marked with 'noreturn', the simplifycfg pass will
>> then
2008 Dec 18
2
[LLVMdev] Mixing calling conventions
Are you not supposed to be able to call a FastCC function from a CCC function?
I'm calling a CCC "main" function from OCaml and that "main" function calls
internal functions that require tail calls. With CCC everywhere it works
(except I don't get tail calls). If I use FastCC on all functions
except "main" then the function arguments are garbage.
Should I
2009 Feb 19
6
[LLVMdev] Improving performance with optimization passes
I'm toying with benchmarks on my HLVM and am unable to get any performance
improvement from optimization passes. Moreover, some of my programs generate
a lot of redundant code (e.g. alloca a struct, store a struct into it and
read only one field without using the rest of the struct) and this does not
appear to be optimized away.
I simply copied the use of PassManager from the Kaleidoscope
2010 Jan 04
2
[LLVMdev] Tail Call Optimisation
On Sun, Jan 3, 2010 at 10:50 PM, Jon Harrop <jon at ffconsultancy.com> wrote:
> On Monday 04 January 2010 03:33:06 Simon Harris wrote:
>> On 04/01/2010, at 3:01 PM, Jon Harrop wrote:
>> > I am certainly interested in tail calls because my HLVM project relies
>> > upon LLVM's tail call elimination. However, I do not understand what tail
>> > calls LLVM
2008 Dec 16
4
[LLVMdev] First-class structs
Apologies for the dumb questions but I'm rustier than I had hoped on this.
I'm trying to write a mini ML implementation and am considering trying to
optimize tuples into structs to avoid heap allocation when possible. Tuples
are often used to return multiple values in ML so I am likely to wind up
returning structs from functions.
I also want to support as much of a C-like
2010 Jan 04
0
[LLVMdev] Tail Call Optimisation
On Monday 04 January 2010 05:16:40 Jeffrey Yasskin wrote:
> On Sun, Jan 3, 2010 at 10:50 PM, Jon Harrop <jon at ffconsultancy.com> wrote:
> > LLVM's TCO already handles mutual recursion.
>
> Only for fastcc functions
Yes.
> compiled with -tailcallopt, right?
If you use the compiler, yes.
> http://llvm.org/docs/CodeGenerator.html#tailcallopt
>
> I believe
2009 Feb 23
3
[LLVMdev] Broke my tail (call)
Hello Duncan and Jon,
I am the criminal responsible for the tail call implementation in the backends.
On Mon, Feb 23, 2009 at 9:17 AM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Jon,
>
>> >From what I have understood of the LLVM docs about when tail calls get
>> eliminated on x86 and x64 it should be a tail call, yes.
See below.
> this list is for the code