1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-06-20 03:29:32 +00:00
Commit Graph

3045 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
Flight_Control
00df07b7bf - Fixed test cases. Full retest of all test cases.
- Treat global variables of libraries, as part of the .asm library .namespace.
- Fix bugs.
- Assign meaningful struct names to .asm internal variables and labels. (Remove the $x notation).
2024-04-20 07:03:31 +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
2c74b2a19c - Fixes test cases. 2024-01-02 21:15:42 +01: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
88dfeec3de - Now nesting of libraries works. Had to take care of the zero-page usage of nested procedures. The _asm.h file, containing the exported procedures contains the full zero-page usage, including the used (nested) procedures in the call graph of each exported procedure.
- Proper import mechanisms and naming.
- Ensure that .asm library files are imported only once!
- Added a new asm directory in kc folder, that contains library stub C files for .asm library generation.
- Fixed library startup initialization. .asm libraries are now also calling correctly the library init routines etc.
- Added new test cases.
2023-12-30 20:33:13 +01:00
Sven Van de Velde
5ac5eb159e - Added a new -A or -asmLibdir option to specify the path where to find the .asm files for import during pass4.
- Validate that an .asm library can be actually found within the path specifications of -A or in the current folder when importing a library using #pragma asm_import pre-processor command or __asm_import directive. If the .asm file cannot be found, throw a compile error with a very descriptive and helping message.
- Optimized the Program class, now containing a currentPath variable.
-
2023-12-19 09:58:08 +01:00
Sven Van de Velde
61c4e8418d - Fragments 2023-12-19 09:52:31 +01:00
Sven Van de Velde
58fef5acc3 Cleanup compile test case and folder. 2023-12-17 12:13:29 +01:00
Sven Van de Velde
d81e6ed2fa Merge remote-tracking branch 'origin/master-libraries' into master-libraries
# Conflicts:
#	src/test/kc/library/printf/printf_lib.c
#	src/test/kc/library/printf/printf_test.c
2023-12-17 11:45:04 +01:00
Sven Van de Velde
9690a10195 - An .asm library creation to include the most important printf statements together with conio, so that the main program does not need to recompile all this logic. 2023-12-17 11:44:00 +01:00
Sven Van de Velde
8cf479d458 - Fixed an issue where for main programs (so non-library programs), also the link script conditional include would be defined in pass4 for in the assembler generation. 2023-12-17 11:42:27 +01:00
Sven Van de Velde
dcbf2a4efe - Fixed an issue where __zp without specifying the number would cause a crash. 2023-12-17 11:39:53 +01:00
Sven Van de Velde
d75d96473c - Fixed a clobber test issue with alive variables that are in libraries (as parameters) and do not need a clobber test, as the library tested full clobber issues. The issue was fixed by not generating memory, zp or register usage for procedure parameters imported from .asm libraries. 2023-12-17 11:38:59 +01:00
Sven Van de Velde
bcab0a8c94 - Fixed a clobber test issue with alive variables that are in libraries (as parameters) and do not need a clobber test, as the library tested full clobber issues. 2023-12-16 19:13:39 +01:00
Sven Van de Velde
fa678aac3d - Rework printf to include printf in libraries. printf_type functions don't user anymore the format structure, but all formatting is passed as parameters. 2023-12-16 19:12:46 +01:00
Sven Van de Velde
46321d47f4 - Bugfix of link file. Must be properly included and defined in all cases. With or without .asm library. 2023-12-16 13:45:38 +01:00
Sven Van de Velde
30e6aff441 - Documentation for .asm libraries fixes.
- Asm library code debug fixes.
- Added test programs as explained in the documentation.
2023-12-15 14:51:18 +01:00
Sven Van de Velde
a0416a1a1d - Documentation 2023-12-15 08:44:41 +01:00
Sven Van de Velde
4b0d259fc7 Merge remote-tracking branch 'origin/master-libraries' into master-libraries
# Conflicts:
#	manual/2.11.libraries.md
2023-12-14 22:28:46 +01:00
Sven Van de Velde
acb385094b - Documentation for .asm libraries.
- Preparing source file identification routines for later usage during linking.
- Refining the code generation routines in pass4.
2023-12-14 22:27:25 +01:00
Sven Van de Velde
b90ef9f94d - Documentation for .asm libraries.
- Preparing source file identification routines for later usage during linking.
- Refining the code generation routines in pass4.
2023-12-14 20:44:03 +01:00
Sven Van de Velde
b9472afb31 - zeropages allocated for local variables, used in procedures exported to .Asm libraries, are also added as part of the function prototype using the directive __zp_reserve. 2023-12-13 17:19:01 +01:00
Sven Van de Velde
ff06b2eddf Code review of library. 2023-12-12 22:45:19 +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
979ec83112 - Correct calculation of live ranges for exported and imported procedures parameters and return value, resulting in better ZP coalesce accuracy and ZP consumation 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:43:06 +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
4bfb6d5d1d - Correct calculation of live ranges for exported procedures parameters, resulting in better ZP coalesce accuracy.
- Working on the coalesce benchmark tests (comparing the compiles of the same procedures with library functions and without library functions). WIP.
- Added documentation.
2023-12-06 18:39:52 +01:00
Sven Van de Velde
5e6622b2a8 Small test program to test parameters. 2023-12-05 16:23:22 +01:00
Sven Van de Velde
53a918025a Fine-tuned the verbose of the text and the weight of the equivalence classes allocation. 2023-12-05 14:12:39 +01:00
Sven Van de Velde
a4bbf1fd4f Fine-tuned the verbose of the weight of the symbols and the onlyZP flag. 2023-12-05 11:28:00 +01:00
Sven Van de Velde
59fd0e0703 CX16 library changes 2023-11-30 13:38:42 +01:00
Sven Van de Velde
5d86d93160 - Added vera constants
- Added fragment
2023-11-29 14:45:23 +01:00
Sven Van de Velde
5a5f3e1dee Merge remote-tracking branch 'origin/master-libraries' into master-libraries 2023-11-29 14:28:22 +01:00
Sven Van de Velde
fcd38d0a19 - Now compiling the eight queens example with conio asm library.
- Added proper return value handling for __varcall functions.
- Added many fixes concerning start functions.
- Optimized asm library examples.
- Added a return value asm library example.
2023-11-29 14:27:59 +01:00
Sven Van de Velde
07cb0ba6fa - Now compiling the eight queens example with conio asm library.
- Added proper return value handling for __varcall functions.
- Added many fixes concerning start functions.
- Optimized asm library examples.
- Added a return value asm library example.
2023-11-29 14:15:52 +01:00
Sven Van de Velde
4012887479 Merge branch 'master' into master-libraries 2023-11-27 15:47:50 +01:00
Sven Van de Velde
f252f4b56f Merge remote-tracking branch 'origin/master-libraries' into master-libraries 2023-11-27 15:36:04 +01:00
Sven Van de Velde
0883478470 - only call namespaced procedures when the library is import. For export, just call the procedure without the library prefix. (KickAsm does not support it). 2023-11-27 15:35:45 +01:00
Sven Van de Velde
77eb2f7bcb - only call namespaced procedures when the library is import. For export, just call the procedure without the library prefix. (KickAsm does not support it). 2023-11-27 15:35:30 +01:00
Sven Van de Velde
ca58df159b - only call namespaced procedures when the library is import. For export, just call the procedure without the library prefix. (KickAsm does not support it). 2023-11-27 09:36:57 +01:00
Sven Van de Velde
a182d78172 Merge remote-tracking branch 'origin/master-libraries' into master-libraries
# Conflicts:
#	src/test/kc/library/printf-library-1.c
2023-11-24 16:05:57 +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
b794791cc6 - 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 15:46:48 +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
bcd7a49f6a - Automated the startup init procedures of libraries. For example, conio needs to call the conio init procedure automatically. This procedure is automatically called from the programs that import the libraries, where their __start procedure calls the library __start procedure. To avoid name conflicts, the library start procedures are named __libraryname_start and are embedded into the library name space.
- Reworked the start procedure name for all classes, now the routine getStartProcedureName is called.
2023-11-18 11:45:10 +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