Commit Graph

149 Commits

Author SHA1 Message Date
florian
fd72ed8c56 * applied fix for #41161 as proposed by Pierre 2025-02-26 22:40:26 +01:00
florian
9355e703d7 * change some getglobaldatalabel into getlocaldatalabel to simplify code if pic is used 2025-01-13 22:34:31 +01:00
florian
a285500d36 * patch by Rike: Use reverse_longword instead of manually reversing longword, resolves #39720 2022-05-13 22:38:03 +02:00
florian
6d75992674 * fix proposed by Christo Crause: properly handle pointer constant nodes on avr, resolves #38321
git-svn-id: trunk@48095 -
2021-01-06 12:52:36 +00:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +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
04d295f186 * first step towards supporting 32 bit targets with the LLVM code generator:
use the generic code in more cases when cpuhighleveltarget is defined

git-svn-id: trunk@41133 -
2019-01-29 21:39:09 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
Jonas Maebe
1afab1ab69 * moved the floating point constant range checking code from
pass_generate_code to pass_typecheck, so that it's also used by targets
    that override pass_generate_code (fixes webtbs/tw16315b for LLVM)

git-svn-id: trunk@35021 -
2016-11-29 21:54:33 +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
Jonas Maebe
9727f289b1 + tcalo_apply_constalign option to specify that the alignment should be
modified by applying user alignment settings (so it can be only done for
    user-defined data, not not for internally generated data)
   o set this option for user-defined data

git-svn-id: trunk@34633 -
2016-10-06 06:25:05 +00:00
Jonas Maebe
974c2363c0 - removed tdataconstnode, as it is no longer used and is not type safe.
Use a typed constant builder instead.

git-svn-id: trunk@34155 -
2016-07-19 14:30:42 +00:00
Jonas Maebe
aef6120438 * fixed shortstring constant emission after r28210: the terminating #0
was no longer included, so things went wrong if the string was reused
    for a pchar

git-svn-id: trunk@32738 -
2015-12-26 20:01:06 +00:00
Jonas Maebe
ccf1c67665 * converted large set constant emission to high level typed const builder
git-svn-id: trunk@32206 -
2015-10-30 20:45:11 +00:00
yury
432248cbf1 * Removed lot of unused vars.
git-svn-id: trunk@31732 -
2015-09-17 12:48:58 +00:00
Jonas Maebe
36e5291d94 * converted tcgguidconstnode.pass_generate_code to use the high level typed
constant builder

git-svn-id: trunk@31188 -
2015-07-03 20:04:18 +00:00
Jonas Maebe
f40ea04540 * changed getarraydef() into a tarraydef.getreusable() class method
git-svn-id: trunk@31147 -
2015-06-23 21:23:18 +00:00
Jonas Maebe
ce49f5fb41 * fixed memory leak due to double allocation of typedconstbuilder and wrong
free location

git-svn-id: trunk@30853 -
2015-05-14 14:42:32 +00:00
florian
6797685c86 * write set constants only as large as needed by taking care of resultdef.size, resolves issue #27886
git-svn-id: trunk@30655 -
2015-04-18 19:32:49 +00:00
Jonas Maebe
419a97cce8 * changed emit_ansistring_const() and emit_unicodestring_const() into
instance methods that make use of the internal data builder
    functionality so they automatically place all string data in the
    same section if possible

git-svn-id: branches/hlcgllvm@30342 -
2015-03-27 21:25:53 +00:00
Jonas Maebe
687bb15299 * renamed getdatalabel() to getglobaldatalabel
git-svn-id: branches/hlcgllvm@30336 -
2015-03-27 21:25:34 +00:00
Jonas Maebe
5e1bb8e408 + tcalo_make_dead_strippable to indicate that a typed constant data block
should be dead-strippable; may imply the creation of a separate section
    (on platforms that dead-strip data based on sections), but does not
    require it
  * replaced all existing tcalo_new_section uses with
    tcalo_make_dead_strippable, as that is their meaning/purpose

git-svn-id: branches/hlcgllvm@30335 -
2015-03-27 21:25:30 +00:00
Jonas Maebe
e924dbed90 * moved the specification of the options for a ttai_typedconstbuilder from
get_final_asmlist() to the constructor, in preparation of supporting the
    creation of internal builders for local data that will ignore some of the
    irrelevant flags (at creation time)

git-svn-id: branches/hlcgllvm@30334 -
2015-03-27 21:25:27 +00:00
Jonas Maebe
5a9b931e5c * renamed ttai_lowleveltypedconstbuilder to ttai_typedconstbuilder
git-svn-id: branches/hlcgllvm@28764 -
2014-10-06 20:53:49 +00:00
Jonas Maebe
210b532832 * split up specifying the type of the section of a typed constant and whether
it should be put in a new section

git-svn-id: branches/hlcgllvm@28753 -
2014-10-06 20:53:20 +00:00
Jonas Maebe
5c75b6dd6b * synchronised with trunk up till r28402
git-svn-id: branches/hlcgllvm@28403 -
2014-08-13 16:04:30 +00:00
sergei
f1d1fd4f24 * Inserted explicit typecasts in order to prevent range check errors at some places where signed and unsigned types are assigned to each other (mostly MIPS-specific, but one was necessary in generic code).
git-svn-id: trunk@28379 -
2014-08-10 21:26:14 +00:00
Jonas Maebe
9e074d036b * migrated the handling of ansi/unicodestring constants to the high level
typed constant builder + llvm implementation

git-svn-id: branches/hlcgllvm@28327 -
2014-08-06 18:04:40 +00:00
Jonas Maebe
ea9fbe381e * converted the generation of cst_conststring and cst_shortstring string
constants to the typed constant builder

git-svn-id: branches/hlcgllvm@28210 -
2014-07-12 22:42:26 +00:00
Jonas Maebe
8afffdb176 * moved get_string_symofs() to a virtual class method of
ttai_typedconstbuilder so that it can be overridden by other platforms
  * override get_string_symofs() for LLVM and always return 0, as you can't
    have labels in the middle of a declaration on that platform

git-svn-id: branches/hlcgllvm@28140 -
2014-07-03 22:28:21 +00:00
Jonas Maebe
b0ff41406a * grouped all tai_real* types into a single tai_realconst type,
to free up space for more ait_* types in taitype (can't have
    more than 32 because they have to fit in a small set)
   o factored out writing of floating point numbers as an array of
     byte in the external assemblers

git-svn-id: branches/hlcgllvm@28105 -
2014-07-01 16:29:58 +00:00
nickysn
8b2cde4a99 * fixed tcgstringconstnode.pass_generate_code for i8086 far data memory models
by using the high level code generator

git-svn-id: trunk@27325 -
2014-03-28 22:34:30 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
nickysn
a308994423 * i8086 specific code from tcgpointerconstnode.pass_generate_code moved to an i8086 specific overriden method
git-svn-id: trunk@24577 -
2013-05-24 17:16:55 +00:00
nickysn
0baa004571 * i8086 far pointer fix in tcgpointerconstnode.pass_generate_code; this finally fixes ptr(constseg,constofs)
git-svn-id: trunk@24568 -
2013-05-24 13:08:31 +00:00
florian
9375529430 + put guids in a constant pool as well
git-svn-id: trunk@24061 -
2013-03-29 18:48:55 +00:00
florian
1eeeb309c7 * intial armv6m support, it is not working yet, constant pool insertation and conditional branch fixup is not working yet
git-svn-id: trunk@23682 -
2013-03-03 12:20:10 +00:00
sergei
afd34cf9d5 * Changed section for ansi/wide/unicodestring constants, resourcestrings (content only) and dataconstnodes from sec_rodata to sec_rodata_norel, because they never contain relocations.
git-svn-id: trunk@23017 -
2012-11-18 17:00:18 +00:00
pierre
bc0c94c204 fpcdefs.inc: Set fpc_compiler_has_fixup_jmps for powerpcXX and mips CPUs.
psub.pas: Use new fpc_compiler_has_fixup_jmps conditional.
 mips/aasmcpu.pas: MIPS specific fixup_jmps function,
   The insttruction distance calculation is not exact as
   some pseudo-instruction can be expanded to a variable number of real instructions
   real calculation would only be possible if we first 
   convert pseudo-instuctions to real instructions before calling fixup_jmps.

 ncgutil.pas: Revert commit r21791
 ncgcon.pas: Revert commit r21786
 mips/cgcpu.pas: Partial revert of commit r21798, no need to always use A_J,
 as fixup_jmps now handles out of range branches.

git-svn-id: trunk@21822 -
2012-07-09 08:59:13 +00:00
pierre
3acc0e6686 Add needs_got_for_pic, set global_used to that procedure
git-svn-id: trunk@21786 -
2012-07-04 16:38:19 +00:00
Jonas Maebe
8282d6e37a * do not create a global symbol in the middle of ansi/unicodestring
constants on Darwin, because its linker uses global symbols as delimiters
    of subsections for dead code stripping. This was previously solved by
    never making any ansistring constants smart linkable, which is now
    solved

git-svn-id: trunk@21328 -
2012-05-19 10:19:35 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
sergei
c56ef119a1 * tcgguidconstnode: create a new object section before emitting data, otherwise data ends up in arbitrary section, causing e.g. IE 200602289 if it happens to be .bss.
git-svn-id: trunk@19640 -
2011-11-16 02:21:10 +00:00
paul
c6ca9e5091 compiler:
- add helper function getansistringcodepage which returns explicitly set codepage or 0 in other case
  - add helper function getansistringdef which return a def with explicitly set codepage or cansistringtype in other case
  - change tstoreddef.createnai constructor to allow set codepage in constructor
  - don't convert string constants to rawbytestring. if string constant already has a codepage - preserve it or convert to ansistring codepage (delphi compatible)
  - don't perform string conversion from ansistring to strings with explicitly set codepage (by directive or by compiler switch) and vice versa (delphi compatible)
  + test which covers most of the cases

git-svn-id: trunk@19510 -
2011-10-19 02:45:52 +00:00
paul
21ac5dfb3b compiler: output ansistring constants in explicit codepage if codepage is explicitly defined using either $codepage directive or compiler switch or for SystemCodepage modeswitch
git-svn-id: trunk@19462 -
2011-10-11 08:58:56 +00:00
paul
b1b0b2bb1f compiler: move ansistring codepage number replacement code from the asm generator to one level up. output both 0 and CP_NONE ansistring constants as constants with codepage 0. codepage 0 means CP_ACP and it will be properly understood of RTL routines while codepage CP_NONE means no codepage. For delphi unicode mode output them in compiler codepage as before.
git-svn-id: trunk@19459 -
2011-10-11 07:22:49 +00:00
paul
4cf5e36ce7 compiler:
- add TTagHashSet class descendant of THashSet with an ability to has also a LongWord value together with key
  - change TAsmData.ConstPools[] to be an indexed property to properly initialize ConstPool class, remove pool initialization from all other units
  - add ansistring constants to pool together with their encoding to distinct the same text constants with different codepage
  + test

git-svn-id: trunk@19261 -
2011-09-28 01:18:43 +00:00
paul
aba0106366 compiler: manual merge some cpstrnew changes which was impossible to merge using regular tools due to the merge conflicts
git-svn-id: trunk@19131 -
2011-09-17 15:36:56 +00:00
Jonas Maebe
37aa2d8443 + full support for sets on the JVM target
o sets of enums are handled as JUEnumSet instances, others as JUBitSet
     derivatives (both smallsets and varsets, to make interoperability with
     Java easier)
   o special handling of set constants: these have to be constructed at run
     time. In case of constants in the code, create an internal constsym to
     represent them. These and regular constsyms are then aliased by an
     another internal staticvarsym that is used to initialise them in the
     unit initialisation code.
   o until they are constructed at run time, set constants are encoded as
     constant Java strings (with the characters containing the set bits)
   o hlcgobj conversion of tcginnode.pass_generate_code() for the genjumps
     part (that's the only part of the generic code that's used by the JVM
     target)
   o as far as explicit typecasting support is concerned, currently the
     following ones are supported (both from/to setdefs): ordinal types,
     enums, any other set types (whose size is the same on native targets)
   o enum setdefs also emit signatures
   o overloading routines for different ordinal set types, or for different
     enum set types, is not supported on the JVM target

git-svn-id: branches/jvmbackend@18662 -
2011-08-20 08:22:22 +00:00
Jonas Maebe
d1a1d30e04 * unless compiled with -dnounsupported, the compiler will now accept not
only JVM constructs that are already implemented, but also ones that
    will be supported in the future but that aren't implemented yet (to
    make it easier to already adapt code to the future changes)

git-svn-id: branches/jvmbackend@18498 -
2011-08-20 08:04:51 +00:00