1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-07-28 19:29:30 +00:00
Commit Graph

301 Commits

Author SHA1 Message Date
Karol Stasiak
138dcfa19f 8080: implement signed byte comparisons for CPU's without the overflow flag 2019-05-29 14:07:57 +02:00
Karol Stasiak
62984fce9b 8080: optimize handling 2-byte parameters 2019-05-02 13:33:45 +02:00
Karol Stasiak
1862fed70f The @struct array format; fix the @long format 2019-04-30 01:30:22 +02:00
Karol Stasiak
d9f88cdfad Const arrays 2019-04-30 00:41:42 +02:00
Karol Stasiak
546c4d0f44 Unified syntax for indexing 2019-04-18 16:24:46 +02:00
Karol Stasiak
0a36d83164 nullptr 2019-04-16 16:59:16 +02:00
Karol Stasiak
9ea04db566 Use the return variable directly if applicable 2019-04-16 16:34:17 +02:00
Karol Stasiak
629691dfb3 Fix stack variables on 8080 and LR35902 2019-04-16 12:09:14 +02:00
Karol Stasiak
d0f64f2cee Short syntax for small functions 2019-04-15 19:56:14 +02:00
Karol Stasiak
029e84b0f0 Unions, typed pointers, indirect field access via pointers 2019-04-15 19:45:26 +02:00
Karol Stasiak
1ba4b57c1c Array elements can now be types other than byte 2019-04-15 01:57:18 +02:00
Karol Stasiak
d3e62c0065 Preliminary struct support 2019-04-15 01:30:47 +02:00
Karol Stasiak
4cd1db0e0f Allow putting pointer variables anywhere 2019-04-15 00:27:34 +02:00
Karol Stasiak
194f79f907 65816: Various fixes regarding (d,S),Y addressing mode 2019-04-15 00:21:25 +02:00
Karol Stasiak
69ccd993b2 6502: Functions shouldn't use index registers if not necessary 2019-03-18 21:54:26 +01:00
Karol Stasiak
b8547ed154 Aliases should access subfields 2019-03-18 15:14:13 +01:00
Karol Stasiak
6979cbfe39 Generate checksums for Game Boy 2019-01-11 15:17:48 +01:00
Karol Stasiak
fb42e77e6e 6502: Two fixes:
– fix writing constants to volatile variables
– fix optimizing variables to registers yet again
2018-12-31 13:19:13 +01:00
Karol Stasiak
d7b2181ef5 If a variable is used wholly within a loop body and initialized conditionally, do not remove the last store to it 2018-12-29 20:07:43 +01:00
Karol Stasiak
cbe709a9cf 6502: fix optimizations using index registers 2018-12-29 20:01:17 +01:00
Karol Stasiak
f848bf898c 6502: inline variables to registers swapping addressing modes 2018-12-27 20:49:54 +01:00
Karol Stasiak
59afc24db6 Fix memset 2018-12-27 14:19:04 +01:00
Karol Stasiak
0ded460840 8080: Test subroutine extraction 2018-12-27 14:18:30 +01:00
Karol Stasiak
9ff254c72d Allow hi() and lo() in inline assembly 2018-12-27 14:17:48 +01:00
Karol Stasiak
4d64bbafac 6502: always fold constants 2018-12-27 14:16:34 +01:00
Karol Stasiak
f12463aef0 Optimization refactoring:
– -Of should imply -finline
– certain optimizations should be controllable
– unused global symbols should be removed even if we're not optimizing
2018-12-27 01:18:29 +01:00
Karol Stasiak
0bb662183c Faster comparisons to 0 and $FFFF 2018-12-26 02:05:41 +01:00
Karol Stasiak
bf5639761b Optimize constant comparisons 2018-12-26 01:01:43 +01:00
Karol Stasiak
acaaa5bdfe Implicit ranges in for loops are dumb, remove 2018-12-22 01:30:54 +01:00
Karol Stasiak
84c3406dc7 Fix for over enum 2018-12-22 01:30:39 +01:00
Karol Stasiak
02e91070aa Accept bytes as LHS for >>>> 2018-12-21 22:36:53 +01:00
Karol Stasiak
d62901fb51 6502: Allow more complex expressions 2018-12-21 22:36:29 +01:00
Karol Stasiak
36a0065b96 Forbid redefining builtins 2018-12-21 22:35:16 +01:00
Karol Stasiak
e43fb39781 Optimize some stdlib calls 2018-12-21 22:33:27 +01:00
Karol Stasiak
960cee5124 Foreach statement; emitting subprocedures 2018-12-19 18:13:38 +01:00
Karol Stasiak
fc10746522 Alias improvements:
– aliases can now override other objects
– take aliases into account when ordering functions for optimizations and inlining
2018-12-19 17:33:51 +01:00
Karol Stasiak
49ee0fd3a2 MInor test suite improvements 2018-12-19 17:28:15 +01:00
Karol Stasiak
bcd17f1a78 6502: more bit-twiddling optimizations 2018-12-19 01:11:40 +01:00
Karol Stasiak
08f9426ccb Multiplication fixes and improvements 2018-12-19 01:10:39 +01:00
Karol Stasiak
2454f223c8 Return dispatch over enums 2018-12-19 01:04:56 +01:00
Karol Stasiak
acf9db80d3 Reenable mistakenly disabled tests 2018-12-16 22:56:02 +01:00
Karol Stasiak
eb29e78f56 More warnings 2018-12-16 21:07:27 +01:00
Karol Stasiak
5a99dc7293 65816: various improvements 2018-12-16 19:34:33 +01:00
Karol Stasiak
cd8697552c Add sizeof operator 2018-12-16 15:43:17 +01:00
Karol Stasiak
0e5d79f222 6502 Minor comparison optimisation 2018-12-15 00:01:34 +01:00
Karol Stasiak
f32d72b51f Multiplication u16×u8 2018-12-14 22:50:20 +01:00
Karol Stasiak
65f5c552b4 6502: optimization improvements 2018-12-14 22:09:22 +01:00
Karol Stasiak
c28b71add5 6502: Stack-related things:
– software variable stack
– fixes for handling stack variables
2018-12-14 22:01:52 +01:00
Karol Stasiak
eb6b7d7769 Fix and improve nonet operations 2018-12-14 15:43:12 +01:00
Karol Stasiak
406d69c74a Add original line numbers to generated assembly 2018-12-14 15:42:31 +01:00
Karol Stasiak
a985c4f753 More various optimization fixes and improvements 2018-12-14 00:10:30 +01:00
Karol Stasiak
dbe8e39e4a various optimization fixes and improvements 2018-12-13 23:18:56 +01:00
Karol Stasiak
c1ce4a9283 8080: fixed shifting by 0 2018-12-13 23:12:46 +01:00
Karol Stasiak
df71435c78 Fix for...downto loops 2018-10-11 23:59:50 +02:00
Karol Stasiak
6b43f73f57 Don't deduplicate non-elidable code 2018-10-04 23:23:04 +02:00
Karol Stasiak
fe1bf68295 Add align keyword 2018-10-04 21:34:53 +02:00
Karol Stasiak
3736b5ae56 6502: Use zeropage addressing mode when accessing fixed zeropage locations 2018-09-29 01:16:22 +02:00
Karol Stasiak
cbe6d03e60 8080: Optimized multiplication 2018-09-28 23:45:26 +02:00
Karol Stasiak
74dbca1f53 Fix typo in test 2018-08-16 22:01:45 +02:00
Karol Stasiak
376c3283b8 Improvements to trigonometric functions 2018-08-08 23:52:47 +02:00
Karol Stasiak
34b7107d27 Allow casting to wider types 2018-08-08 23:14:09 +02:00
Karol Stasiak
9581891d66 Following jumps. Generating conditional returns/calls. 2018-08-08 23:12:20 +02:00
Karol Stasiak
2d0f3a5a12 Fix tests 2018-08-08 18:48:11 +02:00
Karol Stasiak
2b279ac5e8 Give the preprocessor access to compilation options 2018-08-08 13:44:30 +02:00
Karol Stasiak
2af8304512 Deduplicate more complex code. Better deduplication. 2018-08-08 01:53:47 +02:00
Karol Stasiak
02d6b5b71c 6502: Crank up the optimizations 2018-08-07 21:37:25 +02:00
Karol Stasiak
8dfb223a8c Fast memset for Z80 and 6502 2018-08-07 17:37:09 +02:00
Karol Stasiak
ff16854a11 Code deduplication 2018-08-06 19:29:09 +02:00
Karol Stasiak
48b183828b Z80: LDH instruction for LR35902 2018-08-03 16:43:31 +02:00
Karol Stasiak
f4a2c96512 Fix comparisons 2018-08-03 16:21:02 +02:00
Karol Stasiak
fab1cafec3 Z80: Intel syntax support 2018-08-03 13:23:37 +02:00
Karol Stasiak
388ceb8b3a 6502: software BCD, increase default zpreg to 4 2018-08-03 13:06:23 +02:00
Karol Stasiak
30aa62ceaf Z80: Fix 16-bit operations 2018-08-03 13:02:18 +02:00
Karol Stasiak
e952d89849 Z80: Intel syntax for output. 2018-08-01 21:16:20 +02:00
Karol Stasiak
d4beba11a1 Z80: >>' operator 2018-08-01 18:49:37 +02:00
Karol Stasiak
9b5b39181a Z80: Decimal subtraction on 8080, fixes for adding longs returned from functions 2018-08-01 15:33:07 +02:00
Karol Stasiak
69f233e378 Z80: Interrupt handlers. Allow using IY as base pointer. 2018-08-01 12:50:05 +02:00
Karol Stasiak
e914ad6d7b Move label generation into a separate class 2018-07-31 18:16:36 +02:00
Karol Stasiak
53f550d266 Z80: Fix line size calculations 2018-07-31 00:52:01 +02:00
Karol Stasiak
2bac42c187 Optimizations for LR35902 and 8080 2018-07-30 23:51:41 +02:00
Karol Stasiak
6d7643b817 6502: Better descriptions of benchmarked tests 2018-07-30 23:50:44 +02:00
Karol Stasiak
998902acf6 Refactor: error logging 2018-07-30 18:53:08 +02:00
Karol Stasiak
cb92b09942 Improvements related to large types:
– returning types larger than 2
– fastcall for 1 parameter of size 3 or 4 on Z80
– more integer types (up to int128)
– marked farword as a deprecated alias of int24
2018-07-30 14:33:16 +02:00
Karol Stasiak
3c019b06c1 Tests for LR35902 2018-07-27 19:12:28 +02:00
Karol Stasiak
600e49cf49 Make some tests work on LR35902 2018-07-27 19:10:15 +02:00
Karol Stasiak
1948c38e04 Separate optimization presets for Z80, LR35902 and 8080 2018-07-27 19:09:38 +02:00
Karol Stasiak
2ca30315ca Preparations for work on LR35902 support 2018-07-24 23:44:00 +02:00
Karol Stasiak
c5b45947dc Preliminary support for Intel 8080 2018-07-24 23:14:41 +02:00
Karol Stasiak
b724ba9c6a Z80: Full assembly support 2018-07-24 17:40:06 +02:00
Karol Stasiak
e280aca08b Z80: Emit RES and SET instructions 2018-07-24 16:16:49 +02:00
Karol Stasiak
43c044c80c Z80: Various optimizations for stack variables 2018-07-24 14:31:23 +02:00
Karol Stasiak
c9cbd267c5 6502: Fix stack variables in more complex situations 2018-07-24 01:38:10 +02:00
Karol Stasiak
4be1e46308 6502: Faster page-aligned loops 2018-07-23 16:20:49 +02:00
Karol Stasiak
a34acbf6ce Z80: Operators *'=, <<' and <<'= 2018-07-23 15:47:03 +02:00
Karol Stasiak
85243c96a7 Z80: The >>>> operator 2018-07-23 13:49:59 +02:00
Karol Stasiak
a39064cf76 Z80: Return dispatch 2018-07-23 13:41:51 +02:00
Karol Stasiak
8c1492b211 A statement preprocessor with some basic node-level optimizations 2018-07-21 23:59:16 +02:00
Karol Stasiak
c4c1bf00f2 Enumeration types. Stricter type checks. 2018-07-20 22:46:53 +02:00
Karol Stasiak
ab57090790 Improve optimization in tests for 6502 2018-07-16 23:03:12 +02:00
Karol Stasiak
2c0256c1c1 Tons of Z80 improvements:
– long assignments
– word and long comparisons
– byte multiplication
– correct sign extension
– fixed flow analysis for LD A,(IX,0) and similar
– unused variable store elimination
– unused code elimination
– unused label elimination
– poinless stack stashing elimination
– function inlining
– other flow analysis improvements
– other bugfixes
– other stuff
– more tests
2018-07-16 00:13:35 +02:00
Karol Stasiak
215d8d92b4 Preprocessor. Z80 improvements. Library improvements. 2018-07-12 19:39:25 +02:00
Karol Stasiak
35f3638a4f Added alias support 2018-07-12 01:23:38 +02:00
Karol Stasiak
2c8de8b6a5 Text encoding improvements 2018-07-07 00:58:44 +02:00
Karol Stasiak
a00ba49820 Multiple improvements and fixes:
– reorganized code for future support of larger zeropage register sets
– added stack-allocated variables for Z80
– added many stack-related optimizations for 6502 and Z80
– fixed flow analysis and optimization bugs for Z80
– flow analysis for stack-allocated variables on Z80
– added more optimizations for 6502 and Z80
– fixed IX/IY-indexed operations on Z80
– code cleanup
2018-07-06 22:45:59 +02:00
Karol Stasiak
670741392c Fix tests 2018-07-05 00:57:43 +02:00
Karol Stasiak
4acc040813 More tests for Z80 2018-07-03 01:52:29 +02:00
Karol Stasiak
da023daadc Z80 doesn't have a zeropage 2018-07-02 22:34:29 +02:00
Karol Stasiak
a394ab631f Faster array iteration for Z80 2018-07-02 14:59:21 +02:00
Karol Stasiak
62e94d96f7 Added unsigned byte comparisons for Z80 2018-07-02 00:18:33 +02:00
Karol Stasiak
4d00cb4db9 Added Z80 emulator for testing 2018-07-01 22:28:27 +02:00
Karol Stasiak
893515b649 8- and 16-bit shifting for Z80 2018-07-01 22:27:12 +02:00
Karol Stasiak
2500f842e9 Interprocedural optimization plus some minor fixes:
– fixed handling LDX/LDY/LDZ when inlining variables into registers
– fixed CLA/CLX/CLY instruction generation
– refactored optimization definitions
2018-06-25 21:29:04 +02:00
Karol Stasiak
57740cc6b4 Optimizations for shifting 2018-06-25 01:13:01 +02:00
Karol Stasiak
992ea7090e Comparison fixes and improvements 2018-06-19 00:08:04 +02:00
Karol Stasiak
9b7d58cf65 Optimizing addition by replacing it with bit ops (NMOS) or increments (CMOS) 2018-06-18 19:48:47 +02:00
Karol Stasiak
daf8461c07 Allocating arbitrary variables in the zeropage and using zeropage addressing when appropriate 2018-06-18 17:59:47 +02:00
Karol Stasiak
24a3943501 Array filters (@word, @word_be) 2018-06-18 02:52:14 +02:00
Karol Stasiak
0f453e2d2c Start of the Z80 backend 2018-06-17 02:01:35 +02:00
Karol Stasiak
5281b5f527 Refactoring for the upcoming Z80 support 2018-06-12 22:46:20 +02:00
Karol Stasiak
5dc1bba8ed Multiple improvements:
- fixed some invalid LDX(zp),Y instructions
- better error reporting
- removing unused extern functions
- a new testcase
2018-06-09 00:08:17 +02:00
Karol Stasiak
0919a98e4b Fix for i,const,downto,0 loops 2018-06-04 09:44:54 +02:00
Karol Stasiak
b6e61f16ec Optimizations of adding one 2018-06-01 09:51:59 +02:00
Karol Stasiak
2f1faa12c2 A 24-bit integer type 2018-05-14 02:16:46 +02:00
Karol Stasiak
76a30acf9a Preliminary BBC Micro support 2018-04-02 23:40:40 +02:00
Karol Stasiak
0ddf2f31c8 Inserting raw byte sequences in assembly 2018-04-02 21:40:54 +02:00
Karol Stasiak
d6995091cf Character literals 2018-04-02 21:06:18 +02:00
Karol Stasiak
1fcbf9fd5b More uses for the DCP instruction 2018-03-28 18:56:11 +02:00
Karol Stasiak
d785d43ae7 Many optimization improvements and bugfixes
- fixed VariableToRegisterOptimization removing variables during superoptimization
- fixed PointlessMathFromFlow giving results that do not fit a byte
- fixed PointlessLoadBeforeReturn moving reads from before to after memory modification
- achieved and exceeded CC65 performance when doing 16-bit Eratosthenes sieve
2018-03-28 12:37:38 +02:00
Karol Stasiak
e32887b6b7 Added array initialization syntax with for 2018-03-25 23:14:16 +02:00
Karol Stasiak
9ff888c0d9 Fixed zero-extending for bytes; improved adding bytes to constant words 2018-03-18 23:54:02 +01:00
Karol Stasiak
986252db5b Added some more optimizations 2018-03-18 23:52:40 +01:00
Karol Stasiak
fa34402749 Segment syntax test 2018-03-17 13:49:37 +01:00
Karol Stasiak
e0c3a566b7 Long comparisons; word vs unsigned byte comparison optimization 2018-03-16 13:19:54 +01:00
Karol Stasiak
516d7eae26 Removal of the <<<< operator; nonet operation improvements
Use `nonet(a << b)` instead of `a <<<< b`
2018-03-16 00:34:24 +01:00
Karol Stasiak
8a347e5058 Preliminary segment support; C16/+4 fixes 2018-03-15 23:09:19 +01:00
Karol Stasiak
9e8a125487 Various optimization improvements and bugfixes 2018-03-14 18:50:58 +01:00
Karol Stasiak
38f3923d4d Shifting by variable amount 2018-03-11 23:02:34 +01:00
Karol Stasiak
89b23ee425 Expanding macros from within assembly 2018-03-10 21:52:28 +01:00
Karol Stasiak
739461bfa9 Word addition and bit ops; better handling of side effects 2018-03-10 21:48:04 +01:00
Karol Stasiak
59cf1e06b4 nonet() operator 2018-03-10 00:08:13 +01:00
Karol Stasiak
807a9df8ac Fixed org option 2018-03-09 00:07:05 +01:00
Karol Stasiak
1d865302ca Indexing fixes; 16-bit indexing 2018-03-07 12:36:21 +01:00
Karol Stasiak
11337f4975 Optimizing predictable reads from local variables 2018-03-06 23:43:09 +01:00
Karol Stasiak
af812fe348 else if 2018-03-06 16:46:50 +01:00
Karol Stasiak
791f910cc4 Optimize away impossible odd/even equalities 2018-03-06 16:44:57 +01:00
Karol Stasiak
05e147b880 Removal of detailed flow analysis; it was slow and not worth it 2018-03-05 12:41:43 +01:00
Karol Stasiak
15dbaad6d1 Use zero page locations as as pseudo-registers; 8-bit multiplication and 16-bit shifts 2018-03-05 12:05:37 +01:00
Karol Stasiak
50ddd52786 Added break and continue statements 2018-03-03 21:34:12 +01:00
Karol Stasiak
6ed5d51260 Preliminary support for 65816, 65CE02 and HuC6280 2018-03-03 01:21:57 +01:00
Karol Stasiak
50b93db337 Constant pointer optimization 2018-03-01 15:57:54 +01:00