Commit graph

361 commits

Author SHA1 Message Date
Wolfgang Bumiller
4ff68e07e8 Adding coverage support:
The -coverage option causes all values have AST_FLAG_BLOCK_COVERAGE
set by default.
The coverage attribute can be used to control coverage:
It takes an optional list of coverage types, currently only "block"
and "none" is recognized.
[[coverage]] defaults to [[coverage(block)]].
Use [[coverage(none)]] or [[coverage()]] to disable.
2014-01-07 14:36:00 +01:00
Dale Weiler
a934e0fe4b Happy new year! 2014-01-01 06:24:16 -05:00
Dale Weiler
73c4015046 Fix unary minus on vector 2013-11-13 08:57:14 -05:00
Wolfgang Bumiller
8d5e719026 replacing the current [[accumulate]] implementation: shorter and simpler, and also supports non-void return types 2013-10-18 11:26:41 +02:00
Dale Weiler
97217b55d1 Ignore generating a return instruction in accumulated functions, eventually we'll have a way to merge these into one function but for now the RETURN is a waste. 2013-10-17 04:45:24 -04:00
Dale Weiler
87d9371a5c Refactor some util/platform usage and extend file system file interface to accept its own flags and EOF 2013-10-11 06:12:56 -04:00
Dale Weiler
12a864abf5 Some more platform / compiler specific code refactoring. 2013-10-11 03:02:38 -04:00
Dale Weiler
151606e255 Initial platform / compiler specific code refactoring. 2013-10-11 02:39:30 -04:00
Dale Weiler
a02e44100e Fix some things: get all the Quake mods to compile again (I broke binary expressions .. oops) Fix the check-proj script, using $? for status was invalid because of pipes. The ir now properly considers negation virtual instruction to be operations (as it should). 2013-10-05 23:36:48 -04:00
Dale Weiler
353455e1ad Remove pointless thinking comment, fix builds for clang. 2013-09-29 22:06:26 -04:00
Dale Weiler
b10de1b240 Make unary - operator act as an ast_unary node. This allows for consistency (no sense in making unary use binstore nodes, it doesn't make much sense). It also allows for the peephole optimization on unary chains that cancel each other to take place; i.e code like "-(-a)" simplifies to "a", thus eliminating instructions. 2013-09-29 22:01:46 -04:00
Dale Weiler
81df8fa139 Remove the rest of it. 2013-09-28 06:10:02 -04:00
Dale Weiler
8a294683bb Remove it, maybe it can be done in the AST instead. 2013-09-28 06:09:24 -04:00
Dale Weiler
c4e92df106 Eh. 2013-09-28 05:36:09 -04:00
Dale Weiler
2b3663e18d Optimize for superfluous cases of NOT, i.e !!!!x can be simplified to !!x. 2013-09-28 05:34:53 -04:00
Wolfgang Bumiller
b6da3613ac making irwarning warn on an unused result 2013-09-18 16:20:24 +02:00
Dale Weiler
b2c8f3ebc5 Vector cross product virtual instruction, now >< operator works for non-constant vectors. Thanks divVerent for the help. 2013-08-31 14:49:06 -04:00
Dale Weiler
a7c1f6f021 Implement [[eraseable]] attribute. When used with a function it instructs the AST (which than transfers logic to the IR) that the function (or variable) is potentially unused (verified by checking the read count). This than propogates through the IR and prevents the IR from generating both the definition and global/function. The intrinsics system uses this as well to prevent intrinsic functions from being generated unless they're used. 2013-08-29 00:05:37 -04:00
Rudolf Polzer
abfe98ce8a Fix XOR maths for overlapping inputs by setting the lifetimes correctly.
Signed-off-by: Rudolf Polzer <divverent@xonotic.org>
2013-08-27 12:27:20 +02:00
Dale Weiler
fc57fa4064 Add support for columns to LNOF files. 2013-08-26 14:14:33 -04:00
Rudolf Polzer
e50b7a2719 Support vector bitor/bitand/bitxor.
Signed-off-by: Rudolf Polzer <divverent@xonotic.org>
2013-08-26 18:32:28 +02:00
Dale Weiler
bee14a6df7 Some bug fixes 2013-08-14 07:19:49 +00:00
Dale Weiler
5e54db46c4 Some statistics as Samual wanted. 2013-08-14 04:08:00 +00:00
Dale Weiler
d6ca5673dc Use the _t consistency naming scheme. Also various cleanups. 2013-07-30 16:00:51 +00:00
Dale Weiler
c8c25ef6f7 Some cleanups and smaller binaries! 2013-07-28 00:23:15 +00:00
Dale Weiler
c7679722fb Please the whitespace gods 2013-07-27 11:48:55 +00:00
Wolfgang Bumiller
b39a748984 actually no :) 2013-06-22 20:31:50 +02:00
Dale Weiler
adc9e7bf22 Fix some more bugs (coverity you're a life saver) 2013-06-22 02:05:04 +00:00
Dale Weiler
bbffdde2dc Fix some bugs and a memleak in the testsuite. 2013-06-22 01:56:22 +00:00
Dale Weiler
5429b6f189 Fix out of bound access 2013-06-22 01:16:24 +00:00
Dale Weiler
458cfcb48c I'm assuming this is a bug since all other read tests compare with itself's ir_value, and only this one doesn't. Otherwise why would you need to load to an ir_value for vec? 2013-06-21 23:54:09 +00:00
Dale Weiler
ce23e95d0b Remove a ton of dead code and document the one really insane case. 2013-06-21 23:40:51 +00:00
Dale Weiler
82fd7fcf68 Move code generator into ir_builder for earlier free. It's also a much more cleaner design than load parser->code for all ast/ir operations. We also have a proper chain'd design now (so making this a library will be easier). 2013-06-20 10:52:58 +00:00
Dale Weiler
11179a2a71 Major header reworking, this respects the namespaces properly. Makes object dependency more obvious, allows for better make caches, and prevents misuse of library features, i.e use con_* instead of printf. 2013-06-04 02:47:07 +00:00
Dale Weiler
f892b32335 Major export cleanup. Anything that was exported but wasn't used outside where it was implemented has been turned into static, and their exports have been removed. This actually makes the compiler compile slightly faster. 2013-05-29 03:29:04 +00:00
Wolfgang Bumiller
4d0a5af475 removing this dead code_init call 2013-05-07 19:59:06 +02:00
Wolfgang Bumiller
c5225b2fa1 fixing a few leaks - code_write doesn't delete the code object anymore, code_cleanup has to be called 2013-05-07 19:56:41 +02:00
Dale Weiler
dc6a7436ee Expression has undefined behavior (left operand modifies code->globals->used, used by right operand): (code->globals)[(((vector_t*)((void *)code->globals)) - 1)->used++] = (code_genstring(code, global->constval.vstring)) Code has unspecified behavior. Order of evaluation of function parameters or subexpressions is not defined, so if a value is used and modified in different places not separated by a sequence point constraining evaluation order, then the result of the expression is unspecified. 2013-04-27 15:20:01 +00:00
Dale Weiler
785ab7c072 No more globals for codegen 2013-04-25 09:35:30 +00:00
Wolfgang Bumiller
73070395eb these can be const now 2013-04-25 09:55:58 +02:00
Dale Weiler
10dd7aacfe Apply some static where it belongs 2013-04-25 03:34:42 +00:00
Wolfgang Bumiller
3a4aba0b31 Grrrr 2013-04-24 17:47:42 +02:00
Dale Weiler
489ad486bc Get it compiling in visual studio again. 2013-04-24 01:43:53 +00:00
Dale Weiler
160e7cf7ee Remove trailing whitespace 2013-04-21 10:24:55 +00:00
Wolfgang Bumiller
46752af74b parser_const_string now uses hashtables; hashtables may want to dup an empty string without it becoming NULL - also replacing ir_strdup with the new util_ one 2013-04-17 18:23:30 +02:00
Dale Weiler
ccc2eb3298 More function flatening 2013-04-14 01:14:14 +00:00
Dale Weiler
c74889f648 Fix some memory leaks. 2013-04-13 18:01:26 +00:00
Wolfgang Bumiller
a32f59b256 hopefully fix an off-by-1 vararg copy issue 2013-02-26 16:39:28 +01:00
Dale Weiler
b1d1aabbdd Remove debug printf 2013-02-25 08:52:56 +00:00
Dale Weiler
aebab8b68a Push definitions when -O0 2013-02-25 08:52:17 +00:00