xonotic/gmqcc.git
9 years agoMerge branch 'master' into ast-and-ir
Dale Weiler [Sat, 28 Apr 2012 20:45:02 +0000 (16:45 -0400)]
Merge branch 'master' into ast-and-ir

9 years agoRemove trailing whitespace from everything
Dale Weiler [Sat, 28 Apr 2012 20:43:39 +0000 (16:43 -0400)]
Remove trailing whitespace from everything

9 years agogitattributes for whitespace
Dale Weiler [Sat, 28 Apr 2012 20:40:03 +0000 (16:40 -0400)]
gitattributes for whitespace

9 years agolex.c -> lex_init s/lex->line = 0/lex->line = 1/
Dale Weiler [Sat, 28 Apr 2012 20:31:30 +0000 (16:31 -0400)]
lex.c -> lex_init s/lex->line = 0/lex->line = 1/

9 years agoThis should fix line counting issues with the lexer
Dale Weiler [Sat, 28 Apr 2012 20:30:44 +0000 (16:30 -0400)]
This should fix line counting issues with the lexer

9 years agoLexer fixes
Dale Weiler [Sat, 28 Apr 2012 20:25:43 +0000 (16:25 -0400)]
Lexer fixes

9 years agoast and ir testers - to use: compile into gmqcc and execut the functions in main()
Wolfgang Bumiller [Sat, 28 Apr 2012 19:42:12 +0000 (21:42 +0200)]
ast and ir testers - to use: compile into gmqcc and execut the functions in main()

9 years agoparam_argument cleanup
Dale Weiler [Sat, 28 Apr 2012 19:36:39 +0000 (15:36 -0400)]
param_argument cleanup

9 years agoparam_argument cleanup
Dale Weiler [Sat, 28 Apr 2012 19:20:13 +0000 (15:20 -0400)]
param_argument cleanup

9 years agoDo not force -[aci] parameters' arguments to be in the same argv; (Allow 'gmqcc ...
Wolfgang Bumiller [Sat, 28 Apr 2012 12:32:52 +0000 (14:32 +0200)]
Do not force -[aci] parameters' arguments to be in the same argv; (Allow 'gmqcc -c foo' to act like 'gmqcc -cfoo'

9 years agoast_function gets a handle to its ir_function, ast_global_codegen to generate an...
Wolfgang Bumiller [Sat, 28 Apr 2012 16:54:27 +0000 (18:54 +0200)]
ast_function gets a handle to its ir_function, ast_global_codegen to generate an ir global, or an ir_function

9 years agoFirst delete the blocks, THEN the locals, since blocks USE locals, darn
Wolfgang Bumiller [Sat, 28 Apr 2012 15:29:43 +0000 (17:29 +0200)]
First delete the blocks, THEN the locals, since blocks USE locals, darn

9 years agoast_binary takes 2 expressions, not 2 values, ast_store takes a value and and express...
Wolfgang Bumiller [Sat, 28 Apr 2012 15:27:06 +0000 (17:27 +0200)]
ast_binary takes 2 expressions, not 2 values, ast_store takes a value and and expression for now until we support pointers, also: dropped the 'keep' param from ast_value_new, values are always to be stored somewhere to be deleted independently from their uses

9 years agoast_value and ast_function are linked together when using ast_function_new, note...
Wolfgang Bumiller [Sat, 28 Apr 2012 13:57:19 +0000 (15:57 +0200)]
ast_value and ast_function are linked together when using ast_function_new, note however, that neither will delete the other in their _delete functions.

9 years agosurpress empty bodies
Dale Weiler [Sat, 28 Apr 2012 19:13:41 +0000 (15:13 -0400)]
surpress empty bodies

9 years agovector parsing for assembly
Dale Weiler [Sat, 28 Apr 2012 11:27:03 +0000 (07:27 -0400)]
vector parsing for assembly

9 years agoGet rid of ast_setfunc
Wolfgang Bumiller [Sat, 28 Apr 2012 10:51:44 +0000 (12:51 +0200)]
Get rid of ast_setfunc

9 years agoCut at comma
Dale Weiler [Sat, 28 Apr 2012 10:35:42 +0000 (06:35 -0400)]
Cut at comma

9 years agoMerge remote-tracking branch 'origin/ast-and-ir' into ast-and-ir
Dale Weiler [Sat, 28 Apr 2012 10:32:32 +0000 (06:32 -0400)]
Merge remote-tracking branch 'origin/ast-and-ir' into ast-and-ir

9 years agoFixed all invalid mmeory accesses
Dale Weiler [Sat, 28 Apr 2012 10:31:16 +0000 (06:31 -0400)]
Fixed all invalid mmeory accesses

9 years agoalmost ISO C now, fixed all the MEM_VECTOR trailing semicolon issues.
Dale Weiler [Sat, 28 Apr 2012 09:54:24 +0000 (05:54 -0400)]
almost ISO C now, fixed all the MEM_VECTOR trailing semicolon issues.

9 years agoAdding debug dump functions
Wolfgang Bumiller [Sat, 28 Apr 2012 09:50:01 +0000 (11:50 +0200)]
Adding debug dump functions

9 years agoFixed: block-labels were NULLed after being set -_-
Wolfgang Bumiller [Sat, 28 Apr 2012 09:49:52 +0000 (11:49 +0200)]
Fixed: block-labels were NULLed after being set -_-

9 years ago2 missind free->mem_d in MEM_VECTOR macros
Wolfgang Bumiller [Sat, 28 Apr 2012 09:30:52 +0000 (11:30 +0200)]
2 missind free->mem_d in MEM_VECTOR macros

9 years agolex_ctx_t -> lex_ctx, vector_t -> vector
Wolfgang Bumiller [Sat, 28 Apr 2012 09:13:16 +0000 (11:13 +0200)]
lex_ctx_t -> lex_ctx, vector_t -> vector

9 years agoInterface change
Dale Weiler [Sat, 28 Apr 2012 09:35:32 +0000 (05:35 -0400)]
Interface change

9 years agostruct lex_file -> lex_file
Dale Weiler [Sat, 28 Apr 2012 09:25:19 +0000 (05:25 -0400)]
struct lex_file -> lex_file

9 years agoastir.h -> gmqcc.h
Dale Weiler [Sat, 28 Apr 2012 09:08:03 +0000 (05:08 -0400)]
astir.h -> gmqcc.h

9 years agoMerge branch 'blub/ast-and-ir-merging' of github.com:graphitemaster/gmqcc into ast...
Dale Weiler [Sat, 28 Apr 2012 09:03:31 +0000 (05:03 -0400)]
Merge branch 'blub/ast-and-ir-merging' of github.com:graphitemaster/gmqcc into ast-and-ir

9 years agowindows makefile update
Dale Weiler [Sat, 28 Apr 2012 09:01:19 +0000 (05:01 -0400)]
windows makefile update

9 years agoRemoved the qc_type enum and replaced all qc_* by TYPE_*
Wolfgang Bumiller [Sat, 28 Apr 2012 08:42:03 +0000 (10:42 +0200)]
Removed the qc_type enum and replaced all qc_* by TYPE_*

9 years agoAdd shouldn't clear on failure either, it would be rather ugly to handle
Wolfgang Bumiller [Sat, 28 Apr 2012 08:32:10 +0000 (10:32 +0200)]
Add shouldn't clear on failure either, it would be rather ugly to handle

9 years agoHeader guards and macros get {} in oneline ifs and loops
Wolfgang Bumiller [Sat, 28 Apr 2012 08:17:32 +0000 (10:17 +0200)]
Header guards and macros get {} in oneline ifs and loops

9 years agoMerge branch 'assembler' into ast-and-ir
Dale Weiler [Sat, 28 Apr 2012 08:12:24 +0000 (04:12 -0400)]
Merge branch 'assembler' into ast-and-ir

9 years agotype parsing for constants, globals and locals. Sanatize constants to select interna...
Dale Weiler [Sat, 28 Apr 2012 07:53:23 +0000 (03:53 -0400)]
type parsing for constants, globals and locals.  Sanatize constants to select internal functions to prevent possible runtime issues that could be a result of atoi working for what we consider invalid strings containing constants.

9 years agoBetter codegen
Dale Weiler [Sat, 28 Apr 2012 07:37:14 +0000 (03:37 -0400)]
Better codegen

9 years agoassembler can parse internal functions. Wrote all internal functions (that are not...
Dale Weiler [Sat, 28 Apr 2012 07:26:40 +0000 (03:26 -0400)]
assembler can parse internal functions. Wrote all internal functions (that are not extensions) to test.qs

9 years agoMore assembly work
Dale Weiler [Sat, 28 Apr 2012 06:34:39 +0000 (02:34 -0400)]
More assembly work

9 years agoMore assembler code
Dale Weiler [Fri, 27 Apr 2012 20:45:34 +0000 (16:45 -0400)]
More assembler code

9 years agoWorking on the assembler
Dale Weiler [Fri, 27 Apr 2012 20:31:38 +0000 (16:31 -0400)]
Working on the assembler

9 years ago2 missing return values
Wolfgang Bumiller [Fri, 27 Apr 2012 16:00:57 +0000 (18:00 +0200)]
2 missing return values

9 years agoa vector_remove shouldn't clear the vector when failing to reallocate as a smaller...
Wolfgang (Blub) Bumiller [Fri, 27 Apr 2012 11:53:49 +0000 (13:53 +0200)]
a vector_remove shouldn't clear the vector when failing to reallocate as a smaller chunk, just return false. The value is still removed from the vector, so no unstable state is generated by this, which makes a _remove safe to ignore where it makes sense.

9 years agoast_value_set_name to return bool
Wolfgang (Blub) Bumiller [Fri, 27 Apr 2012 11:32:52 +0000 (13:32 +0200)]
ast_value_set_name to return bool

9 years agoUsing GMQCC_WARN some more where it makes sense
Wolfgang (Blub) Bumiller [Fri, 27 Apr 2012 11:31:40 +0000 (13:31 +0200)]
Using GMQCC_WARN some more where it makes sense

9 years agoTurned nearly every void-returning function into a bool-returning function, and check...
Wolfgang (Blub) Bumiller [Fri, 27 Apr 2012 11:28:39 +0000 (13:28 +0200)]
Turned nearly every void-returning function into a bool-returning function, and checking return values wherever necessary to be able to properly exit on failures

9 years agoUse GMQCC_WARN on generated vector functions
Wolfgang (Blub) Bumiller [Fri, 27 Apr 2012 10:38:53 +0000 (12:38 +0200)]
Use GMQCC_WARN on generated vector functions

9 years agoGMQCC_WARN macro
Wolfgang (Blub) Bumiller [Fri, 27 Apr 2012 10:35:59 +0000 (12:35 +0200)]
GMQCC_WARN macro

9 years agoGet rid of realloc
Wolfgang (Blub) Bumiller [Fri, 27 Apr 2012 09:41:12 +0000 (11:41 +0200)]
Get rid of realloc

9 years agowhitespace
Dale Weiler [Fri, 27 Apr 2012 09:33:22 +0000 (05:33 -0400)]
whitespace

9 years agoSanity check
Dale Weiler [Fri, 27 Apr 2012 09:33:02 +0000 (05:33 -0400)]
Sanity check

9 years agoMerge branch 'master' into blub/ast-and-ir-merging
Wolfgang (Blub) Bumiller [Fri, 27 Apr 2012 09:05:57 +0000 (11:05 +0200)]
Merge branch 'master' into blub/ast-and-ir-merging

9 years agoNow compiles with mingw; added makefile for windows.
Dale Weiler [Fri, 27 Apr 2012 03:23:31 +0000 (23:23 -0400)]
Now compiles with mingw; added makefile for windows.

9 years agoremoved clutter
Dale Weiler [Fri, 27 Apr 2012 03:20:35 +0000 (23:20 -0400)]
removed clutter

9 years agoGMQCC_VERSION
Dale Weiler [Thu, 26 Apr 2012 15:37:47 +0000 (11:37 -0400)]
GMQCC_VERSION

9 years agoAdding a 'keep' bool to nodes: Generally, destroying an AST node should destroy all...
Wolfgang (Blub) Bumiller [Thu, 26 Apr 2012 09:45:22 +0000 (11:45 +0200)]
Adding a 'keep' bool to nodes: Generally, destroying an AST node should destroy all its child-nodes, global variables get 'keep' to be true to avoid them being deleted together with expressions they're used in.

9 years agoIntroduce an ast_store rather than splitting ast_binary
Wolfgang (Blub) Bumiller [Thu, 26 Apr 2012 09:36:46 +0000 (11:36 +0200)]
Introduce an ast_store rather than splitting ast_binary

9 years agoUse .o rather than .c in the Makefile... sorry for that mistake
Wolfgang (Blub) Bumiller [Thu, 26 Apr 2012 09:36:28 +0000 (11:36 +0200)]
Use .o rather than .c in the Makefile... sorry for that mistake

9 years agoast_binary_new to initialize codegen function ptr, codegen proto for store and binary...
Wolfgang (Blub) Bumiller [Thu, 26 Apr 2012 08:38:00 +0000 (10:38 +0200)]
ast_binary_new to initialize codegen function ptr, codegen proto for store and binary ast nodes

9 years agoblock and value codegen protos
Wolfgang (Blub) Bumiller [Thu, 26 Apr 2012 08:28:42 +0000 (10:28 +0200)]
block and value codegen protos

9 years agoqbool -> bool
Wolfgang (Blub) Bumiller [Thu, 26 Apr 2012 08:16:15 +0000 (10:16 +0200)]
qbool -> bool

9 years agoMerge branch 'master' into blub/ast-and-ir-merging
Wolfgang (Blub) Bumiller [Thu, 26 Apr 2012 08:13:07 +0000 (10:13 +0200)]
Merge branch 'master' into blub/ast-and-ir-merging
-> Todo: take over bool from qbool

9 years agoImplemented platform[safe, neutral], compiler[safe, neutral] and C version[safe,...
Dale Weiler [Wed, 25 Apr 2012 21:03:56 +0000 (17:03 -0400)]
Implemented platform[safe, neutral], compiler[safe, neutral] and C version[safe, neutral] <stdbool.h>.  M$ Visual Studio doesn't provide support for C99

9 years agocode_strings_add replaced with proper multiplie element insertion vector support...
Dale Weiler [Wed, 25 Apr 2012 20:49:04 +0000 (16:49 -0400)]
code_strings_add replaced with proper multiplie element insertion vector support just added

9 years agoImplemented support for multiple element (with assisted length) insertion on VECTOR_...
Dale Weiler [Wed, 25 Apr 2012 20:43:25 +0000 (16:43 -0400)]
Implemented support for multiple element (with assisted length) insertion on VECTOR_ expansions

9 years agoMake VECTOR_ more flexible for inside structures, and such.
Dale Weiler [Wed, 25 Apr 2012 19:49:20 +0000 (15:49 -0400)]
Make VECTOR_ more flexible for inside structures, and such.

9 years agoTYPE_ macros
Dale Weiler [Wed, 25 Apr 2012 15:45:01 +0000 (11:45 -0400)]
TYPE_ macros

9 years agos/#define / / & s/[0-9]// & inplace enum { - end }
Dale Weiler [Wed, 25 Apr 2012 15:42:20 +0000 (11:42 -0400)]
s/#define /    / & s/[0-9]// & inplace enum { - end }

9 years agoCopyright notices
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 15:22:16 +0000 (17:22 +0200)]
Copyright notices

9 years agotodo note
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 15:20:59 +0000 (17:20 +0200)]
todo note

9 years agoGet stuff ready to compile - #if 0 on instructions not yet added to the instruction...
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 14:21:04 +0000 (16:21 +0200)]
Get stuff ready to compile - #if 0 on instructions not yet added to the instruction list (eg integer ones)

9 years agouse CC ?= because clang crashes on me
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 14:20:38 +0000 (16:20 +0200)]
use CC ?= because clang crashes on me

9 years agoAdding liferange-calculation used later for templ-allocateion
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 13:16:55 +0000 (15:16 +0200)]
Adding liferange-calculation used later for templ-allocateion

9 years agomore weak typing
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 13:16:22 +0000 (15:16 +0200)]
more weak typing

9 years ago_naive_ phi solver
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 13:08:03 +0000 (15:08 +0200)]
_naive_ phi solver

9 years agoifalse->false and true again, binop code
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 13:07:48 +0000 (15:07 +0200)]
ifalse->false and true again, binop code

9 years agoA few of the main IR operation implementations
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 13:03:57 +0000 (15:03 +0200)]
A few of the main IR operation implementations

9 years agoremoved an old vector related function
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:59:35 +0000 (14:59 +0200)]
removed an old vector related function

9 years agoir.c: ir_value and style fixups
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:59:08 +0000 (14:59 +0200)]
ir.c: ir_value and style fixups

9 years agoSame style fixups for ir_instr
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:56:47 +0000 (14:56 +0200)]
Same style fixups for ir_instr

9 years agoir.c: ir_instr
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:55:15 +0000 (14:55 +0200)]
ir.c: ir_instr

9 years agoSame style fixup for ir_block as previous commits for function
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:54:37 +0000 (14:54 +0200)]
Same style fixup for ir_block as previous commits for function

9 years agoir.c: importing ir_block
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:52:03 +0000 (14:52 +0200)]
ir.c: importing ir_block

9 years agofilecontext_t -> lex_ctx_t, removing some const
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:51:23 +0000 (14:51 +0200)]
filecontext_t -> lex_ctx_t, removing some const

9 years agospace idnentation, macros, strdup again
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:49:29 +0000 (14:49 +0200)]
space idnentation, macros, strdup again

9 years agoir.c: importing ir_function
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:47:20 +0000 (14:47 +0200)]
ir.c: importing ir_function

9 years agoSpace indentation in ir.c builder part
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:46:10 +0000 (14:46 +0200)]
Space indentation in ir.c builder part

9 years agomacros, strdup->util_strdup, malloc->mem_a
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:45:40 +0000 (14:45 +0200)]
macros, strdup->util_strdup, malloc->mem_a

9 years agoimporting from ir_builder.c -> ir.c
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:43:23 +0000 (14:43 +0200)]
importing from ir_builder.c -> ir.c

9 years agoast.h
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:43:00 +0000 (14:43 +0200)]
ast.h

9 years agoAdding the 3 virtual instructions required for the IR later.
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 12:35:15 +0000 (14:35 +0200)]
Adding the 3 virtual instructions required for the IR later.

9 years agoRemove some underscores
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:44:43 +0000 (13:44 +0200)]
Remove some underscores

9 years agoVector macros
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:44:17 +0000 (13:44 +0200)]
Vector macros

9 years agoAdopting space indentation in ir.h
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:39:32 +0000 (13:39 +0200)]
Adopting space indentation in ir.h

9 years agoImporting ir.h
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:37:17 +0000 (13:37 +0200)]
Importing ir.h

9 years agoRemoved unnecessary line
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:26:29 +0000 (13:26 +0200)]
Removed unnecessary line

9 years agoSpace indentation for ast->ir part
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:26:08 +0000 (13:26 +0200)]
Space indentation for ast->ir part

9 years agoi{false,true} -> {false,true}
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:25:05 +0000 (13:25 +0200)]
i{false,true} -> {false,true}

9 years agoAdding from astcodegen.c
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:24:25 +0000 (13:24 +0200)]
Adding from astcodegen.c

9 years agostyle-fix
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:22:48 +0000 (13:22 +0200)]
style-fix

9 years agouse the actual VECTOR macros
Wolfgang (Blub) Bumiller [Wed, 25 Apr 2012 11:21:59 +0000 (13:21 +0200)]
use the actual VECTOR macros