cparser
12 years agoDo not truncate the existing attribute list if a __declspec has no arguments.
Christoph Mallon [Thu, 26 Apr 2012 17:15:29 +0000 (19:15 +0200)]
Do not truncate the existing attribute list if a __declspec has no arguments.

12 years agoCorrect anchor underflow in case of error in parse_microsoft_extended_decl_modifier().
Christoph Mallon [Thu, 26 Apr 2012 17:13:24 +0000 (19:13 +0200)]
Correct anchor underflow in case of error in parse_microsoft_extended_decl_modifier().

12 years agoImprove error recovery in parse_compound_statement().
Christoph Mallon [Thu, 26 Apr 2012 12:53:09 +0000 (14:53 +0200)]
Improve error recovery in parse_compound_statement().

- Handle EOF generically with expect().
- Do not skip semantic checks, when breaking out of the parsing loop due to an error.

12 years agoRemove pointless skip loop: intern_parse_statement() only returns a single statement.
Christoph Mallon [Thu, 26 Apr 2012 12:37:10 +0000 (14:37 +0200)]
Remove pointless skip loop: intern_parse_statement() only returns a single statement.

12 years agoRemove pointless test: If intern_parse_statement() returns a STATEMENT_ERROR, then...
Christoph Mallon [Thu, 26 Apr 2012 12:28:11 +0000 (14:28 +0200)]
Remove pointless test: If intern_parse_statement() returns a STATEMENT_ERROR, then the current token is an anchor.

12 years agoRemove stale TODO.
Christoph Mallon [Thu, 26 Apr 2012 11:33:03 +0000 (13:33 +0200)]
Remove stale TODO.

12 years agoImprove error recovery in parse_asm_statement() and do not return an error statement.
Christoph Mallon [Thu, 26 Apr 2012 11:21:55 +0000 (13:21 +0200)]
Improve error recovery in parse_asm_statement() and do not return an error statement.

12 years agoImprove error recovery in parse_do() and do not return an error statement.
Christoph Mallon [Thu, 26 Apr 2012 11:17:25 +0000 (13:17 +0200)]
Improve error recovery in parse_do() and do not return an error statement.

12 years agoImprove error recovery in parse_for() and do not return an error statement.
Christoph Mallon [Thu, 26 Apr 2012 10:41:04 +0000 (12:41 +0200)]
Improve error recovery in parse_for() and do not return an error statement.

12 years agoPlug an extension leak on parse error in parse_for().
Christoph Mallon [Thu, 26 Apr 2012 10:18:44 +0000 (12:18 +0200)]
Plug an extension leak on parse error in parse_for().

12 years agoDo not return an error statement, if a goto misses its label argument, but create...
Christoph Mallon [Thu, 26 Apr 2012 06:40:57 +0000 (08:40 +0200)]
Do not return an error statement, if a goto misses its label argument, but create an anonymous label instead.

12 years agoDo not return an error statement from parse_ms_try_statment(), just keep on parsing.
Christoph Mallon [Wed, 25 Apr 2012 19:33:29 +0000 (21:33 +0200)]
Do not return an error statement from parse_ms_try_statment(), just keep on parsing.

12 years agoDo not refetch a value, which we already have.
Christoph Mallon [Wed, 25 Apr 2012 12:44:42 +0000 (14:44 +0200)]
Do not refetch a value, which we already have.

12 years agoDo not refetch a value, which we already have.
Christoph Mallon [Wed, 25 Apr 2012 12:37:06 +0000 (14:37 +0200)]
Do not refetch a value, which we already have.

12 years agoReduce variable scope.
Christoph Mallon [Wed, 25 Apr 2012 12:34:32 +0000 (14:34 +0200)]
Reduce variable scope.

12 years agoDo not refetch a value, which we already have.
Christoph Mallon [Wed, 25 Apr 2012 12:33:14 +0000 (14:33 +0200)]
Do not refetch a value, which we already have.

12 years agoOnly use the skipped type, the unskipped type is useless here.
Christoph Mallon [Wed, 25 Apr 2012 12:30:18 +0000 (14:30 +0200)]
Only use the skipped type, the unskipped type is useless here.

12 years agoMove the GNU special case for sizeof(function) from sizeof_to_firm() to get_type_size().
Christoph Mallon [Wed, 25 Apr 2012 11:16:04 +0000 (13:16 +0200)]
Move the GNU special case for sizeof(function) from sizeof_to_firm() to get_type_size().

12 years agoFactorise the code to parse conditions of statements, i.e. an expression enclosed...
Christoph Mallon [Wed, 25 Apr 2012 10:36:37 +0000 (12:36 +0200)]
Factorise the code to parse conditions of statements, i.e. an expression enclosed in parentheses.

This addresses several issues:
- No null pointer as condition anymore, if a if lacks its (.
- No anchor leak anymore, if a switch lacks its ).
- Better error recovery: No error statement anymore, if any part of a condition is missing.
- Less code duplication.

12 years agoRemove dead assignment and the stale assert, which checked for the dead value, with it.
Christoph Mallon [Wed, 25 Apr 2012 07:17:09 +0000 (09:17 +0200)]
Remove dead assignment and the stale assert, which checked for the dead value, with it.

12 years agoMove adding/removing ';' as anchor from intern_parse_statement() to parse_compound_st...
Christoph Mallon [Wed, 25 Apr 2012 07:11:07 +0000 (09:11 +0200)]
Move adding/removing ';' as anchor from intern_parse_statement() to parse_compound_statement().

It is already an anchor at {.S*} and then needs not to be repeated in intern_parse_statement() (and only adding ';' is a bit poor).

12 years agoDiscard all non-anchors from the input, not just the first one.
Christoph Mallon [Wed, 25 Apr 2012 07:01:50 +0000 (09:01 +0200)]
Discard all non-anchors from the input, not just the first one.

12 years agoPush the special case for compound types into get_ir_mode_storage().
Christoph Mallon [Wed, 25 Apr 2012 05:38:34 +0000 (07:38 +0200)]
Push the special case for compound types into get_ir_mode_storage().

It already had a special case for array types, now it handles all non-scalar types.

12 years agoadjust to latest libfirm debugoutput
Matthias Braun [Wed, 25 Apr 2012 23:30:55 +0000 (01:30 +0200)]
adjust to latest libfirm debugoutput

12 years agoAdjust cparser to extended debug information retrieval of libFirm, which includes...
Christoph Mallon [Tue, 24 Apr 2012 18:49:04 +0000 (20:49 +0200)]
Adjust cparser to extended debug information retrieval of libFirm, which includes the column.

12 years agoSimplify and reduce code duplication in return_statement_to_firm().
Christoph Mallon [Tue, 24 Apr 2012 18:12:18 +0000 (20:12 +0200)]
Simplify and reduce code duplication in return_statement_to_firm().

12 years agoUse the cparser type instead of the Firm type in return_statement_to_firm().
Christoph Mallon [Tue, 24 Apr 2012 17:21:41 +0000 (19:21 +0200)]
Use the cparser type instead of the Firm type in return_statement_to_firm().

12 years agoReduce code duplication in layout_struct_type().
Christoph Mallon [Tue, 24 Apr 2012 16:55:33 +0000 (18:55 +0200)]
Reduce code duplication in layout_struct_type().

12 years agoRemove the macro constant INVALID_TYPE, which is only used in comparisons, but never...
Christoph Mallon [Tue, 24 Apr 2012 11:01:53 +0000 (13:01 +0200)]
Remove the macro constant INVALID_TYPE, which is only used in comparisons, but never assigned.

12 years agoAdhere an obscure C++ rule: typedef T void; void f(T) {} is not a valid way to declar...
Christoph Mallon [Sun, 22 Apr 2012 14:04:24 +0000 (16:04 +0200)]
Adhere an obscure C++ rule: typedef T void; void f(T) {} is not a valid way to declare an empty parameter list.

12 years agoUse is_type_void(x) instead of x == type_void where qualified versions of void might...
Christoph Mallon [Sun, 22 Apr 2012 13:53:02 +0000 (15:53 +0200)]
Use is_type_void(x) instead of x == type_void where qualified versions of void might occur.

12 years agoImprove the error message if a qualified void type is used to denote an empty paramet...
Christoph Mallon [Sun, 22 Apr 2012 14:16:35 +0000 (16:16 +0200)]
Improve the error message if a qualified void type is used to denote an empty parameter list.

12 years agoReplace is_type_atomic(x, ATOMIC_TYPE_VOID) by the more concise is_type_void(x).
Christoph Mallon [Sun, 22 Apr 2012 11:30:46 +0000 (13:30 +0200)]
Replace is_type_atomic(x, ATOMIC_TYPE_VOID) by the more concise is_type_void(x).

12 years agoRemove the unused variables ir_type_void and ir_type_int.
Christoph Mallon [Sun, 22 Apr 2012 13:54:36 +0000 (15:54 +0200)]
Remove the unused variables ir_type_void and ir_type_int.

12 years agoFactorise code to conditionally print an error or a warning.
Christoph Mallon [Sun, 22 Apr 2012 07:13:15 +0000 (09:13 +0200)]
Factorise code to conditionally print an error or a warning.

12 years agoCorrect semantic check in parse_return(): A condition was inverted.
Christoph Mallon [Sat, 21 Apr 2012 21:09:19 +0000 (23:09 +0200)]
Correct semantic check in parse_return(): A condition was inverted.

12 years agoDo not get the break block of a switch before it is sure that a jump there is actuall...
Christoph Mallon [Sat, 21 Apr 2012 16:39:22 +0000 (18:39 +0200)]
Do not get the break block of a switch before it is sure that a jump there is actually created.

Usually the inner (compound) statement of a switch ends in a break or return, so there is no normal flow out of the switch statement.

12 years agoSplit jump_if_reachable() into jump_to() and jump_if_reachable().
Christoph Mallon [Sat, 21 Apr 2012 14:45:05 +0000 (16:45 +0200)]
Split jump_if_reachable() into jump_to() and jump_if_reachable().

- jump_to() does what jump_if_reachable() did before, i.e. create a Bad if the source is unreachable.
- jump_if_reachable() does nothing if the source is unreachable.
- Document in which case which of these two functions needs to be used.
- This prevents Bad predecessors in the usual cases, e.g. non-fallthrough case labels.

12 years agoIt is not necessary to remember the switch block to create the default Proj at the...
Christoph Mallon [Sat, 21 Apr 2012 15:49:24 +0000 (17:49 +0200)]
It is not necessary to remember the switch block to create the default Proj at the end.

12 years agoSimplify compound_statement_to_firm() by letting statement_to_firm() return an ir_nod...
Christoph Mallon [Fri, 20 Apr 2012 06:22:15 +0000 (08:22 +0200)]
Simplify compound_statement_to_firm() by letting statement_to_firm() return an ir_node* instead of just expression_statement_to_firm().

12 years agoFix walk_statement(): Walk the expression(s) of case labels, too.
Christoph Mallon [Fri, 20 Apr 2012 18:14:23 +0000 (20:14 +0200)]
Fix walk_statement(): Walk the expression(s) of case labels, too.

12 years agoReformat _expression_to_firm() for better readability.
Christoph Mallon [Tue, 17 Apr 2012 21:16:35 +0000 (23:16 +0200)]
Reformat _expression_to_firm() for better readability.

12 years agoRename EXPR_REFERENCE_ENUM_VALUE to EXPR_ENUM_CONSTANT.
Christoph Mallon [Tue, 17 Apr 2012 11:00:04 +0000 (13:00 +0200)]
Rename EXPR_REFERENCE_ENUM_VALUE to EXPR_ENUM_CONSTANT.

This is closer to what the C standard calls it (enumeration constant).

12 years agoShorten the edgaresque name reference_expression_enum_value_to_firm() to enum_constan...
Christoph Mallon [Tue, 17 Apr 2012 10:48:11 +0000 (12:48 +0200)]
Shorten the edgaresque name reference_expression_enum_value_to_firm() to enum_constant_to_firm().

This comes close to what the C standard calls it (enumeration constant).

12 years agoRemove special cases for EXPR_ERROR and TYPE_ERROR from constant folding and type...
Christoph Mallon [Tue, 17 Apr 2012 10:35:20 +0000 (12:35 +0200)]
Remove special cases for EXPR_ERROR and TYPE_ERROR from constant folding and type construction.

We do not fold expressions containing errors anymore.

12 years agoRemove duplicate assertion.
Christoph Mallon [Tue, 17 Apr 2012 10:31:58 +0000 (12:31 +0200)]
Remove duplicate assertion.

The subsequent call to fold_constant_to_tarval() checks the same.

12 years agoRemove unnecessary assertion.
Christoph Mallon [Tue, 17 Apr 2012 10:28:20 +0000 (12:28 +0200)]
Remove unnecessary assertion.

A subsequent assertion checks more.

12 years agoUse fold_constant_to_tarval() instead of reimplementing it badly, i.e. failing with...
Christoph Mallon [Tue, 17 Apr 2012 10:12:36 +0000 (12:12 +0200)]
Use fold_constant_to_tarval() instead of reimplementing it badly, i.e. failing with -O0.

12 years agoUse create_Const_from_bool() instead of duplicating it.
Christoph Mallon [Tue, 17 Apr 2012 09:23:17 +0000 (11:23 +0200)]
Use create_Const_from_bool() instead of duplicating it.

12 years agoMove a case, which unnecessarily was an explicit if, into the following switch.
Christoph Mallon [Tue, 17 Apr 2012 09:18:45 +0000 (11:18 +0200)]
Move a case, which unnecessarily was an explicit if, into the following switch.

12 years agoReformat statement_to_firm() for better readability.
Christoph Mallon [Tue, 17 Apr 2012 08:51:22 +0000 (10:51 +0200)]
Reformat statement_to_firm() for better readability.

12 years agoUse create_jump_statement() to construct IR for goto statements.
Christoph Mallon [Tue, 17 Apr 2012 08:46:15 +0000 (10:46 +0200)]
Use create_jump_statement() to construct IR for goto statements.

12 years agoRemove anchors only when they were added before.
Christoph Mallon [Tue, 17 Apr 2012 08:42:00 +0000 (10:42 +0200)]
Remove anchors only when they were added before.

12 years agoCorrect expression_to_firm() for compound literals.
Christoph Mallon [Thu, 12 Apr 2012 11:44:14 +0000 (13:44 +0200)]
Correct expression_to_firm() for compound literals.

12 years agoCorrect the ir_relation used for implicit comparisons with 0.
Christoph Mallon [Wed, 11 Apr 2012 08:02:33 +0000 (10:02 +0200)]
Correct the ir_relation used for implicit comparisons with 0.

For floats checking for unordered is necessary.

12 years agoSimplify if_statement_to_firm() so it in particular does not create a critical edge...
Christoph Mallon [Tue, 10 Apr 2012 13:39:12 +0000 (15:39 +0200)]
Simplify if_statement_to_firm() so it in particular does not create a critical edge, if there is no else part.

- The then part is constructed before the else part now.
- No explicit block after the if statement is created if the then or else parts do not jump there.

12 years agoSet the correct length for literal suffixes, i.e. do not count the terminating NUL.
Christoph Mallon [Thu, 29 Mar 2012 16:22:07 +0000 (18:22 +0200)]
Set the correct length for literal suffixes, i.e. do not count the terminating NUL.

12 years agoSplit computed gotos (STATEMENT_COMPUTED_GOTO) from normal goto statements.
Christoph Mallon [Wed, 28 Mar 2012 11:39:12 +0000 (13:39 +0200)]
Split computed gotos (STATEMENT_COMPUTED_GOTO) from normal goto statements.

12 years agoFix: Walk the expression of computed goto statements, too.
Christoph Mallon [Wed, 28 Mar 2012 12:45:43 +0000 (14:45 +0200)]
Fix: Walk the expression of computed goto statements, too.

12 years agoReformat switches for better readability.
Christoph Mallon [Wed, 28 Mar 2012 13:07:32 +0000 (15:07 +0200)]
Reformat switches for better readability.

12 years agoMake our multi-case macros nicer for code beautifiers.
Christoph Mallon [Wed, 28 Mar 2012 13:19:23 +0000 (15:19 +0200)]
Make our multi-case macros nicer for code beautifiers.

12 years agoAdd EXPR_ERROR to the precedence list.
Christoph Mallon [Wed, 28 Mar 2012 13:53:51 +0000 (15:53 +0200)]
Add EXPR_ERROR to the precedence list.

12 years agoSimplify printing the seperator (", ") between call arguments.
Christoph Mallon [Tue, 27 Mar 2012 11:32:54 +0000 (13:32 +0200)]
Simplify printing the seperator (", ") between call arguments.

12 years agoUse for () where it is better suited than while ().
Christoph Mallon [Tue, 27 Mar 2012 11:29:37 +0000 (13:29 +0200)]
Use for () where it is better suited than while ().

12 years agoUse print_char('x') instead of print_string("x").
Christoph Mallon [Tue, 27 Mar 2012 11:27:36 +0000 (13:27 +0200)]
Use print_char('x') instead of print_string("x").

12 years agoImprove printing after an inner statement.
Christoph Mallon [Tue, 27 Mar 2012 11:23:35 +0000 (13:23 +0200)]
Improve printing after an inner statement.

Now we print
  if (x) {
  } else {
  }
instead of
  if (x) {
  }
  else {
  }

12 years agoEnsure that case labels are always printed with the same indentation as their switch.
Christoph Mallon [Tue, 27 Mar 2012 11:09:09 +0000 (13:09 +0200)]
Ensure that case labels are always printed with the same indentation as their switch.

Now we print
  switch (x) {
  case 0:
   if (y) {
  case 1:
   f();
   }
  }
instead of
  switch (x) {
  case 0:
   if (y) {
   case 1:
   f();
   }
  }

12 years agoHandle printing of inner statements systematically and correct/improve the output.
Christoph Mallon [Tue, 27 Mar 2012 08:54:50 +0000 (10:54 +0200)]
Handle printing of inner statements systematically and correct/improve the output.

- Now we print
    if (x)
     f();
    else
     g();
  instead of
    if (x) f();
    else g();

- If cascades are still printed as
    if (x) {
    } else if (y) {
    }

- This corrects indendation when {case,default,goto} labels are inner statements.

12 years agoHandle printing of indentation before statements more systematically and reduce code...
Christoph Mallon [Tue, 27 Mar 2012 08:38:21 +0000 (10:38 +0200)]
Handle printing of indentation before statements more systematically and reduce code duplication.

This corrects the indentation if case labels and goto labels are interspersed or if there are consecutive goto labels.

12 years agoLet the callers of print_statement() handle printing a newline at the end.
Christoph Mallon [Tue, 27 Mar 2012 07:46:43 +0000 (09:46 +0200)]
Let the callers of print_statement() handle printing a newline at the end.

12 years agoRemove pointless null pointer check.
Christoph Mallon [Tue, 27 Mar 2012 07:02:03 +0000 (09:02 +0200)]
Remove pointless null pointer check.

Case label statements always have an inner statement.

12 years agoignore config.mak
Matthias Braun [Mon, 12 Mar 2012 11:48:03 +0000 (12:48 +0100)]
ignore config.mak

12 years agofix -O0 still performing local optimizations
Matthias Braun [Thu, 1 Mar 2012 14:49:11 +0000 (15:49 +0100)]
fix -O0 still performing local optimizations

12 years agoupdate libfirm version
Matthias Braun [Wed, 29 Feb 2012 13:17:09 +0000 (14:17 +0100)]
update libfirm version

12 years agoignore -msse2
Matthias Braun [Wed, 29 Feb 2012 13:16:59 +0000 (14:16 +0100)]
ignore -msse2

12 years agorework os classification
Matthias Braun [Wed, 29 Feb 2012 13:16:46 +0000 (14:16 +0100)]
rework os classification

12 years agoignore TARGET environment variable (Makefiles tend to set that and confuse cparser)
Matthias Braun [Wed, 29 Feb 2012 13:16:04 +0000 (14:16 +0100)]
ignore TARGET environment variable (Makefiles tend to set that and confuse cparser)

12 years agoupdate libfirm reference (so new builtins actually work)
Matthias Braun [Fri, 17 Feb 2012 16:03:22 +0000 (17:03 +0100)]
update libfirm reference (so new builtins actually work)

12 years agoimplement more builtins
Matthias Braun [Fri, 17 Feb 2012 16:00:51 +0000 (17:00 +0100)]
implement more builtins

(bswap, fabs)

12 years agodarwin name in target tripple may contain version
Matthias Braun [Tue, 14 Feb 2012 10:22:05 +0000 (11:22 +0100)]
darwin name in target tripple may contain version

12 years agoupdate libfirm reference
Matthias Braun [Fri, 10 Feb 2012 15:53:01 +0000 (16:53 +0100)]
update libfirm reference

12 years agoupdate for new release
Matthias Braun [Wed, 7 Dec 2011 18:00:22 +0000 (19:00 +0100)]
update for new release

12 years agodisable download from internet in makefile for now
Matthias Braun [Tue, 20 Dec 2011 13:41:17 +0000 (14:41 +0100)]
disable download from internet in makefile for now

12 years agoimplement -dumpversion for gcc compatibility
Matthias Braun [Tue, 20 Dec 2011 13:35:02 +0000 (14:35 +0100)]
implement -dumpversion for gcc compatibility

12 years agofix --help display
Matthias Braun [Tue, 20 Dec 2011 13:34:51 +0000 (14:34 +0100)]
fix --help display

12 years agoFixed wrong enum type.
Sebastian Buchwald [Wed, 21 Dec 2011 13:20:43 +0000 (14:20 +0100)]
Fixed wrong enum type.

12 years agomaturing start and end block isn't necessary anymore with latest libfirm
Matthias Braun [Mon, 19 Dec 2011 09:57:08 +0000 (10:57 +0100)]
maturing start and end block isn't necessary anymore with latest libfirm

12 years agodo not use ir_.*_ptr types
Matthias Braun [Mon, 12 Dec 2011 15:18:24 +0000 (16:18 +0100)]
do not use ir_.*_ptr types

12 years agoDo not link on every make invocation
Andreas Zwinkau [Mon, 19 Dec 2011 14:45:50 +0000 (15:45 +0100)]
Do not link on every make invocation

Previously, ld had to be called, because the static libfirm might have
been updated.

Note the little hack, which apparently makes GNU Make re-evaluated the
Makefile, whenever the phony libfirm_subdir goal has been executed:

> Makefile: libfirm_subdir

12 years agofix noreturn attribute
Matthias Braun [Thu, 8 Dec 2011 17:39:49 +0000 (18:39 +0100)]
fix noreturn attribute

12 years agoignore gcc --unroll-loops
Matthias Braun [Wed, 7 Dec 2011 17:54:57 +0000 (18:54 +0100)]
ignore gcc --unroll-loops

12 years agoupdate NEWS, README
Matthias Braun [Wed, 7 Dec 2011 17:54:47 +0000 (18:54 +0100)]
update NEWS, README

12 years agofix warnings
Matthias Braun [Mon, 28 Nov 2011 17:44:16 +0000 (18:44 +0100)]
fix warnings

12 years agocompound literals are linker_constants
Matthias Braun [Thu, 24 Nov 2011 20:13:20 +0000 (21:13 +0100)]
compound literals are linker_constants

12 years agofix non-scalar type initializers
Matthias Braun [Thu, 24 Nov 2011 20:13:05 +0000 (21:13 +0100)]
fix non-scalar type initializers

12 years agocreate constant initializers as entities in data segment
Matthias Braun [Thu, 24 Nov 2011 20:00:02 +0000 (21:00 +0100)]
create constant initializers as entities in data segment

12 years agocleanup driver interface a bit
Matthias Braun [Fri, 18 Nov 2011 16:16:29 +0000 (17:16 +0100)]
cleanup driver interface a bit

12 years agothe frontend shouldn't care about the inliner
Matthias Braun [Thu, 17 Nov 2011 16:33:46 +0000 (17:33 +0100)]
the frontend shouldn't care about the inliner

12 years agoalways put a mode into assembler constraints
Matthias Braun [Thu, 17 Nov 2011 16:33:39 +0000 (17:33 +0100)]
always put a mode into assembler constraints

12 years agouse ir_export_file so we can also export to stdout
Matthias Braun [Thu, 17 Nov 2011 16:33:03 +0000 (17:33 +0100)]
use ir_export_file so we can also export to stdout