Commit Graph

120 Commits

Author SHA1 Message Date
grischka
fbc8810334 Fix "Add support for struct > 4B returned via registers"
- avoid assumption "ret_align == register_size" which is
  false for non-arm targets
- rename symbol "sret" to more descriptive "ret_nregs"

This fixes commit dcec8673f2

Also:
- remove multiple definitions in win32/include/math.h
2013-12-16 15:38:10 +01:00
Thomas Preud'homme
dcec8673f2 Add support for struct > 4B returned via registers
On ARM with hardfloat calling convention, structure containing 4 fields
or less of the same float type are returned via float registers. This
means that a structure can be returned in up to 4 double registers in a
structure is composed of 4 doubles. This commit adds support for return
of structures in several registers.
2013-11-22 09:27:15 +08:00
grischka
73faaea227 i386-gen: preserve fp control word in gen_cvt_ftoi
- Use runtime function for conversion
- Also initialize fp with tcc -run on windows

This fixes a bug where
  double x = 1.0;
  double y = 1.0000000000000001;
  double z = x < y ? 0 : sqrt (x*x - y*y);
caused a bad sqrt because rounding precision for the x < y comparison
was different to the one used within the sqrt function.

This also fixes a bug where
  printf("%d, %d", (int)pow(10, 2), (int)pow(10, 2));
would print
  100, 99

Unrelated:
  win32: document relative include & lib lookup
  win32: normalize_slashes: do not mirror silly gcc behavior
  This reverts part of commit 8a81f9e103
  winapi: add missing WINAPI decl. for some functions
2013-08-28 22:55:05 +02:00
Thomas Preud'homme
f6b50558fc Add support for load/store of _Bool value
Add support for loading _Bool value in i386, x86_64 and arm as well as
support for storing _Bool value on arm.
2013-06-14 16:19:51 +02:00
grischka
be1b6ba7b7 avoid "decl after statement" please
for compiling tcc with msc
2013-04-30 00:33:34 +02:00
James Lyon
41b3c7a507 Improved variable length array support.
VLA storage is now freed when it goes out of scope. This makes it
possible to use a VLA inside a loop without consuming an unlimited
amount of memory.

Combining VLAs with alloca() should work as in GCC - when a VLA is
freed, memory allocated by alloca() after the VLA was created is also
freed. There are some exceptions to this rule when using goto: if a VLA
is in scope at the goto, jumping to a label will reset the stack pointer
to where it was immediately after the last VLA was created prior to the
label, or to what it was before the first VLA was created if the label
is outside the scope of any VLA. This means that in some cases combining
alloca() and VLAs will free alloca() memory where GCC would not.
2013-04-27 22:58:52 +01:00
James Lyon
ae2ece93da Fixed i386 calling convention issue and CMake build on i386.
The i386 calling convention expects the callee to pop 1 word of the
stack when performing a struct ret.
2013-04-26 00:31:46 +01:00
James Lyon
2bbfaf436f Tests in abitest.c now work on Win32.
I expect that Linux-x86 is probably fine. All other architectures
except ARM are definitely broken since I haven't yet implemented
gfunc_sret for these, although replicating the current behaviour
should be straightforward.
2013-04-18 17:27:34 +01:00
Urs Janssen
0bdbd49eac add version number to manpage
avoid c++/c99 style comments in preprocessor directives
avoid leadings whitespaces in preprocessor directives
mention implemented variable length arrays in documentation
fixed ambiguous option in texi2html call (Austin English)
2013-02-17 00:48:51 +01:00
Kirill Smelkov
ab24aaeca3 i386: We can change 'lea 0(%ebp),r' to 'mov %ebp,r'
Because that mov is 1 byte shorter, look:

    int *func()
    {
        return __builtin_frame_address(0);
    }

before patch:

00000000 <func>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   81 ec 00 00 00 00       sub    $0x0,%esp
   9:   8d 45 00                lea    0x0(%ebp),%eax   // <- here
   c:   e9 00 00 00 00          jmp    11 <func+0x11>
  11:   c9                      leave
  12:   c3                      ret

after patch:

00000000 <func>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   81 ec 00 00 00 00       sub    $0x0,%esp
   9:   89 e8                   mov    %ebp,%eax        // <- here
   b:   e9 00 00 00 00          jmp    10 <func+0x10>
  10:   c9                      leave
  11:   c3                      ret
2012-11-16 10:22:45 +04:00
Daniel Glöckner
9527c4949f i386: fix loading of LLOCAL floats
These loads clobbered ebx as TinyCC wanted to load the address into st0.
2012-01-23 01:45:11 +01:00
Thomas Preud'homme
9c25ed13b4 s/derefencing/dereferencing/ in i386-gen.c 2012-01-08 18:03:17 +01:00
grischka
bf374a5f23 rename error/warning -> tcc_(error/warning) 2011-08-11 17:07:56 +02:00
Kirill Smelkov
87db8b637e chmod a-x i386-gen.c
No need to keep executable bit on plain C source.
2010-06-16 14:37:30 +04:00
U-UNIT1\dennis
d3c432244c generate inc and dec for smaller code 2010-04-03 21:20:34 +03:00
grischka
2341ee5142 tccpe: improve dllimport/export and use for tcc_add_symbol 2010-01-14 20:59:42 +01:00
grischka
88a3ccab9f allow tcc be build from separate objects
If you want that, run: make NOTALLINONE=1
2009-12-20 01:53:49 +01:00
grischka
7fa712e00c win32: enable bounds checker & exception handler
exception handler borrowed from k1w1. Thanks.
2009-12-19 22:22:43 +01:00
grischka
41e112360f fix uninitialized warnings with 'type.ref' 2009-12-19 22:16:22 +01:00
grischka
94bf4d2c22 tccpe: improve dllimport 2009-12-19 22:16:21 +01:00
grischka
1308e8ebcf integrate x86_64-asm.c into i386-asm.c
Also, disable 16bit support for now as it causes bugs
in 32bit mode.  #define I386_ASM_16 if you want it.
2009-12-19 22:16:20 +01:00
grischka
5b113f3ee3 win32: handle __declspec(dllimport) 2009-11-13 18:04:56 +01:00
Shinichiro Hamaji
5dadff3de5 x86-64: Fix stab debug information.
We need 32bit relocations for code and 64bit for debug info.
Introduce a new macro R_DATA_PTR to distinguish the two usages.
2009-08-24 13:30:03 +02:00
grischka
c998985c74 cleanup: constify some global data 2009-07-18 22:07:42 +02:00
grischka
610fd47510 win32: structure return GCC compatible (ret 4 with cdecl) 2009-06-17 02:11:13 +02:00
grischka
f9181416f6 move some global variables into TCCState 2009-05-11 18:45:44 +02:00
Daniel Glöckner
2c657f6608 Set VT_LVAL_xxx flags for function arguments in gfunc_prolog (Daniel Glöckner) 2008-09-12 02:36:32 +02:00
grischka
5342b32eef Switch to newer tccpe.c (includes support for resources) 2007-12-19 17:36:42 +00:00
bellard
38d2e8b9d8 Bug fix: A long long value used as a test expression ignores the upper 32 bits at runtime (Dave Dodge) 2006-10-28 14:10:07 +00:00
bellard
e9c64e3f47 windows style fastcall (Filip Navara) 2005-09-03 22:21:22 +00:00
bellard
09f4ce9857 _Bool type fix 2005-04-17 13:15:31 +00:00
bellard
9825011ced __chkstk support 2005-04-10 22:15:08 +00:00
bellard
c9c05ca5f0 copyright update 2004-10-27 21:38:03 +00:00
bellard
72a88fbab0 primitive fastcall functions support 2004-10-18 00:14:40 +00:00
bellard
3bd3c71fd1 faster (Daniel Glöckner) 2004-10-04 22:06:22 +00:00
bellard
79c72b2419 initial TMS320C67xx support (TK) 2004-10-04 21:57:35 +00:00
bellard
4df5bd2eb0 ARM target support (Daniel Glockner) - allow unsigned char as default on ARM (Daniel Glockner) - fixed small ld script support (Daniel Glockner) 2003-10-14 22:15:56 +00:00
bellard
8f5e44a439 changed license to LGPL 2003-05-24 14:11:17 +00:00
bellard
214ccccea7 simpler function call API 2003-04-16 21:16:20 +00:00
bellard
b5259da4f2 renamed registers 2002-12-08 14:34:48 +00:00
bellard
d1e7e264a5 added MAX_ALIGN 2002-11-24 15:58:50 +00:00
bellard
9620fd18e4 added CType structure for type storage - supressed define hash table - added time dump in bench 2002-11-18 21:46:44 +00:00
bellard
fde824b7cd handle computed gotos 2002-11-03 00:43:01 +00:00
bellard
3748975feb trivial jump size optimization 2002-09-08 22:06:11 +00:00
bellard
431d648096 fixed PC32 relocation if constant address 2002-08-31 12:42:16 +00:00
bellard
d2115bfb27 added symbol + relocation handling 2002-08-29 23:05:59 +00:00
bellard
4891761bc9 realloc text section in code generation 2002-08-18 13:19:18 +00:00
bellard
4c9c0ab114 added size info 2002-07-27 23:08:29 +00:00
bellard
a42941b1f0 use data_offset in sections instead of pointer to ease section reallocation 2002-07-27 14:06:11 +00:00
bellard
58af3a6cd2 moved bcheck.c outside of tcc - optimized add sp code 2002-07-24 22:11:30 +00:00
bellard
6cdecbe4e6 added runtime library - fixed more relocations 2002-07-22 23:37:39 +00:00
bellard
3d902af1a9 moved relocation handling to elf generator 2002-07-22 00:20:57 +00:00
bellard
be44fce9cd added GOT support 2002-07-18 00:51:27 +00:00
bellard
82695ae971 fixed PC32 relocation 2002-07-14 23:00:53 +00:00
bellard
6cd36b1285 added better relocation support (needed for file output) 2002-07-14 14:38:33 +00:00
bellard
264dbcfed2 fixed floating poing compare - use LVAL type - optimized bound checking 2002-07-13 15:55:16 +00:00
bellard
14fb0c49d8 added arg to save_regs() 2002-05-13 23:00:39 +00:00
bellard
4226681d36 added optionnal bound check compile - fixed error reporting 2002-03-03 22:45:55 +00:00
bellard
421911f921 moved i368 specific code 2002-02-10 16:13:14 +00:00
bellard
621b3fc3b5 stdcall added + floating point fixes 2002-01-26 17:23:44 +00:00
bellard
b7fed2f2d4 added local bound generation - fixed binary ops - added bound check dereference 2002-01-05 16:17:34 +00:00
bellard
14799da838 suppressed some buffer overflows - moved function generation to cpu specific code (XXX: should have less cpu specific code for that) 2002-01-03 22:43:10 +00:00
bellard
1465899342 added full long long support - added section support - added __attribute__ parsing - added -U option 2002-01-03 21:14:59 +00:00
bellard
21c35b9443 use register classes (will allow better and simpler code gen - fixed long double handling 2001-12-23 00:34:26 +00:00
bellard
498551188e last patches to separate type and value handling 2001-12-22 17:05:23 +00:00
bellard
f7181903bb separated type and value on stack 2001-12-20 01:05:21 +00:00
bellard
2694c10547 float update 2001-12-17 21:56:48 +00:00
bellard
fbc51a39f9 new value stack system to handle the futur types (long long and floats) 2001-12-16 17:58:32 +00:00
bellard
25618c0430 float parsing + long double 2001-12-13 22:28:53 +00:00
bellard
3917389449 separated i386 code generator 2001-12-12 21:16:34 +00:00