Commit Graph

19075 Commits

Author SHA1 Message Date
svenbarth
25744dd3f1 Fix for Mantis #29609.
pexpr.pas, factor.factor_read_id:
  * don't use a cloadvmtaddrnode for accessing class properties in records

+ added test

git-svn-id: trunk@33110 -
2016-02-19 21:37:02 +00:00
svenbarth
1945bf64b4 Merged revision(s) 32302-32305, 32310 from branches/svenbarth/packages:
+ new stream class TCRangeStream that represents a substream of another stream while being also extendable
........
Extend tentryfile so that it can be opened from a stream in addition to a file

entfile.pas, tentryfile:
  + new method openstream() to open a readable tentryfile based on a stream
  + new method createstream() to open a writeable tentryfile based on a stream
  * adjust openfile() to use openstream()
  * adjust createfile() to use createstream()
........
A few extensions for tentryfile needed for package files

entfile.pas, tentryfile:
  + new property position to retrieve/control the position of the underlying stream (works also with tempclose()/tempopen())
  + new method substream() to retrieve a stream that goes from the specified offset with the specified length (-1 create a stream that is extendable, aka for writing)
  + new property stream to get the underlying stream directly; be careful when using this!
........
Extend tppumodule so that it can be opened from a stream as well.

fppu.pas, tppumodule:
  * rename openppu() to openppufile()
  + new method openppustream() to open a module based on a stream
  + put the common part of openppufile() and openppustream() into a new method openppu()
........
Fix compilation.

fppu.pas, tppumodule:
  * openppu: add parameter ppufiletime for printing the time of the file (only if filetime is not -1)
  * openppufile: pass the retrieve time of the PPU to openppu()
  * openppustream: pass -1 to openppu()
........

git-svn-id: trunk@33109 -
2016-02-19 17:13:58 +00:00
svenbarth
8152d1185c Only write the IIDStr for Corba interfaces (it's completely redundant for COM ones)
ncgrtti.pas, TRTTIWriter.write_rtti_data.objectdef_rtti.objectdef_rtti_interface_full:
  * only set the ifHasStrGUID flag for Corba interfaces and if the IIDStr is not '' (which it is by default)
  * only write the IIDStr for Corba interfaces

git-svn-id: trunk@33105 -
2016-02-19 15:22:46 +00:00
Jeppe Johansen
1c0c944311 Added x86_64-embedded target. Patch from Benjamin Rosseaux
git-svn-id: trunk@33097 -
2016-02-14 10:57:00 +00:00
sergei
41751bc5b4 + Next portion of MIPS peephole optimizations. Get more aggressive and do more than a single pass if needed, enabling optimization of instructions that logically turn into MOVE due to register renaming.
git-svn-id: trunk@33095 -
2016-02-13 12:33:30 +00:00
sergei
e8f2f42b75 * Reverted r29373 and replaced it with more appropriate fix.
git-svn-id: trunk@33093 -
2016-02-13 11:09:31 +00:00
sergei
e23ed15634 * MIPS: reworked and fixed procedure fixup_jmps:
* support conditional branches with 2 parameters
  * factored out common parts
  * adjusted range limits, they were copy-pasted from PowerPC target which uses 14-bit offsets. MIPS however uses 16-bit offsets, i.e. can branch 4 times farther.

git-svn-id: trunk@33088 -
2016-02-12 13:53:04 +00:00
sergei
ed2488eb03 - MIPS: removed the ugly hack of splitting LDC1/SDC1 instructions into pairs of LWC1/SWC1 at assembler writer level. It probably was there as a workaround for insufficient alignment of double-precision variables, which was present once, but fixed a long time ago.
git-svn-id: trunk@33084 -
2016-02-11 15:09:19 +00:00
sergei
7f58608008 * MIPS: changed function is_macro_instruction into method of taicpu. Functionality unchanged.
git-svn-id: trunk@33081 -
2016-02-10 12:46:55 +00:00
sergei
55492a0f30 * Don't do useless string case conversions in a loop.
git-svn-id: trunk@33077 -
2016-02-10 02:10:23 +00:00
sergei
2861362780 * Reuse binary search routine from rgbase.pas to look up AT&T register names, removes need in regnumber_count_bsstart constant. Resolves #29471.
git-svn-id: trunk@33076 -
2016-02-09 16:48:32 +00:00
marcus
fc2069eca8 - Removed the string for tai_labeled_instruction, repairs m68k building after revision 33074
git-svn-id: trunk@33075 -
2016-02-09 08:08:18 +00:00
sergei
36043d13ae - Removed remains of tai_labeled_instruction, already commented out probably in 1.0 times.
git-svn-id: trunk@33074 -
2016-02-09 02:25:27 +00:00
sergei
4fc05e6ec1 - MIPS: removed taicpu.delayslot_annulled, it was a copy-paste from SPARC code.
git-svn-id: trunk@33073 -
2016-02-09 01:32:42 +00:00
florian
ddad3b3166 * allow very small heaps for avr
git-svn-id: trunk@33071 -
2016-02-07 18:28:13 +00:00
florian
fd61d65313 * handle controller type already in the first options pass_1
* set heapsize for the avrsim controller target to a reasonable size

git-svn-id: trunk@33068 -
2016-02-07 11:24:47 +00:00
florian
56b6cedcf4 * increase ram size of the avrsim controller target
git-svn-id: trunk@33066 -
2016-02-07 11:17:55 +00:00
svenbarth
dea4ac557d Fix for Mantis #28100.
symdef.pas, tstoreddef:
  * deref: don't free the deref list and it's entries as deref() might be called again when the unit reloaded a second time

git-svn-id: trunk@33054 -
2016-02-05 19:04:38 +00:00
Tomas Hajny
6a8caf84b2 * -Mdelphiunicode added to the help pages
git-svn-id: trunk@33053 -
2016-02-05 15:31:38 +00:00
florian
aa0ec8c0e5 + show -Mextendedpascal in the help page
git-svn-id: trunk@33051 -
2016-02-04 20:32:09 +00:00
florian
368d77dfae + show -Miso in the help page
git-svn-id: trunk@33050 -
2016-02-04 20:22:36 +00:00
svenbarth
8287773b16 Reverted revision 33036. This feature is too controverse to be left in.
git-svn-id: trunk@33048 -
2016-02-04 19:26:51 +00:00
Jeppe Johansen
e20f2111b7 Check for nil before doing loopunrolling.
git-svn-id: trunk@33047 -
2016-02-04 15:53:36 +00:00
svenbarth
05174f3e67 Fix for Mantis #29546.
htypechk.pas, tcallcandidates:
  * create_candidate_list: don't check whether the pd is a specialization if the owner is valid; happens if a generic method is used more than once (which should happen here and then :P )

+ added test

git-svn-id: trunk@33037 -
2016-01-31 17:14:44 +00:00
svenbarth
ed94ca4b24 Add support for IfThen() instrinsic that works like the if-statement in that it evaluates only the expression that is indeed executed.
The result type of the intrinsic is determined by the Then-expression to provide a bit of control. There might however be some situations in which this fails, for this exceptions need to be added (e.g. a constant string needs to be converted to a normal string).

compinnr.inc:
  + add new constant in_ifthen_x_y_z for the IfThen() intrinsic
psystem.pas: 
  + create_intern_symbols: add symbol for IfThen() intrinsic
pexpr.pas:
  * statement_syssym: parse parameters of IfThen() intrinsic and return corresponding inline node
ninl.pas, tinlinenode:
  + new method handle_ifthen() which converts the inline node to an if-node which assigns the expressions to a temp node that is returned
  * pass_typecheck: handle in_ifthen_x_y_z using handle_ifthen()
  * pass_1: in_ifthen_x_y_z does not need a first pass as it's already converted after the typecheck pass

+ added tests

git-svn-id: trunk@33036 -
2016-01-31 14:29:12 +00:00
pierre
d081d9fdc0 Fix cycle for x86_64-win64 target with -Cr option
git-svn-id: trunk@33014 -
2016-01-28 15:07:40 +00:00
pierre
1e5883b6d1 Avoid overflow error for single MinValue in rtl syshelph.inc for x86_64 CPU
git-svn-id: trunk@33012 -
2016-01-28 14:20:51 +00:00
pierre
f9011289b5 * Fix default OS target for i386 and sparc processor on solaris OS
git-svn-id: trunk@33010 -
2016-01-27 15:32:55 +00:00
nickysn
c2b0256869 - don't define 'CPU8086' on the i8086 target, because it clashes with the
selected instruction set define (CPU8086/CPU80186/CPU80286, etc.)
  For a generic i8086 target define, 'CPUI8086' should be used instead of
  'CPU8086'.

git-svn-id: trunk@33006 -
2016-01-26 00:33:02 +00:00
florian
8b4a392863 * compilation fixed
git-svn-id: trunk@33003 -
2016-01-24 16:52:49 +00:00
florian
5aabe71aee * better throw an internalerror in TAoptBase.RegLoadedWithNewValue instead of trying to make a safe approximation
git-svn-id: trunk@33002 -
2016-01-24 16:24:45 +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
svenbarth
d2a7f17d8c Fix for Mantis #29372.
compiler/ncgcal.pas:
  * tchcallnode.release_para_temps: don't release temps of a constructor's self parameter

+ added test

git-svn-id: trunk@32990 -
2016-01-23 22:19:00 +00:00
svenbarth
0aca2357ac Merged revision(s) 29037 from branches/svenbarth/packages:
Fix a potential access violation when exporting symbols on a Unix based system.

expunix.pas, texportlibunix:
  * generatelib: check whether hp2.sym is really assigned before accessing it

........

git-svn-id: trunk@32983 -
2016-01-22 17:02:40 +00:00
svenbarth
557f74cdbd (Note to self: always include the root of the working copy in the commit when dealing with merges -.-)
Merged revision(s) 28793, 28903, 31951 from branches/svenbarth/packages:
psub.pas, read_proc:
  * don't generate assembler symbols for compiler internal code
........
Ensure that unneeded initialization/finalization procedures don't leave assembler symbols.

ncgutil.pas:
  + new function release_proc_symbol which removes all assembler symbols of a procdef
pmodules.pas, proc_unit:
  * if the initialization or finalization procedure is empty also remove their assembler symbols so they are exported
........
Ensure that readonly sections that need relocations are indeed declared as such.
Thanks to Jonas for this.

ncgvmt.pas, TVMTWriter:
  * writeinterfaceids: use sec_rodata instead of sec_rodata_norel

........

git-svn-id: trunk@32982 -
2016-01-22 16:58:33 +00:00
svenbarth
9d5f98eaa3 Merged revision(s) 28690 from branches/svenbarth/packages:
Extract reading of the PPU/PCP version into tentryfile.

entfile.pas:
  + add new getversion method which uses the pointer returned by getheaderaddr to read the PPU/PCP version
ppu.pas:
  - remove GetPPUVersion method
fppu.pas, pmodules.pas, utils/ppufiles.pp, utils/ppumove.pp, utils/ppuutils/ppudump.pp
  * replace call to GetPPUVersion by call to getversion
........

git-svn-id: trunk@32980 -
2016-01-22 15:47:29 +00:00
svenbarth
678716be22 msgidx.inc & msgtixt.inc: regenerate after r32978
git-svn-id: trunk@32979 -
2016-01-22 15:36:13 +00:00
svenbarth
e9d8fadb58 Merged revision(s) 28237 from branches/svenbarth/packages:
Add a new target flag which determines whether the target supports dynamic packages or not.

systems.pas:
  + new flag tf_supports_packages
pmodules.pas, proc_package:
  * error out when flag tf_supports_packages is not set for the current target
msg/errore.msg:
  + error message for when tf_supports_packages is missing and a package file is compiled
........

git-svn-id: trunk@32978 -
2016-01-22 15:35:41 +00:00
svenbarth
01af8f9cc4 Merged revision(s) 28693 from branches/svenbarth/packages:
Provide possibility to register callbacks that are called from InitGlobals and DoneGlobals.

globals.pas:
  + new function register_initdone_proc which allows to register a callback for InitGlobals and DoneGlobals respectively
  + add functions callinitprocs, calldoneprocs, allocinitdoneprocs, freeinitdoneprocs to manage and access the init/done-callbacks
  * InitGlobals: call callinitprocs
  * DoneGlobals: call calldoneprocs 
........

git-svn-id: trunk@32977 -
2016-01-22 15:28:30 +00:00
svenbarth
02e56f410d Merged revision(s) 28689 from branches/svenbarth/packages:
Extract functionality that is shared between the metadata files for units (PPU) and for packages (PCP) into a parent class called tentryfile

+ add new unit entfile which contains the new tentryfile class and related types and constants
* ppu.pas:
    - remove methods, fields, types and constants which were moved to entfile.pas
    * replace the parts of tppuheader shared with tentryheader by a field of type tentryheader
fppu.pas, pmodules.pas, utils/ppumove.pp, utils/ppuutils/ppudump.pp:
    + add entfile to uses
    * adjust access to common header fields
node.pas, symdef.pas, symsym.pas, symtable.pas, wpoinfo.pas, utils/ppufiles.pp:
    + add entfile to uses
........

git-svn-id: trunk@32976 -
2016-01-22 15:26:30 +00:00
svenbarth
716b3082e9 Merged revision(s) 28792 from branches/svenbarth/packages:
Provide a possibility to ignore duplicate symbols for exporting.

export.pas, texportlib:
  + new property "ignoreduplicates" with which duplicate symbols are ignored upon insertion
  + new method "duplicatesymbol" which checks "ignoreduplicates" and generates an error if it is False (this method needs to be used if a duplicate was detected)
expunix.pas, texportlibunix:
  * exportprocedure: use "duplicatesymbol" instead of always generating an error
systems/t_beos.pas, texportlibbeos:
  * exportprocedure: use "duplicatesymbol" instead of always generating an error
systems/t_haiku.pas, texportlibhaiku:
  * exportprocedure: use "duplicatesymbol" instead of always generating an error
systems/t_nwl.pas, texportlibnetwlibc:
  * exportprocedure: use "duplicatesymbol" instead of always generating an error
systems/t_nwm.pas, texportlibnetware:
  * exportprocedure: use "duplicatesymbol" instead of always generating an error
systems/t_win.pas, texportlibwin:
  * exportfromlist: use "duplicatesymbol" instead of always generating an error
........

git-svn-id: trunk@32974 -
2016-01-22 13:57:41 +00:00
sergei
1aec09f8cd * MIPS asm reader: parse dollar sign followed by identifier/number as a single token (register), not as two separate tokens.
git-svn-id: trunk@32971 -
2016-01-21 14:57:24 +00:00
Jonas Maebe
a65ab73e8b * support unicodestring constants in "case string of" (mantis #29353)
git-svn-id: trunk@32970 -
2016-01-20 21:11:26 +00:00
Jonas Maebe
9ace5ad038 * let is_conststringnode() and is_constwidestringnode() also recognise string
constants that have a stringdef as resultdef

git-svn-id: trunk@32969 -
2016-01-20 21:11:22 +00:00
Jonas Maebe
53052f26a0 * changed output parameter of process_ea_ref() from "out" to "var", as it is
already partially initialised by its caller (part of mantis #29439)

git-svn-id: trunk@32968 -
2016-01-18 22:20:26 +00:00
Jonas Maebe
e4c8a2776b - removed empty "protected type" section
git-svn-id: trunk@32966 -
2016-01-18 22:20:05 +00:00
Károly Balogh
4e14c292b0 fixed a the check for pd.owner being assigned before defererencing it. this fixes a reproduceable compiler crash I ran into recently
git-svn-id: trunk@32965 -
2016-01-18 12:42:24 +00:00
Jeppe Johansen
017d58748f Use thumb_func flag to detect selected arm/thumb mode.
git-svn-id: trunk@32958 -
2016-01-16 11:24:38 +00:00
svenbarth
3b71841a84 Merged revision(s) 28691, 31914 from branches/svenbarth/packages:
Convert export options from constants to a set and accordingly adjust all usage locations

git-svn-id: trunk@32945 -
2016-01-15 16:06:06 +00:00
nickysn
439ab331e9 * factored out some of the duplicated (between x86 targets) parts of process_ea() to a common function
git-svn-id: trunk@32940 -
2016-01-14 18:00:37 +00:00
nickysn
db5e67c3fe + introduced a new type TRelocDataInt for use as the 'data' parameter for
TObjData.writeReloc; on i8086 it was changed to longint to allow using 32-bit
  relocations
+ added support for writing 32-bit OMF relocations

git-svn-id: trunk@32936 -
2016-01-13 17:57:36 +00:00
nickysn
4f8baf29c6 + handle RELOC_FARPTR48 relocations as well in TOmfObjData.writeReloc; this is
not used yet, but is added for completeness (and might be useful, if we add an
  i386 target, that uses the OMF object format)

git-svn-id: trunk@32935 -
2016-01-13 15:07:41 +00:00
nickysn
e628729e1d + support 48-bit (16:32) far pointer relocations in the OMF internal linker
git-svn-id: trunk@32928 -
2016-01-11 17:50:27 +00:00
nickysn
02a6b77e32 + added support for 32-bit offset OMF relocations (fltOffset32) in the OMF internal linker
git-svn-id: trunk@32927 -
2016-01-11 17:34:56 +00:00
nickysn
d4c21cf13a * also check for 386+ when emitting a reference with a fs: or gs: prefix
git-svn-id: trunk@32926 -
2016-01-11 16:30:06 +00:00
nickysn
80b3e3020a * the SEGFS and SEGGS prefixes are 386+
git-svn-id: trunk@32925 -
2016-01-11 15:51:40 +00:00
nickysn
c8e20dfe74 + added i8086-specific consts RELOC_ABSOLUTE16 and RELOC_RELATIVE16, which are
aliases for RELOC_ABSOLUTE and RELOC_RELATIVE
* use RELOC_ABSOLUTE16 and RELOC_RELATIVE16, instead of RELOC_ABSOLUTE and
  RELOC_RELATIVE in the linker-related parts of the OMF support (OMF object
  reader and MZ exe output). This will make the code more readable, when 32-bit
  relocation support is added to the linker. It will also make easier to reuse
  this code for i386, in case we add an i386 target, that uses the OMF object
  format.

git-svn-id: trunk@32923 -
2016-01-11 15:24:34 +00:00
pierre
40193ea1db Add pi_has_open_array_parameter to proc_info.flags as this requires special handling for i8086 huge memory model to restore DS register correctly
git-svn-id: trunk@32922 -
2016-01-11 15:02:10 +00:00
nickysn
741a3eedf9 * fixed the cpu level of several 186+ instructions, that were mistakenly marked as either 286+ or 8086+
git-svn-id: trunk@32921 -
2016-01-11 13:22:08 +00:00
Jonas Maebe
b9231aa6f1 * converted objcgutl (Objective-C metadata generation) to the high level
typed const builder

git-svn-id: trunk@32917 -
2016-01-10 17:22:20 +00:00
Jonas Maebe
4aba875c34 * add llvm "weak" flag for tcalo_weak
git-svn-id: trunk@32916 -
2016-01-10 17:22:17 +00:00
Jonas Maebe
e3f8f8c974 * fixed position of "weak" linkage flag
git-svn-id: trunk@32915 -
2016-01-10 17:22:14 +00:00
Jonas Maebe
90071e04c4 * encode objc classrefdefs as objc_idtype as that is how they are typed
elsewhere in the compiler as well

git-svn-id: trunk@32914 -
2016-01-10 17:22:11 +00:00
Jonas Maebe
dacfb1a6ff * load an objc classrefdef as objc_idtype, as that is also how we type
the self parameter in Objective-C class methods

git-svn-id: trunk@32913 -
2016-01-10 17:22:09 +00:00
Jonas Maebe
5959f45694 * emit custom Objective-C names in the LLVM assembler writer
git-svn-id: trunk@32912 -
2016-01-10 17:22:06 +00:00
Jonas Maebe
9e4806f21a * made Objective-C non-fragile ABI field indexing type safe for LLVM
git-svn-id: trunk@32911 -
2016-01-10 17:22:03 +00:00
Jonas Maebe
d46fad1e7f * use provided name to a_call_name() instead of hardcoding pd.mangledname()
(so that Objective-C messaging and WPO procedure names are used)

git-svn-id: trunk@32910 -
2016-01-10 17:21:59 +00:00
Jonas Maebe
1c99adb411 * fix rol/ror for llvm
git-svn-id: trunk@32909 -
2016-01-10 14:02:06 +00:00
Jonas Maebe
4cfec3b6e9 * fixed copy/paste error in r31285
git-svn-id: trunk@32908 -
2016-01-10 14:02:02 +00:00
Jonas Maebe
bbe8e346e0 * handle tc_equal typeconversions from conststring to a stringdef in
simplify, so that shortstring -> shortstring constant string conversions
    are simplified for LLVM too (it leaves regular tc_equal type conversions
    because often the type is still somewhat different), which is required
    for the code in tasmlisttypedconstbuilder.tc_emit_stringdef() (it
    assumes the result of inserting a type conversion is again a
    stringconstant if it can be handled at compile time)

git-svn-id: trunk@32907 -
2016-01-10 14:01:58 +00:00
Jonas Maebe
0350369c6a * don't check for a simple result location when loading an uninitialised
function result: we always only use the first location's register

git-svn-id: trunk@32906 -
2016-01-10 14:01:54 +00:00
Jonas Maebe
ae7b17890a * support non-power-of-two records that have to be passed in MM registers
in a_load_ref_cgpara()

git-svn-id: trunk@32905 -
2016-01-10 14:01:50 +00:00
Jonas Maebe
49a83b2872 * allow targets to keep certain type conversions for equal types in
inserttypeconv()
   o keep typeconversions between structurally equivalent but semantically
     different procvardefs for LLVM and JVM, because they're different
     types there

git-svn-id: trunk@32904 -
2016-01-10 14:01:46 +00:00
Jonas Maebe
5aadb149ed * ensure the types of all elements emitted in all paths through
writeaccessproc() are the same, so the reuse of existing defs doesn't
    result in the generation of typecasts for llvm

git-svn-id: trunk@32903 -
2016-01-10 14:01:43 +00:00
Jonas Maebe
4ae8dcc91e * make the resultdef of left and right equal when comparing a dynarray
with nil (for llvm)

git-svn-id: trunk@32902 -
2016-01-10 14:01:39 +00:00
Jonas Maebe
f5a3bab7d4 * add llvminfo to override optimizer switches in case of {$ifdef llvm}
git-svn-id: trunk@32901 -
2016-01-10 14:01:35 +00:00
Jonas Maebe
508038a691 + emit_pchar_const() helper for high level typed const builder
git-svn-id: trunk@32899 -
2016-01-10 14:01:24 +00:00
pierre
c863cd5bc8 Add u128bit and s128bit support in ppudump
git-svn-id: trunk@32898 -
2016-01-09 21:34:07 +00:00
florian
4ccc75e2e8 + be able to specify endianess in the assembler command line
+ pass endianess to the powerpc assembler (GNU only), so an unified be/le GNU assembler can used to build powerpc64le

git-svn-id: trunk@32894 -
2016-01-09 14:28:25 +00:00
nickysn
ef9504ffd7 * made the \325 x86 prefix to generate a 0x66 prefix on i8086, thus fixing many
32-bit instructions on i8086, when using the internal obj writer

git-svn-id: trunk@32890 -
2016-01-08 17:20:37 +00:00
nickysn
6037976202 * several imul variants, featuring 32-bit or 64-bit registers marked 386+, instead of 286+
git-svn-id: trunk@32889 -
2016-01-08 17:07:36 +00:00
nickysn
e6ac1a4af5 + added check for the compatibility of each instruction with the selected target
cpu in the i8086's internal obj writer

git-svn-id: trunk@32888 -
2016-01-08 16:44:28 +00:00
nickysn
e877bae4fc + add 'jmp rm16' and 'call rm16' before the rm32 versions on i8086, so the
16-bit version is picked up by default for opsize=S_NO. Previously the 386
  version was picked on i8086, but the generated code was correct, because we
  don't yet generate a 0x66 prefix for "\325", which leads to many 32-bit
  instructions not being assembled correctly with the internal asm obj writer on
  the i8086

git-svn-id: trunk@32887 -
2016-01-08 16:41:21 +00:00
Jonas Maebe
3aba28deb7 * factored out the generation of the Objective-C section names, so we can
reuse them for llvm too

git-svn-id: trunk@32885 -
2016-01-07 22:06:21 +00:00
Jonas Maebe
3f7169e250 * treat Objective-C metaclasses (classrefdefs) as voidpointertype at the
LLVM type level

git-svn-id: trunk@32884 -
2016-01-07 22:06:13 +00:00
Jonas Maebe
53bf43983a + support for emitting weak symbols with the high level typed constant builder
git-svn-id: trunk@32883 -
2016-01-07 22:06:06 +00:00
Jonas Maebe
58ae32e2d1 * factored out writing the LLVM linkage flags, take into account version
differences and also write them for procdefs

git-svn-id: trunk@32882 -
2016-01-07 22:06:00 +00:00
Jonas Maebe
d290ede5a6 + added (not yet configurable) target LLVM version
git-svn-id: trunk@32881 -
2016-01-07 22:05:54 +00:00
Jonas Maebe
3dbe97d9b6 + added some extra llvm versions and flags describing their features
git-svn-id: trunk@32880 -
2016-01-07 22:05:49 +00:00
Jonas Maebe
110a5642c0 - removed ait_weak/tai_weak, and replaced it with the previously existing
asd_weak_reference/asd_weak_definition directives

git-svn-id: trunk@32879 -
2016-01-07 22:05:38 +00:00
Jonas Maebe
1046c995a8 * ttai_typedconstbuilder.finalize_asmlist(): fixed handling of non-local
symbols that aren't AB_GLOBAL (e.g. AB_PRIVATE_EXTERN)

git-svn-id: trunk@32878 -
2016-01-07 22:05:28 +00:00
Jonas Maebe
bf735c7e58 * cleanup
git-svn-id: trunk@32877 -
2016-01-07 22:04:44 +00:00
nickysn
a508f9e5d3 + added check if the selected cpu is 386+ when writing a 66h or 67h prefix in
the i8086 internal object writer. This allows weeding out spurious 386
  instructions, as is similarly done by NASM when using it as an external
  assembler.

git-svn-id: trunk@32871 -
2016-01-07 15:40:32 +00:00
nickysn
114c76bc4a + added i8086 to the list of supported cpus in the compiler usage help screen
git-svn-id: trunk@32870 -
2016-01-07 14:38:25 +00:00
nickysn
22b6e00147 * extracted the writing of 0x66 and 0x67 prefixes in the x86 internal assembler
to local procedures write0x66prefix and write0x67prefix

git-svn-id: trunk@32869 -
2016-01-07 14:18:14 +00:00
Jeppe Johansen
0251263234 Move some of the local reloc calculation out of aasmcpu, and into COFF and ELF writers.
git-svn-id: trunk@32867 -
2016-01-06 23:15:08 +00:00
nickysn
21c9712ea2 * allow 32-bit operand sizes in the i8086 version of Tx86Operand.SetSize, so
32-bit operands can work properly in i8086's inline asm. Fixes mantis #29188.

git-svn-id: trunk@32866 -
2016-01-06 18:06:34 +00:00
Jeppe Johansen
1b02dd27dc Make relocation type more precise compared to output of gas.
Change and to or in case symbol in other section is not exported.

git-svn-id: trunk@32852 -
2016-01-05 07:23:20 +00:00
Károly Balogh
b799ca40f8 m68k: various cleanups and improvements in the GAS assembler writer: pass operands to the helpers by reference, removed a few extra shortstring copies, cleanups
git-svn-id: trunk@32849 -
2016-01-05 04:12:00 +00:00
Károly Balogh
288fa53694 m68k: is_calljmp cleanup
git-svn-id: trunk@32848 -
2016-01-05 04:07:00 +00:00
Károly Balogh
e0b0ec3d43 m68k: disabled the force-enabled stack checking for m68k-amiga when compiling the compiler, which was enabled since forever. the current Amiga RTL startup code supports setting stack size programmatically, therefore very low default stack on Amiga is no longer a problem
git-svn-id: trunk@32847 -
2016-01-05 02:14:40 +00:00
florian
a4d2f71d3d * better estimation of compatibility of array constructors with open arrays, resolves issue #29244
git-svn-id: trunk@32846 -
2016-01-04 23:10:45 +00:00
svenbarth
61b12af82b Fix for Mantis #29321.
pexpr.pas, postfixoperators:
  * also handle type helpers for static arrays

+ added test

git-svn-id: trunk@32845 -
2016-01-04 22:02:24 +00:00
sergei
5456960d54 * MIPS: Fixed code generation for PIC calls to local functions. Uncovered by r32803, before that the buggy branch was never taken because all functions were global.
git-svn-id: trunk@32844 -
2016-01-04 18:13:18 +00:00
Károly Balogh
2b3bd71735 m68k: include CMPI in the CMP to TST optimization
git-svn-id: trunk@32842 -
2016-01-04 01:14:34 +00:00
Károly Balogh
1e0763e251 m68k: use a_load_const_ref in a_load_const_cgpara to utilize the recently added optimized small const loading here too. this change alone shaves off ~80KB from the compiled FP IDE size...
git-svn-id: trunk@32841 -
2016-01-03 23:48:06 +00:00
florian
37cb35d780 + support for the .code directive in arm inline assembler
git-svn-id: trunk@32840 -
2016-01-03 22:08:25 +00:00
Károly Balogh
185ee93312 m68k: if we're loading small (8 bit signed) values into long references, move them through a register (usually with MOVEQ). this is two bytes shorter and also faster on most 68k CPUs
git-svn-id: trunk@32837 -
2016-01-03 18:32:27 +00:00
sergei
f69f6336e9 * Replaced hacks with resetting 'c' to zero and decreasing inputpointer by boolean parameter to skipcomment and skipoldtpcomment. This parameter specifies whether first character of comment should be read.
- in_asm_string also rendered useless by r32828, removed.

git-svn-id: trunk@32836 -
2016-01-03 17:07:15 +00:00
Károly Balogh
ff7a0c5235 m68k: while updating reference, don't reallocate and copy the index to another register if we can apply scaling for it and we don't need to multiply, so the maybe_const_reg doesn't change. this improves generated code when a const reg (eg: a loop counter) is used as array index
git-svn-id: trunk@32830 -
2016-01-02 16:05:41 +00:00
Károly Balogh
92e7c0b03f m68k: assembler reader changes
* don't reimplement BuildStringConst, use the inherited one
* findopcode's string argument is now const, simplified the function and removed some dead code
* removed an intentional null ptr write in an error path, which was debug code and left in accidentally

git-svn-id: trunk@32829 -
2016-01-02 15:51:42 +00:00
sergei
bbfbab7e0c * Moved handling of comments and line breaks in assembler blocks from scanner to tokenizer level. Handling them at character level was causing compiler to accept comments in the middle of any assembler token, which should never happen. It was also causing Mantis #27459: a newline immediately after closing 'end' token was first handled in asmgetchar and then by normal parser, causing all subsequent line numbering to be off by one.
git-svn-id: trunk@32828 -
2016-01-02 06:17:14 +00:00
sergei
b1ee3dd5e5 * m68k assembler reader: call tscannerfile.illegal_char instead of reimplementing it.
git-svn-id: trunk@32819 -
2016-01-01 10:49:38 +00:00
Jonas Maebe
8164d5aaf4 * don't make all procdef symbols global if we are using section-based
smartlinkin

git-svn-id: trunk@32803 -
2015-12-30 21:55:32 +00:00
Jonas Maebe
81381cfbb4 + vectorized dead-strippable section support for LLVM
o individual elements are not (yet) dead-strippable on LLVM though,
     there doesn't seem to be a way to encode the necessary information
     in LLVM (so e.g. all resource strings from a unit are currently
     always linked in if at least one is referenced)

git-svn-id: trunk@32802 -
2015-12-30 21:55:29 +00:00
florian
53e89b25d1 * reverted r32746: *inttype shall be the normally used integer type, os*inttype shall be the int type with the max. size of integer registers
git-svn-id: trunk@32789 -
2015-12-29 15:07:58 +00:00
florian
3f2057a2f2 * do not generate blx instructions, the generation of blx instead of bl was introduced some years ago but today it proves to be wrong: if necessary, the linker converts the bl into a blx, this is also how gcc and clang handle it
git-svn-id: trunk@32788 -
2015-12-29 13:32:21 +00:00
Jeppe Johansen
c929bb32ae Make sure to remove postfix as well when fixing thumb instructions.
git-svn-id: trunk@32787 -
2015-12-29 12:20:30 +00:00
Jeppe Johansen
4b0f4cf86a Fix some small bugs in the Thumb assembler.
git-svn-id: trunk@32785 -
2015-12-28 21:10:46 +00:00
Jonas Maebe
015a864db1 * def.fullownerhierarchyname() already ends in a '.', so don't append another
one

git-svn-id: trunk@32783 -
2015-12-28 15:06:55 +00:00
Jonas Maebe
4643913d58 - disable x86-specific workarounds when using LLVM (even when targeting x86)
git-svn-id: trunk@32782 -
2015-12-28 15:06:50 +00:00
Jonas Maebe
8471d93bf8 * include the unit name in tstoreddef.fullownerhierarchyname()
git-svn-id: trunk@32781 -
2015-12-28 15:06:43 +00:00
Jonas Maebe
96698994f3 * ensure that we don't firstpass a tcgnestloadnode twice, as it
changes left (should be solved in a cleaner way, by transforming
    the whole load node into an equivalent construct)

git-svn-id: trunk@32780 -
2015-12-28 15:06:36 +00:00
Jonas Maebe
1a09209659 * fixed type correctness of array parameter handling for calls to
fpc_addref_array/fpc_finalize_array (those helpers expect a pointer
    to the elements of the array, not a pointer to the array)

git-svn-id: trunk@32779 -
2015-12-28 15:06:29 +00:00
Jonas Maebe
35a170ed8e * don't internalerror when asked to set the function result of a function
returning an empty record to "uninitialized"

git-svn-id: trunk@32778 -
2015-12-28 15:06:22 +00:00
Jonas Maebe
c452e70f74 + support for a reference without base or symbol, if the offset is 0
(for @ptrtype(0)^.field expressions)

git-svn-id: trunk@32777 -
2015-12-28 15:06:15 +00:00
Jonas Maebe
b4fe4789d6 + support for constant call parameters on LLVM
o reduces the size of the generated LLVM IR, but mainly important for LLVM
     intrinsics such as llvm.memcpy.*(), as llc complains if some of their
     parameters are not constants (you could work around it by first running
     opt or by using clang with optimizations so that the constants, which
     were loaded in registers until now, were propagated to the intrinsics
     by the time llc saw them)

git-svn-id: trunk@32776 -
2015-12-28 15:06:07 +00:00
Jonas Maebe
8917633199 * implement sizeof/typeof completely at the node level, based on
loadvmtaddr and vmt_def
   o give an error when trying to use sizeof on a class/object when
     targeting the JVM (can't get/load the data size there)

git-svn-id: trunk@32764 -
2015-12-27 14:22:06 +00:00
Jonas Maebe
59eff35c5d * give fields added for VMT definition of TP-style objects the same
name as the equivalent fields for class VMTs, so we can access them
    using common code

git-svn-id: trunk@32763 -
2015-12-27 14:21:59 +00:00
Jonas Maebe
d44100448c * add support in the debug info for the dummy s128bit/u128bit types added
in r32735 (mantis #29259)

git-svn-id: trunk@32758 -
2015-12-27 11:45:24 +00:00
Jonas Maebe
5201547043 * don't reuse defs when writing RTTI for stored properties, as their layout
depends on how exactly they are stored

git-svn-id: trunk@32757 -
2015-12-27 11:14:41 +00:00
Jeppe Johansen
9d1646e2a8 Add support for writeback in RFE and SRS instructions.
git-svn-id: trunk@32749 -
2015-12-26 23:53:11 +00:00
Jeppe Johansen
803f402bf8 Fix minor bug in peephole optimizer.
git-svn-id: trunk@32748 -
2015-12-26 23:51:08 +00:00
florian
c83fa22b2b * cleaned up initialization of (ptr)s/uinttype
git-svn-id: trunk@32746 -
2015-12-26 20:57:30 +00:00
florian
e1d4d167b4 * hidden high parameter must be of type ptrsinttype, resolves issue #29204
git-svn-id: trunk@32745 -
2015-12-26 20:48:50 +00:00
Jonas Maebe
e3d2980c98 * don't load data in a register when converting from void to an integer
type (like with integer(pointer1^):=integer(pointer2^))

git-svn-id: trunk@32743 -
2015-12-26 20:01:44 +00:00
Jonas Maebe
205136f924 * fixed the size used for setting uninitialised function results if it
has to be zero/sign-extended for ABI reasons

git-svn-id: trunk@32742 -
2015-12-26 20:01:38 +00:00
Jonas Maebe
fad7c8f151 * fixed indexing dynamic arrays and strings with a constant index (the index
was ignored in this case)

git-svn-id: trunk@32741 -
2015-12-26 20:01:32 +00:00
Jonas Maebe
31bd38c45b * only add the procdef's parentfpinitblock if there are any statements in it
* internalerror if we try to add a non-empty parentfpinitblock to a
    pure assembler routine

git-svn-id: trunk@32740 -
2015-12-26 20:01:25 +00:00
Jonas Maebe
5a8c151a72 * don't create the nestedvars struct for pure assembler routines, as
those will never call a nested routine using Pascal-level support
    for accessing local variables (even if the nestedvars stayed empty,
    this caused a stack frame to be allocated because a temp of 0
    bytes is rounded up to 4 bytes)

git-svn-id: trunk@32739 -
2015-12-26 20:01:14 +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
ea1e368328 + added div-by-zero and overflow checking support for mod/div
git-svn-id: trunk@32737 -
2015-12-26 20:00:57 +00:00
Jonas Maebe
4939c9a7b9 * implemented overflow checking for llvm
git-svn-id: trunk@32736 -
2015-12-26 20:00:44 +00:00
Jonas Maebe
9258b5d76b + non-functional 128 bit integer types (inaccessible from Pascal), for use
in the LLVM high level code generator to implement overflow checking

git-svn-id: trunk@32735 -
2015-12-26 20:00:33 +00:00
Jonas Maebe
cd5db0d186 * register the types for the cgparas instead of for the parameters of
procvardefs, as it's those types that we use in the LLVM IR

git-svn-id: trunk@32734 -
2015-12-26 20:00:18 +00:00
florian
1857fd513e * osuinttype and ossinttype must match OS_INT and OS_UINT on avr as well
git-svn-id: trunk@32720 -
2015-12-26 08:38:53 +00:00
Jonas Maebe
99aaec5431 * handle typed constant definitions of variant records using different fields
than the one we use to construct the LLVM equivalent (which doesn't support
    variants), or in case the complete record is not defined in the source and
    has to be padded with zeroes
   o we do this by creating a new recorddef in this case with as elements the
     defs of the actually emitted constant data, and replacing the original
     def with this new def; note that this can also replace arrays in case of,
     e.g., an array of a variant record type
   o the pass in llvmtype takes care of inserting type conversions (bitcasts)
     when these constants are accessed using the original def

git-svn-id: trunk@32719 -
2015-12-25 21:05:45 +00:00
Jonas Maebe
926e62c886 + tai_aggregatetypedconst.changetorecord() to change the type of an
aggregate to a (new) recorddef
   o the size of the original type and that of the record must match
   o will be used by the LLVM generator in case of a variant record, or
     an array of variant records with constant data that does not match
     our canonical LLVM definition

git-svn-id: trunk@32718 -
2015-12-25 21:05:40 +00:00
Jonas Maebe
00c777e51a * add padding byte fields all as unsigned, as that is also how we
generate them in aasmcnst

git-svn-id: trunk@32717 -
2015-12-25 21:05:36 +00:00
Jonas Maebe
abcf441c00 * moved tllvmshadowsymtable items default property from private to public
section (although the compiler doesn't seem to care about it)

git-svn-id: trunk@32716 -
2015-12-25 21:05:31 +00:00