libfirm
13 years agoadd missing FIRM_API prefixes
Matthias Braun [Thu, 9 Jun 2011 11:49:58 +0000 (13:49 +0200)]
add missing FIRM_API prefixes

13 years agoRemoved the callee/caller saved flag from register specification.
Michael Beck [Wed, 8 Jun 2011 17:39:39 +0000 (19:39 +0200)]
Removed the callee/caller saved flag from register specification.

The callee/caller saved information is not constant accross different
ABI's, so don't make it constant. Instead, all BE that still use beabi
provide a callback now.
This allows to implement support for x64_64/Win32 and is a necessary step
for the combined x86 BE.

13 years agoverify nodes before optimizing them
Matthias Braun [Wed, 8 Jun 2011 17:08:50 +0000 (19:08 +0200)]
verify nodes before optimizing them

13 years agojumpthreading must not split edges
Andreas Zwinkau [Wed, 8 Jun 2011 11:19:33 +0000 (13:19 +0200)]
jumpthreading must not split edges

* the splitted edge is never critical, so the name was misleading
* it might result in an infinite loop
  fixes opt/jumpthreading5 and opt/jumpthreading5b

13 years agoadapt to firm coding conventions, avoid warnings by using INT_TO_PTR and PTR_TO_INT
Matthias Braun [Tue, 7 Jun 2011 11:03:07 +0000 (13:03 +0200)]
adapt to firm coding conventions, avoid warnings by using INT_TO_PTR and PTR_TO_INT

13 years agofix a few comment typos
Matthias Braun [Tue, 7 Jun 2011 10:39:25 +0000 (12:39 +0200)]
fix a few comment typos

13 years agoFix some types
Andreas Zwinkau [Mon, 6 Jun 2011 09:30:00 +0000 (11:30 +0200)]
Fix some types

Fixes issue 64, because casting long to int does work on 64bit.

13 years agoexperimental patch to limit GCSE so we don't produce partially dead code like crazy
Matthias Braun [Wed, 1 Jun 2011 14:15:43 +0000 (16:15 +0200)]
experimental patch to limit GCSE so we don't produce partially dead code like crazy

13 years agolower small switches to ifs
Matthias Braun [Wed, 1 Jun 2011 13:56:48 +0000 (15:56 +0200)]
lower small switches to ifs

13 years agoremove bads in backend
Andreas Zwinkau [Wed, 1 Jun 2011 13:48:29 +0000 (15:48 +0200)]
remove bads in backend

Like the comment says "we can't have Bad-blocks".
However, optimize_cf does not remove them anymore.

13 years agolower_dw must deactivate edges
Andreas Zwinkau [Wed, 1 Jun 2011 12:56:25 +0000 (14:56 +0200)]
lower_dw must deactivate edges

There might be some ProjL nodes reachable via out edges
and the following "local" phase does enqueue_users for
optimized nodes, which might visit the 'undead' ProjL.

13 years agorework fragile ops to have a throws_exception attribute
Matthias Braun [Tue, 31 May 2011 14:27:06 +0000 (16:27 +0200)]
rework fragile ops to have a throws_exception attribute

13 years agochange pn_XXX_max enum to really be the maximum pn and not maximum+1, add n_XXX_max...
Matthias Braun [Wed, 1 Jun 2011 12:06:54 +0000 (14:06 +0200)]
change pn_XXX_max enum to really be the maximum pn and not maximum+1, add n_XXX_max enum

13 years agoAssert that the given node in set_r_cur_block() has mode BB.
Christoph Mallon [Wed, 1 Jun 2011 06:20:31 +0000 (08:20 +0200)]
Assert that the given node in set_r_cur_block() has mode BB.

13 years agoReduce code duplication: Implement set_cur_block() by calling set_r_cur_block().
Christoph Mallon [Wed, 1 Jun 2011 06:22:44 +0000 (08:22 +0200)]
Reduce code duplication: Implement set_cur_block() by calling set_r_cur_block().

13 years agoalways transform integer abs, even in GRAPH_STATE_KEEP_MUX
Matthias Braun [Tue, 31 May 2011 11:23:44 +0000 (13:23 +0200)]
always transform integer abs, even in GRAPH_STATE_KEEP_MUX

13 years agofix transform_node_Cmp
Matthias Braun [Tue, 31 May 2011 11:19:03 +0000 (13:19 +0200)]
fix transform_node_Cmp

13 years agoIntroduce flip-flopping normalisations
Matthias Braun [Tue, 31 May 2011 10:44:52 +0000 (12:44 +0200)]
Introduce flip-flopping normalisations

There are cases where we can normalize in 2 directions and both have
their merits. Just do both in this case. The frontend should at some
point set IRG_GRAPH_STATE_NORMALISATION2 to trigger the 2nd direction.

13 years agoirverify: simplify/refactor internal interfaces
Matthias Braun [Fri, 27 May 2011 16:21:46 +0000 (18:21 +0200)]
irverify: simplify/refactor internal interfaces

13 years agoa const ir_graph is enough for get_idx_irn
Matthias Braun [Fri, 27 May 2011 16:21:17 +0000 (18:21 +0200)]
a const ir_graph is enough for get_idx_irn

13 years agofragile nodes must be exception or memory pinned
Matthias Braun [Fri, 27 May 2011 14:57:31 +0000 (16:57 +0200)]
fragile nodes must be exception or memory pinned

13 years agomove integer abs optimisation from backend to the middleend
Matthias Braun [Mon, 30 May 2011 21:18:31 +0000 (23:18 +0200)]
move integer abs optimisation from backend to the middleend

13 years agoreverse direction of bitop/shift normalisation
Matthias Braun [Mon, 30 May 2011 18:24:08 +0000 (20:24 +0200)]
reverse direction of bitop/shift normalisation

13 years agooptimize_blocks ignores unreachable blocks
Andreas Zwinkau [Tue, 31 May 2011 10:56:27 +0000 (12:56 +0200)]
optimize_blocks ignores unreachable blocks

Fixes opt/ioet.c

13 years agoCosmetics in cfopt
Andreas Zwinkau [Tue, 31 May 2011 08:55:47 +0000 (10:55 +0200)]
Cosmetics in cfopt

* set_irg_outs_inconsistent is unnecessary as exchange does that already
* "useless if optimization" was a confusing comment
* more precise type: int -> block_flags_t

13 years agoFix "Some cleanup of cfopt."
Andreas Zwinkau [Tue, 31 May 2011 08:50:49 +0000 (10:50 +0200)]
Fix "Some cleanup of cfopt."

The remove_empty_blocks function must be used for a pre-walker, otherwise
it might be called on blocks, which were optimized away. Consider infinite
loops and the Keep edges:

  \ ___
   B   |
    \  /
    Empty
    /
   / Keep Edge!

In this example, we must not call remove_empty_blocks on Empty,
after we called it on B, but a post walker would do that.

13 years agoImproved doxygen docu.
unknown [Mon, 30 May 2011 21:59:06 +0000 (23:59 +0200)]
Improved doxygen docu.

13 years agoSome cleanup of cfopt.
unknown [Mon, 30 May 2011 17:00:18 +0000 (19:00 +0200)]
Some cleanup of cfopt.

- renamed clear_link() to clear_link_and_mark_blocks_removable()
- renamed optimize_conds() to optimize_ifs()
- simplified has_*() implementations
- made some walker POST walker
- invalidate out edges
- and add some doxygen docu
- fixed some typos
- adapt to firm indentation style

13 years agoimprove our 'don't use AM' heuristic: immediates do not increase register pressure
Matthias Braun [Mon, 30 May 2011 14:21:52 +0000 (16:21 +0200)]
improve our 'don't use AM' heuristic: immediates do not increase register pressure

13 years agoUse XMALLOCF*().
Christoph Mallon [Fri, 27 May 2011 17:05:29 +0000 (19:05 +0200)]
Use XMALLOCF*().

13 years agoFix opt/inline.c
Andreas Zwinkau [Mon, 30 May 2011 13:46:33 +0000 (15:46 +0200)]
Fix opt/inline.c

13 years agolocalopt/lower_dw opt: a==b && c==d => (a^b)|(c^d)==0
Matthias Braun [Sun, 29 May 2011 11:33:26 +0000 (13:33 +0200)]
localopt/lower_dw opt: a==b && c==d  => (a^b)|(c^d)==0

13 years agoimplement Cmp(Conv(x),Const) => Cmp(x,Const)
Matthias Braun [Sat, 28 May 2011 14:59:47 +0000 (16:59 +0200)]
implement Cmp(Conv(x),Const) => Cmp(x,Const)

13 years agoFixed typos.
Michael Beck [Fri, 27 May 2011 21:19:02 +0000 (23:19 +0200)]
Fixed typos.

13 years agoC99 feature removed.
Michael Beck [Fri, 27 May 2011 21:12:27 +0000 (23:12 +0200)]
C99 feature removed.

13 years agoFixed calculation of meet blocks broken in 4db6c5b3.
Michael Beck [Fri, 27 May 2011 21:11:32 +0000 (23:11 +0200)]
Fixed calculation of meet blocks broken in 4db6c5b3.

13 years agocfopt must maintain Bad structure
Andreas Zwinkau [Fri, 27 May 2011 13:59:55 +0000 (15:59 +0200)]
cfopt must maintain Bad structure

13 years agoRemoved unused variable.
Sebastian Buchwald [Fri, 27 May 2011 13:44:32 +0000 (15:44 +0200)]
Removed unused variable.

The get_n in the foreach loop is a macro and not a use of the function.

13 years agomerge start-block successor with start-block in backend (necessary after equivalent_n...
Matthias Braun [Fri, 27 May 2011 12:41:42 +0000 (14:41 +0200)]
merge start-block successor with start-block in backend (necessary after equivalent_node_Block is gone)

13 years agofix activate_backedges failing for nodes with Deleted block in the identities table
Matthias Braun [Fri, 27 May 2011 13:22:17 +0000 (15:22 +0200)]
fix activate_backedges failing for nodes with Deleted block in the identities table

13 years agoimplement 'x-(x&y) => x & ~y' localopt
Matthias Braun [Fri, 27 May 2011 11:54:58 +0000 (13:54 +0200)]
implement 'x-(x&y) => x & ~y' localopt

13 years agoimplement/refactor x&~x, x|~x, x^~x and x+~x localopts
Matthias Braun [Fri, 27 May 2011 08:09:41 +0000 (10:09 +0200)]
implement/refactor x&~x, x|~x, x^~x and x+~x localopts

13 years agostruct ir_settings_if_conv_t does not exist anymore.
Christoph Mallon [Fri, 27 May 2011 13:25:03 +0000 (15:25 +0200)]
struct ir_settings_if_conv_t does not exist anymore.

13 years agoMake the elements of binary_table[] const.
Christoph Mallon [Fri, 27 May 2011 09:04:43 +0000 (11:04 +0200)]
Make the elements of binary_table[] const.

13 years agoAdapted some issues noticed during removal of unused variables.
Sebastian Buchwald [Fri, 27 May 2011 11:31:47 +0000 (13:31 +0200)]
Adapted some issues noticed during removal of unused variables.

13 years agoFixed some warning about unused variables.
Sebastian Buchwald [Fri, 27 May 2011 11:29:10 +0000 (13:29 +0200)]
Fixed some warning about unused variables.

13 years agoFixed some typos.
Sebastian Buchwald [Wed, 25 May 2011 12:28:13 +0000 (14:28 +0200)]
Fixed some typos.

13 years agofp-vrp transfer function ignore Bads
Andreas Zwinkau [Fri, 27 May 2011 10:12:38 +0000 (12:12 +0200)]
fp-vrp transfer function ignore Bads

Since Bads have modes now the check for mode_X initialized the bitinfo,
which results in incorrect reachability information.

13 years agoedges deactivate fix
Andreas Zwinkau [Fri, 27 May 2011 08:38:33 +0000 (10:38 +0200)]
edges deactivate fix

Broken with csmith 2.0.0 seed 909842313
in libFirm 1953ce88fe94d589a9b47d2ab8969c21bfb55b3a

13 years agoDo not generate declaration for non-existing arch_get_n_regs()
Matthias Braun [Sat, 7 May 2011 13:47:01 +0000 (15:47 +0200)]
Do not generate declaration for non-existing arch_get_n_regs()

13 years agofix ShlD/ShrD not getting generated in some cases
Matthias Braun [Thu, 26 May 2011 16:37:00 +0000 (18:37 +0200)]
fix ShlD/ShrD not getting generated in some cases

13 years agoAnother Bad mode fix
Andreas Zwinkau [Thu, 26 May 2011 13:44:42 +0000 (15:44 +0200)]
Another Bad mode fix

13 years agoconvopt: fix potential bug with modulo shifts, improve cost calculation for optimizab...
Matthias Braun [Thu, 26 May 2011 11:08:59 +0000 (13:08 +0200)]
convopt: fix potential bug with modulo shifts, improve cost calculation for optimizable conv(shift) combinations

13 years agoadd some localopts for shifting over the mode size
Matthias Braun [Thu, 26 May 2011 11:07:50 +0000 (13:07 +0200)]
add some localopts for shifting over the mode size

13 years agoreindent escape_ana.c in firm style
Matthias Braun [Wed, 25 May 2011 16:18:07 +0000 (18:18 +0200)]
reindent escape_ana.c in firm style

13 years agoifconv must remove bads first
Andreas Zwinkau [Thu, 26 May 2011 10:49:15 +0000 (12:49 +0200)]
ifconv must remove bads first

Fixes C/unkept_loop.c

13 years agoNew API function: remove_bads
Andreas Zwinkau [Thu, 26 May 2011 10:38:52 +0000 (12:38 +0200)]
New API function: remove_bads

The functionality already existed,
but this is necessary at more than on place.

13 years agosimplify merge_env struct
Andreas Zwinkau [Thu, 26 May 2011 08:03:43 +0000 (10:03 +0200)]
simplify merge_env struct

13 years agoreuse is_switch_Cond function
Andreas Zwinkau [Wed, 25 May 2011 08:36:39 +0000 (10:36 +0200)]
reuse is_switch_Cond function

13 years agoAdditional cfopt: Cond=>Jmp
Andreas Zwinkau [Tue, 24 May 2011 14:34:06 +0000 (16:34 +0200)]
Additional cfopt: Cond=>Jmp

        Cond
       /    \
  projA      projB   =>   Jmp     Bad
       \    /                \   /
       block                 block

This optimization might produce more empty blocks to remove,
which in turn might enable more Cond=>Jmp opts.
So we need to perform this until nothing changes anymore.

Fixes x86code/cfopt.c
Breaks C/unkept_loop.c, because ifconv cannot handle Bads

13 years agoTypo.
Julian Oppermann [Wed, 25 May 2011 14:54:16 +0000 (16:54 +0200)]
Typo.

13 years agoRemove nop optimization
Andreas Zwinkau [Tue, 24 May 2011 12:32:35 +0000 (14:32 +0200)]
Remove nop optimization

This code does nothing, because the previous commit removed the
equivalent_node_Block function.

13 years agoRemove equivalent_node_Block
Andreas Zwinkau [Mon, 23 May 2011 14:29:39 +0000 (16:29 +0200)]
Remove equivalent_node_Block

Fixes opt/localopts2

Because of Phis blocks cannot be equivalent. The cfopt must do all
block merging.

For example, consider the case where block A has one predecessor
block B, which contains a Jmp. Naively, we might exchange(A,B).
However, A might contain a Phi with one operand, then the graph
is broken afterwards, since we move the Phi into B as well.

13 years agoRemove goto
Andreas Zwinkau [Wed, 25 May 2011 08:42:16 +0000 (10:42 +0200)]
Remove goto

13 years agoFix cfopt Bad mode
Andreas Zwinkau [Wed, 25 May 2011 13:20:11 +0000 (15:20 +0200)]
Fix cfopt Bad mode

13 years agoget_Block_cfgpred_block must return mode_BB
Andreas Zwinkau [Wed, 25 May 2011 13:18:42 +0000 (15:18 +0200)]
get_Block_cfgpred_block must return mode_BB

13 years agoFix comment
Andreas Zwinkau [Wed, 25 May 2011 07:53:17 +0000 (09:53 +0200)]
Fix comment

13 years agocleanup fragile op handling
Matthias Braun [Wed, 25 May 2011 13:31:54 +0000 (15:31 +0200)]
cleanup fragile op handling

- The pns of X_regular and X_except are annotated in the opcode now.
- The memory input is annotated in the opcode now
- only nodes with X_regular, X_except are marked fragile

13 years agogenerate n_Node_XXX enums for node inputs
Matthias Braun [Wed, 25 May 2011 12:37:22 +0000 (14:37 +0200)]
generate n_Node_XXX enums for node inputs

13 years agoBad,Unknown are no cfopcdes
Matthias Braun [Wed, 25 May 2011 12:00:00 +0000 (14:00 +0200)]
Bad,Unknown are no cfopcdes

13 years agofix warnings
Matthias Braun [Wed, 25 May 2011 11:34:57 +0000 (13:34 +0200)]
fix warnings

13 years agofix fehler189.c
Matthias Braun [Wed, 25 May 2011 10:54:31 +0000 (12:54 +0200)]
fix fehler189.c

13 years agotypo
Andreas Zwinkau [Mon, 23 May 2011 14:40:02 +0000 (16:40 +0200)]
typo

13 years agosparc: implement 64bit lowering
Matthias Braun [Wed, 11 May 2011 12:36:05 +0000 (14:36 +0200)]
sparc: implement 64bit lowering

13 years agocompiler library entities should be visibility_external
Matthias Braun [Mon, 23 May 2011 09:01:10 +0000 (11:01 +0200)]
compiler library entities should be visibility_external

13 years agolower_dw: Shift lowering without intrinsics
Matthias Braun [Mon, 16 May 2011 11:32:44 +0000 (13:32 +0200)]
lower_dw: Shift lowering without intrinsics

We can still use ia32 ShlD, ShrD functions by matching Or(Shl,Shr)
patterns in the ia32 transformer.

13 years agolower_dw: huge refactoring, allow custom lowering funcs, fix endianess problems
Matthias Braun [Wed, 11 May 2011 15:57:19 +0000 (17:57 +0200)]
lower_dw: huge refactoring, allow custom lowering funcs, fix endianess problems

13 years agoirg_walk_anchors uses visited field, reserve it
Matthias Braun [Thu, 12 May 2011 12:18:37 +0000 (14:18 +0200)]
irg_walk_anchors uses visited field, reserve it

13 years agoinclude irnode_t.h, irgraph_t.h for better performance
Matthias Braun [Mon, 16 May 2011 11:58:29 +0000 (13:58 +0200)]
include irnode_t.h, irgraph_t.h for better performance

13 years agofix some set_ functions not being marked as FIRM_API
Matthias Braun [Tue, 17 May 2011 17:06:39 +0000 (19:06 +0200)]
fix some set_ functions not being marked as FIRM_API

13 years agofix shiftop optimization failing for negative shift values
Matthias Braun [Wed, 18 May 2011 12:45:53 +0000 (14:45 +0200)]
fix shiftop optimization failing for negative shift values

13 years agouse irg from block instead of current_ir_graph in backend node constructors
Matthias Braun [Wed, 11 May 2011 12:19:16 +0000 (14:19 +0200)]
use irg from block instead of current_ir_graph in backend node constructors

13 years agoadd support for backend nodes without attributes
Matthias Braun [Wed, 11 May 2011 12:13:51 +0000 (14:13 +0200)]
add support for backend nodes without attributes

13 years agolower_dw: add support for Bad nodes
Matthias Braun [Tue, 10 May 2011 17:09:58 +0000 (19:09 +0200)]
lower_dw: add support for Bad nodes

13 years agosparc: Sub is mode neutral
Matthias Braun [Wed, 11 May 2011 14:57:30 +0000 (16:57 +0200)]
sparc: Sub is mode neutral

13 years agobackend: ProjT/Start is an anchor and explicitely transformed
Matthias Braun [Wed, 11 May 2011 13:52:38 +0000 (15:52 +0200)]
backend: ProjT/Start is an anchor and explicitely transformed

13 years agoUnresolved should_be_same constraint => panic
Andreas Zwinkau [Mon, 23 May 2011 11:02:27 +0000 (13:02 +0200)]
Unresolved should_be_same constraint => panic

13 years agofix opt/jumpthreading7
Andreas Zwinkau [Wed, 18 May 2011 12:41:45 +0000 (14:41 +0200)]
fix opt/jumpthreading7

13 years agocode placement fixes gcse
Andreas Zwinkau [Tue, 17 May 2011 11:25:41 +0000 (13:25 +0200)]
code placement fixes gcse

GCSEing nodes into unreachable blocks is ok now. The
verifier does not check the cfg, when irg is floating.
Code placement fixes and pins the irg after gcse.
Nodes in unreachable blocks are moved into the first block
after the start block.

Reachability checks in place_late are converted into asserts,
because after place_early, there are no unreachable blocks anymore.

reverts c64fe29 and 318579c
but also fixes opt/unreachable_block

13 years agoCode reuse
Andreas Zwinkau [Mon, 16 May 2011 12:39:16 +0000 (14:39 +0200)]
Code reuse

13 years agoDo not gcse unreachable code
Andreas Zwinkau [Mon, 16 May 2011 11:56:08 +0000 (13:56 +0200)]
Do not gcse unreachable code

During global CSE we now ignore nodes in unreachable blocks,
otherwise cse could pick the wrong representative node
and use unreachable nodes in reachable code.

13 years agoDelay exchange until all nodes are created
Andreas Zwinkau [Fri, 13 May 2011 16:30:11 +0000 (18:30 +0200)]
Delay exchange until all nodes are created

add_block_cf_input breaks, if the block has two Bad inputs

13 years agoldstop must deactivate edges after changes
Andreas Zwinkau [Fri, 13 May 2011 11:14:20 +0000 (13:14 +0200)]
ldstop must deactivate edges after changes

Skipping Loads might lead to dead code, which is still reference by
out edges.

13 years agoRemoved C99 features, adopt to Firm style.
Michael Beck [Tue, 10 May 2011 19:43:44 +0000 (21:43 +0200)]
Removed C99 features, adopt to Firm style.

13 years agoRemove kept Bad AFTER dead blocks are deleted to ensure no Bad ist kept.
Michael Beck [Tue, 10 May 2011 19:34:22 +0000 (21:34 +0200)]
Remove kept Bad AFTER dead blocks are deleted to ensure no Bad ist kept.

13 years agoMoved some helper functions from irgopt to irtools for reuse.
Michael Beck [Tue, 10 May 2011 19:18:32 +0000 (21:18 +0200)]
Moved some helper functions from irgopt to irtools for reuse.

13 years agoRemove unused variables, squelch warning about unused parameter.
Christoph Mallon [Tue, 10 May 2011 06:27:49 +0000 (08:27 +0200)]
Remove unused variables, squelch warning about unused parameter.

13 years agoUse simple assignment instead of memcpy() when possible.
Christoph Mallon [Tue, 10 May 2011 06:27:11 +0000 (08:27 +0200)]
Use simple assignment instead of memcpy() when possible.

13 years agosimplify unreachable code elimination:
Matthias Braun [Fri, 6 May 2011 19:12:54 +0000 (21:12 +0200)]
simplify unreachable code elimination:

only set block/phi inputs to bad to kill unreachable code, all other
code will be dead and removed anyway

13 years agofix iredges EDGE_KIND_BLOCK not updating correctly when exchanging blocks
Matthias Braun [Fri, 6 May 2011 18:46:12 +0000 (20:46 +0200)]
fix iredges EDGE_KIND_BLOCK not updating correctly when exchanging blocks