Bill Currie
980cf58ac5
Wait for the window to be visible before mouse warping
...
This fixes the hang during fullscreen startup on my system (the motion
events weren't being generated because there was no window to see the
motion).
2019-07-10 22:28:33 +09:00
Bill Currie
a4f963f67b
Add a cvar to block use of x11 vidmode
...
Or really, allow it if the user specifically requests it: the default is
blocked. Modern systems (particularly displays) do not really like
changing resolution, so doing so by default seems rather wrong.
2019-07-10 22:28:33 +09:00
Bill Currie
c3fa78ef4d
Include test for 2d vector expressions
2019-07-06 14:49:28 +09:00
Bill Currie
c727f6a130
Rewrite QuatMultVec to be faster
...
Could be faster still using SSE, but that's another project.
2019-07-06 14:45:40 +09:00
Bill Currie
ab71311174
Correct some comments
2019-07-06 14:44:22 +09:00
Bill Currie
8caf2eb584
Mark some new functions as pure
2019-06-27 21:37:48 +09:00
Bill Currie
a5ee58cebb
Support 2d vector expressions
...
[x, y] expands to [x, y, 0] (for now, might add a 2d vector type).
2019-06-18 11:54:45 +09:00
Bill Currie
83fac13a0c
Fix debug line numbers for vector expressions
2019-06-18 11:53:58 +09:00
Bill Currie
b37c331e76
Catch taking size of null type
...
This should help catch similar errors in the future.
2019-06-18 10:39:17 +09:00
Bill Currie
0f1f477e64
Set up temp aliases correctly
...
Fixes vector expressions as sub-expresses. I really don't know why I did
the temp alias setup that way.
2019-06-18 10:38:19 +09:00
Bill Currie
fc50376297
Fix a minor error check mistake
2019-06-18 08:54:18 +09:00
Bill Currie
fe73547f43
Update alias type sameness check
...
This one seems to be fairly robust. Fixes alias being used to cast
pointers (maybe a better way, but this works for now).
2019-06-18 08:53:05 +09:00
Bill Currie
f7825fe7cf
Print types properly in pointer value expressions
2019-06-18 00:22:24 +09:00
Bill Currie
b996fb7aa4
Make operand->type actual type instead of low-level
...
And clean up the resulting mess. This fixes struct copy, but uncovers
another bug :/
2019-06-17 23:38:34 +09:00
Bill Currie
e0c8285f07
Extend nested struct test to cover struct copy
...
Fails :P
2019-06-17 22:57:40 +09:00
Bill Currie
dd52b7fea1
Merge aliased alias expressions
...
This comes up when accessing struct fields nested in another struct.
Fixes the nested struct fields test.
2019-06-17 22:48:42 +09:00
Bill Currie
e9c24dbf1c
Test case for accessing nested struct fields
...
Currently fails.
2019-06-17 22:47:44 +09:00
Bill Currie
ec128ffeee
Leave a FIXME for daglabel_t.live
2019-06-16 19:24:19 +09:00
Bill Currie
d6d3027411
Mark the correct operand as live
...
This fixes vecexpr (and possibly other cases).
2019-06-16 19:21:02 +09:00
Bill Currie
6e21c3ae2e
Treat func statements similarly to flow statements
...
func statements need their operands marked live like flow statements do
because usage is more indirect.
2019-06-16 19:20:21 +09:00
Bill Currie
db4a7a139e
Use the alias code when making vars live
...
Not sure the live forcing flag is needed anymore (need to test).
2019-06-16 19:17:45 +09:00
Bill Currie
2977c145d0
Clean up dag live alias code a little
...
Mainly, this makes it possible to reuse the alias code.
2019-06-16 19:17:01 +09:00
Bill Currie
82b334e919
Number dot dumps to help identify order
2019-06-16 19:12:18 +09:00
Bill Currie
c40f4194e9
Use tempop_visit_all for flow and dags
...
Fixes t3 of vecexpr, but t2 is broken (lost first assignment).
2019-06-16 16:56:39 +09:00
Bill Currie
3c4903245a
Fix some curly space
2019-06-16 16:55:54 +09:00
Bill Currie
bc271d8a02
Add tempop_visit_all
...
Works the same as def_visit_all, but for temp operands.
2019-06-16 16:52:49 +09:00
Bill Currie
fa69aeef0f
Improve handling of temp aliases
...
This makes all tests pass when not optimizing. More work needs to be
done in dags.
2019-06-12 00:37:02 +09:00
Bill Currie
b18a744288
Use offset alias expressions
...
They are not quite working yet as the operand generator does not use the
offset yet.
2019-06-10 23:55:16 +09:00
Bill Currie
cc27949a34
Ensure pointer values always have a type
...
The dags generator was creating a pointer value with no type which
caused print_statement to segfault.
2019-06-10 23:52:39 +09:00
Bill Currie
ee1f5f9478
Add support for binary alias expressions
...
Doesn't quite work yet.
2019-06-10 23:48:58 +09:00
Bill Currie
913b9f52e0
Add an offset alias expression
...
This should make dealing with def elements (vector etc) easier.
2019-06-10 18:13:28 +09:00
Bill Currie
efdfc7436f
Move ev_types into types.[ch]
...
No wonder I couldn't find it the other day...
2019-06-10 18:04:25 +09:00
Bill Currie
08ab42fc15
Handle vector expressions as sub-expressions
...
Now my little game builds again :)
2019-06-10 15:50:35 +09:00
Bill Currie
49ed4310fd
Fix assigning int to enum or enum to int
...
Or float, for v6 progs.
2019-06-10 08:46:40 +09:00
Bill Currie
83fb588727
Support vector/quaternion division by float
...
Implemented via v*(1/f) or q*(1/f) to give CSE a chance to optimize the
division if necessary as otherwise the engine would have to divide every
time.
2019-06-10 08:44:36 +09:00
Bill Currie
7dc1a0640a
Delay creating actual enum symbols
...
In order to keep enumerator type and enum type the same, the values need
to have their type set after the enum type is finalized, and then the
appropriate symbols created in the parent scope. This fixes the infinite
recursion when assigning an enum value to its own type.
2019-06-10 07:44:23 +09:00
Bill Currie
f81484a068
Test compiling enums
...
It turns out the enumerator type and enum type wind up with different
instances of the same type (due to the way type chaining works). This
results in infinite recursion in assign_expr and check_types_compatible.
2019-06-10 07:17:41 +09:00
Bill Currie
ef4ad52239
Make binary_expr fold constants
...
This is where constant folding should have happened all along. While
unary_expr should fold constants too, it seems to already try to do so
and it's a bit much of a mess to clean up right now.
2019-06-10 00:36:13 +09:00
Bill Currie
bf0543f7fb
Be paranoid about temp var sizes
...
Prevents array index errors.
2019-06-10 00:19:48 +09:00
Bill Currie
28a2b96800
Implement automatic array sizing from initializer
2019-06-09 23:11:38 +09:00
Bill Currie
00f12263ca
Fix casting arrays to pointers
2019-06-09 22:55:38 +09:00
Bill Currie
3196bcc851
Allow fold_constants to handle some math identities
...
Such as x*0 -> 0, x*1 -> x, x+0 ->x, etc.
2019-06-09 22:34:23 +09:00
Bill Currie
c98d1ff08c
Document some problems with nil
...
While he's a pretty cool character in HZD, he seems to have some
identity problems when in a compiler.
2019-06-09 22:29:51 +09:00
Bill Currie
439cd15620
Do type promotion for short
...
fold_constants used to do this when it was overly aggressive. Fixes the
ICE when accessing an array in a struct via a pointer.
2019-06-09 22:27:53 +09:00
Bill Currie
227ac46ffe
Clean up array expression processing
...
And make sure constants are folded since fold_constants is no longer
recursive.
2019-06-09 22:25:55 +09:00
Bill Currie
f70801fa52
Add a test for accessing an array in a struct
...
That's accessed via a pointer. Whee. However, at this stage, the problem
is really a promotion issue for short -> integer.
2019-06-09 21:44:58 +09:00
Bill Currie
e46a44d9c6
Update TODO
2019-06-09 21:37:46 +09:00
Bill Currie
6253623e9b
Remove some weird dereference code
...
It appears to have been an attempt at optimizing dereferences, but it
instead just utterly mangled them.
2019-06-09 21:37:46 +09:00
Bill Currie
f49303e774
Emit code for address expressions
...
It helps if the necessary code is actually emitted in the first place.
2019-06-09 21:37:46 +09:00
Bill Currie
8cef85e5de
Cast scalar types when necessary on assignment
...
This fixes type promotion errors that broke some tests.
2019-06-09 20:12:50 +09:00