Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jul 2011 18:51:51 +0200
From:      Roman Divacky <rdivacky@freebsd.org>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        svn-src-projects@freebsd.org, Marcel Moolenaar <marcel@freebsd.org>, src-committers@freebsd.org
Subject:   Re: svn commit: r223705 - projects/llvm-ia64/lib/clang/libllvmjit
Message-ID:  <20110701165151.GA6877@freebsd.org>
In-Reply-To: <00211D6B-F882-43C1-9D93-5ED2D72C5132@xcllnt.net>
References:  <201107010329.p613Tn8s071270@svn.freebsd.org> <20110701084224.GA43291@freebsd.org> <00211D6B-F882-43C1-9D93-5ED2D72C5132@xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> The following open items are on my mind:
> 
> 1.  On ia64, function prologues allocate a register frame that has
>     enough (stacked) registers for local scratch registers and 
>     outgoing function arguments. This means that I need to know
>     (after register allocation) how many (unique) scratch registers
>     are in use and what the largest number of arguments that need
>     to be passed in registers to children (the max being 8). Without
>     this information the compiler is forced to allocate the maximum
>     size (which is 96 stacked registers, of which 8 are outgoing).
>     This obviously eats into the register stack and probably causes
>     runtime failures on deep call chains.
 
I recommend you to do this little experiment (on amd64 or so):

pes ~$ cat test.c
void foo(int i) {
  printf("foo %i\n", i);
}

int main(int agc, char **argv)
{
  printf("hello world\n");
  for (unsigned i = 0; i < 5; ++i)
    foo(i);

}
pes ~$ clang -emit-llvm -c test.c                                                                                                                 test.c:2:3: warning: implicitly declaring C library function 'printf' with type 'int (const char *, ...)'
  printf("foo %i\n", i);
  ^
test.c:2:3: note: please include the header <stdio.h> or explicitly provide a declaration for 'printf'
1 warning generated.
pes ~$ llc -debug test.o

the llc -debug will show you a lot of interesting information on how llvm handles this code.
Among others you'll find there:

# Machine code for function foo:
Frame Objects:
  fi#0: size=4, align=4, at location [SP+8]
Function Live Ins: %EDI in %vreg0

I believe this is what you asked.


> 2.  [C++] vtable entries are not function pointers like on other
>     architectures. They are function descriptors. I think Nathan
>     said that PowerPC64 also have function descriptors. Anyway,
>     Duraid Madina (the author of the original ia64 backend) said
>     that support for this was missing from LLVM. I don't know if
>     this has changed in the mean time or whether I need to go
>     down into the bowels of LLVM and add support for this.

I would forget about C++ for now.

roman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110701165151.GA6877>