An Improved Quake C Compiler
Find a file
Wolfgang Bumiller 2d4a054440 ir: fix generation of multi-op vinstrs
Do not assume that the destination is a temporary location,
as our peephole optimizer will break this. For example, the
following IR code (generated via from `x ^= gety()`):

    (0) binst6 <- BITXOR   x,      call5
    (0) x <- STORE_F       binst6

after peephole optimization becomes:

    (7) x <- BITXOR        x,      call5

Therefore we cannot assume that the output of the virtual
xor instruction can be utilized as a temporary value.

BITXOR becomes `(x | y) - (x & y)`, which would wrongly be
generated as:
    x = x | y;
    temp0 = x & y;
    x = x - temp0;

While this particular case can be fixed by using temp0 first
and then x, the cross-product case would not be so simple.

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
Fixes #190
2019-09-15 10:23:47 +02:00
doc added -fdefault-eraseable which is the same as adding [[eraseable]] to all definitions 2018-05-09 21:18:37 -04:00
misc Remove msvc project files and misc stuff 2015-01-13 21:28:26 -05:00
tests catch broken vector member access 2018-01-14 10:58:29 +01:00
.gitattributes gitattributes for whitespace 2012-04-28 16:40:03 -04:00
.gitignore update .gitignore 2016-02-10 19:01:12 +01:00
algo.h more c++ migration for ast/ir/code; reached a working condition here 2015-01-20 20:25:56 +01:00
ast.cpp added -fdefault-eraseable which is the same as adding [[eraseable]] to all definitions 2018-05-09 21:18:37 -04:00
ast.h added -fdefault-eraseable which is the same as adding [[eraseable]] to all definitions 2018-05-09 21:18:37 -04:00
AUTHORS s/brian/brain/ ;) 2013-11-30 12:31:21 +04:00
CMakeLists.txt Add CMakeLists.txt 2016-01-03 17:14:02 +11:00
code.cpp more c++ migration for ast/ir/code; reached a working condition here 2015-01-20 20:25:56 +01:00
conout.cpp ast conversion mostly finished 2015-02-01 11:44:00 +01:00
exec.cpp cleanup some silly more warnings 2017-07-23 10:11:31 +02:00
fold.cpp fix __builtin_nan and add some missing builtins 2018-11-14 08:43:22 -05:00
fold.h fix __builtin_nan and add some missing builtins 2018-11-14 08:43:22 -05:00
ftepp.cpp Fix #161 2016-11-24 13:41:26 +00:00
gmqcc.h move more parser code to c++, fix crashes with gcc 2017-07-23 10:11:31 +02:00
gmqcc.ini.example added -fdefault-eraseable which is the same as adding [[eraseable]] to all definitions 2018-05-09 21:18:37 -04:00
intrin.cpp fix __builtin_nan and add some missing builtins 2018-11-14 08:43:22 -05:00
intrin.h temp committing major c++ification 2015-01-20 16:43:58 +01:00
ir.cpp ir: fix generation of multi-op vinstrs 2019-09-15 10:23:47 +02:00
ir.h introduce another vinstr temp 2019-09-15 10:12:40 +02:00
lexer.cpp fix octals 2018-10-30 17:32:21 -04:00
lexer.h temp committing major c++ification 2015-01-20 16:43:58 +01:00
LICENSE Update license headers 2015-01-09 14:53:35 -05:00
main.cpp fixes for progs.src 2018-09-01 00:48:18 -04:00
Makefile fixes for progs.src 2018-09-01 00:48:18 -04:00
opts.cpp sanitize: shift 1u (unsigned) for flag bits 2017-02-14 19:24:04 +01:00
opts.def added -fdefault-eraseable which is the same as adding [[eraseable]] to all definitions 2018-05-09 21:18:37 -04:00
parser.cpp added -fdefault-eraseable which is the same as adding [[eraseable]] to all definitions 2018-05-09 21:18:37 -04:00
parser.h move more parser code to c++, fix crashes with gcc 2017-07-23 10:11:31 +02:00
README Minifi README 2015-01-13 21:30:23 -05:00
stat.cpp fix some UB 2017-12-01 13:55:19 -05:00
test.cpp Merge branch 'master' into cleanup 2016-01-02 22:30:35 -05:00
utf8.cpp .c -> .cpp 2015-01-14 21:48:47 -05:00
util.cpp Get rid of a warning on Windows 2017-06-23 16:21:22 +02:00

An improved QuakeC compiler