From owner-svn-src-projects@FreeBSD.ORG Fri Jul 1 16:51:53 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 456A4106566C; Fri, 1 Jul 2011 16:51:53 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: from vlakno.cz (lev.vlakno.cz [46.28.110.116]) by mx1.freebsd.org (Postfix) with ESMTP id 054D28FC08; Fri, 1 Jul 2011 16:51:52 +0000 (UTC) Received: by vlakno.cz (Postfix, from userid 1002) id 4261B7F3A8B; Fri, 1 Jul 2011 18:51:51 +0200 (CEST) Date: Fri, 1 Jul 2011 18:51:51 +0200 From: Roman Divacky To: Marcel Moolenaar Message-ID: <20110701165151.GA6877@freebsd.org> References: <201107010329.p613Tn8s071270@svn.freebsd.org> <20110701084224.GA43291@freebsd.org> <00211D6B-F882-43C1-9D93-5ED2D72C5132@xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00211D6B-F882-43C1-9D93-5ED2D72C5132@xcllnt.net> User-Agent: Mutt/1.4.2.3i Cc: svn-src-projects@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org Subject: Re: svn commit: r223705 - projects/llvm-ia64/lib/clang/libllvmjit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2011 16:51:53 -0000 > 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 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