[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] How to optimize compiling sizeof const?
From: |
YX Hao |
Subject: |
[Tinycc-devel] How to optimize compiling sizeof const? |
Date: |
Tue, 29 Jul 2014 19:11:24 +0800 |
Hi there,
We know that tcc generates bigger binary file than gcc for non-small projects.
But I'm not meaning the optimization options.
Here I find the titled issue when I compile an html5 library (Google's
"gumbo"). In the compiled object file and linked binary file, that of tcc you
can find the string to be calculated size of is stored, and you will see it
will not be used with a debugger, while gcc generates clean file with smaller
size. The attached file is a piece of code for testing.
For non-small projects, I think, the way of using "sizeof" like this could be
common. And hundreds or thousands of words can result in a considerable size.
Hope we can improve tcc in any aspect. Please consider this issue.
I only find out where it occurs, but can't tell why.
-------------------------------------------------------------------------
static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
int has_init, int v, char *asm_label,
int scope)
{
...
size = type_size(type, &align); /* <-- get a zero */
tok_str_new(&init_str);
if (size < 0 || (flexible_array && has_init)) {
...
decl_initializer(type, NULL, 0, 1, 1); /* <-- will store the str */
...
}
...
}
-------------------------------------------------------------------------
Regards,
YX Hao
test_compiling_sizeof.c
Description: Text document
- [Tinycc-devel] How to optimize compiling sizeof const?,
YX Hao <=