Jonas Maebe
67fc9a7853
* fixed peephole opitimizer removing some infinite loops (mantis #36139 )
...
git-svn-id: trunk@43175 -
2019-10-12 21:39:48 +00:00
florian
9230ae5aab
o overhaul-base.patch by J. Gareth Moreton, base for further patches
...
+ some inline directives added
+ some functions exported from units
git-svn-id: trunk@42722 -
2019-08-17 16:14:22 +00:00
Jonas Maebe
1b6425176b
* synchronised with trunk till r42049
...
git-svn-id: branches/debug_eh@42050 -
2019-05-12 18:44:05 +00:00
Jonas Maebe
281b3ad276
* fix case completeness and unreachable code warnings in compiler that would
...
be introduced by the next commit
git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
5d28e2156b
+ support for generating Dwarf CFI using .cfi_* directives
...
o adjust peephole optimisers so they don't remove cfi_endproc directives
in case of tail call optimisation
git-svn-id: branches/debug_eh@41578 -
2019-03-03 17:15:03 +00:00
florian
94d7a02fae
* modified patch by Gareth Moreton to pool TmpUsedRegs in the assembler optimizers, resolves #34679
...
git-svn-id: trunk@40938 -
2019-01-20 14:16:38 +00:00
Jonas Maebe
122d0d36d6
+ volatile() expression that marks an expression as volatile
...
* disable matching volatile references in the assembler optimisers, so they
can't be removed (more conservative than needed, but better than removing
too many)
o the CSE optimiser will ignore them by default, because they're an unknown
inline node for it
* also removed no longer used fpc_in_move_x and fpc_in_fillchar_x inline node
identifiers from rtl/inc/innr.inc, and placed fpc_in_unaligned_x at the
right place
git-svn-id: trunk@40465 -
2018-12-04 19:53:20 +00:00
florian
9b0ff05ee8
- get rid of MaxOps, it is redundant with max_operands
...
* MatchOpType with three operands is only available of max_operands>2
git-svn-id: trunk@40190 -
2018-11-02 21:32:29 +00:00
florian
2a016889de
* skip align directives after unconditional jumps
...
git-svn-id: trunk@40160 -
2018-11-01 20:49:18 +00:00
pierre
0abc978cc4
Change RemoveCurrentP parameter type to tai, because GetNextInstruction does not always return a taicpu, adapt code in avr/aoptcpu unit
...
git-svn-id: trunk@40120 -
2018-10-31 23:15:22 +00:00
Jeppe Johansen
054bf32f1f
Add RV64GC cpu type.
...
Fix float loading.
Fix a number of small issues with wrong operand sizes.
Fixed concatcopy code generation.
Align jump table for case statements.
git-svn-id: branches/laksen/riscv_new@39481 -
2018-07-21 22:34:42 +00:00
Jeppe Johansen
ceb38833f2
Added RiscV32/64 target, from a cleaned up version of branches/laksen/riscv/trunk.
...
git-svn-id: branches/laksen/riscv_new@39474 -
2018-07-20 08:21:15 +00:00
florian
5782acc32d
* patch by J. Gareth Moreton to fix 33909
...
git-svn-id: trunk@39353 -
2018-07-01 12:54:30 +00:00
florian
ae950956af
+ TAOptObj.*PeepHoleOpts* check if p is really assigned
...
+ TAOptObj.RemoveCurrentP
git-svn-id: trunk@38488 -
2018-03-10 21:53:48 +00:00
florian
78878f59b1
+ generic TAOptObj.AllocRegBetween
...
- removed x86 specific AllocRegBetween
git-svn-id: trunk@38445 -
2018-03-07 22:17:35 +00:00
florian
52510ea933
+ TUsedRegs.Dump
...
git-svn-id: trunk@38067 -
2018-01-28 13:26:45 +00:00
florian
8315c660f4
* fix JumpTargetOp for sparc64
...
git-svn-id: trunk@37158 -
2017-09-09 19:36:50 +00:00
florian
7f286eb54e
+ define cpudelayslot: set during compiler compilation for CPUs having branch instructions with delay slot (MIPS, SPARC)
...
git-svn-id: trunk@36958 -
2017-08-20 17:20:38 +00:00
florian
f4718c0969
* made nop handling generic for sparc, so it is used by sparc64 as well
...
git-svn-id: trunk@36814 -
2017-07-29 20:06:14 +00:00
florian
b1dff29cbf
* removed unused units
...
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
florian
e3f0b338d4
* SkipLabels moved to aoptutils
...
* factored out OptPass2Jmp assembler optimization
* OptPass2Jmp now used by x86-64 as well
git-svn-id: trunk@36141 -
2017-05-06 21:07:02 +00:00
nickysn
c096b1fe6b
* fixed the debug output, generated by -dDEBUG_INSTRUCTIONREGISTERDEPENDENCIES
...
for x86 instructions, entered via inline assembler, using intel syntax
(the low level optimizer isn't normally run on them, so it doesn't matter that
InstructionLoadsFromReg and similar functions don't work on them, but with
-dDEBUG_INSTRUCTIONREGISTERDEPENDENCIES it is much more convenient for
debugging purposes to have correct data for them, because you can enter
instructions manually and see how these functions behave)
git-svn-id: trunk@36065 -
2017-05-03 10:14:35 +00:00
nickysn
a9617b623f
+ print info about the registers, in which new values are written (as reported
...
by RegLoadedWithNewValue), when DEBUG_INSTRUCTIONREGISTERDEPENDENCIES is
defined
git-svn-id: trunk@35996 -
2017-04-28 13:14:12 +00:00
nickysn
7ea0429d40
+ added new compiler debug ifdef DEBUG_INSTRUCTIONREGISTERDEPENDENCIES, which
...
adds instruction register usage info to the assembly output (only register
reads for now, but register writes will also be added later). Useful for
debugging InstructionLoadsFromReg and other similar functions.
git-svn-id: trunk@35967 -
2017-04-27 13:40:58 +00:00
florian
b274599a47
* made some assembler optimizer methods class methods
...
git-svn-id: trunk@33929 -
2016-06-06 21:18:20 +00:00
florian
d05222990e
* while updating used register sets, all labels can/must be skipped
...
git-svn-id: trunk@33909 -
2016-06-04 19:45:12 +00:00
florian
cfd49ec708
+ TAOptBase.SuperRegistersEqual
...
+ properly implemented TAOptObj.PrePeepHoleOpts
+ properly implemented TAOptObj.PeepHoleOptPass2
git-svn-id: trunk@33654 -
2016-05-05 12:38:19 +00:00
florian
3c2dab9878
* i386 peephole assembler uses largely the common peephole optimizer infrastructure, the resulting code is besides a few improvements the same
...
git-svn-id: trunk@33542 -
2016-04-21 20:14:01 +00:00
florian
1266491085
o refactored some peephole optimizer code:
...
* updated TAOptObj.RegUsedAfterInstruction with the arm implementation and removed the arm specific implementation
* RegLoadedWithNewValue and InstructionLoadsFromReg are now a methods of TAoptBase
* moved RegEndOfLife to TAOptObj
* during this refactoring, fixed also TCpuAsmOptimizer.RegLoadedWithNewValue for arm regarding post/preindexed
memory references: those modify the register but do not load it with a new value in the sense of RegLoadedWithNewValue
git-svn-id: trunk@33000 -
2016-01-24 15:25:16 +00:00
yury
5771073e0b
* Fixed general peephole optimization of conditional jumps after r30446. It has been broken, since r30446 had added some IsJumpToLabel() checks, which tests for unconditional jump, but the optimization code expects also conditional jumps.
...
- Renamed IsJumpToLabel() to IsJumpToLabelUncond() to avoid confusions.
- Added IsJumpToLabel() to check for any jump to a label.
- Added comments.
git-svn-id: trunk@32114 -
2015-10-21 15:35:54 +00:00
yury
11a9ff4a43
* Removed unused vars for mipsel compiler.
...
git-svn-id: trunk@31745 -
2015-09-17 15:46:30 +00:00
yury
432248cbf1
* Removed lot of unused vars.
...
git-svn-id: trunk@31732 -
2015-09-17 12:48:58 +00:00
Jonas Maebe
8c8657e2d5
* base optimiser support for the JVM target
...
o jump threading only works for unconditional branches until now,
as conditional ones have limited offsets
git-svn-id: trunk@31448 -
2015-08-29 10:08:19 +00:00
Jeppe Johansen
03880c2f74
Added some peephole optimizations, and fixed generic unconditional jump optimizations, for AVR.
...
Fixed multiplication code generation for AVR controllers without mul instructions.
Added handling of the old interrupt procedure directive such that procedures with that use RETI instead of RET.
git-svn-id: trunk@31030 -
2015-06-13 12:25:11 +00:00
florian
1114089d25
* IsJumpToLabel checks number of operands
...
* add a few safety checks
git-svn-id: trunk@30446 -
2015-04-05 19:24:22 +00:00
Jonas Maebe
620af1732a
* support for AArch64 branch forwarding
...
o don't forward cb(n)z, as we don't check the maxiumum offsets
o don't forward conditional branches to global labels, as they also have a
limited range and at least the OS X toolchain doesn't support this
git-svn-id: trunk@29929 -
2015-02-23 22:53:26 +00:00
sergei
0041024e5f
* Modified FindRegAlloc() to skip branch delay slots in the same way it is done in GetNextInstruction(). This fixes processing sequences "dealloc reg; branch reg,label; NOP; alloc reg" in BuildLabelTableAndFixRegAlloc(), deallocation is now correctly moved after branch. Before this change, the last allocation was ignored, and deallocation was moved forward until another instruction using reg was encountered.
...
git-svn-id: trunk@28891 -
2014-10-21 20:56:37 +00:00
florian
8060d4a3f7
* when updating registers in RegUsedAfterInstruction, new reg. allocs should be ignored
...
git-svn-id: trunk@27711 -
2014-05-01 19:20:32 +00:00
masta
81517fdf70
Rerun peephole optimizers on the whole block
...
Up until now if a peephole optimizer matched we've only restarted from
the current instruction. This patch restarts optimizations on the whole
block if the previous run had at least one match.
As this can take considerable time this will only be enabled if -O3 or
higher is specified.
git-svn-id: trunk@26640 -
2014-01-31 23:21:52 +00:00
florian
0eeb3e8d49
* check if the pointer is really assigned when trying to remove unneeded jumps
...
git-svn-id: trunk@25867 -
2013-10-27 16:47:34 +00:00
sergei
40239e8bcc
* Elaborating removal of branches with delay slots: ignore reg. deallocations that are inserted by RA between branch and its delay slot instruction.
...
* Also skip possible ait_marker's between branch and its immediately following target (which was preventing certain optimizations of "exit" statements on all targets because procedure's exit label is always preceded by location marker).
git-svn-id: trunk@25855 -
2013-10-26 17:45:01 +00:00
florian
2806947a8f
+ FindRegAllocBackward
...
* search reg. allocations backward in RemoveSuperfluousMove because the changed instruction could be the first one in a list
git-svn-id: trunk@25289 -
2013-08-18 18:56:56 +00:00
sergei
1c84c3edbf
* Fixed label optimizer to work with MIPS, and enabled level 1 optimization for MIPS targets.
...
The difference in branch instruction formats is isolated in function JumpTargetOp, it is a plain function rather than a virtual method, so it can be easily inlined and, after inlining, produces the same code for non-MIPS targets as it was before change.
git-svn-id: trunk@25033 -
2013-07-03 14:40:24 +00:00
sergei
a4217da7df
* Factored repeating code into separate procedure (IsJumpToLabel)
...
- Assigned(x) check before "x is y" is redundant because "is" operator does the same check.
git-svn-id: trunk@24901 -
2013-06-15 07:02:47 +00:00
florian
b6a4602989
* ignore alignment entries in FindLabel
...
git-svn-id: trunk@22306 -
2012-09-04 10:43:44 +00:00
florian
3e9baa3f47
* check also register type in FindRegalloc
...
git-svn-id: trunk@22195 -
2012-08-22 19:52:43 +00:00
florian
6e62fbc3d2
* more consistent updates of used registers
...
+ FindRegDeAlloc searching for a register deallocation
* FindRegAlloc now returns the allocation object which was found
git-svn-id: trunk@22191 -
2012-08-22 19:52:15 +00:00
florian
07e26cfb12
+ TUsedRegs.Update parameter IgnoreNewAllocs so new allocs of registers can be ignored during update
...
git-svn-id: trunk@22188 -
2012-08-22 19:51:54 +00:00
Jonas Maebe
d472a6d5d0
* changed tregset into tcpuregisterset so it's faster and uses less memory
...
git-svn-id: trunk@21717 -
2012-06-26 19:01:11 +00:00
florian
72746e635d
* optimize TAOptObj.UpdateUsedRegs to avoid multiple passes through the asmlist
...
git-svn-id: trunk@21513 -
2012-06-07 15:19:55 +00:00
florian
17dd362a5a
* white space
...
git-svn-id: trunk@21308 -
2012-05-15 18:08:52 +00:00
florian
2402e8e504
* fixes FindRegAlloc
...
+ GetAllocationString
* fix comment for lazarus
* change behaviour of UpdateUsedRegs in PeepHoleOptPass1
git-svn-id: trunk@21306 -
2012-05-15 18:07:52 +00:00
florian
748694a325
* fixes some issues with reg. allocation information
...
git-svn-id: trunk@21303 -
2012-05-15 18:06:41 +00:00
Jonas Maebe
7742dc0006
* don't remove ait_markers between unconditional jumps and the next label,
...
to prevent removing the start/end of assembler blocks, and the start/end
of nolineinfo blocks (solves the problem that with -O2 -al most of the
source lines were missing from classes.s)
git-svn-id: trunk@21113 -
2012-04-29 13:13:31 +00:00
florian
3c33bf4e6d
* completed framework for register usage tracking
...
git-svn-id: trunk@20891 -
2012-04-15 20:29:35 +00:00
florian
2a6a4831ea
* basics for generic register usage information
...
git-svn-id: trunk@20886 -
2012-04-15 14:20:47 +00:00
florian
39ab9eceba
* fix OpsEqual
...
git-svn-id: trunk@20875 -
2012-04-14 20:08:56 +00:00
florian
2f5ce095ce
* RefsHaveIndexReg -> cpurefshaveindexreg
...
* cpurefshaveindexreg defined properly in fpcdefs.inc
git-svn-id: trunk@20504 -
2012-03-10 19:43:52 +00:00
florian
4868b09844
* patch by alexvin to replace $ifopt by $push/$pop, resolves #20332
...
git-svn-id: trunk@19239 -
2011-09-25 21:19:50 +00:00
Jonas Maebe
4be36c4b2b
* fixed a number of missing label reference removals when deleting
...
instructions that reference them (patch by M.K., mantis #18858 )
git-svn-id: trunk@17067 -
2011-03-03 17:11:53 +00:00
Jonas Maebe
666b4e2469
* fixed range errors in label bookkeeping that caused too much memory to be
...
allocated for optimising jumps
git-svn-id: trunk@14470 -
2009-12-23 21:08:05 +00:00
florian
c71bc4084d
* fixed wrongly fix of r11444 in r12049
...
git-svn-id: trunk@12062 -
2008-11-12 20:55:06 +00:00
florian
74efea399e
* fix getlabelwithsym for 64 bit hosts and 32 bit targets
...
git-svn-id: trunk@12049 -
2008-11-11 19:10:11 +00:00
yury
bf454fad71
* Added function result for unimplemented methods to prevent warnings.
...
git-svn-id: trunk@11448 -
2008-07-23 11:47:03 +00:00
yury
451a290caf
* Fixed 'mixed signed/unsigned' and pointer conversion warnings.
...
git-svn-id: trunk@11444 -
2008-07-23 11:17:27 +00:00
yury
491f0fa1d8
* Replaced all user defined warnings by TODO comments to reduce compiler noise.
...
git-svn-id: trunk@11443 -
2008-07-23 11:00:03 +00:00
yury
6c6bf452ca
* Fixed level 2 comment warnings.
...
git-svn-id: trunk@11441 -
2008-07-23 10:08:48 +00:00
yury
fcceb9cfa1
* Removed/ifdefed/commented unused local variables.
...
git-svn-id: trunk@11430 -
2008-07-20 23:00:31 +00:00
Jonas Maebe
e4e6f8112d
* fixed some warnings about hidden constructors
...
git-svn-id: trunk@5784 -
2007-01-02 14:18:12 +00:00
florian
4010d66c2c
* arm cond. instruction support
...
git-svn-id: trunk@5387 -
2006-11-14 22:37:22 +00:00
Jonas Maebe
7528e074a5
* fixed compilation for non-ARM
...
git-svn-id: trunk@5380 -
2006-11-14 20:24:03 +00:00
florian
47010f2e5f
* properly optimize jumps on ARM
...
git-svn-id: trunk@5378 -
2006-11-14 19:40:32 +00:00
peter
658c46b903
* remove tdictionary and tindexarray
...
* symtables based on TFPHashObjectList and TFPObjectList
* rename torddef.typ to torddef.ordtype
* rename tfloatdef.typ to tfloatdef.floattype
* rename tdef.deftype to tdef.typ
* remove obsolete browser code, browcol is kept so the ide
can still be compiled
git-svn-id: trunk@5192 -
2006-11-03 00:30:30 +00:00
florian
85d63d9fa9
* settings refactored
...
git-svn-id: trunk@5094 -
2006-10-30 18:02:58 +00:00
peter
d07f470b71
* remove ifdef fpc
...
git-svn-id: trunk@4819 -
2006-10-07 13:43:34 +00:00
peter
b7fe6797bf
Merged revisions 2921-2922,2925 via svnmerge from
...
http://svn.freepascal.org/svn/fpc/branches/linker/compiler
........
r2921 | peter | 2006-03-15 08:35:00 +0100 (Wed, 15 Mar 2006) | 2 lines
* pass ObjectWriter to ObjectOuput
........
r2922 | peter | 2006-03-15 12:40:30 +0100 (Wed, 15 Mar 2006) | 2 lines
* refactor asmdata
........
r2925 | peter | 2006-03-15 16:09:39 +0100 (Wed, 15 Mar 2006) | 3 lines
* add cfi to asmdata
* move asmlist, asmcfi, asmdata to own unit
........
git-svn-id: trunk@2932 -
2006-03-16 08:52:22 +00:00
peter
b6e35a200e
* rewrite of optimizer options
...
git-svn-id: trunk@2901 -
2006-03-13 09:05:50 +00:00
Jonas Maebe
ab5f5ca15e
* fixed ppc compilation
...
git-svn-id: trunk@2778 -
2006-03-05 22:06:44 +00:00
Jonas Maebe
a9dbc0c8ab
* changed parameters of references_equal from value to const to
...
avoid copying
git-svn-id: trunk@2693 -
2006-02-26 15:02:06 +00:00
Jonas Maebe
db580afbff
* fixed refs bookkeeping of jump labels (fix from Florian in popt386)
...
git-svn-id: trunk@2225 -
2006-01-08 15:50:14 +00:00
Jonas Maebe
cd3f064a33
+ enabled postpeepholeopts phase
...
+ optimize "integer op" followed by comparison of target register with zero
to a variant of that integer op which sets the flags (ppc)
+ change rlwinm. instructions which do nothing but an "and" operation into
andi./andis., since the rlwinm. is cracked on the G5 while andi./andis.
isn't
git-svn-id: trunk@1361 -
2005-10-12 19:47:21 +00:00
Jonas Maebe
ab3bc45fa4
* cpu-specific overrides of optimizer methods now get called
...
+ first simple rlwinm optimization for ppc
git-svn-id: trunk@1320 -
2005-10-07 21:44:00 +00:00
peter
82faa95118
* lineinfo fixed for binary writer
...
* add tai_directive to replace old tai_direct calls
in powerpc
git-svn-id: trunk@1139 -
2005-09-19 11:47:30 +00:00
peter
a3ab2053c9
* support multiple asmlabel types, renamed getlabel to
...
getjumplabel and added type para to getlabel for specific types
* moved lineinfo generation from assemble and aggas to dbgstabs
git-svn-id: trunk@1120 -
2005-09-18 21:16:10 +00:00
Jonas Maebe
4c463a7a0a
* check unconditional jumps to make sure that they actually refer to a
...
tasmlabel instead of blindly assuming that they always do
git-svn-id: trunk@1080 -
2005-09-14 19:46:57 +00:00
fpc
790a4fe2d3
* log and id tags removed
...
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3
initial import
...
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
Jonas Maebe
ec959955bd
* fixed generic jumps optimizer and enabled it for ppc (the label table
...
was not being initialised -> getfinaldestination always failed, which
caused wrong optimizations in some cases)
* changed the inverse_cond into a function, because tasmcond is a record
on ppc
+ added a compare_conditions() function for the same reason
2005-02-26 01:26:59 +00:00
Jonas Maebe
04b1263e7f
* fixed uninitialised function result in getfinaldestination() when
...
maximum recursion reached
2005-02-25 20:50:53 +00:00
peter
e417e34496
* truncate log
2005-02-14 17:13:06 +00:00
florian
054f6bff3a
* fixed missing cgutils usage
2004-11-03 17:51:58 +00:00
peter
c95a859f0a
* generic tlocation
...
* move tlocation to cgutils
2004-10-31 21:45:02 +00:00
florian
e04b172854
* fixed generic optimizer
...
* enabled generic optimizer for sparc
2004-10-30 15:21:37 +00:00
florian
8a9758c5e2
* logs truncated
2004-06-20 08:55:28 +00:00
peter
1422985ca0
* Change several $ifdef i386 to x86
...
* Change several OS_32 to OS_INT/OS_ADDR
2004-01-31 17:45:16 +00:00
florian
35b8e93073
* fixed more alignment issues
2004-01-30 13:42:03 +00:00
peter
a496dbe1ff
* pass proccalloption to ret_in_xxx and push_xxx functions
2002-11-18 17:31:54 +00:00
florian
12ef4a944a
* fixed compilation error
2002-08-18 18:16:55 +00:00
florian
07783d2a0d
* powerpc target fixed, very simple units can be compiled
...
* some basic stuff for better callparanode handling, far from being finished
2002-07-07 09:52:32 +00:00
peter
4285e99853
* internal linker
...
* reorganized aasm layer
2002-07-01 18:46:20 +00:00