florian
d88d644925
+ support for FMA intrinsic: if there is no hardware support, the compiler throws an error.
...
Currently it is implemented only for x86-CPUs supporting the FMA extension. While it would
be possible to implement it in software or simulate fma(<single>,<single>,<single>) using
double operations, it makes no sense in my opinion to do so.
git-svn-id: trunk@27564 -
2014-04-13 19:21:54 +00:00
svenbarth
256c852631
Fix for Mantis #23776 .
...
ninl.pas, tinlinenode.pass_typecheck:
* don't generate a type error if Length() is used inside generics with a generic argument
+ added test
git-svn-id: trunk@27533 -
2014-04-11 15:57:21 +00:00
Jonas Maebe
d452686c39
* moved pbestrealtype from symdef to symcpu
...
git-svn-id: trunk@27441 -
2014-04-01 21:41:37 +00:00
Jonas Maebe
b57c95043f
+ support overriding tdef/tsym methods with target-specific functionality:
...
o made all (non-abstract) tdef and tsym constructors virtual
o added c*def/c*sym classref types for every (non-abstract) t*def/t*sym
class
o added cpusym unit for every architecture that derives a tcpu*def/tcpu*sym
class from the base classes, and initialises the c*def/c*sym classes with
them. This is done so that the llvm target will be able to derive from
the tcpu*def/sym classes without umpteen ifdefs, and it also means that
the WPO can devirtualise everything because the c* variables are only
initialised with one class type
o replaced all t*def/t*sym constructor calls with c*def/c*sym constructor
calls
git-svn-id: trunk@27361 -
2014-03-29 22:31:55 +00:00
Jonas Maebe
0edb7b2288
* fixed r27320 for darwin, as its mangled names get prefixed with '_'
...
and hence the generated mangled name did not start with a '$' as
expected
git-svn-id: trunk@27357 -
2014-03-29 22:31:36 +00:00
svenbarth
a08e8ff982
Fix for Mantis #25929
...
* ninl.pas, tinlinenode.handle_default.getdefaultvarsym:
prefix the default variable's name with a "$zero" instead of a "zero" and use only the string from the second character on for comparisons so that findwithhash() and checkduplicates() generate consistent results
+ added test
git-svn-id: trunk@27320 -
2014-03-28 14:45:18 +00:00
florian
ab3f5744e0
* skip dec/inc type checking in unspecialized generic methods, resolves #25603
...
git-svn-id: trunk@26830 -
2014-02-22 09:20:57 +00:00
florian
e841027a48
* fixes handling of typed files in iso mode
...
git-svn-id: trunk@26436 -
2014-01-12 20:17:48 +00:00
nickysn
e1332304ef
* when converting Hi() to a shr node, convert the right shr const parameter to
...
sinttype, instead of u32inttype. This:
1) is consistent with what type conversion tshlshrnode.pass_typecheck inserts
on the right side
2) avoids the expensive conversion to 32-bit and the even more expensive
performing the operation in 32-bit on i8086
git-svn-id: trunk@26352 -
2014-01-01 23:57:42 +00:00
Jonas Maebe
d2b8275b99
+ support for arbitrary encodings in readstr/writestr
...
o set the code page of the temporary "text" file to utf-8 for writestr with
unicodestring/widestring as destination, so that no data loss can occur
(+ properly deal with cases whereby part of an utf-8 character is
written to the textbuf in this case)
o explicitly pass the code page of the destination ansistring for writestr
with ansistring as destination and set it for the temporary "text" file
o set the code page of the text file for readstr
git-svn-id: trunk@26317 -
2013-12-29 19:18:49 +00:00
sergei
8ecad469a6
* Reverted r26256 since it produced wrong results if argument of inc/dec is actually unaligned. Added description of the issue and slightly increased node complexity at which address is cached, so operations on record/class fields do not take address.
...
git-svn-id: trunk@26258 -
2013-12-21 10:33:38 +00:00
sergei
b376f56bf3
* Use typed pointer to store address of x when processing inc(x)/dec(x) with range checking enabled. This preserves alignment of x and prevents generating unaligned code on alignment-sensitive targets.
...
git-svn-id: trunk@26256 -
2013-12-20 17:13:41 +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
florian
412dc6586f
* the writestr helper initializes the target string, so mark it as being written
...
before the call to the helper to get proper life information
git-svn-id: trunk@26017 -
2013-11-10 20:20:40 +00:00
sergei
9ad98a2c4d
* Handle "SarInt64" always as internal procedure, introduced virtual method tinlinenode.first_sar that by default converts it into call to "fpc_sarint64" unless target CPU is 64-bit. This provides a point to insert target-specific optimizations.
...
git-svn-id: trunk@25876 -
2013-10-28 14:31:36 +00:00
sergei
dac8cbcefc
* Handle assigned(x) expressions entirely in first pass by converting them to "x<>nil", indicate that procedure variables should not be called by setting nf_load_procvar flag (which is already used with typeconvnode for exactly the same purpose). This allows to generate better code when assigned(x) is used on right side of assigments. Mantis #24572 .
...
git-svn-id: trunk@25499 -
2013-09-16 14:38:38 +00:00
florian
a2a405581c
* don't call the ansistring val variant for a zero based array if not necessary to avoid ansistring usage in embedded applications
...
git-svn-id: trunk@25283 -
2013-08-18 17:04:06 +00:00
masta
b81f746e05
Inline Length(DynamicArray)
...
Up until now a helperfunction was called at runtime. This change inlines
the whole code in the same way Length(AnsiString) works. As dynamic
arrays do not record their length but their highest index, an additional
"OP_ADD" is this case.
git-svn-id: trunk@25227 -
2013-08-07 22:07:08 +00:00
Jonas Maebe
fb8fb29574
* record/use the code page of string constants typecasted to an ansistring
...
type with a non-default code page
TODO: ensure that string constants typecasted to ansistring become
ansistrings rather than typeless string constants
git-svn-id: trunk@25207 -
2013-08-02 13:23:32 +00:00
sergei
87cfd86172
* Define SUPPORT_GET_FRAME for targets having "get_frame" as internal symbol (x86,arm and jvm, currently), removes need to enumerate these targets in every related conditional compilation directive and simplifies configuring this feature for other targets.
...
git-svn-id: trunk@24978 -
2013-06-26 11:03:24 +00:00
sergei
cc8772cf92
* sizeof(x), typeof(x): if "x" is typenode, request GOT for PIC because a global VMT label will be loaded.
...
* typeinfo(x): transform into rttinode (which does request GOT) during pass 1, so pass 2 is not needed.
git-svn-id: trunk@24798 -
2013-06-03 18:07:32 +00:00
florian
0968d095ed
* convert function like used new into a appropriate nodes only in pass_1 so proper error checking can be carried out, resolves #24495
...
git-svn-id: trunk@24667 -
2013-05-31 14:55:49 +00:00
nickysn
a86cb5c600
+ far pointer fixes in the internal compiler handling of ptr(const,const)
...
git-svn-id: trunk@24567 -
2013-05-24 12:42:43 +00:00
nickysn
b0f7786782
+ added support for special versions of near data pointers associated with a x86 segment register. They are supported on all x86 platforms: i8086, i386 and x86_64
...
git-svn-id: trunk@24453 -
2013-05-05 17:22:37 +00:00
florian
0e41df598e
* merge i8086 branch by Nikolay Nikolov
...
git-svn-id: trunk@24324 -
2013-04-25 20:23:51 +00:00
nickysn
3c6df5bedc
* use is_nativeuint() in ninl.get_str_int_func(), instead of the ifdef sequence
...
git-svn-id: branches/i8086@24217 -
2013-04-09 20:39:58 +00:00
nickysn
526c3b9c9b
* val, str and read/write(ln) now use is_oversizedint/ord to determine which helper function to use; this also clears the warnings that prevented compilation of the 64-bit targets
...
git-svn-id: branches/i8086@24092 -
2013-03-31 16:27:26 +00:00
nickysn
91038d6d0a
* prevent compilation warning due to function result not being set in tinlinenode.first_seg
...
git-svn-id: branches/i8086@24084 -
2013-03-30 20:32:52 +00:00
nickysn
be761ba232
* sequences that check for cpu64bitaddr made to also check for cpu32bitaddr instead of cpu32bitalu. this fixes ppcjvm compilation
...
git-svn-id: branches/i8086@24083 -
2013-03-30 20:31:52 +00:00
nickysn
917a1eb0f2
* the default Seg() handling moved to virtual methods, so that they can be overriden in the i8086 code generator
...
git-svn-id: branches/i8086@24070 -
2013-03-30 12:08:24 +00:00
nickysn
615d6e4a51
* internal compiler handling of Val() fixed for 16/8-bit CPUs
...
git-svn-id: branches/i8086@24049 -
2013-03-29 01:38:21 +00:00
nickysn
53ad3fc662
+ Str() handling in the compiler fixed for 16/8-bit CPU support
...
git-svn-id: branches/i8086@24009 -
2013-03-25 23:58:09 +00:00
nickysn
8fa9105151
+ 16-bit and 8-bit CPU support added in the internal handling of read/readln/write/writeln
...
git-svn-id: branches/i8086@24007 -
2013-03-25 23:23:48 +00:00
Jonas Maebe
e1e11f81e3
* fixed using readstr/writestr inside routines called from the parameter
...
list of another readstr/writestr expression (mantis #23912 )
git-svn-id: trunk@23888 -
2013-03-17 14:23:33 +00:00
florian
d5985b4f0e
* patch by Christophe Staïesse to implement more ISO-like read behaviour in iso mode, resolves #24060
...
git-svn-id: trunk@23884 -
2013-03-17 08:27:21 +00:00
nickysn
573ea10ef3
* fixed val when the 'code' parameter is the same size as the native CPU int type, but unsigned
...
git-svn-id: branches/i8086@23859 -
2013-03-16 12:42:37 +00:00
nickysn
fdf831b4c6
* i8086 fix in tinlinenode.pass_typecheck for trunc and round
...
git-svn-id: branches/i8086@23849 -
2013-03-15 17:03:33 +00:00
florian
b43b4bb455
+ pseudo procedure aligned: tells the compiler to assume that the given parameter is naturally aligned, counterpart of unaligned
...
git-svn-id: trunk@23310 -
2013-01-04 19:13:24 +00:00
florian
d140c5b4ee
* handle inc/dec/pred/succ correctly with type parameters, resolves #23299
...
git-svn-id: trunk@23248 -
2012-12-29 10:01:54 +00:00
florian
761fcca4ec
+ is_dynamicstring
...
+ implement low/high for dynamic strings, resolves #15244 and #22936
+ basic support for $zerobasedstrings directive
git-svn-id: trunk@22933 -
2012-11-04 21:48:53 +00:00
sergei
12ad6704f6
- Removed a number of unused variables, reduces noise at compilation.
...
git-svn-id: trunk@22880 -
2012-10-30 11:55:59 +00:00
florian
9a5e64442f
+ support copy with two parameters, resolves #22964
...
git-svn-id: trunk@22575 -
2012-10-07 19:44:52 +00:00
florian
ff12d63248
+ generic popcnt support
...
git-svn-id: trunk@22290 -
2012-09-02 20:59:44 +00:00
florian
b782918434
* first draft to support the popcnt instruction, works so far for x86 with a real popcnt instruction
...
git-svn-id: trunk@22289 -
2012-09-02 20:59:39 +00:00
florian
396a9cafa8
* use ptrsinttype instead of sinttype as code parameter for val: for "normal" 32/64 bit targets this does not matter,
...
for 8 bit targets like avr this makes code in theory useful for ansistrings etc.
git-svn-id: trunk@22161 -
2012-08-21 16:46:19 +00:00
sergei
684bf4fba2
+ Reject object types without VMT as arguments of typeof(). Without this check, an undefined reference to VMT is generated which fails at the linking stage.
...
git-svn-id: trunk@21923 -
2012-07-17 05:46:55 +00:00
pierre
dd59db1bba
* Set retun value of get_frame method to nil
...
git-svn-id: trunk@21904 -
2012-07-12 14:16:24 +00:00
Jonas Maebe
56fcc87cb2
* add get_frame as an internal symbol for the jvm target because that target
...
defines INTERNAL_BACKTRACE (which assumes get_frame to be internal rather
than a system unit procedure)
* changed fpc_assert() declaration for jvm to be the same as for other
targets, so the same code can be used to call it in ninl now that's
called from the first pass
git-svn-id: trunk@21903 -
2012-07-12 13:25:02 +00:00
Jonas Maebe
89c230c035
* moved assert handling from second to first pass, so that the code generator
...
knows that the frame pointer needs to be available (and the code is also
much simpler this way), fixes test/units/system/tassert7 after r21843
git-svn-id: trunk@21869 -
2012-07-11 11:49:47 +00:00
svenbarth
7332a0f801
ninl.pas, tinlinenode.pass_typecheck: an intrinsic which has a generic type parameter as argument is left as is (e.g. a call) and thus this needs to be respected when typechecking a SizeOf. Fixes Mantis #21592 .
...
git-svn-id: trunk@21497 -
2012-06-06 14:41:12 +00:00