Is it possible to make gcc detect whether printf prints floating point numbers?

2012-06-08 Thread Bin.Cheng
Hi all,
In micro-controller applications, code size is critical and the size
problem is worse if library is linked.
For example, most c programs call printf to format output data, that
means floating point code get linked even the program only want to
output non-floating point numbers. Currently, we rely on end-user to
call iprintf if the program does not want floating point.

I noticed that GCC now can check format string of printf functions, so
I am wondering if it is possible to take advantage of this utility, by
making gcc detect whether printf prints floating point number and then
generate assembly directive in backend to pull in floating point
functions only if necessary.

The problem is:
The check is done in front end, so how should I expose the check
result to back-end. Is there any hook utility?

In the future, could this feature be supported by GCC in upstream? I
assuming mcu backends may have interests in this.

Thanks very much.
-- 
Best Regards.


HARD_REGNO_CALL_PART_CLOBBERED question (PR53595)

2012-06-08 Thread Georg-Johann Lay

I observed that HARD_REGNO_CALL_PART_CLOBBERED gets called with
hard registers that HARD_REGNO_MODE_OK would reject.

Is it save to set HARD_REGNO_CALL_PART_CLOBBERED to FALSE for
hard registers for which HARD_REGNO_MODE_OK is FALSE?

Background is PR53593 where I see a code size increase of +10%
for avr.

HARD_REGNO_CALL_PART_CLOBBERED gets called with REGNO=29, MODE=HI
This register is not a valid hard register because HI regs must
start with even register numbers.

If it /was/ valid, then HARD_REGNO_CALL_PART_CLOBBERED should
return TRUE for HI:29. That is what the hook macro currently does.

However, if the hook macro is defined like so,
then the performance regression goes away:

#define HARD_REGNO_CALL_PART_CLOBBERED(REGNO, MODE) \
  (HARD_REGNO_MODE_OK (REGNO, MODE)
   && (more conditions))


Questions:

1:
Is it save to define the macro like that?
I.e. return FALSE for a register that is invalid
but would be call-part-clobbered if it was valid?

2:
What's the point of calling the macro with invalid hard register?
I can understand this to keep the call sites simple, but I don't
understand why changing the properties for an invalid hard register
affects code generation that much.

Thanks, Johann



How to walk a const_tree?

2012-06-08 Thread Georg-Johann Lay
When calling walk_tree in a hook that gets a node passed
as const_tree, the const qualifier must be kicked off
somehow in order to get get of build warning.


Currently I have the following hook implementation for
TARGET_ASM_DECLARE_CONSTANT_NAME:

static void
avr_asm_declare_constant_name (FILE *file, const char *name,
   const_tree expr, HOST_WIDE_INT size)
{
  /* FIXME: Is there a way to get rid of the const without using
 inside knowledge of tree resp. const_tree?  */

  tree node = CONST_CAST (union tree_node*, expr);

  walk_tree_without_duplicates (&node, avr_walk_initializer_r, NULL);

  default_asm_declare_constant_name (file, name, expr, size);
}


Is there a better way without using the insides of a tree?

Thanks



unique lines in test summaries

2012-06-08 Thread Janis Johnson
I'd like to eliminate duplicate messages in test summary files.  Some of
these are from tests that check for multiple error or warning messages
on the same line of source code, some are from misused torture options,
and some are from scans that don't report torture options.  All of the
ones I've found so far can be cleaned up to allow the same tests to run
with additional information in result lines so they're all unique.

The one drawback to fixing this is that comparisons with older test
results will show the changed summary lines.  I think the long-term
benefits of unique lines in test summaries far outweighs the short-term
pain, but I'd like to make sure others share that view before I start
submitting patches.  Thoughts?

Janis


Re: unique lines in test summaries

2012-06-08 Thread Diego Novillo

On 12-06-08 13:40 , Janis Johnson wrote:


I think the long-term benefits of unique lines in test summaries far outweighs 
the short-term
pain


Absolutely.  Thanks for doing this.


Diego.


gcc-4.6-20120608 is now available

2012-06-08 Thread gccadmin
Snapshot gcc-4.6-20120608 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.6-20120608/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

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

You'll find:

 gcc-4.6-20120608.tar.bz2 Complete GCC

  MD5=45e6229ae3276979286b995303759597
  SHA1=8c217495625ae0a44c5fad3442c616de0aeed178

Diffs from 4.6-20120601 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-4.6
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.