Commit Graph

124 Commits

Author SHA1 Message Date
florian
d2d1c30b53 * patch by Christo Crause, resolves #38961, fixes the following formatting and spelling problems in the AVR compiler files:
- Change spelling of AM_PREDRECEMENT to AM_PREDECREMENT
    - Fix multiline comment style to use {}
    - Fix indenting of code in method tcgavr.g_concatcopy

git-svn-id: trunk@49474 -
(cherry picked from commit aec49340a3)
2021-10-24 12:40:38 +02:00
florian
6a653c298c * patch by Christo Crause: do not generate LDD for avrtiny, resolves #38958
git-svn-id: trunk@49473 -
(cherry picked from commit 9d6ceda532)
2021-10-24 12:40:38 +02:00
florian
e168707f5b * patch by Christo Crause: handle references to absolute address 0 correctly, resolves #38861
git-svn-id: trunk@49344 -
(cherry picked from commit 5e1e6c24a4)
2021-10-24 12:40:38 +02:00
florian
af4eb12b43 * patch by Christo Crause to fix illegal ldd generation for avrtiny, resolves #37929
git-svn-id: trunk@47118 -
(cherry picked from commit fa54335938)
2021-10-24 12:40:38 +02:00
nickysn
34eb9ade91 * fix for OP_ROR in tcgavr.a_op_reg_reg_internal
git-svn-id: trunk@44749 -
(cherry picked from commit 599b7e80c0)
2021-10-24 12:40:37 +02:00
florian
32e17c5114 * for avr1, do not save registers during an interrupt procedure, as it has no memory to store them
git-svn-id: trunk@44139 -
(cherry picked from commit 2135b9b724)

# Conflicts:
#	compiler/msg/errore.msg
#	compiler/msgidx.inc
#	compiler/msgtxt.inc
2021-10-24 12:40:37 +02:00
florian
8d1eeea942 * actually, with lds/sts avrtiny can load addresses up to 191
git-svn-id: trunk@44104 -
(cherry picked from commit 640fe9c290)
2021-10-24 12:40:37 +02:00
florian
dd2212e1f7 * based on a patch by Christo Crause: more compiler fixes for avrtiny, resolves #36646
git-svn-id: trunk@44103 -
(cherry picked from commit 36058ca4d4)
2021-10-24 12:40:37 +02:00
florian
0dc7bfde42 * patch by Christo Crause: support for megaAVR 0 and tinyAVR 0/1, #36616, part 1/3
git-svn-id: trunk@44036 -
(cherry picked from commit 670c61e760)
2021-10-24 12:40:37 +02:00
florian
23d26d495f * AVR: attiny can do post increment operations, so remove code working around this
git-svn-id: trunk@43996 -
(cherry picked from commit 429130fa34)
2021-10-24 12:40:37 +02:00
florian
bee41253bd + AVR: initial support for the avrtiny architecture
git-svn-id: trunk@43987 -
(cherry picked from commit 2d9cdab264)
2021-10-24 12:40:37 +02:00
florian
4a73c31c82 * AVR: tcgavr.normalize_ref must always load the reference into tmpreg
git-svn-id: trunk@43986 -
(cherry picked from commit f629fa1bb9)
2021-10-24 12:40:37 +02:00
florian
a9bbcccb5d + AVR: GetDefaultZeroReg and GetDefaultTmpReg
git-svn-id: trunk@43985 -
(cherry picked from commit 26eae3672b)

# Conflicts:
#	compiler/avr/cpubase.pas
2021-10-24 12:40:37 +02:00
florian
3328f991c7 * AVR: fixes pushing and handling of stack passed parameters
git-svn-id: trunk@43983 -
(cherry picked from commit 96a4cda03b)
2021-10-24 12:40:37 +02:00
florian
b04f398d27 * avr: help the compiler with constant loading to avoid ie 200309041
git-svn-id: trunk@43350 -
(cherry picked from commit 701848889e)
2021-10-24 12:40:37 +02:00
florian
3b5dfbf79c * avr: more precise execution weigth for shift loops
git-svn-id: trunk@43349 -
(cherry picked from commit e8a48be3bc)
2021-10-24 12:40:37 +02:00
florian
b241fec17b * avr directly encodes constant shifts of 64 bit values
git-svn-id: trunk@43348 -
(cherry picked from commit f61207f1cc)
2021-10-24 12:40:37 +02:00
florian
63375effda * patch by Christo Crause: fix for r43136
git-svn-id: trunk@43169 -
(cherry picked from commit 5fc12500f2)
2021-10-24 12:40:36 +02:00
florian
8e68ea69cb * (modified/re-formatted) patch by Christo Crause: AVR: Optimizing code generation for shift with compile time constant
git-svn-id: trunk@43136 -
(cherry picked from commit dd2d1bf68b)
2021-10-24 12:40:36 +02:00
florian
bf85e51962 * AVR: patch by Christo Crause: fixes tcgavr.g_concatcopy for data with size>255, resolves #36066
git-svn-id: trunk@42977 -
(cherry picked from commit 4e93a9a6c7)
2021-10-24 12:40:36 +02:00
florian
97b0bda68d * fix tcgavr.g_flags2reg for sizes > 1 byte
git-svn-id: trunk@42938 -
(cherry picked from commit 9e5cbce6be)
2021-10-24 12:40:36 +02:00
Jeppe Johansen
d14e3e96a7 - Fix bug in software overflow checking for longint's.
- AVR: Fix overflow checking for HW multiplications

git-svn-id: trunk@42531 -
(cherry picked from commit 1b698d319f)
2021-10-24 12:40:36 +02:00
Jeppe Johansen
0c4d299514 AVR: Add support for using nostackframe in interrupt routines.
git-svn-id: trunk@42519 -
(cherry picked from commit f72342ed0e)
2021-10-24 12:40:36 +02:00
Jeppe Johansen
49ac4e0ed3 AVR: Add optimizations for sign testing, and a better Abs() implementation.
git-svn-id: trunk@42510 -
(cherry picked from commit 91016c97a4)
2021-10-24 12:40:36 +02:00
Jeppe Johansen
464aeb266e - Fix overflow checking for multiplication operations on AVR.
git-svn-id: trunk@42492 -
(cherry picked from commit 030cf78ac5)
2021-10-24 12:40:36 +02:00
Jeppe Johansen
3916bcba38 Check if the current register was the last in the cgpara, to avoid running over the last register allocated.
git-svn-id: trunk@42159 -
(cherry picked from commit 5bdc635f50)
2021-10-24 12:40:36 +02:00
florian
3d3e828151 * properly allocate parameter registers for constants on avr, resolves #33932
git-svn-id: trunk@40848 -
(cherry picked from commit 8fceba4493)
2021-10-24 12:40:36 +02:00
florian
7ac474341a * patch (slighly modified) by Christo Crause to write 16 bit registers on avr in hi/lo order, resolves #34721
git-svn-id: trunk@40678 -
(cherry picked from commit 917de001d6)
2021-10-24 12:40:36 +02:00
Jonas Maebe
3ac703506c * rest of the previous accidental partial commit
git-svn-id: branches/fixes_3_2@41250 -
2019-02-07 19:56:21 +00:00
Jonas Maebe
d69ad8fa41 * removed temppos field again from parameter locations: they're not allocated
by the temp manager of the current procedure

git-svn-id: trunk@38858 -
2018-04-27 19:18:55 +00:00
Jonas Maebe
4686f61002 * keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
    (e.g. in case of array indexing or record field accesses) (mantis #33628)

git-svn-id: trunk@38814 -
2018-04-22 17:03:16 +00:00
florian
ee252d0ecd + allocate real registers properly in tcgavr
git-svn-id: trunk@38490 -
2018-03-10 21:53:52 +00:00
florian
3a81ccf48b * simplify tcgavr.a_op_reg_reg_internal
git-svn-id: trunk@38484 -
2018-03-10 21:53:41 +00:00
florian
23722a2f95 * correctly negate 8 bit values on avr, resolves #33322
git-svn-id: trunk@38407 -
2018-03-04 16:28:52 +00:00
florian
311bcd4c08 * do not destroy flags while clearing R1, resolves #33170
git-svn-id: trunk@38241 -
2018-02-14 19:28:33 +00:00
florian
291ee4b562 * clear r1 (and save/restore) in interrupt routines on avr
+ generate no entry/exit code except ret for empty subroutines

git-svn-id: trunk@38233 -
2018-02-13 17:47:23 +00:00
florian
cb087279d6 * do not generate an andi if the constant is 255
git-svn-id: trunk@37608 -
2017-11-19 18:05:21 +00:00
florian
7817102727 * patch by Christo Crause to implement 8 bit multiplications for "mul-less" avr types, resolves issue #31925
git-svn-id: trunk@37380 -
2017-10-01 20:34:44 +00:00
florian
9ef646e3c5 * fix avr for new GetNextReg behaviour
* some wrong GetNextReg usage in the avr code generator fixed

git-svn-id: trunk@37316 -
2017-09-24 20:51:05 +00:00
nickysn
db09759763 * also integrated the getnextreg() implementation for 8-bit and 16-bit alus from
the avr and i8086 code generators into the base tcg class

git-svn-id: trunk@37182 -
2017-09-11 15:47:39 +00:00
nickysn
cf28b202eb * integrated the getintregister() implementation for 8-bit and 16-bit alus from
the avr and i8086 code generators into the base tcg class (so it can be reused
  by other 8-bit and 16-bit targets)

git-svn-id: trunk@37181 -
2017-09-11 15:23:59 +00:00
nickysn
ddba821561 * GetNextReg(), used by 16-bit and 8-bit code generators (i8086 and avr) moved
from cpubase unit to a method in the tcg class. The reason for doing that is
  that this is now a standard part of the 16-bit and 8-bit code generators and
  moving to the tcg class allows doing extra checks (not done yet, but for
  example, in the future, we can keep track of whether there was an extra
  register allocated with getintregister and halt with an internalerror in case
  GetNextReg() is called for registers, which weren't allocated as a part of a
  sequence, therefore catching a certain class of 8-bit and 16-bit code
  generator bugs at compile time, instead of generating wrong code).
- removed GetLastReg() from avr's cpubase unit, because it isn't used for
  anything. It might be added to the tcg class, in case it's ever needed, but
  for now I've left it out.
* GetOffsetReg() and GetOffsetReg64() were also moved to the tcg unit.

git-svn-id: trunk@37180 -
2017-09-11 14:53:06 +00:00
nickysn
3c96090d3c + optimized avr code generation for shr by shiftcount=size*8-1 and sar by
shiftcount>=size*8-1. This is commonly used by code, that extracts the sign
  bit and improves code generation for signed division by power-of-2 as well.
  This also fixes building avr-embedded (mantis #32241), which was caused by an
  infinite loop in the register allocator, when regvars are enabled, due to too
  much register pressure, when building charset.pp after r36842.

git-svn-id: trunk@36867 -
2017-08-09 15:53:06 +00:00
nickysn
5138d4e067 * fixed avr multiplication after r36344
git-svn-id: trunk@36369 -
2017-05-29 12:42:02 +00:00
florian
0954e09834 * correctly handle 16 bit signed operations on AVRs without mul instruction, resolves #31036
git-svn-id: trunk@35031 -
2016-12-01 21:01:47 +00:00
Jonas Maebe
a25ebbba3e + added volatility information to all memory references
o separate information for reading and writing, because e.g. in a
     try-block, only the writes to local variables and parameters are
     volatile (they have to be committed immediately in case the next
     instruction causes an exception)
   o for now, only references to absolute memory addresses are marked
     as volatile
   o the volatily information is (should be) properly maintained throughout
     all code generators for all archictures with this patch
   o no optimizers or other compiler infrastructure uses the volatility
     information yet
   o this functionality is not (yet) exposed at the language level, it
     is only for internal code generator use right now

git-svn-id: trunk@34996 -
2016-11-27 18:17:37 +00:00
florian
0882c13cb7 * do not move dest to a new register if not needed in tcgavr.g_concatcopy
git-svn-id: trunk@34935 -
2016-11-20 16:07:53 +00:00
Jonas Maebe
0afbe85aab * various memory reference alignment fixes
git-svn-id: trunk@34544 -
2016-09-20 21:43:19 +00:00
Jonas Maebe
aa1be3276f - removed default value of _typ parameter of TAsmData.(Weak)RefAsmSymbol():
it was AT_NONE, which is invalid and should never be used
  * explicitly pass the correct value for all calls to those methods elsewhere
    in the compiler

git-svn-id: trunk@34250 -
2016-08-05 07:09:16 +00:00
Jeppe Johansen
159c28eca8 Fix AVR comparison with zero.
git-svn-id: trunk@32589 -
2015-12-05 15:25:33 +00:00