1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-26 19:30:00 +00:00
Commit Graph

80 Commits

Author SHA1 Message Date
Flight_Control
20f3529a2d - Optimized namespace prefix logic for global variables and fixed but to also include exported global variables used in logic.
- Fixed bug for hasExportAsmLibrary to use the LibraryName always and optimized the code in AsmLibrary.java.
- Fixed bug for hasExportAsmLibrary to use the LibraryName always and optimized the code in Pass4CodeGeneration.java.
- Optimized naming of asmLibrary labels and names. Labels are to be used in assembler generation only. Names are used for all other purposes.
2024-04-27 09:30:58 +03:00
Flight_Control
1a53d6a913 - Refer .asm library imported global variables to the the namespace where the global variable resides.
- Generalized the AsmLibrary procedures to symbols, to also allow exporting variables.
- Removed the initialization part of .asm library header generation for global exported variables.
- The directive __asm_export can now also be used to indicate global variables exporting within C libraries (for potential .asm library generation).
- Converted the usage of typedef to struct for __conio global variable in cx16_conio.c
- Updated example code.
- Fixed a bug where for exported structs and imported structs, the variables were defined as volatile to non-volatile.
- VariableBuilder constructor now also received the program variable to refer to program level configurations defined.
- Remove to declare string constants as .asm library exported global variables.
- Removed the optimization PassNAsmLibraryGlobalVarsExport. It is not needed. Each global variable export must be explicitly declared using asm_export or __asm_export.
- Improved naming of variables and procedures to retrieve and manage import and export libraries within the program.
2024-04-26 12:44:28 +03:00
Sven Van de Velde
e371d304f6 - Fixed test cases. Full retest of all test cases.
- Create the possibility of forward declaration of structs as part of the language.
- Generation of forward declarations in the .asm header files.
- Treat global variables as part of global memory, even in libraries. Ensure that globals are not overwritten when importing.
- Ensure that the various compilation models (stack, var, phi) in combination with the memory models (zp, mem) result in proper execution of code and proper memory allocation etc, etc.
- Added the lru-cache logic to properly test the compilation and memory model combinations. (A lot of bugfixes as a result!)
2024-01-16 08:06:14 +03:00
Sven Van de Velde
f2b5d160a8 - Fixing setting exported and imported globals as volatile method...
Now using the directives approach at pass0 instead of in VariableBuilder.
2024-01-02 21:15:31 +01:00
Sven Van de Velde
fab740f797 - Fix earlier manual merge mistakes.
- Fixed a couple of issues with AsmIdentifier.
- Global variables exported are volatile.
- Created proper generation of the protypes for exported global variables in _asm.h.
- Created new test cases.
- Struggled with the proper export of global struct variables, first version of it implemented but this will require rework ...
- There are issues with "types" of structures, will need more work in the future and a strategy for it...
- Made AsmLibrary functions as AsmExportLibrary to make the code more clear.
- Created isAsmExportLibraryGlobal and isAsmImportLibrary global functions.
2024-01-02 19:41:03 +01:00
Sven Van de Velde
d477cb9eae - New AsmImportLibrary class, for generating the #import statements.
- New AsmIdentifier class that replaces unallowed kickasm characters to an _.
- New AsmIgnoredImportInlinedKickAsm class, for creating the construct to ignore the body lines when the library is imported (used), and removed the #else clause (was confusing).
- Export of global variable in .asm Libraries (first version).
- Removal of constructor_for in .asm libraries.
- Reworked the way in assembler generation how link files are treated.
- Reworked all `replace("-","_")` areas using AsmIdentifier properly.
2024-01-01 16:57:48 +01:00
Sven Van de Velde
5436877fa0 Many Fixes and Additions:
- #820/29 - ensure that during pass4, namespaces are correctly labelled for variables.
- #820/30 - added option to only having to specify #pragma asm_library and the source file name will be used as the library name.
- #820/31 - remove the need for link files for libraries.
- #820/1 - Lots of optimizations
- Added lru-cache as a library in the library tests. It works!
- Added many tests
- Added conio example
- Added eightqueens example.
2023-12-12 08:21:28 +01:00
Sven Van de Velde
30e58f54e3 - Correct calculation of live ranges for exported and imported procedures parameters and return value, resulting in better ZP coalesce accuracy and ZP allocation compactness. (I really worked a lot on this ...)
- Working on the coalesce benchmark tests (comparing the compiles of the same procedures with library functions and without library functions).
- Added documentation.
- Completed issue #820 check list on gitlab, see the details there. Source code changes use the #820/ tags to document each change context.
2023-12-08 19:06:03 +01:00
Sven Van de Velde
f98424ed97 - First well improved version for exporting and importing .asm library functions.
- Full documentation in the new manual directory containing the kickc.md markup manual file.
- library folder containing a concrete example.
2023-11-24 16:05:02 +01:00
Sven Van de Velde
818da3f995 - Ensure that for exported procedure parameters, there are no constant values calculated.
- Optimization of function to calculate exported procedure parameters.
2023-11-18 17:24:13 +01:00
Sven Van de Velde
1209353803 - Successful export and import of conio.
- TODO: Create header file for import.
- TODO: Resolve coalesce of exported procedure parameters.
- TODO: Remove constant optimizations for exported procedure parameters.
2023-11-18 10:40:50 +01:00
jespergravgaard
ac96f0b8da #815 working on moving control flow graphs into procedure compilation. 2023-04-09 23:40:37 +02:00
jespergravgaard
8a38c2a887 Using C declaration format for types in logs, errors, comments and more. 2021-08-10 17:48:55 +02:00
jespergravgaard
ac9dbc88a8 Added toCDecl() that cn print variables and types in standard C declaration format. 2021-08-10 00:54:20 +02:00
jespergravgaard
f50cbf3cf1 Working on classic structs and unions. #197 2021-07-25 02:21:25 +02:00
jespergravgaard
29633a2479 Working on varcall calling convention, structs and unions. #197 #372 2021-07-24 11:33:07 +02:00
Jesper Gravgaard
843baa6fb2 #666 working on memory model for intermediate vars 2021-06-06 12:19:05 +02:00
Jesper Gravgaard
fcb23cbf59 Added some fragments. Preparing for VariableBuilder being used for intermediate variables. 2021-06-05 09:46:47 +02:00
jespergravgaard
78209db593 Variable printing now in C syntax. #121 2021-04-30 17:26:46 +02:00
jespergravgaard
8fd8bb1832 Removed const/volatile from Variable. #121 2021-04-30 16:21:38 +02:00
jespergravgaard
6e0cacc908 Moved const/volatile to SymbolType. #121 2021-04-30 15:39:29 +02:00
jespergravgaard
37ad98913f working on type qualifiers 2021-04-24 08:05:16 +02:00
Jesper Gravgaard
76edc3b8c8 Moved ArraySpec to SymbolTypePointer. 2021-04-12 20:57:46 +02:00
jespergravgaard
82a045934d Updated to ANTLR4.9. Merged Andrzej Śliwa implementation of __address() support for constant expressions branch address_with_expression_value. Closes !1 2020-12-11 01:18:36 +01:00
jespergravgaard
f117db148d Working on log output readability. #534 2020-10-05 09:31:16 +02:00
jespergravgaard
cb1b9bece1 Implemented support for __address() on arrays. Removed support for pc parameter on inline kickasm. Closes #480. Closes #479 2020-06-22 00:07:59 +02:00
jespergravgaard
096d7c0640 Cleaned up scope getters. Might have caused a slow-down of compilation. 2020-04-09 22:17:33 +02:00
jespergravgaard
23ae5cf5f5 Variable extern declarations are now supported. Closes #196 2020-04-09 09:21:43 +02:00
jespergravgaard
db92daf4bf Added initial support for function declarations without a body. #196 2020-04-08 23:40:27 +02:00
jespergravgaard
db6f8b5a36 Added variable nomodify/volatile information to log. 2020-03-29 21:00:25 +02:00
jespergravgaard
a579ab491a Changed pointer and directive parsing to distinguish directives applied to pointers and directives applied to variables. Fixed all example-code to reflect this. Closes #271 2020-03-29 20:22:16 +02:00
jespergravgaard
3770874860 Unrolled condition variables are now converted to SSA automatically in pass 1. 2020-02-14 15:55:04 +01:00
jespergravgaard
f106f953a8 Working on memory model ma_mem. Added some support for local static variables. 2020-02-13 11:36:27 +01:00
jespergravgaard
45ad6b64b0 Dropped inferred volatile. 2020-02-06 18:07:56 +01:00
jespergravgaard
1a978bc82d Fixed struct address-of handling. 2020-02-06 15:40:27 +01:00
jespergravgaard
e8a0478e5f Implemented C-classic struct functionality for loadstore struct variables. Works for most scenarios: declaration, initialization, assignment, member-access. Structs containing arrays not working yet. 2019-12-27 22:35:05 +01:00
Jesper Gravgaard
6b7a0ed92b Added no-modify support. 2019-12-24 11:05:32 +01:00
jespergravgaard
593a8428a0 Fixed Variable.toString() 2019-12-22 23:22:02 +01:00
jespergravgaard
f1a897e37b Fixed Variable.nomodify 2019-12-22 23:15:52 +01:00
jespergravgaard
3abd8bed01 Moving Variable properties towards semantic names (nomodify, volatile, optimize, ...). 2019-12-22 23:05:59 +01:00
jespergravgaard
2fddd14a0a Moving Variable properties towards semantic names (nomodify, volatile, optimize, ...). 2019-12-22 22:31:20 +01:00
jespergravgaard
574f21b25a VariableBuilder has replaced VariableBuilderContext. 2019-12-22 22:16:18 +01:00
jespergravgaard
9811e48039 VariableBuilder has replaced VariableBuilderContext. 2019-12-22 22:04:30 +01:00
jespergravgaard
17a9e90f2b Working on new VariableBuilder. 2019-12-16 22:51:59 +01:00
jespergravgaard
3b297ef85d working on struct strategy 2019-12-14 09:50:26 +01:00
jespergravgaard
cff815f5d7 Restructured Variable creation to make it more explicit what type is being created. 2019-12-08 17:49:14 +01:00
jespergravgaard
1883da7a86 Minor refactoring. 2019-11-24 11:19:57 +01:00
jespergravgaard
59ab4e0eb1 Improved variable constructors. Improved constant comments. 2019-11-23 23:46:46 +01:00
jespergravgaard
4d9c23b6bc Removed isConstant from Variable (now using Kind). 2019-11-23 18:44:43 +01:00
jespergravgaard
5ab9b4353c Refactoring Variable creation. 2019-11-22 23:41:01 +01:00