libfirm
13 years agorename NO_BAD_BLOCKS to NO_BADS, remove unnecessary implication from opt_manage
Matthias Braun [Fri, 16 Sep 2011 11:22:00 +0000 (13:22 +0200)]
rename NO_BAD_BLOCKS to NO_BADS, remove unnecessary implication from opt_manage

13 years agocleanup/fix optimize_graph_df flag handling
Matthias Braun [Fri, 16 Sep 2011 09:28:33 +0000 (11:28 +0200)]
cleanup/fix optimize_graph_df flag handling

13 years agosimplify code
Matthias Braun [Thu, 15 Sep 2011 15:19:48 +0000 (17:19 +0200)]
simplify code

13 years agowe must clear block+phi-node links
Matthias Braun [Thu, 15 Sep 2011 15:19:35 +0000 (17:19 +0200)]
we must clear block+phi-node links

13 years agotransform_node_Block does not produce bad blocks anyway
Matthias Braun [Thu, 15 Sep 2011 13:47:16 +0000 (15:47 +0200)]
transform_node_Block does not produce bad blocks anyway

13 years agodo not use custom copy without custom attributes
Matthias Braun [Thu, 15 Sep 2011 13:49:03 +0000 (15:49 +0200)]
do not use custom copy without custom attributes

13 years agosparc: fix spec, it's called dump_func not dump_node
Matthias Braun [Sat, 17 Sep 2011 10:54:33 +0000 (12:54 +0200)]
sparc: fix spec, it's called dump_func not dump_node

13 years agoTurn off CSE when creating Projs during double word lowering.
Manuel Mohr [Mon, 19 Sep 2011 09:30:34 +0000 (11:30 +0200)]
Turn off CSE when creating Projs during double word lowering.

13 years agofix warning
Andreas Zwinkau [Fri, 16 Sep 2011 13:46:14 +0000 (15:46 +0200)]
fix warning

13 years agoDocumentation: why kill unreachable code between localopts
Andreas Zwinkau [Fri, 16 Sep 2011 11:08:44 +0000 (13:08 +0200)]
Documentation: why kill unreachable code between localopts

13 years agoPerform KeepAlive housekeeping after each opt
Andreas Zwinkau [Fri, 16 Sep 2011 10:59:53 +0000 (12:59 +0200)]
Perform KeepAlive housekeeping after each opt

13 years agoDo not replace Bad predecessors by new Bads in transform_node_Block() and transform_n...
Christoph Mallon [Fri, 16 Sep 2011 08:55:01 +0000 (10:55 +0200)]
Do not replace Bad predecessors by new Bads in transform_node_Block() and transform_node_Phi().

13 years agodocumentation for graph state flags
Andreas Zwinkau [Fri, 16 Sep 2011 08:51:49 +0000 (10:51 +0200)]
documentation for graph state flags

13 years agoReplace magic 4 by SPARC_REGISTER_SIZE.
Christoph Mallon [Fri, 16 Sep 2011 05:55:29 +0000 (07:55 +0200)]
Replace magic 4 by SPARC_REGISTER_SIZE.

13 years agoUse SPARC_STACK_ALIGNMENT and round_up2() instead of magic numbers and calculations.
Christoph Mallon [Fri, 16 Sep 2011 05:48:48 +0000 (07:48 +0200)]
Use SPARC_STACK_ALIGNMENT and round_up2() instead of magic numbers and calculations.

13 years agosparc: Keep stack pointer 8 bytes aligned when generating code for MemPerm.
Manuel Mohr [Thu, 15 Sep 2011 14:06:13 +0000 (16:06 +0200)]
sparc: Keep stack pointer 8 bytes aligned when generating code for MemPerm.

13 years agoFix cfopt
Andreas Zwinkau [Thu, 15 Sep 2011 12:09:41 +0000 (14:09 +0200)]
Fix cfopt

The cfopt itself can handle unreachable code,
but it transforms it in a way that makes the verifier unhappy.

13 years agoFixed inconsistent uses of DEBUG_ONLY.
Sebastian Buchwald [Thu, 15 Sep 2011 11:45:56 +0000 (13:45 +0200)]
Fixed inconsistent uses of DEBUG_ONLY.

13 years agoFix DEBUG_ONLY use
Andreas Zwinkau [Thu, 15 Sep 2011 11:23:39 +0000 (13:23 +0200)]
Fix DEBUG_ONLY use

13 years agowrapping stuff in DEBUG_ONLY
Andreas Zwinkau [Thu, 15 Sep 2011 10:41:38 +0000 (12:41 +0200)]
wrapping stuff in DEBUG_ONLY

13 years agoNo unreachable code in backend
Andreas Zwinkau [Thu, 15 Sep 2011 09:28:51 +0000 (11:28 +0200)]
No unreachable code in backend

13 years agoInsert declarations to remove cparser warnings
Andreas Zwinkau [Thu, 15 Sep 2011 08:43:56 +0000 (10:43 +0200)]
Insert declarations to remove cparser warnings

13 years agoAdd licence header and documentation to opt_manage.h
Andreas Zwinkau [Thu, 15 Sep 2011 08:32:19 +0000 (10:32 +0200)]
Add licence header and documentation to opt_manage.h

13 years agooops, forgot to add a file
Matthias Braun [Thu, 15 Sep 2011 10:38:41 +0000 (12:38 +0200)]
oops, forgot to add a file

13 years agolower_mode_b: refactoring, make it more robust
Matthias Braun [Thu, 15 Sep 2011 07:51:40 +0000 (09:51 +0200)]
lower_mode_b: refactoring, make it more robust

- Make API private as it should only be called by backends
- Let ia32 backend create special ia32_Set nodes instead of relying
  on muxes which must not be touched anymore
- Does not create ConvB nodes anymore but instead produces the Cmp
  directly. (All backends did this anyway during code-selection so I was
  able to leave this case out code-selection)
- First collect nodes to lower, then lower them. This avoids robustness
  problems when transforming the graph while at the same time walking
  it.

13 years agosome cleanups for middleend node creation in backends
Matthias Braun [Tue, 13 Sep 2011 14:50:59 +0000 (16:50 +0200)]
some cleanups for middleend node creation in backends

Some backends create nodes in their lower_for_target phases already.
These nodes are placeholders for real backend nodes later, in contrast
they do not have register requirements or backend attributes. Simplified
this by allowing custom dumpers for them and leaving out the backend
node structs.

13 years agoWe can only optimize one CopyB for each return value.
Sebastian Buchwald [Thu, 15 Sep 2011 07:13:41 +0000 (09:13 +0200)]
We can only optimize one CopyB for each return value.

This fixes opt/fehler202.c.

13 years agoMinor indentation fix.
Manuel Mohr [Wed, 14 Sep 2011 12:48:53 +0000 (14:48 +0200)]
Minor indentation fix.

13 years agoMerge branch 'opt_manage'
Andreas Zwinkau [Wed, 14 Sep 2011 11:40:07 +0000 (13:40 +0200)]
Merge branch 'opt_manage'

This is a merge, because it should be considered as a single commit
and libFirm might be broken between the various commits of the branch.
However, there are so many changes, that i do not want to squash
them all into one mega-commit.

13 years agoRemove entity_usage_state attribute
Andreas Zwinkau [Wed, 14 Sep 2011 11:00:07 +0000 (13:00 +0200)]
Remove entity_usage_state attribute

13 years agoRemove dom_state and pdom_state attributes
Andreas Zwinkau [Wed, 14 Sep 2011 09:28:59 +0000 (11:28 +0200)]
Remove dom_state and pdom_state attributes

13 years agoRemove outs_state attribute
Andreas Zwinkau [Tue, 13 Sep 2011 11:08:17 +0000 (13:08 +0200)]
Remove outs_state attribute

API change: removes set_irg_outs_inconsistent and get_irg_outs_state
Use set_irg_state and is_irg_state instead!

13 years agoAPI to enable dumping
Andreas Zwinkau [Thu, 8 Sep 2011 12:25:47 +0000 (14:25 +0200)]
API to enable dumping

13 years agoRemoved IR_GRAPH_STATE_BAD_BLOCK symbol
Andreas Zwinkau [Wed, 7 Sep 2011 12:06:08 +0000 (14:06 +0200)]
Removed IR_GRAPH_STATE_BAD_BLOCK symbol

13 years agoconvert opts to use the opt_manage framework
Andreas Zwinkau [Fri, 2 Sep 2011 11:59:47 +0000 (13:59 +0200)]
convert opts to use the opt_manage framework

Converted: ifconv, boolopt, combo, fpvrp, ldst, code placement,
jumpthreading, deconv, parallelize mem, loop, scalar replacement,
cfopt.

13 years agointroduce opt_manage framework
Andreas Zwinkau [Wed, 7 Sep 2011 12:59:03 +0000 (14:59 +0200)]
introduce opt_manage framework

This is a basic implementation of http://libfirm.org/PhaseManagement

Introduces remove_unreachable_blocks as an extra API function,
which does a subset of optimize_graph_df.

13 years agointroduce remove_unreachable_blocks
Andreas Zwinkau [Thu, 8 Sep 2011 10:56:39 +0000 (12:56 +0200)]
introduce remove_unreachable_blocks

13 years agoRemove dead assignment
Andreas Zwinkau [Wed, 14 Sep 2011 09:01:55 +0000 (11:01 +0200)]
Remove dead assignment

Cheering up Tron ;)

13 years agobeabi: no special treatment of returns_twice
Matthias Braun [Tue, 13 Sep 2011 12:19:26 +0000 (14:19 +0200)]
beabi: no special treatment of returns_twice

returns_twice handling was broken in the ia32-backend (the only real
beabi user) for a long time now. Just noone noticed because our
frontends lacked the special treatment to set the flag correctly.
Turned out setjmp/longjmp on ia32 save/restore the registers anyway
so not doing anything is fine here.

13 years agosparc: implement returns_twice calling convention
Matthias Braun [Tue, 13 Sep 2011 09:06:09 +0000 (11:06 +0200)]
sparc: implement returns_twice calling convention

13 years agodump calling convention and additional properties for method types
Matthias Braun [Tue, 13 Sep 2011 09:05:52 +0000 (11:05 +0200)]
dump calling convention and additional properties for method types

13 years agoremove_bads must preserve block entities
Andreas Zwinkau [Tue, 13 Sep 2011 11:40:25 +0000 (13:40 +0200)]
remove_bads must preserve block entities

They might be the target of an ijmp afterall.

13 years agoDo not touch deleted nodes.
Sebastian Buchwald [Tue, 13 Sep 2011 06:28:53 +0000 (08:28 +0200)]
Do not touch deleted nodes.

This fixes backend/float_ret_sse.c with -O1.

13 years agosparc: first implementation of upper_bits_clean
Matthias Braun [Fri, 9 Sep 2011 21:28:43 +0000 (23:28 +0200)]
sparc: first implementation of upper_bits_clean

13 years agoia32: fix overly conservative upper_bits_clean (by avoiding undefined behaviour)
Matthias Braun [Fri, 9 Sep 2011 21:28:14 +0000 (23:28 +0200)]
ia32: fix overly conservative upper_bits_clean (by avoiding undefined behaviour)

13 years agosparc: remove unnecessary convs before stores
Matthias Braun [Fri, 9 Sep 2011 20:51:11 +0000 (22:51 +0200)]
sparc: remove unnecessary convs before stores

13 years agomake sure projs of projs are moved in part_block_edges
Matthias Braun [Fri, 9 Sep 2011 09:21:13 +0000 (11:21 +0200)]
make sure projs of projs are moved in part_block_edges

13 years agoimplement compound-call-argument lowering
Matthias Braun [Thu, 8 Sep 2011 13:26:03 +0000 (15:26 +0200)]
implement compound-call-argument lowering

Implement a generic way to lower compound-call-arguments.
Parameters are prepared on the stackframe and passed as a pointer
to the function.

13 years agoChange "associated type" logic to a single linked list to the "higher type"
Matthias Braun [Thu, 8 Sep 2011 10:38:19 +0000 (12:38 +0200)]
Change "associated type" logic to a single linked list to the "higher type"

13 years agoFix offsets for Loads and Stores.
Sebastian Buchwald [Thu, 8 Sep 2011 09:06:38 +0000 (11:06 +0200)]
Fix offsets for Loads and Stores.

13 years agoUse additional register instead of multiple immediate instructions.
Sebastian Buchwald [Wed, 7 Sep 2011 13:02:38 +0000 (15:02 +0200)]
Use additional register instead of multiple immediate instructions.

13 years agoIgnore g4 for internal usage.
Sebastian Buchwald [Tue, 6 Sep 2011 08:04:42 +0000 (10:04 +0200)]
Ignore g4 for internal usage.

13 years agoFixed some typos.
Sebastian Buchwald [Wed, 7 Sep 2011 12:59:34 +0000 (14:59 +0200)]
Fixed some typos.

13 years agoremove_bads invalidates outs
Andreas Zwinkau [Thu, 8 Sep 2011 11:07:43 +0000 (13:07 +0200)]
remove_bads invalidates outs

13 years agofunctions with compound parameters are never const in firm
Matthias Braun [Tue, 6 Sep 2011 15:01:41 +0000 (17:01 +0200)]
functions with compound parameters are never const in firm

This should fix fehler200.c

13 years agosparc: fix invalid stack bias calculation in omit-fp-mode
Matthias Braun [Tue, 6 Sep 2011 14:16:40 +0000 (16:16 +0200)]
sparc: fix invalid stack bias calculation in omit-fp-mode

13 years agosparc: panic instead of segfault for struct parameters
Matthias Braun [Tue, 6 Sep 2011 14:16:24 +0000 (16:16 +0200)]
sparc: panic instead of segfault for struct parameters

13 years agoremove has_compound_ret_parameter, we already had cc_compound_ret
Matthias Braun [Tue, 6 Sep 2011 11:55:20 +0000 (13:55 +0200)]
remove has_compound_ret_parameter, we already had cc_compound_ret

This should also fix compound returns in combination with
-msoft-float on sparc

13 years agosparc: support for thread local storage
Matthias Braun [Tue, 6 Sep 2011 11:24:28 +0000 (13:24 +0200)]
sparc: support for thread local storage

13 years agobegnuas: let user specify elf variants
Matthias Braun [Tue, 6 Sep 2011 11:00:45 +0000 (13:00 +0200)]
begnuas: let user specify elf variants

13 years agolower parameter entities in softfloat lowerer
Matthias Braun [Mon, 5 Sep 2011 14:22:19 +0000 (16:22 +0200)]
lower parameter entities in softfloat lowerer

13 years agosparc: do not use MATCH_MODE_NEUTRAL when using Or/And/Eor for flags
Matthias Braun [Mon, 5 Sep 2011 15:00:08 +0000 (17:00 +0200)]
sparc: do not use MATCH_MODE_NEUTRAL when using Or/And/Eor for flags

13 years agosparc: Ignore long doubles like ia32 backend.
Manuel Mohr [Fri, 26 Aug 2011 11:28:02 +0000 (13:28 +0200)]
sparc:  Ignore long doubles like ia32 backend.

Softfloat library does not support long double anyway.

13 years agosparc: split Mulh node into SMulh and UMulh
Matthias Braun [Mon, 5 Sep 2011 14:48:49 +0000 (16:48 +0200)]
sparc: split Mulh node into SMulh and UMulh

(Hannes ancient technique based on the Proj-mode is deprecated)

13 years agosparc: Stop looking for delay slot node when leaving current block.
Manuel Mohr [Wed, 24 Aug 2011 14:30:23 +0000 (16:30 +0200)]
sparc:  Stop looking for delay slot node when leaving current block.

13 years agoAdded dw_lower special case to handle Calls whose result is never used.
Manuel Mohr [Wed, 24 Aug 2011 12:51:58 +0000 (14:51 +0200)]
Added dw_lower special case to handle Calls whose result is never used.

13 years agoAlternative fix for const functions with aggregate return
Matthias Braun [Mon, 5 Sep 2011 12:07:17 +0000 (14:07 +0200)]
Alternative fix for const functions with aggregate return

They really are const before lowering. So only mark the function
as non-const after lowering

This reverts commit 72c631f337f78b20460c508bd8af37fe67a5af37.

13 years agosparc: initial support for Alloc/Free nodes
Matthias Braun [Tue, 23 Aug 2011 17:09:29 +0000 (19:09 +0200)]
sparc: initial support for Alloc/Free nodes

This commit also adds a generic Alloc/Free lowering helper
Unfortunately we often produce invalid code, because currently our
stackpointer wiring logic is too weak and produces invalid results for
example when using alloca in a loop.

13 years agorename Free argument from size to count to be consistent with Alloc
Matthias Braun [Tue, 23 Aug 2011 16:51:08 +0000 (18:51 +0200)]
rename Free argument from size to count to be consistent with Alloc

13 years agoFix cfopt bug due to infinite loops
Andreas Zwinkau [Tue, 6 Sep 2011 09:14:06 +0000 (11:14 +0200)]
Fix cfopt bug due to infinite loops

13 years agoPrint the linkage of entities only once, not twice.
Christoph Mallon [Sat, 3 Sep 2011 14:45:22 +0000 (16:45 +0200)]
Print the linkage of entities only once, not twice.

13 years agoPrint the value of const initializers instead of just <CONST>Const.
Christoph Mallon [Sat, 3 Sep 2011 14:34:29 +0000 (16:34 +0200)]
Print the value of const initializers instead of just <CONST>Const.

13 years agoAdd missing newlines when dumping entities.
Christoph Mallon [Sat, 3 Sep 2011 14:33:22 +0000 (16:33 +0200)]
Add missing newlines when dumping entities.

13 years agoPrint "default" instead of nothing if an entity has default linkage.
Christoph Mallon [Sat, 3 Sep 2011 14:31:45 +0000 (16:31 +0200)]
Print "default" instead of nothing if an entity has default linkage.

13 years agoWe may return a parameter and thus need to copy them.
Sebastian Buchwald [Fri, 2 Sep 2011 12:53:34 +0000 (14:53 +0200)]
We may return a parameter and thus need to copy them.

This fixes opt/fehler200.c.

13 years agoDirectly ask backend for current machine size in CopyB lowering.
Manuel Mohr [Thu, 1 Sep 2011 17:41:51 +0000 (19:41 +0200)]
Directly ask backend for current machine size in CopyB lowering.

Old version used parameter.

13 years agoAdapt documentation to implementation
Andreas Zwinkau [Thu, 1 Sep 2011 16:54:31 +0000 (18:54 +0200)]
Adapt documentation to implementation

13 years agoCmp must not counted as an operation
Andreas Zwinkau [Thu, 1 Sep 2011 14:34:47 +0000 (16:34 +0200)]
Cmp must not counted as an operation

13 years agoLet collect_nodes cope with Bad nodes
Andreas Zwinkau [Thu, 1 Sep 2011 14:27:33 +0000 (16:27 +0200)]
Let collect_nodes cope with Bad nodes

13 years agoDo not regard functions with compound return types as pure/const.
Manuel Mohr [Thu, 1 Sep 2011 14:00:31 +0000 (16:00 +0200)]
Do not regard functions with compound return types as pure/const.

13 years agoImproved CopyB lowering, made it part of target lowering.
Manuel Mohr [Wed, 31 Aug 2011 17:34:55 +0000 (19:34 +0200)]
Improved CopyB lowering, made it part of target lowering.

Backends can configure CopyB lowering, so that it's possible to keep
CopyB nodes in a certain size range for special backend-specific
optimizations.  Furthermore, large CopyBs are turned into memcpy calls.

13 years agofix warning
Andreas Zwinkau [Thu, 1 Sep 2011 10:40:37 +0000 (12:40 +0200)]
fix warning

13 years agoImprove cfopt
Andreas Zwinkau [Thu, 1 Sep 2011 09:10:22 +0000 (11:10 +0200)]
Improve cfopt

The part, which does not handle Phis is now recomputing block info,
because converting Cond -> Jmp, might make this info obsolete.

Additionally, it can now remove empty Jmp blocks with more than one
control flow predecessor, provided the origin block has no Phis.

Now cfopt should now be idempotent
(at least the part not handling Phis).

13 years agofix the fix of the call ordering...
Matthias Braun [Tue, 23 Aug 2011 17:19:05 +0000 (19:19 +0200)]
fix the fix of the call ordering...

13 years agoia32: make sure the stackframe IncSp is always used
Matthias Braun [Tue, 23 Aug 2011 11:22:40 +0000 (13:22 +0200)]
ia32: make sure the stackframe IncSp is always used

13 years agosparc: support va_start
Matthias Braun [Mon, 22 Aug 2011 14:11:58 +0000 (16:11 +0200)]
sparc: support va_start

13 years agoa const parameter is enough for get_method_XXX()
Matthias Braun [Mon, 22 Aug 2011 13:24:05 +0000 (15:24 +0200)]
a const parameter is enough for get_method_XXX()

13 years agoadd special constant to represent VA_START-address in a parameter_entity
Matthias Braun [Mon, 22 Aug 2011 12:47:14 +0000 (14:47 +0200)]
add special constant to represent VA_START-address in a parameter_entity

13 years agobeverify: test register width in regalloc verification
Matthias Braun [Thu, 18 Aug 2011 17:17:30 +0000 (19:17 +0200)]
beverify: test register width in regalloc verification

13 years agofix mode of call-result proj
Matthias Braun [Thu, 18 Aug 2011 13:01:44 +0000 (15:01 +0200)]
fix mode of call-result proj

13 years agoFixed call dependency comparison for backend call ordering.
Manuel Mohr [Fri, 19 Aug 2011 13:25:54 +0000 (15:25 +0200)]
Fixed call dependency comparison for backend call ordering.

Code was taken from cmp_call_dependency in beabi.c which handles the
situation correctly.

13 years agoBugfix: Added special case for x mod 1.
Sebastian Buchwald [Fri, 19 Aug 2011 12:07:11 +0000 (14:07 +0200)]
Bugfix: Added special case for x mod 1.

13 years agoIR export: export mode name as string; mark "the" mode_P mode.
Julian Oppermann [Fri, 19 Aug 2011 11:46:32 +0000 (13:46 +0200)]
IR export: export mode name as string; mark "the" mode_P mode.

13 years agoClarify remove_bads doc
Andreas Zwinkau [Fri, 19 Aug 2011 08:17:01 +0000 (10:17 +0200)]
Clarify remove_bads doc

13 years agoCorrect comment.
Christoph Mallon [Fri, 19 Aug 2011 06:15:04 +0000 (08:15 +0200)]
Correct comment.

13 years agoReduce code duplication.
Christoph Mallon [Fri, 19 Aug 2011 06:14:21 +0000 (08:14 +0200)]
Reduce code duplication.

13 years agoUse new_*_Const(irg, get_mode_$VAL(mode)) instead of new_*_Const_long(irg, mode,...
Christoph Mallon [Fri, 19 Aug 2011 06:08:41 +0000 (08:08 +0200)]
Use new_*_Const(irg, get_mode_$VAL(mode)) instead of new_*_Const_long(irg, mode, $VAL).

13 years agosparc: Set object file format when initializing backend.
Manuel Mohr [Thu, 18 Aug 2011 16:56:55 +0000 (18:56 +0200)]
sparc: Set object file format when initializing backend.

Old version breaks for files which do not contain any functions because
in this case, emit_routine never gets called.

13 years agoFix div by one
Andreas Zwinkau [Thu, 18 Aug 2011 14:56:50 +0000 (16:56 +0200)]
Fix div by one

For k==0 the Div to Shift conversion is wrong.
Instead, we just convert to the left operand of the Div.

13 years agoRefactoring to remove one level of indentation
Andreas Zwinkau [Thu, 18 Aug 2011 14:53:18 +0000 (16:53 +0200)]
Refactoring to remove one level of indentation