Re: the interface for cloning function

2011-06-16 Thread Richard Henderson
On 06/15/2011 10:20 AM, Feng LI wrote:
> Hi,
> 
> Is there an interface provided in GCC to clone the current function?
> I searched in the source code but failed, just in case I'm going wrong.

Try cgraph_copy_node_for_versioning.

It's not 100% generic atm; you may find that you have to make
some changes to it depending on what you're doing exactly.
C.f. the transactional-memory branch.


r~


[gimplefe] Merged trunk -> gimple-front-end rev 175051

2011-06-16 Thread Diego Novillo
Tested on x86_64.


Diego.


Re: the interface for cloning function

2011-06-16 Thread Martin Jambor
Hi,

On Wed, Jun 15, 2011 at 07:20:47PM +0200, Feng LI wrote:
> Hi,
> 
> Is there an interface provided in GCC to clone the current function?
> I searched in the source code but failed, just in case I'm going wrong.
> 

There are at least two.  If you want to clone from within an ordinary
intra-procedural pass (as presented to our pass manager), you are
probably after cgraph_function_versioning.  If, on the other hand you
want to make clones in an inter-procedural stage of an IPA pass, you
probably want cgraph_create_virtual_clone.

HTH

Martin


gcc-4.5-20110616 is now available

2011-06-16 Thread gccadmin
Snapshot gcc-4.5-20110616 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.5-20110616/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 4.5 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_5-branch 
revision 175123

You'll find:

 gcc-4.5-20110616.tar.bz2 Complete GCC

  MD5=ce3948b88da51016ca820a9d41b8b364
  SHA1=42f9186c1b9b7f5b14f2ea3e3214da9258a38a18

Diffs from 4.5-20110609 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-4.5
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


Re: Generate annotations for a binary translator

2011-06-16 Thread 陳韋任
> But where do you want that information to be at runtime?
> 
> The hard part is not getting the information at compile time.  The
> information is readily available after register allocation.  Heck, you
> can see right in the dump files; e.g., use -da when you compile and look
> at the pro_and_epilogue dump file.
> 
> The hard part is getting that information to be available at runtime.

  Recently I have read about GCC LTO. Somehow I feel there are some
similarities between what LTO does and what I want to do. The major
difference between them is LTO dump GIMPLE bytecode into the object
file, and what I (binary translator) want is not so high-level
information.

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667


Generate annotations for a binary translator - loop boundry

2011-06-16 Thread 陳韋任
Hi, all

  I am studying on what kind of information a compiler can pass to a
binary translator (QEMU, for example) so that the binary translator
can do much aggressive optimization. Previous discussion [1] gave an
example on what I want to do. And in the end of the discussion, it
showed that GCC is unable to maintain CFG until emitting the assembly.

  Here I want to know if we can get a loop boundry from GCC, for
example, address 0x0010 and 0x0020 are a loop start and end
respectively. Currently, our binary translator associates a backward
branch with a loop. I don't know if this simple heuristic can identify
all loops, at least for binary generated by GCC. There are studies
argued above heuristic might not work as expected because compiler
might perfom hot-cold optimization and code repositioning which result
in backward branches that are NOT loop-back branches.

  I also asked a similar question on the LLVM mailing list [2].

"What I want to do is to locate the range of a for-loop statement in
a binary. For example, given a for-loop statement belows, 

for (stat1; stat2; stat3) {
  /* do something */
}

  Is it possible to get information about the range (binary address)
of the above for-loop, say, 0x0100 - 0x0120."

It concluded that various optimizations may reorder the code. And one
possible way to disable those optimizations is to insert inline assembly
symbol before and after the loop.

  Any comment appreciated. 

Regards,
chenwj

[1] http://www.mail-archive.com/gcc@gcc.gnu.org/msg58152.html
[2] http://markmail.org/thread/a2ze4v7o4ez64xmd

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667


Re: X32 project status update

2011-06-16 Thread H.J. Lu
Hi,

This is the x32 project status update:

https://sites.google.com/site/x32abi/

With the latest x32 kernel, glibc, gcc and gdb, everything
works, including core dump and vDSO.

I'd like to see x32 kernel system call numbers be finalized
so that people don't have to recompile everything if the final
x32 kernel system call numbers are different from the current
one.

I started to prepare merging GCC x32 branch with trunk followed
by glibc and gdb patches.  I have sent 7 middle-end patches so
far. I got feedbacks on 3 of them.  I checked in one patch.  I
provided one update and I am investigating the 3rd feedback.
I have more middle-end patches.

-- 
H.J.