]> git.rm.cloudns.org Git - xonotic/gmqcc.git/log
xonotic/gmqcc.git
5 years agoir: fix generation of multi-op vinstrs
Wolfgang Bumiller [Sun, 15 Sep 2019 08:07:06 +0000 (10:07 +0200)]
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

5 years agointroduce another vinstr temp
Wolfgang Bumiller [Sun, 15 Sep 2019 08:06:53 +0000 (10:06 +0200)]
introduce another vinstr temp

Some vinstrs are currently broken when using peephole
optimization as they appear as writing to a temporary ssa
output before being stored into their real destination,
causing the store to be optimized out, but the generated
code relies on having the destination as another temporary
value available.

Let's just add a 2nd temp to be used in those cases.

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
5 years agoMerge pull request #187 from divVerent/patch-1
Dale Weiler [Mon, 4 Feb 2019 14:20:23 +0000 (09:20 -0500)]
Merge pull request #187 from divVerent/patch-1

Fix printing of floating poing values in -dumpfin.

5 years agoFix printing of floating poing values in -dumpfin.
divVerent [Mon, 4 Feb 2019 14:14:58 +0000 (06:14 -0800)]
Fix printing of floating poing values in -dumpfin.

%g is not lossless for single precision floats - %.9g is (other than distinguishing NaNs, who cares).

6 years agofix __builtin_nan and add some missing builtins
Dale Weiler [Wed, 14 Nov 2018 13:43:22 +0000 (08:43 -0500)]
fix __builtin_nan and add some missing builtins

6 years agofix octals
Dale Weiler [Tue, 30 Oct 2018 21:32:21 +0000 (17:32 -0400)]
fix octals

6 years agofixes for progs.src
Dale Weiler [Sat, 1 Sep 2018 04:48:18 +0000 (00:48 -0400)]
fixes for progs.src

6 years agoMerge branch 'master' of github.com:graphitemaster/gmqcc
Dale Weiler [Thu, 10 May 2018 01:19:39 +0000 (21:19 -0400)]
Merge branch 'master' of github.com:graphitemaster/gmqcc

6 years agoadded -fdefault-eraseable which is the same as adding [[eraseable]] to all definitions
Dale Weiler [Thu, 10 May 2018 01:18:37 +0000 (21:18 -0400)]
added -fdefault-eraseable which is the same as adding [[eraseable]] to all definitions
instead the opposite behavior can be controlled with [[noerase]] attribute

6 years agoDelete .travis.yml
Dale Weiler [Sat, 5 May 2018 19:44:21 +0000 (15:44 -0400)]
Delete .travis.yml

6 years agoerror if a function is called from global scope opposed to crashing
Dale Weiler [Sat, 5 May 2018 19:38:12 +0000 (15:38 -0400)]
error if a function is called from global scope opposed to crashing

6 years agocatch broken vector member access
Wolfgang Bumiller [Sun, 14 Jan 2018 09:58:29 +0000 (10:58 +0100)]
catch broken vector member access

These kinds of expressions currently cannot be handled
without pionter support in the qcvm without scanning the
ast from within ast_member::codegen for an assignments as
seen in the added test case.

This change makes code like that return a pointer type which
will cause an error that we did not get a vector or field
back. With pointer support this pointer could actually be
used instead.

So at least it shouldn't silently produce broken code
anymore.

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
6 years agoadd variable search order test
Wolfgang Bumiller [Sun, 14 Jan 2018 08:10:29 +0000 (09:10 +0100)]
add variable search order test

Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
6 years agoMake parser_find_local only actually search locals
Wolfgang Bumiller [Sun, 14 Jan 2018 08:31:45 +0000 (09:31 +0100)]
Make parser_find_local only actually search locals

Fixes #163
Signed-off-by: Wolfgang Bumiller <wry.git@bumiller.com>
6 years agoRevert "search for funciton param first before function locals, this fixes #163"
Wolfgang Bumiller [Sun, 14 Jan 2018 08:32:53 +0000 (09:32 +0100)]
Revert "search for funciton param first before function locals, this fixes #163"

This reverts commit 3cf2c52fce792af3e5cc5578b336de83217e625d.

7 years agofix some UB
Dale Weiler [Fri, 1 Dec 2017 18:55:19 +0000 (13:55 -0500)]
fix some UB

7 years agosearch for funciton param first before function locals, this fixes #163
Dale Weiler [Fri, 1 Dec 2017 17:24:50 +0000 (12:24 -0500)]
search for funciton param first before function locals, this fixes #163

7 years agoMerge branch 'master' of github.com:graphitemaster/gmqcc
Dale Weiler [Sun, 26 Nov 2017 22:48:13 +0000 (17:48 -0500)]
Merge branch 'master' of github.com:graphitemaster/gmqcc

7 years agodon't generate storep for vector field unless it's an ent field
Dale Weiler [Sun, 26 Nov 2017 22:47:27 +0000 (17:47 -0500)]
don't generate storep for vector field unless it's an ent field

7 years agoMerge pull request #177 from xonotic/terencehill/warning_removal
Dale Weiler [Sun, 26 Nov 2017 22:30:42 +0000 (17:30 -0500)]
Merge pull request #177 from xonotic/terencehill/warning_removal

Get rid of a warning on Windows

7 years agoMerge pull request #180 from xonotic/mem_leak_fix_on_failure_paths
Dale Weiler [Sun, 26 Nov 2017 22:30:30 +0000 (17:30 -0500)]
Merge pull request #180 from xonotic/mem_leak_fix_on_failure_paths

two small memory leak fixes on failure paths

7 years agofix writing of globaldefs for vector subcomponents so that FTE field remapping works
Dale Weiler [Sun, 26 Nov 2017 22:26:00 +0000 (17:26 -0500)]
fix writing of globaldefs for vector subcomponents so that FTE field remapping works

7 years agofix member binops on entity fields to generate STOREP, this fixes stuff like ent...
Dale Weiler [Sun, 26 Nov 2017 22:09:38 +0000 (17:09 -0500)]
fix member binops on entity fields to generate STOREP, this fixes stuff like ent.vec.x += value.

7 years agocleanup: 'move of a temporary object prevents copy elision'
Wolfgang Bumiller [Sun, 23 Jul 2017 08:10:15 +0000 (10:10 +0200)]
cleanup: 'move of a temporary object prevents copy elision'

7 years agomove more parser code to c++, fix crashes with gcc
Wolfgang Bumiller [Sun, 23 Jul 2017 08:06:51 +0000 (10:06 +0200)]
move more parser code to c++, fix crashes with gcc

we initialized the parser with malloc -> memset to zero ->
placement new. With gcc the latter caused the memset to be
optimized out, causing uninitialized value accesses.

7 years agocleanup some silly more warnings
Wolfgang Bumiller [Sun, 23 Jul 2017 08:05:34 +0000 (10:05 +0200)]
cleanup some silly more warnings

7 years agocleanup: silence fallthrough warnings
Wolfgang Bumiller [Sun, 23 Jul 2017 07:33:19 +0000 (09:33 +0200)]
cleanup: silence fallthrough warnings

7 years agoGet rid of a warning on Windows terencehill/warning_removal
terencehill [Fri, 23 Jun 2017 14:21:22 +0000 (16:21 +0200)]
Get rid of a warning on Windows

7 years agotests: add check for vector negation
Wolfgang Bumiller [Thu, 22 Jun 2017 06:45:38 +0000 (08:45 +0200)]
tests: add check for vector negation

7 years agoqcvm: add stov builtin #16
Wolfgang Bumiller [Thu, 22 Jun 2017 06:45:18 +0000 (08:45 +0200)]
qcvm: add stov builtin #16

7 years agoir: fix vector negation using the nil value
Wolfgang Bumiller [Thu, 22 Jun 2017 06:44:35 +0000 (08:44 +0200)]
ir: fix vector negation using the nil value

We cannot use OFS_NULL as it is only a single value and
overlaps with OFS_RETURN.

7 years agotwo small memory leak fixes on failure paths mem_leak_fix_on_failure_paths
David Carlier [Tue, 23 May 2017 20:56:03 +0000 (21:56 +0100)]
two small memory leak fixes on failure paths

7 years agosanitize: shift 1u (unsigned) for flag bits
Wolfgang Bumiller [Tue, 14 Feb 2017 18:17:45 +0000 (19:17 +0100)]
sanitize: shift 1u (unsigned) for flag bits

7 years agoc++: exec.cpp
Wolfgang Bumiller [Sat, 11 Feb 2017 10:33:12 +0000 (11:33 +0100)]
c++: exec.cpp

8 years agoc++: ir_function::m_params
Wolfgang Bumiller [Sat, 3 Dec 2016 20:42:15 +0000 (21:42 +0100)]
c++: ir_function::m_params

8 years agoc++: ir: function_allocator
Wolfgang Bumiller [Sat, 3 Dec 2016 20:39:09 +0000 (21:39 +0100)]
c++: ir: function_allocator

8 years agoc++: ir_block::m_instr
Wolfgang Bumiller [Sat, 3 Dec 2016 20:30:33 +0000 (21:30 +0100)]
c++: ir_block::m_instr

8 years agoc++: ir_block::m_exits
Wolfgang Bumiller [Sat, 3 Dec 2016 19:34:42 +0000 (20:34 +0100)]
c++: ir_block::m_exits

8 years agoc++: ir_block::m_entries
Wolfgang Bumiller [Sat, 3 Dec 2016 19:32:26 +0000 (20:32 +0100)]
c++: ir_block::m_entries

8 years agoCleaner way to set the mask for -Wunused-component
Dale Weiler [Thu, 24 Nov 2016 19:54:17 +0000 (19:54 +0000)]
Cleaner way to set the mask for -Wunused-component

8 years agoJust mark LOCAL_RETURN noref instead of checking for '#' in the name
Dale Weiler [Thu, 24 Nov 2016 15:50:48 +0000 (15:50 +0000)]
Just mark LOCAL_RETURN noref instead of checking for '#' in the name

8 years agoRemove parser m_uses in favor of {IR,AST}_FLAG_NOREF instead
Dale Weiler [Thu, 24 Nov 2016 15:33:58 +0000 (15:33 +0000)]
Remove parser m_uses in favor of {IR,AST}_FLAG_NOREF instead

8 years agoAdd -Wunused-component like -Wunused-variable but warns about unused components of...
Dale Weiler [Thu, 24 Nov 2016 14:52:57 +0000 (14:52 +0000)]
Add -Wunused-component like -Wunused-variable but warns about unused components of vector

8 years agomore intelligent handling of unused vector fields
Dale Weiler [Thu, 24 Nov 2016 14:44:28 +0000 (14:44 +0000)]
more intelligent handling of unused vector fields

8 years agoFix #158
Dale Weiler [Thu, 24 Nov 2016 14:08:38 +0000 (14:08 +0000)]
Fix #158

8 years agoFix #161
Dale Weiler [Thu, 24 Nov 2016 13:41:26 +0000 (13:41 +0000)]
Fix #161

8 years agoFix #171
Dale Weiler [Thu, 24 Nov 2016 13:40:22 +0000 (13:40 +0000)]
Fix #171

8 years agoFix fieldfuncs test and track unused variables through writes as well.
Dale Weiler [Sat, 19 Nov 2016 12:19:00 +0000 (12:19 +0000)]
Fix fieldfuncs test and track unused variables through writes as well.

8 years agoDon't generate unused warnings for unused constants
Dale Weiler [Sat, 19 Nov 2016 11:46:32 +0000 (11:46 +0000)]
Don't generate unused warnings for unused constants

8 years agofix access to fields of vector members
Wolfgang Bumiller [Sat, 19 Nov 2016 15:15:26 +0000 (16:15 +0100)]
fix access to fields of vector members

When ast_member encounters the result of an ast_entfield it
has to replace the ast_entfield's codegen as we cannot
evaluate the field access first.

We then perform the same action as ast_entfield but call
vectorMember on the field before issuing the load/address
instruction.

This effectively turns the codegen of the following ast
structure:
    member_of {
        field_of {
            entity,
            a_vector
        }
        memberid
    }
into the one of this structure:
    field_of {
        entity,
        member_of {
            a_vector
            memberid
        }
    }

8 years agoRevert "Fix ent.vec.{x,y,z} writes"
Wolfgang Bumiller [Sat, 19 Nov 2016 15:22:13 +0000 (16:22 +0100)]
Revert "Fix ent.vec.{x,y,z} writes"

This reverts commit ad1cfcfeaab754b3a7d34a152b0d334f7f040239.

8 years agoFix ent.vec.{x,y,z} writes
Dale Weiler [Sat, 19 Nov 2016 10:42:33 +0000 (10:42 +0000)]
Fix ent.vec.{x,y,z} writes

8 years agoUnused globals even if they have an initial value should produce unused diagnostic
Dale Weiler [Sat, 19 Nov 2016 10:05:58 +0000 (10:05 +0000)]
Unused globals even if they have an initial value should produce unused diagnostic

8 years agoWarning xonotic-v0.8.2
Dale Weiler [Mon, 23 May 2016 20:47:40 +0000 (16:47 -0400)]
Warning

8 years agoupdate .gitignore
Wolfgang Bumiller [Wed, 10 Feb 2016 18:01:12 +0000 (19:01 +0100)]
update .gitignore

8 years agoMerge pull request #172 from TimePath/cmake
Dale Weiler [Sun, 3 Jan 2016 06:15:18 +0000 (01:15 -0500)]
Merge pull request #172 from TimePath/cmake

Add CMakeLists.txt

8 years agoAdd CMakeLists.txt
TimePath [Sun, 3 Jan 2016 06:13:22 +0000 (17:13 +1100)]
Add CMakeLists.txt

8 years agoFixes
Dale Weiler [Sun, 3 Jan 2016 05:38:58 +0000 (00:38 -0500)]
Fixes

8 years agoeh
Dale Weiler [Sun, 3 Jan 2016 05:35:12 +0000 (00:35 -0500)]
eh

8 years agoFix makefile
Dale Weiler [Sun, 3 Jan 2016 05:34:29 +0000 (00:34 -0500)]
Fix makefile

8 years agoMerge branch 'master' into cleanup
Dale Weiler [Sun, 3 Jan 2016 03:30:35 +0000 (22:30 -0500)]
Merge branch 'master' into cleanup

9 years agooops graphitemaster/cooking graphitemaster/legacy
Dale Weiler [Mon, 28 Dec 2015 13:00:54 +0000 (08:00 -0500)]
oops

9 years agoFix unary negation (-)
Dale Weiler [Mon, 28 Dec 2015 12:58:54 +0000 (07:58 -0500)]
Fix unary negation (-)

9 years agotempcommitting a whole bunch of to-c++ conversions graphitemaster/cleanup
Wolfgang Bumiller [Sat, 2 May 2015 07:48:24 +0000 (09:48 +0200)]
tempcommitting a whole bunch of to-c++ conversions

9 years agoremove a bunch of unnecessary c-casts to ast_expression*
Wolfgang Bumiller [Sun, 1 Feb 2015 11:15:30 +0000 (12:15 +0100)]
remove a bunch of unnecessary c-casts to ast_expression*

9 years agoMerge branch 'cleanup' of git://github.com/graphitemaster/gmqcc into cleanup
Wolfgang Bumiller [Sun, 1 Feb 2015 11:13:59 +0000 (12:13 +0100)]
Merge branch 'cleanup' of git://github.com/graphitemaster/gmqcc into cleanup

9 years agofix std::string constructed from nullptr
Wolfgang Bumiller [Sun, 1 Feb 2015 11:13:22 +0000 (12:13 +0100)]
fix std::string constructed from nullptr

9 years agoast_unary::make: safer double-negation optimization check
Wolfgang Bumiller [Sun, 1 Feb 2015 11:13:05 +0000 (12:13 +0100)]
ast_unary::make: safer double-negation optimization check

9 years agofix backward propagateSideEffect impl
Wolfgang Bumiller [Sun, 1 Feb 2015 11:12:25 +0000 (12:12 +0100)]
fix backward propagateSideEffect impl

9 years agodestructor call order is important here
Wolfgang Bumiller [Sun, 1 Feb 2015 10:52:58 +0000 (11:52 +0100)]
destructor call order is important here

9 years agoir_instr_delete_quick needs to clear _m_ops
Wolfgang Bumiller [Sun, 1 Feb 2015 10:49:46 +0000 (11:49 +0100)]
ir_instr_delete_quick needs to clear _m_ops

9 years agoast conversion mostly finished
Wolfgang Bumiller [Fri, 30 Jan 2015 17:59:48 +0000 (18:59 +0100)]
ast conversion mostly finished

9 years agoSame on the cleanup branch
Dale Weiler [Fri, 30 Jan 2015 05:46:25 +0000 (00:46 -0500)]
Same on the cleanup branch

9 years agoDon't allocate globals for constants that aren't read xonotic-v0.8.1
Dale Weiler [Fri, 30 Jan 2015 05:40:59 +0000 (00:40 -0500)]
Don't allocate globals for constants that aren't read

9 years agoConstant folding for strings xonotic-data/qc_updates
Dale Weiler [Fri, 30 Jan 2015 05:25:10 +0000 (00:25 -0500)]
Constant folding for strings

9 years agoMerge branch 'cleanup' of github.com:graphitemaster/gmqcc into cleanup
Dale Weiler [Fri, 30 Jan 2015 05:20:41 +0000 (00:20 -0500)]
Merge branch 'cleanup' of github.com:graphitemaster/gmqcc into cleanup

9 years agoConstant folding for string comparisons too
Dale Weiler [Fri, 30 Jan 2015 05:18:52 +0000 (00:18 -0500)]
Constant folding for string comparisons too

9 years agoFix for loops
Dale Weiler [Fri, 30 Jan 2015 04:33:59 +0000 (23:33 -0500)]
Fix for loops

9 years agoFor now
Dale Weiler [Fri, 30 Jan 2015 04:13:55 +0000 (23:13 -0500)]
For now

9 years agoBROKEN: more ast nodes converted
Wolfgang Bumiller [Thu, 29 Jan 2015 19:29:34 +0000 (20:29 +0100)]
BROKEN: more ast nodes converted

9 years agoadd another test that we just didn't have anywhere else yet
Wolfgang Bumiller [Thu, 22 Jan 2015 10:45:23 +0000 (11:45 +0100)]
add another test that we just didn't have anywhere else yet

9 years agoBROKEN: in the middle of converting ast nodes to c++ with constructors and methods
Wolfgang Bumiller [Sun, 25 Jan 2015 08:24:26 +0000 (09:24 +0100)]
BROKEN: in the middle of converting ast nodes to c++ with constructors and methods

9 years agoa whole lotta 'm_'s
Wolfgang Bumiller [Sat, 24 Jan 2015 11:25:46 +0000 (12:25 +0100)]
a whole lotta 'm_'s

9 years agowhy didn't gcc catch that...
Wolfgang Bumiller [Sat, 24 Jan 2015 09:26:43 +0000 (10:26 +0100)]
why didn't gcc catch that...

9 years agofix for loops
Wolfgang Bumiller [Tue, 20 Jan 2015 19:55:27 +0000 (20:55 +0100)]
fix for loops

9 years agofor now just call the dtors like this
Wolfgang Bumiller [Tue, 20 Jan 2015 19:33:07 +0000 (20:33 +0100)]
for now just call the dtors like this

9 years agomore c++ migration for ast/ir/code; reached a working condition here
Wolfgang Bumiller [Tue, 20 Jan 2015 19:25:56 +0000 (20:25 +0100)]
more c++ migration for ast/ir/code; reached a working condition here

9 years agotemp committing major c++ification
Wolfgang Bumiller [Tue, 20 Jan 2015 15:43:58 +0000 (16:43 +0100)]
temp committing major c++ification

9 years agomaking ast nodes derive from ast_expression
Wolfgang Bumiller [Mon, 19 Jan 2015 13:00:04 +0000 (14:00 +0100)]
making ast nodes derive from ast_expression

9 years agothis can be a move
Wolfgang Bumiller [Mon, 19 Jan 2015 12:46:30 +0000 (13:46 +0100)]
this can be a move

9 years agoast_expression: params -> type_params
Wolfgang Bumiller [Mon, 19 Jan 2015 12:46:10 +0000 (13:46 +0100)]
ast_expression: params -> type_params

9 years agorenaming ast_function::vtype to function_type
Wolfgang Bumiller [Mon, 19 Jan 2015 12:37:22 +0000 (13:37 +0100)]
renaming ast_function::vtype to function_type

9 years agoast_expression now derives from ast_node
Wolfgang Bumiller [Mon, 19 Jan 2015 12:33:39 +0000 (13:33 +0100)]
ast_expression now derives from ast_node

9 years agorenaming some ast_node members before making ast_expression an ast_node to use the...
Wolfgang Bumiller [Mon, 19 Jan 2015 12:32:26 +0000 (13:32 +0100)]
renaming some ast_node members before making ast_expression an ast_node to use the compiler to help find possible clashes

9 years agoRewrite constant folder in C++
Dale Weiler [Fri, 16 Jan 2015 01:27:17 +0000 (20:27 -0500)]
Rewrite constant folder in C++

9 years agoForgot about this file
Dale Weiler [Thu, 15 Jan 2015 23:12:54 +0000 (18:12 -0500)]
Forgot about this file

9 years agoRewrite intrinsic system in C++
Dale Weiler [Thu, 15 Jan 2015 23:11:41 +0000 (18:11 -0500)]
Rewrite intrinsic system in C++

9 years agos/NULL/nullptr/
Dale Weiler [Thu, 15 Jan 2015 20:18:33 +0000 (15:18 -0500)]
s/NULL/nullptr/

9 years agoUse std::vector for static_names
Dale Weiler [Thu, 15 Jan 2015 20:15:35 +0000 (15:15 -0500)]
Use std::vector for static_names

9 years agoCleanup
Dale Weiler [Thu, 15 Jan 2015 20:11:30 +0000 (15:11 -0500)]
Cleanup