Commit f88523e5 by Nathan Sidwell Committed by Nathan Sidwell

tree.h (crc32_unsigned_n): Declare.

	* tree.h (crc32_unsigned_n): Declare.
	(crc32_unsigned, crc32_unsigned): Make inline.
	* tree.c (crc32_unsigned_bits): Replace with ...
	(crc32_unsigned_n): ... this.
	(crc32_unsigned, crc32_byte): Remove.
	(crc32_string): Remove unnecessary braces.

From-SVN: r247281
parent ffb77fd6
2017-04-26 Nathan Sidwell <nathan@acm.org>
* tree.h (crc32_unsigned_n): Declare.
(crc32_unsigned, crc32_unsigned): Make inline.
* tree.c (crc32_unsigned_bits): Replace with ...
(crc32_unsigned_n): ... this.
(crc32_unsigned, crc32_byte): Remove.
(crc32_string): Remove unnecessary braces.
2017-04-25 Jan Hubicka <hubicka@ucw.cz> 2017-04-25 Jan Hubicka <hubicka@ucw.cz>
* ipa-cp.c (estimate_local_effects): Convert sreal to int. * ipa-cp.c (estimate_local_effects): Convert sreal to int.
......
...@@ -9611,38 +9611,34 @@ dump_tree_statistics (void) ...@@ -9611,38 +9611,34 @@ dump_tree_statistics (void)
#define FILE_FUNCTION_FORMAT "_GLOBAL__%s_%s" #define FILE_FUNCTION_FORMAT "_GLOBAL__%s_%s"
/* Generate a crc32 of a byte. */ /* Generate a crc32 of the low BYTES bytes of VALUE. */
static unsigned unsigned
crc32_unsigned_bits (unsigned chksum, unsigned value, unsigned bits) crc32_unsigned_n (unsigned chksum, unsigned value, unsigned bytes)
{ {
unsigned ix; /* This relies on the raw feedback's top 4 bits being zero. */
#define FEEDBACK(X) ((X) * 0x04c11db7)
for (ix = bits; ix--; value <<= 1) #define SYNDROME(X) (FEEDBACK ((X) & 1) ^ FEEDBACK ((X) & 2) \
^ FEEDBACK ((X) & 4) ^ FEEDBACK ((X) & 8))
static const unsigned syndromes[16] =
{ {
unsigned feedback; SYNDROME(0x0), SYNDROME(0x1), SYNDROME(0x2), SYNDROME(0x3),
SYNDROME(0x4), SYNDROME(0x5), SYNDROME(0x6), SYNDROME(0x7),
feedback = (value ^ chksum) & 0x80000000 ? 0x04c11db7 : 0; SYNDROME(0x8), SYNDROME(0x9), SYNDROME(0xa), SYNDROME(0xb),
chksum <<= 1; SYNDROME(0xc), SYNDROME(0xd), SYNDROME(0xe), SYNDROME(0xf),
chksum ^= feedback; };
} #undef FEEDBACK
return chksum; #undef SYNDROME
}
/* Generate a crc32 of a 32-bit unsigned. */ value <<= (32 - bytes * 8);
for (unsigned ix = bytes * 2; ix--; value <<= 4)
unsigned {
crc32_unsigned (unsigned chksum, unsigned value) unsigned feedback = syndromes[((value ^ chksum) >> 28) & 0xf];
{
return crc32_unsigned_bits (chksum, value, 32);
}
/* Generate a crc32 of a byte. */ chksum = (chksum << 4) ^ feedback;
}
unsigned return chksum;
crc32_byte (unsigned chksum, char byte)
{
return crc32_unsigned_bits (chksum, (unsigned) byte << 24, 8);
} }
/* Generate a crc32 of a string. */ /* Generate a crc32 of a string. */
...@@ -9651,9 +9647,7 @@ unsigned ...@@ -9651,9 +9647,7 @@ unsigned
crc32_string (unsigned chksum, const char *string) crc32_string (unsigned chksum, const char *string)
{ {
do do
{ chksum = crc32_byte (chksum, *string);
chksum = crc32_byte (chksum, *string);
}
while (*string++); while (*string++);
return chksum; return chksum;
} }
......
...@@ -4688,9 +4688,18 @@ inlined_function_outer_scope_p (const_tree block) ...@@ -4688,9 +4688,18 @@ inlined_function_outer_scope_p (const_tree block)
function_args_iter_next (&(ITER))) function_args_iter_next (&(ITER)))
/* In tree.c */ /* In tree.c */
extern unsigned crc32_unsigned_n (unsigned, unsigned, unsigned);
extern unsigned crc32_string (unsigned, const char *); extern unsigned crc32_string (unsigned, const char *);
extern unsigned crc32_byte (unsigned, char); inline unsigned
extern unsigned crc32_unsigned (unsigned, unsigned); crc32_unsigned (unsigned chksum, unsigned value)
{
return crc32_unsigned_n (chksum, value, 4);
}
inline unsigned
crc32_byte (unsigned chksum, char byte)
{
return crc32_unsigned_n (chksum, byte, 1);
}
extern void clean_symbol_name (char *); extern void clean_symbol_name (char *);
extern tree get_file_function_name (const char *); extern tree get_file_function_name (const char *);
extern tree get_callee_fndecl (const_tree); extern tree get_callee_fndecl (const_tree);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment