aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* x86-64-asm: Add mov[sz]xq opcodesMichael Matz2016-05-123-1/+14
| | | | This adds the zero/sign-extending opcodes with 64bit destinations.
* x86-64-asm: Clean up 64bit immediate supportMichael Matz2016-05-115-24/+39
| | | | | | | | | Fix it to actually be able to parse 64bit immediates (enlarge operand value type). Then, generally there's no need for accepting IM64 anywhere, except in the 0xba+r mov opcodes, so OP_IM is unnecessary, as is OPT_IMNO64. Improve the generated code a bit by preferring the 0xc7 opcode for im32->reg64, instead of the im64->reg64 form (which we therefore hardcode).
* x86-asm: Get rid of is_short_jumpMichael Matz2016-05-111-7/+4
| | | | Can be implemented differently.
* x86-asm: Remove old ASM_16 codeMichael Matz2016-05-112-207/+6
| | | | | | This code was inactive since a long time (and was deactivated because it was wrong to start with) and just clutters the sources. Remove it.
* x86-64: Run asmtest as wellMichael Matz2016-05-112-13/+31
| | | | | This fixes and activates the asm test that's part of tcctest.c also on x86-64, requiring a small fix for the 'm' constraint.
* tests: Compile asmtest.S without -m32Michael Matz2016-05-111-1/+1
| | | | | Don't hardcode that option, if you want it do make CC="gcc -m32". The test assembles with -m64 as well now.
* x86-64 asm: Remove useless jmp opcodeMichael Matz2016-05-113-8/+1
| | | | | Also remove the hacky mod/rm byte emission during disp/imm writing.
* x86: Improve cmov handlingMichael Matz2016-05-114-9/+11
| | | | | cmov can accept multi sizes, but is also a OPC_TEST opcode, deal with this.
* x86_64: Use addend on relocsMichael Matz2016-05-092-19/+14
| | | | | | | | | | | | Traditional behaviour on x86-64 is to encode the relocation addend in r_addend, not in the relocated field (after all, that's the reason to use RELA relocs to begin with). Our linker can deal with both, other linkers as well. But using e.g. the GNU assembler one can detect differences (equivalent code in the end, but still a difference). Now there's only a trivial difference in tests/asmtest.S (having to do with ordering of prefixes).
* [x86] Fix some asm problemsMichael Matz2016-05-095-47/+168
| | | | | | | | | | | A bag of assembler fixes, to be either compatible with GAS (e.g. order of 'test' operands), accept more instructions, count correct foo{bwlq} variants on x86_64, fix modrm/sib bytes on x86_64 to not use %rip relative addressing mode, to not use invalid insns in tests/asmtest.S for x86_64. Result is that now output of GAS and of tcc on tests/asmtest.S is mostly the same.
* Insert spaces between certain tokens when tcc is invoked with -E.Edmund Grimley Evans2016-05-094-3/+78
| | | | | | Insert a space when it is required to prevent mistokenisation of the output, and also in a few cases where it is not strictly required, imitating GCC's behaviour.
* TOK_PPNUM in asm (Edmund Grimley Evans version)seyko2016-05-081-0/+1
|
* tccgen: scopes levels for local symbols (update 2)grischka2016-05-063-17/+21
| | | | | | | allow typedef int xxx; typedef int xxx; in the same scope as long as it is the same type
* tccgen: scopes levels for local symbols (update 1)grischka2016-05-055-11/+19
| | | | | | | Catch top level redeclarations too. Also fix mistakes in tcctest.c and the tcc sources (win32) showing up now.
* tccpp: cleanup options -dD -dM, remove -Cgrischka2016-05-055-246/+198
| | | | | | | The lexer is for reading files, not for writing. Also : - macro_is_equal(): avoid crash if redefining __FILE__
* tccgen: scope levels for local symbolsgrischka2016-05-053-26/+30
| | | | | | | | | | | | | | | | | | ... for fast redeclaration checks Also, check function parameters too: void foo(int a) { int a; ... } Also, try to fix struct/union/enum's on different scopes: { struct xxx { int x; }; { struct xxx { int y; }; ... }} and some (probably not all) combination with incomplete declarations "struct xxx;" Replaces 2bfedb18675228c3837c23fa523231f55e102c12 and 07d896c8e5d1b46bf4aebd403c78e5f7ffebe02a Fixes cf95ac399cbce1ea8a519f91dd36a5cfd4ea7943
* tests/tests2/Makefile: Make 85-asm-outside-function Intel-only.Edmund Grimley Evans2016-05-041-0/+3
|
* Revert 78e4ee5.Edmund Grimley Evans2016-05-041-34/+9
|
* Revert 3283c26 and a1c1390 in tccpp.c.Edmund Grimley Evans2016-05-041-46/+4
|
* sym_push2 optimized for the local_stack case.seyko2016-05-041-3/+3
| | | | | | | | | | | | | | | | | A constant expression removed from the loop. If subroutine have 50000+ local variables, then currently compilation of such code takes obly 15 sec. Was 2 min. gcc-4.1.2 compiles such code in 7 sec. pcc -- 3.44 min. A test generator: #include <stdio.h> int main() { puts("#include <stdio.h>"); puts("int main()"); puts("{"); for (int i = 0; i < 50000; ++i) printf("int X%d = 1;\n", i); for (int i = 0; i < 50000; ++i) puts("scanf(\"%d\", &X0);"); puts("}"); return 0; }
* -fno-type-redefinition-checkseyko2016-05-043-5/+9
| | | | | | | | | | | | | don't catch redefinition for local vars. With this option on tcc accepts the following code: int main() { int a = 0; long a = 0; } But if you shure there is no problem with your local variables, then a compilation speed can be improved if you have a lots of the local variables (50000+)
* PP_NUM in ASM modeseyko2016-05-041-9/+34
| | | | | | oxe+1 is parsed as 0xe +1 if (parse_flags & PARSE_FLAG_ASM_FILE) Helps to compile a code: __asm__("mov $0xe" "+1", "%eax\n")
* x86-asm: Fix lcall/ljmp, xchg and inc/decMichael Matz2016-05-032-8/+6
| | | | | | | Various x86 asm fixes: 64bit lcall/ljmp like 32bit a commit before, xchgw accepted wrong operands on 32 and 64bit, and 64bit used 0x40/0x48+reg for incw/decw, but those are REX prefixes, not instructions.
* i386-asm: correct lcall/ljmp encodingMichael Matz2016-05-021-2/+2
| | | | The 0xff/3 form of lcall needs a mod/rm byte, so reflect this.
* __asm__() outside functionseyko2016-05-013-0/+17
| | | | | | | | gcc/pcc allow __asm__() outside a function body: extern void vide(void); __asm__("vide: ret"); There is many such code in the Linux kernels.
* lcall hex code correctionseyko2016-05-011-1/+1
|
* clearing "output space after TOK_PPNUM ..."seyko2016-05-011-23/+20
|
* output space after TOK_PPNUM which followed by '+' or '-'seyko2016-05-019-9/+114
| | | | | | * correct -E output for the case ++ + ++ concatenation do this only for expanded from macro string and only when tcc_state->output_type == TCC_OUTPUT_PREPROCESS
* tccpp: macro subst fixgrischka2016-04-291-4/+4
| | | | | | | | | #define Y(x) Z(x) #define X Y return X(X(1)); was : return Z(Y(1)); now : return Z(Z(1));
* TODO: Add two issues.Edmund Grimley Evans2016-04-241-0/+2
|
* fix for the "Reduce allocations overhead"seyko2016-04-221-1/+1
| | | | Now no trap when compiling tccboot
* .rept asm directiveseyko2016-04-223-1/+41
| | | | | and '.' alone is a token now in *.S (not an identifier) representing a current position in the code (PC).
* section alignmentseyko2016-04-221-1/+1
| | | | | | Alignment of unknown sections changed from 32 to PTR_SIZE This is gcc/pcc default value. This helps to use tcc as linux kernel compiler.
* Source and destination overlap in memcpy, cstr_cat (tccpp.c:322)seyko2016-04-221-1/+1
| | | | This code is from "Improve hash performance"
* Run testcases in sorted orderMichael Matz2016-04-221-1/+1
| | | | | Without sorting they run in whatever order readdir returns, I like it better when the order is reliable (and alphanumeric).
* Reduce allocations overheadVlad Vissoultchev2016-04-172-7/+219
| | | | | | | | | - uses new `TinyAlloc`-ators for small `TokenSym`, `CString` and `TokenString` instances - conditional `TAL_DEBUG` for mem leaks and double frees detection - on `TAL_DEBUG` collects allocation origin (file + line) - conditional `TAL_INFO` for allocators stats (in release mode too) - chain a new allocator twice current capacity on buffer exhaustion
* Improve hash performanceVlad Vissoultchev2016-04-176-97/+105
| | | | | | | | | | | | - better `TOK_HASH_FUNC` - increases `hash_ident` initial size to 16k (from 8k) - `cstr_cat` uses single `realloc` + `memcpy` - `cstr_cat` can append terminating zero - `tok_str_realloc` initial size to 16 (from 8) - `parse_define` uses static `tokstr_buf` - `next` uses static `tokstr_buf` - fixes two latent bugs (wrong deallocations in libtcc.c:482 and tccpp.c:2987)
* Revert "Fix tests Makefiles on Windows"Vlad Vissoultchev2016-04-173-14/+2
| | | | This reverts commit fa2472c17246206ce6947475782de17245eceeea.
* Add travis tests integrationVlad Vissoultchev2016-04-172-0/+126
|
* simplify -C printingseyko2016-04-171-112/+29
| | | | | | | | | | parse_print_line_comment() and parse_print_comment() are combined and made more simply: * don't worry about speed with -E option * don't handle straya in comments Do we need to handle strays in regular parse_line_comment() and parse_comment() ?
* __builtin_expect no-opseyko2016-04-162-0/+38
| | | | | Taken from David Mertens tcc branch on github https://github.com/run4flat/tinycc.git
* allow to compile tcc by pccseyko2016-04-153-2/+6
| | | | | * pcc have only __linux__ macro (and no __linux) * pcc don't have __clear_cache proc
* preprocessor oprtion -C (keep comments)seyko2016-04-155-48/+195
| | | | | This is done by impression of the pcc -C option. Usual execution path and speed are not changed.
* fix preprocessing *.S with ` ' chars in #commentsseyko2016-04-143-1/+17
| | | | | with a test program. Problem detected when trying to compile linux-2.4.37.9 with tcc.
* fix for thev "#pragna once" guardseyko2016-04-142-1/+2
| | | | | gcc 3.4.6 don't understand "#if PATHCMP==stricmp" where "#define PATHCMP stricmp"
* Move utility functions `trimfront/back` to tccpp.cVlad Vissoultchev2016-04-134-19/+18
| | | | These are used in `libtcc.c` now and cannot remain in `tccpe.c`
* Simplify @listfiles parsingVlad Vissoultchev2016-04-131-39/+17
| | | | This moves listfiles parsing inline in `tcc_parse_args1`
* Better pragma once guardVlad Vissoultchev2016-04-132-5/+9
| | | | This takes care of case-insensitive filenames (like on win32)
* win32: Better VS2015 solution and project filesVlad Vissoultchev2016-04-133-0/+34
| | | | These include all header and source files from source directory
* tccpp.c: Guard against ppfp being NULLVlad Vissoultchev2016-04-132-24/+18
| | | | Missed these in e946eb2a4109e0de5f8514457f851897a4824c3e