Commit graph

95 commits

Author SHA1 Message Date
Dale Weiler
a7c1f6f021 Implement [[eraseable]] attribute. When used with a function it instructs the AST (which than transfers logic to the IR) that the function (or variable) is potentially unused (verified by checking the read count). This than propogates through the IR and prevents the IR from generating both the definition and global/function. The intrinsics system uses this as well to prevent intrinsic functions from being generated unless they're used. 2013-08-29 00:05:37 -04:00
Wolfgang Bumiller
69cecb74df ir_builder now has a vinstr_temp array, a bunch of temps (currently 1) which can be used for virtual instruction translation 2013-08-26 10:23:03 +02:00
Dale Weiler
d6ca5673dc Use the _t consistency naming scheme. Also various cleanups. 2013-07-30 16:00:51 +00:00
Dale Weiler
c7679722fb Please the whitespace gods 2013-07-27 11:48:55 +00:00
Dale Weiler
82fd7fcf68 Move code generator into ir_builder for earlier free. It's also a much more cleaner design than load parser->code for all ast/ir operations. We also have a proper chain'd design now (so making this a library will be easier). 2013-06-20 10:52:58 +00:00
Dale Weiler
8afd373e4f Fixed whitespace 2013-06-14 21:36:16 +00:00
Dale Weiler
f892b32335 Major export cleanup. Anything that was exported but wasn't used outside where it was implemented has been turned into static, and their exports have been removed. This actually makes the compiler compile slightly faster. 2013-05-29 03:29:04 +00:00
Dale Weiler
2eddc464d5 Less extern 2013-04-25 12:22:34 +00:00
Dale Weiler
785ab7c072 No more globals for codegen 2013-04-25 09:35:30 +00:00
Wolfgang Bumiller
3a4aba0b31 Grrrr 2013-04-24 17:47:42 +02:00
Dale Weiler
489ad486bc Get it compiling in visual studio again. 2013-04-24 01:43:53 +00:00
Wolfgang Bumiller
3e3b8993aa Lifetime analysis: Don't go through the blocks as a graph, instead, go through only the list.
The difference in code is rather small, but it's much faster.
2013-02-11 11:39:44 +01:00
Wolfgang Bumiller
e8b5ad6625 mask -Olocal-temps by IR_FLAG_MASK_NO_LOCAL_TEMPS which now equals IR_FLAG_MASK_NO_OVERLAP - though HAS_ARRAYS usually suffices, but not for code which _depends_ on uninitialized variables 2013-01-12 14:03:54 +01:00
Wolfgang Bumiller
2a4ea74a97 ir_function stores max_varargs now 2013-01-12 14:01:16 +01:00
Wolfgang Bumiller
973122ed9b ast_call now has a va_count which causes a store to reserved:va_count before the call 2013-01-12 13:29:47 +01:00
Wolfgang Bumiller
6df3c625b0 Added a flag to both ast and ir which enforces the generation of a globaldef for a value 2013-01-11 19:15:59 +01:00
Wolfgang Bumiller
f06a59e3c7 Fix a warning 2013-01-10 16:04:58 +01:00
Dale Weiler
29db4a44ed Happy new years! 2013-01-01 05:08:55 +00:00
Wolfgang Bumiller
40b2a26e89 TYPE_NIL, builder->nil, ast_value_codegen for TYPE_NIL 2012-12-28 18:05:28 +01:00
Dale Weiler
f58b4a6cd9 Added splint.sh (a progressive way to fix some possible bugs) 2012-12-28 12:29:46 +00:00
Wolfgang Bumiller
d4483bfda6 -Oglobal-temps 2012-12-26 23:18:45 +01:00
Wolfgang Bumiller
a7c3ef3e22 -Ocall-stores as part of -O1: instead of having CALL instructions issue STOREs for every parameter, use the newly introduced 'lock' flag to make the operations generating the call's parameters generate them right into the OFS_PARM if there's no interfering CALL in between 2012-12-25 23:25:59 +01:00
Wolfgang Bumiller
710f580e15 liferange calc now sets the 'locked' flag on values when reaching a CALL 2012-12-25 21:03:26 +01:00
Wolfgang Bumiller
63928e231c Remove ir_block_create_{add,sub,mul,div}, they're not used; STOREP instructions don't themselves to their target pointer's 'writes' list, but 'reads' list instead 2012-12-23 21:29:15 +01:00
Wolfgang Bumiller
b8c61f2f88 Try generating the function-locals in a later pass; with the option to overlap them. 2012-12-23 17:32:39 +01:00
Wolfgang Bumiller
88a6437840 remember the maximum amount of required function-locals 2012-12-23 16:31:01 +01:00
Wolfgang Bumiller
7998a98818 ir_function now has a flags field - flags are: IR_FLAG_HAS_{ARRAYS,UNINITIALIZED,GOTO} 2012-12-23 16:21:38 +01:00
Wolfgang (Blub) Bumiller
384446316a VINSTR_NRCALL, translated like any other call for now; to be used to mark a call which never returns, ie the error builtin 2012-12-19 20:38:32 +01:00
Wolfgang (Blub) Bumiller
94560d1873 -Ominor -> -Opeephole; added -Olocaltemps flag; using a less space-wasting temp-allocation in general 2012-12-06 13:08:46 +01:00
Wolfgang (Blub) Bumiller
2a2465c884 prepare fields before generating globals so we avoid the need for relocating initialized fieldpointers 2012-11-30 21:22:48 +01:00
Wolfgang (Blub) Bumiller
6fc00e523d All ir_instrs now get their lex-context, so that we can create an LNO file with -flno 2012-11-30 18:20:02 +01:00
Wolfgang (Blub) Bumiller
5e23e8296d don't just store a 'bool constant' in the ast/ir, store the complete qualifier: 'int cvq', moved CV_ defines into gmqcc.h 2012-11-30 13:47:28 +01:00
Wolfgang (Blub) Bumiller
23e0637e85 ir_function_create_block now takes a lex_ctx instead of copying from the function; ast_ternary: need to remember the _end_ block of the 2 expressions because that's where the jump is actually supposed to be 2012-11-25 23:48:29 +01:00
Wolfgang (Blub) Bumiller
18b27d5cf6 use the hashtables in the IR 2012-11-25 13:37:54 +01:00
Wolfgang (Blub) Bumiller
060f995ca4 removing ir_function_get_local - it's unused 2012-11-25 13:33:00 +01:00
Wolfgang (Blub) Bumiller
b1425dfcf1 'likely' hint for IFs 2012-11-21 17:37:45 +01:00
Wolfgang (Blub) Bumiller
f1735d91b8 remove a redundant ir_function member 2012-11-18 20:36:02 +01:00
Wolfgang (Blub) Bumiller
f023004a67 Make functions copy their extparams 2012-11-18 20:06:28 +01:00
Wolfgang (Blub) Bumiller
906f319673 Replaced it all... 2012-11-15 18:32:09 +01:00
Wolfgang (Blub) Bumiller
e143db0cae gcc lost it's magic analyzer and now complains about uninitialized stuff... <sadface> 2012-11-04 11:41:44 +01:00
Wolfgang (Blub) Bumiller
b2315777d1 cache the IMMEDIATE string in the builder directly 2012-08-24 19:52:06 +02:00
Wolfgang (Blub) Bumiller
74cb075665 cache filenames as such instead of using code_cachedstring 2012-08-24 19:44:29 +02:00
Wolfgang (Blub) Bumiller
04dca17cff ir_value now checks if a name was specified 2012-08-24 18:14:39 +02:00
Wolfgang (Blub) Bumiller
5e4b8846d1 slight change to ir_value_dump_life; fixing ir_value_life_merge_into: TODO test this seperately, all cases 2012-08-23 22:07:32 +02:00
Wolfgang (Blub) Bumiller
fe3b1b2e8d ir_values which are members of a vector should know that, so that liferange calc can use the vector rather than the member 2012-08-19 21:37:29 +02:00
Wolfgang (Blub) Bumiller
e606913187 IR generation: for functions: first generate all defs, then the code, so access to prototyped functions doesn't result in NULL code 2012-08-19 18:00:53 +02:00
Wolfgang (Blub) Bumiller
b3d4e406ec it's not undefined, stupid 2012-08-16 12:58:26 +02:00
Wolfgang (Blub) Bumiller
7e3edea621 fixing the messup of MUL_FV and _VF being swapped - getting rid of additions that really have no place here (YET) (matrix/quaternion types) 2012-08-12 11:34:55 +02:00
Wolfgang (Blub) Bumiller
d68d19dbfd Merging master to handle vector members, fields, and members of vector fields 2012-08-12 10:08:41 +02:00
Wolfgang (Blub) Bumiller
1559dedfd9 ir_value_set_field 2012-08-11 15:41:10 +02:00