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
f634387394
+ implement TCpuAsmOptimizer.RegLoadedWithNewValue for x86-64, resolves issue #29527
...
git-svn-id: trunk@33525 -
2016-04-15 21:27:06 +00:00
florian
406e3c4ac1
+ support xgetbv instruction, resolves issue #29958
...
git-svn-id: trunk@33418 -
2016-04-03 20:53:10 +00:00
florian
8d5cc3dfa4
* (extended and modified) patch by Emelyanov Roman to add suport of RDRAND, RDSEED and TSX instructions set, resolves issue #29893 .
...
In comparison with the original patch, support for a i386 has been added as well as a test program.
Further, a small issue with xbegin has been fixed
git-svn-id: trunk@33375 -
2016-03-28 19:08:13 +00:00
nickysn
cf3230b100
- removed IF_CENTAUR and replaced it with IF_CYRIX. Rationale: only 3 Centaur -
...
specific instructions were marked as CENTAUR, all the others were marked
CYRIX, so it wasn't an accurate flag at all
git-svn-id: trunk@33326 -
2016-03-25 17:01:11 +00:00
sergei
0f301b4c57
* Fixed spilling info for vcvt* instructions, part of Mantis #29783 .
...
git-svn-id: trunk@33208 -
2016-03-09 16:36:30 +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
nickysn
80b3e3020a
* the SEGFS and SEGGS prefixes are 386+
...
git-svn-id: trunk@32925 -
2016-01-11 15:51:40 +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
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
66bad5a1cf
* pushf and popf are 8086 level instructions, not 186+
...
git-svn-id: trunk@32677 -
2015-12-17 15:23:21 +00:00
sergei
eb86cd47c6
* tcgx86_64.g_proc_entry: Don't crash if 'list' is initially empty. Went unnoticed this far because ncgutil.gen_proc_entry_code adds some items before calling cg.g_proc_entry.
...
git-svn-id: trunk@32670 -
2015-12-16 11:13:24 +00:00
florian
a3964d9ee0
+ support for RDTSCP, resolves issue #28916
...
git-svn-id: trunk@32652 -
2015-12-13 13:28:51 +00:00
Jonas Maebe
a27927e658
* disable parameter struct padding for llvm, as llvm does that it by itself
...
(and interprets our padding as extra parameters)
git-svn-id: trunk@32554 -
2015-11-29 21:46:03 +00:00
Jonas Maebe
9fd4531e79
* fixed parameter allocation if there are fewer locations than the parameter
...
is long (e.g. if the last 4 bytes of a record is padding) -- not triggered
by default because we just extend the last parameter location to 8 bytes
in such a case, but can happen when we remove that for llvm
git-svn-id: trunk@32552 -
2015-11-29 21:45:57 +00:00
Jonas Maebe
126046dabf
* set the def for SSE 64 bit parameters to double instead of an
...
array of 2 singles
git-svn-id: trunk@32544 -
2015-11-27 14:44:32 +00:00
sergei
1b965e6766
* x86: Don't save/restore integer registers that are volatile per calling convention of current procedure. It implies that nothing will be saved for procedures with OLDFPCCALL, FAR16 and PASCAL and calling conventions. OLDFPCCALL restores behavior that was in effect before r25224.
...
git-svn-id: trunk@32542 -
2015-11-27 05:48:49 +00:00
sergei
a78250a78b
* x87 FBSTP and FBLD instructions cannot have size suffix in ATT syntax. Mantis #29095 .
...
git-svn-id: trunk@32541 -
2015-11-27 03:59:06 +00:00
Jonas Maebe
fa3b0ca312
* support marking defs created via the getreusable*() class methods as
...
"don't free even if not registered"; use for defs that may not be written
to a ppu file, but that must nevertheless survive the compilation of the
current module
* mark all defs created for para locations as "don't free even if not
registered", because we don't discard and recalculate all para locations
after a module has been compiled (since that's not needed)
o solves issues if the paralocations for a routine in the interface of
unit A are calculated while the implementation of unit B gets
compiled, and a new reusable type is allocated at that point which
is not used anywhere else (after r32160)
git-svn-id: trunk@32235 -
2015-11-04 20:46:18 +00:00
Jonas Maebe
4f7b4a2735
* changed {$ifdef x86} code in defcmp into virtual methods
...
git-svn-id: trunk@32180 -
2015-10-28 18:06:27 +00:00
florian
53ea4fb7d4
* unify x86 peephole optimizer helpers
...
git-svn-id: trunk@31843 -
2015-09-27 09:36:39 +00:00
svenbarth
529677cc79
ncal.pas:
...
* extend tcallnode with the ability to pass a tspecializationcontext so that tcallcandidates can do a final specialization
* the final procdef is registered at the end of tcallnode.pass_typecheck
git-svn-id: trunk@31763 -
2015-09-18 14:48:54 +00:00
yury
47b316d0e2
* Removed unused vars for x86-64 compiler.
...
git-svn-id: trunk@31744 -
2015-09-17 15:26:31 +00:00
sergei
e542800ea9
* Win64 SEH: Track control flow out of unwind-protected regions in a more precise way and don't generate expensive calls to __fpc_local_unwind when not necessary.
...
git-svn-id: trunk@31582 -
2015-09-09 18:43:46 +00:00
Jeppe Johansen
3cb9be73bc
Moved tcontrollerdatatype out into cpuinfo.
...
Added cputype and fputype info to tcontrollerdatatype arrays.
git-svn-id: trunk@31574 -
2015-09-07 20:36:54 +00:00
sergei
5cfeaedd23
* Fixed copy&paste error introduced in r24398, resolves #28584 .
...
git-svn-id: trunk@31475 -
2015-09-01 14:06:02 +00:00
Jonas Maebe
1bcc276dcf
* remove implicit typecast to extended automatically inserted for trunc/round
...
(due to the declaration in the system unit) on x86_64 if this allows us
to use SSE code instead (mantis #28366 )
git-svn-id: trunk@31192 -
2015-07-03 21:01:18 +00:00
Károly Balogh
f0ccbc87f2
AROS/x86_64: enable syscalls code in the parser, fix EAX->RAX reference base while calculating syscall offset
...
git-svn-id: trunk@31172 -
2015-06-28 23:04:51 +00:00
Károly Balogh
7ca62febcd
AROS/x86_64: initial AROS/x86_64 support and implement syscalls for AROS/x86_64
...
git-svn-id: trunk@31169 -
2015-06-28 19:16:40 +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
f402b0d7df
* changed getpointerdef() into a tpointerdef.getreusable() class method
...
o allows removing the ugly x86 hacks
git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
Jonas Maebe
6e5af0b31e
* don't replace classrefdef with i64 in parameter locations (so llvm can use
...
the type information)
git-svn-id: trunk@30787 -
2015-05-03 16:51:23 +00:00
florian
7dd1d6aa77
o fixes handling of iso i/o parameters/program parameters:
...
* explicit reset is needed
* variable must be declared again
git-svn-id: trunk@30757 -
2015-05-01 20:58:31 +00:00
Jonas Maebe
61e4a1b811
+ added tasmlist parameter to getintparaloc() (needed for llvm)
...
git-svn-id: trunk@30429 -
2015-04-04 14:29:16 +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
bd203a5b57
* synchronised with trunk till r30240
...
git-svn-id: branches/hlcgllvm@30241 -
2015-03-15 19:44:58 +00:00
florian
331ace25c6
* handle undefineddef in classify_argument, resolves #27658
...
git-svn-id: trunk@30239 -
2015-03-15 16:19:58 +00:00
Jonas Maebe
3d9713b9c8
* has_single_field() now looks recursively into fields that are aggregate
...
types until it finds a non-aggregate type, and then returns "true" if
that aggregate (record or array) contains one element
* it now also returns the type of that element directly rather than a
tfieldvarsym, since we only care about the type and in case of an array
there is no field
git-svn-id: trunk@30205 -
2015-03-14 18:35:53 +00:00
Jeppe Johansen
914e9e7b49
Merged from trunk
...
git-svn-id: branches/laksen/armiw@30146 -
2015-03-08 12:33:46 +00:00
Jonas Maebe
67b8aceaee
* synchronized with privatetrunk till r30095
...
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
florian
99635658ec
* corrects change flags for VSQRTSD
...
git-svn-id: trunk@30037 -
2015-02-28 22:42:25 +00:00
Jonas Maebe
79a06b1514
+ iphonesim/x86_64 target (64 bit iOS simulator)
...
git-svn-id: trunk@29970 -
2015-02-23 22:56:09 +00:00
florian
de17e9fa1c
+ cpu capability CPUX86_HAS_CMOV
...
git-svn-id: trunk@29776 -
2015-02-21 20:47:40 +00:00
florian
d6e4af8279
+ applied remaining patches of Torsten Grundke: adds gather instructions of avx2
...
git-svn-id: trunk@29745 -
2015-02-17 21:43:46 +00:00
Jeppe Johansen
47dbec3111
Rebase to trunk revision
...
git-svn-id: branches/laksen/armiw@29708 -
2015-02-15 16:08:18 +00:00
florian
35a04ad095
* modified patch of Paul W to replace leave by mov/pop, resolves #26455
...
git-svn-id: trunk@29633 -
2015-02-05 20:51:12 +00:00
pierre
c7e939b243
Add x86_64-solaris to the list of supported targetss for as_x86_64_elf64 binary writer
...
git-svn-id: trunk@29574 -
2015-01-28 22:52:01 +00:00
sergei
ed4e876f4f
* Generate exception filters data on i386-win32 and x86_64-win64 without using global labels.
...
git-svn-id: trunk@29512 -
2015-01-20 13:52:19 +00:00
Jeppe Johansen
901275b4a1
Switch back to emitting BLX instructions and fix calculation of constant offsets(should rarely/never happen).
...
Add missing fields to other elf targets.
git-svn-id: branches/laksen/armiw@29286 -
2014-12-14 16:28:35 +00:00
marco
2578514853
* first dragonfly patch (existing most). Mantis #27091
...
git-svn-id: trunk@29213 -
2014-12-07 20:27:02 +00:00
florian
5c67fcc43f
+ change always floating point divisions into multiplications if they are a power of two,
...
this is an exact operation so it is always allowed
* change only divisions by normal numbers into multiplications
git-svn-id: trunk@29085 -
2014-11-16 20:47:38 +00:00
sergei
8f05f8c839
- Forgot to commit with r29081
...
git-svn-id: trunk@29082 -
2014-11-16 17:29:52 +00:00
Tomas Hajny
3ee3542744
* boolean constant instead of IFDEFs for detection of microcontroller support
...
git-svn-id: trunk@29052 -
2014-11-10 12:34:59 +00:00
Jonas Maebe
d8c898742a
* handle the fact that records containing a single extended value are
...
returned on the x87 fpu stack on x86-64
o also handle the fact that this means that we'll generated float
loads/stores with OS_128/OS_F128 in case the surrounding record
is padded to a multiple of its alignment
git-svn-id: trunk@28985 -
2014-11-04 21:16:27 +00:00
Jonas Maebe
6712954607
* correctly handle X86_64_X87UP_CLASS getting merged with another class and
...
becoming X86_64_SSE_CLASS/X86_64_INTEGER_CLASS/... This is not defined in
the ABI because there sizeof(extended)=16 and hence the class of the upper
eightbyte of the extended value can never be merged with the class of
another field (except in a union, but then the class of the lower
eightbyte will also be overwritten).
Handle it the same as when the lower eightbyte class of an extended in an
aggregate gets changed into something else: pass everything in memory
(part of mantis #26993 )
git-svn-id: trunk@28984 -
2014-11-04 21:16:24 +00:00
Jonas Maebe
8244d366d0
- moved deallocation of NR_PIC_OFFSET_REG from the x86_64 to the i386 code
...
generator (as it's also allocated for i386 rather than for x86_64)
git-svn-id: trunk@28928 -
2014-10-25 17:47:44 +00:00
Jonas Maebe
b745dcc64c
* moved g_external_wrapper() to the hlcg, and also g_intf_wrapper() because
...
for some platforms it depends on that routine
git-svn-id: branches/hlcgllvm@28492 -
2014-08-19 20:22:54 +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
nickysn
94bcb9878a
* reimplemented r28329 in a different way, as suggested by Jonas
...
git-svn-id: trunk@28332 -
2014-08-07 19:36:52 +00:00
Jonas Maebe
7949bebb8d
* synchronised with r28168 of trunk
...
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
Jonas Maebe
1516661249
+ new chlcgobj class reference variable that can be used to call thlcg*
...
virtual methods even when hlcg doesn't contain a valid instance
git-svn-id: branches/hlcgllvm@28143 -
2014-07-03 22:28:31 +00:00
sergei
dc628b8969
* x86: Completely skip instructions that do not exist for target CPU bit width. The existing behavior of writing mnemonics and properties but no encoding allows an invalid instruction to be recognized by assembler reader or even generated by compiler, but it but won't assemble anyway.
...
git-svn-id: trunk@27934 -
2014-06-11 22:31:40 +00:00
sergei
b594eee70b
* Moved x86_64 mod/div code to x86, with minimal changes to ensure it compiles on i386/i8086. Merging optimized division-by-const code from i386 is pending...
...
git-svn-id: trunk@27930 -
2014-06-11 01:42:46 +00:00
Jonas Maebe
bacd303208
* synchronized with trunk up to r27758
...
git-svn-id: branches/hlcgllvm@27779 -
2014-05-12 16:12:34 +00:00
florian
2fa066b003
* optimize vmovaps/vmovapd after avx instructions
...
git-svn-id: trunk@27712 -
2014-05-01 19:20:35 +00:00
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
02495c17bd
Fix a typo. The CPU specific version of "ttypesym" should be called "tcputypesym" and not "tcpuypesym".
...
git-svn-id: trunk@27531 -
2014-04-11 14:30:59 +00:00
Jonas Maebe
d452686c39
* moved pbestrealtype from symdef to symcpu
...
git-svn-id: trunk@27441 -
2014-04-01 21:41:37 +00:00
sergei
8c693a3300
* Win64 apparently expects records with single field of floating-point type to be passed the same way as that only field, i.e. in xmm register. Fixes tests/cg/tcalext6.pp.
...
git-svn-id: trunk@27431 -
2014-04-01 17:04:47 +00:00
Jonas Maebe
338c064beb
* moved x86-specific tpointerdef functionality to architecture-specific
...
descendants
git-svn-id: trunk@27397 -
2014-03-30 21:04:36 +00:00
Jonas Maebe
dae5d1ff62
+ added class reference types of the architecture-specific t*def/t*sym
...
classes
git-svn-id: trunk@27396 -
2014-03-30 21:04:32 +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
florian
842e027a9f
+ prove of concept how FMA4 could be supported in inline assembler
...
git-svn-id: trunk@27214 -
2014-03-20 21:25:38 +00:00
florian
a79be2b05c
+ support for FMA instructions in inline assembler
...
+ extended avx test code with FMA
git-svn-id: trunk@27209 -
2014-03-20 20:06:56 +00:00
florian
aa107b914c
* merged avx2 branch, developed by Torsten Grundke
...
git-svn-id: trunk@27200 -
2014-03-20 12:03:52 +00:00
florian
0e5cf6529e
+ peephole optimizations AndMovzToAnd, MovMov2Mov1 and MovMov2MovMov1 for x86-64
...
git-svn-id: trunk@27181 -
2014-03-18 21:54:42 +00:00
sergei
3fb304cbe2
- Removed Win64 SEH code specific to results of managed types returned in registers. Since r26228 managed types are always returned in parameters.
...
git-svn-id: trunk@27162 -
2014-03-16 15:48:49 +00:00
Jonas Maebe
41a53ef037
* don't replace some pointer types in paralocs with int64, gives nicer
...
results in llvm (fewer needless pointer -> int -> pointer conversions)
git-svn-id: branches/hlcgllvm@26994 -
2014-03-06 21:41:04 +00:00
Jonas Maebe
68fa17593d
* no longer associated defs with size 1 to 3 bytes with paralocs, because
...
gcc and clang always allocate them in multiple of 4 bytes too (except in
case of _Bool, which is 1 byte -> do the same for PasBool) and this is
one possible interpretation of the ABI. This also frees us from having to
perform special adjustments afterwards to ensure that smaller values are
sign/zero-extended to 32 bits
git-svn-id: branches/hlcgllvm@26993 -
2014-03-06 21:41:00 +00:00
Jonas Maebe
e9268a0a14
* synchronised with trunk up till r26975
...
git-svn-id: branches/hlcgllvm@26976 -
2014-03-06 21:36:58 +00:00
sergei
2c02e8a726
- i386, x86_64, SPARC: removed paramanager.getintparaloc overrides, it is handled by generic implementation since r24716.
...
(This probably can be removed for all targets, but I don't want to do it without prior testing).
git-svn-id: trunk@26870 -
2014-02-24 16:01:14 +00:00
florian
13cb468a8e
* fixed modification information for some avx instructions
...
git-svn-id: trunk@26840 -
2014-02-22 15:52:33 +00:00
florian
0d6cc46a5e
+ CPU type corei
...
git-svn-id: trunk@26790 -
2014-02-16 08:27:27 +00:00
florian
be0a29da95
* fix modification information for bmi instructions
...
git-svn-id: trunk@26738 -
2014-02-08 21:38:21 +00:00
florian
53ddaf03ff
* fixes masking error in tx8664shlshrnode.pass_generate_code
...
* cleaned up tx8664shlshrnode.pass_generate_code and fix register loading of the right node, resolves #25664
git-svn-id: trunk@26716 -
2014-02-08 10:15:47 +00:00
Jonas Maebe
a1eb9a0f99
* fixed spilling of CMOVcc instruction: it "reads" operand two (in the sense
...
that the value of operand two is used/kept in case the condition is false)
(fixes mantis #25672 )
git-svn-id: trunk@26674 -
2014-02-05 00:27:21 +00:00
Jonas Maebe
6a4afd3a33
* changed uses of "exit" in constructors to if/then constructs, to
...
avoid the constructor result/SSA bug in 2.6.x
git-svn-id: trunk@26651 -
2014-02-02 09:09:51 +00:00
florian
28a8dc42c6
* fix tcgx86.a_op_reg_reg on x86-64 and make use of it
...
git-svn-id: trunk@26636 -
2014-01-30 20:24:41 +00:00
florian
d8c0f11ff9
+ cs_userbp optimizer switch, so on x86-64 the compiler can make use of rbp if it is not needed as frame pointer
...
git-svn-id: trunk@26633 -
2014-01-30 19:44:17 +00:00
florian
a3f58e84be
* rbp can be used for normal purpose under certain conditions so it shouldn't interfere with all other registers
...
git-svn-id: trunk@26632 -
2014-01-30 19:44:14 +00:00
florian
8989a40b4f
* more flags to mark changes fixed
...
git-svn-id: trunk@26626 -
2014-01-30 17:34:28 +00:00
Jonas Maebe
859676d7d3
* fixed r26519 for darwin/x86-64, see comments (mantis #25644 )
...
git-svn-id: trunk@26618 -
2014-01-29 21:26:45 +00:00
florian
060aa2a7fe
+ SSE and AVX unit cpu flags
...
git-svn-id: trunk@26587 -
2014-01-26 12:37:52 +00:00
florian
2ec5a649d7
* set Ch_* for more operations
...
* Ch_* flags for VMOVSD and VMOVSS are now set for the 2 operand variants
git-svn-id: trunk@26586 -
2014-01-26 12:37:50 +00:00
pierre
42140bd11f
Add forgotten new file, should fix bug report 25571
...
git-svn-id: trunk@26554 -
2014-01-21 14:17:29 +00:00
pierre
3327d508ee
Enable nasm assembler for x86_64 cpu
...
git-svn-id: trunk@26548 -
2014-01-21 00:26:49 +00:00
sergei
ca58cc1d64
+ x86_64: generate position-independent case jump tables (twice smaller than absolute ones and do not require dynamic relocations in .dll/.so).
...
git-svn-id: trunk@26519 -
2014-01-19 15:41:05 +00:00
florian
a752e3542d
+ more x86 cpu flags
...
git-svn-id: trunk@26513 -
2014-01-18 21:03:09 +00:00
florian
7028210817
+ tzcnt assembler instruction
...
git-svn-id: trunk@26506 -
2014-01-18 12:11:50 +00:00
nickysn
2459518bdd
* use IMUL even for unsigned multiplication on x86_64, when overflow checking is
...
off
git-svn-id: trunk@26499 -
2014-01-18 03:36:15 +00:00
florian
e210d5f30e
+ cpu_capabilites for x86_64 and i386
...
* take advantage of bmi2 instruction rorx
git-svn-id: trunk@26482 -
2014-01-16 21:47:28 +00:00
sergei
1ee9373fa6
* Changed function create_pd into method of ttryfinallynode, so it can be reused for Win32 SEH and, in the future, for DWARF-based exception handling on other targets.
...
* Additional two minor changes: reset po_delphi_nested_cc on result, so it is independent of current {$modeswitch nestedprocvar} state, and removed call to alloc_proc_symbol (which belongs to pass 2).
git-svn-id: trunk@26222 -
2013-12-12 08:38:06 +00:00
sergei
f508442a7e
* Emit everything to the same asmlist (fixing copy-paste error).
...
git-svn-id: trunk@26187 -
2013-12-06 07:10:39 +00:00
florian
e914612423
* the win64 exception handling code messes with asm nodes, so mark the helper procedure that they contain assembler
...
git-svn-id: trunk@26162 -
2013-12-01 17:02:13 +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
sergei
409e176ded
* Factored reusable (SEH-related) piece of code into separate procedure.
...
git-svn-id: trunk@26157 -
2013-12-01 11:47:12 +00:00
Jonas Maebe
386cda95b7
* synchronised with trunk up to r26077
...
git-svn-id: branches/hlcgllvm@26078 -
2013-11-13 13:12:49 +00:00
sergei
3ce0b33302
* Win64 SEH: when creating a finalization procedure, put its def into the same symtable with sym. By default, defs are added into symtablestack.top, which may be set to something temporary like exceptsymtable. In such cases it is possible that def is destroyed before sym, leaving sym with invalid pointers.
...
git-svn-id: trunk@26077 -
2013-11-13 12:27:27 +00:00
Jonas Maebe
c71f75b4ec
* don't include any architecture-specific node classes when creating an
...
llvm-targeting compiler, but use llvmnode instead
o after this commit it possible to build an llvm/x86-64 compiler with
very limited functionality (you can only compile dummy system units
containing procedures --not functions!-- with simple arithmetic
and array expressions; parameters are partially supported, making
calls is not). Use a make command line similar to the following:
make OPT="-Fullvm -Fillvm -dllvm" PPC_TARGET=x86_64 clean all
The resuling compiler can generate (some) valid code for at least
Mac OS X/x86-64 and should also be able to target Linux/x86-64.
Win64 support may work by simply adding it to the list of supported
targets in as_llvm_info in llvm/agllvm.pas.
git-svn-id: branches/hlcgllvm@26058 -
2013-11-11 11:16:41 +00:00
Jonas Maebe
99de108c68
* renamed all paramanagers to tcpuparamanager so the llvm paramanager can
...
derive from them without ifdefs
git-svn-id: branches/hlcgllvm@26039 -
2013-11-11 11:15:27 +00:00
florian
f132a804d6
+ handle 32 bit references on x86-64 so lea can be used for 32 bit arithmetics
...
git-svn-id: trunk@25909 -
2013-11-01 19:01:39 +00:00
florian
bfbb0c5b9d
* optimize mov/lea
...
git-svn-id: trunk@25899 -
2013-11-01 19:01:14 +00:00
florian
c8743c4826
* support 32 bit operations on x86-64 in the code generator
...
git-svn-id: trunk@25895 -
2013-11-01 19:01:02 +00:00
nickysn
0f69362edd
- rm LEA reg,imm from x86ins.dat, as that's not a valid x86 instruction,
...
using it in inline asm causes an internal error and removing it didn't show
any regressions after running the testsuite on i386-linux.
git-svn-id: trunk@25827 -
2013-10-18 23:26:58 +00:00
nickysn
4aa010eedc
+ support LEA with 16-bit operand size
...
git-svn-id: trunk@25808 -
2013-10-17 16:11:08 +00:00
nickysn
bf07fc077b
* specify AT_DATA in all references to the tobjectdef.vmt_mangledname symbol.
...
This fixes a lot of bugs, related to objects and classes in the i8086 medium
memory model
git-svn-id: trunk@25794 -
2013-10-15 18:56:27 +00:00
nickysn
f6e846c574
+ added the NEC V20/V30 instructions
...
git-svn-id: trunk@25750 -
2013-10-11 21:27:56 +00:00
svenbarth
c48d572996
Implement support for saving and restoring address registers.
...
cgobj.pas, tcg:
* g_save_registers: add the amount of used address registers to size as well
* g_save_registers: save all used address registers
* g_restore_registers: restore all stored address registers
m68k/cpubase.pas:
* rename saved_standard_address_registers to saved_address_registers
all other platform's cpubase.{inc,pas} (except alpha, ia64 and vis which are not up to date):
* add a saved_address_registers variable with one entry of RS_INVALID
At least a "make fullcycle" did complete.
git-svn-id: trunk@25664 -
2013-10-05 21:43:42 +00:00
sergei
5af873ee5b
* x86 targets: Profiling shows that quite a bit of time is spent in findreg_by_number(), despite it uses binary search. Worse, it is repeated for every piece of register information. Trying to get rid of some of these calls: rearranged registers so that their "opcode" matches 3 LSBs of superregister number (with a few exceptions described at the beginning of x86reg.dat). This allows to lookup opcodes in regval() with O(1) complexity, and removes need in rXXXop.inc files.
...
git-svn-id: trunk@25627 -
2013-10-03 08:08:04 +00:00
sergei
da2887a4ec
* x86_64-win64: SEH finalization procedures have frame pointer set to RBP but since r25389 they save registers relative to RSP. Fixed offsets for .seh_savereg/.seh_savexmm directives.
...
* In epilogue, deallocate current_procinfo.framepointer, not RBP.
git-svn-id: trunk@25414 -
2013-09-04 15:31:55 +00:00
sergei
e41149a7ec
* x86_64: reworked register saving/restoring to use PUSH/POP instructions for procedures with RSP-based frame and SEH finalization procedures. XMM registers are also saved/restored without involving tempgen in mentioned cases. This prevents SEH finalization procedures from saving registers in stack frame of their parent procedures, fixing incorrect unwind bytecode (Mantis #24791 ). It also reduces executable size (for compiler itself, by about 100Kb).
...
git-svn-id: trunk@25389 -
2013-08-30 07:54:02 +00:00
sergei
5dda96bdfe
- Tcgx86_64.init_register_allocators: removed 'preserved_by_proc' parameter, because it isn't used by RA in any way.
...
* tcgx86_64.g_intf_wrapper: jump directly to reference without loading its content into RAX, this saves an instruction.
git-svn-id: trunk@25381 -
2013-08-28 09:10:57 +00:00
sergei
1f72143eef
* In preparation for fixing Mantis #24791 : Copy related code from tcgx86.g_proc_entry to tcgx86_64.g_proc_entry, and remove win64-specific stuff from tcgx86 version.
...
git-svn-id: trunk@25218 -
2013-08-06 07:34:50 +00:00
sergei
11b72b5515
x86_64 internal ELF linker:
...
* Split generation of regular and TLSIE GOT entries. Although code for both is similar to some extent, mixing them in a single method turns it into spaghetti.
* Several fixes to content and dynamic relocations of TLSIE entries.
git-svn-id: trunk@25180 -
2013-07-29 08:34:00 +00:00
sergei
70dda94474
* x86_64-win64: don't allocate outgoing parameter area in nostackframe procedures, it fails compilation if range/overflow/etc checking is enabled (which always sets pi_do_call) due to check introduced in r22677.
...
git-svn-id: trunk@25176 -
2013-07-26 10:24:31 +00:00
florian
58610af9f0
* adapt max_linear_list on x86-64 as well
...
git-svn-id: trunk@25060 -
2013-07-07 20:01:10 +00:00
florian
94cf650d9a
* use lea to adjust stack pointer, this is equal or faster on all modern CPUs than add/sub
...
git-svn-id: trunk@25010 -
2013-06-28 17:06:57 +00:00
florian
9b6094a58c
+ added a few BMI instructions to see if they can be encoded
...
git-svn-id: trunk@24907 -
2013-06-16 09:35:21 +00:00
florian
e81d2d1f3b
* basic avx support for floating point operations (use -Cfavx to activate)
...
git-svn-id: trunk@24896 -
2013-06-14 20:03:01 +00:00
Jonas Maebe
7566ddcc8f
* add a tdef to each parameter location and set it for all target
...
backends (not yet used, will be used in high level code generator)
git-svn-id: trunk@24761 -
2013-06-02 10:24:02 +00:00
Jonas Maebe
2dd75e707e
* renamed thlcgobj.tcgsize2orddef to defutil.cgsize_orddef
...
git-svn-id: trunk@24743 -
2013-06-01 18:28:15 +00:00
nickysn
125a6a8720
* register id of (e)flags changed, so it doesn't overlap with dr0
...
git-svn-id: trunk@24647 -
2013-05-30 16:40:59 +00:00
sergei
8c91cddfc8
* Win64 SEH: Fixed handling control flow statements also in 'except' and 'on' parts of try..except statements.
...
git-svn-id: trunk@24398 -
2013-05-01 01:47:01 +00:00
sergei
c7937f6736
* Win64 exception handling: don't reset fc_unwind control flow flag at the beginning of try..except blocks. Resolves #24342 .
...
git-svn-id: trunk@24385 -
2013-04-30 03:56:58 +00:00
florian
a07af824ea
* properly fix raise node handling on x86-64 after r24288
...
git-svn-id: trunk@24334 -
2013-04-26 20:17:54 +00:00
sergei
2caa05ccd1
* Make Win64 SEH support enabled by default. If necessary to disable, compiler should be cycled with OPT=-dDISABLE_WIN64_SEH. Mantis #24012 .
...
git-svn-id: trunk@23732 -
2013-03-08 16:58:05 +00:00
Jonas Maebe
5d628b29bb
* set the subregsize of OS_M64 SSE registers to R_SUBQ so we can
...
differentiate between 64 bit and 128 bit (R_SUBMMWHOLE) SSE vector regs,
and support spilling/assembling for R_SUBQ SSE registers (8 bytes)
(mantis #23962 )
We currently never use the full 128 bit of an SSE register, and
spilling for those hasn't been implemented yet either (R_SUBMMWHOLE
SSE regs are spilled into a 4-byte temp currently -> can overwrite data)
git-svn-id: trunk@23700 -
2013-03-06 12:42:46 +00:00
svenbarth
7bad1763b8
Decrease amount of code duplication regarding handling of safecall and record constructors.
...
paramgr.pas, tparamanager:
+ add new method "handle_common_ret_in_param"
* extract common code (safecall + record constructor handling) from "ret_in_param" to "handle_common_ret_in_param" and call the latter in "ret_in_param"
[aarch64,arm,avr,i386,x86_64]/cpupara.pas, tCPUparamanager.ret_in_param:
* call "handle_common_ret_in_param" instead of implementing the same check again and again
ncgcal.pas, tcgcallnode.handle_return_value:
* move the check for (record) constructors to "tparamanager.handle_common_ret_in_param"
git-svn-id: trunk@23520 -
2013-01-25 20:39:28 +00:00
sergei
cb1098c26c
* Do not create SEH finalization procedures in generic methods, their similarity with nested procedures causes compilation errors because actual nested procedures are not allowed for generics. Not creating them doesn't hurt because generic node tree is not used for code generation. Resolves #23724 .
...
git-svn-id: trunk@23519 -
2013-01-25 18:50:04 +00:00
sergei
40c510403f
* Don't crash on a PLT-generating relocation to a local symbol (which should not normally appear, but nevertheless is possible).
...
git-svn-id: trunk@23481 -
2013-01-21 16:49:10 +00:00
paul
b2a613c17f
compiler: implement record constructors + tests
...
git-svn-id: trunk@23395 -
2013-01-16 02:07:42 +00:00
paul
51825b6f2e
compiler: change ret_in_param to accept tabstractprocdef instead of tproccalloption to allow check more options (required for record constructor implementation)
...
git-svn-id: trunk@23394 -
2013-01-16 01:14:23 +00:00
sergei
af4935e346
+ Support dynamic copy relocations.
...
* For unresolved weak symbols, provide dynamic binding only if they are referenced via GOT or PLT (ld-compatible behavior).
* Made more TElfExeOutput properties/methods usable by descendant classes.
* x86_64/cpuelf.pas: some refactoring, handle DTPOFF relocations, prohibit TPOFF relocations in shared objects.
* i386/cpuelf.pas: set symref_from_text flags for copy relocations to work correctly.
git-svn-id: trunk@23375 -
2013-01-13 17:44:14 +00:00
Jonas Maebe
69c29a415f
* pass the procdef to getintparaloc instead of only the proccalloption, so
...
that the type of the parameters can be determined automatically
o added compilerproc declarations for all helpers called in the compiler
via their assembler name, so we can look up the corresponding procdef
git-svn-id: trunk@23325 -
2013-01-06 15:05:40 +00:00
sergei
0aa7204707
+ Added codes of dynamic relocations to TElfTarget; since most targets use similar dynamic relocation model differing only in code values, this will allow to do majority of handling in the base class.
...
git-svn-id: trunk@23154 -
2012-12-16 09:36:34 +00:00
sergei
a771d68685
* Fixed a bug introduced in r23077: relative_reloc_count must be increased only once per GOT entry, not every time a relocation to that entry is seen.
...
git-svn-id: trunk@23126 -
2012-12-09 06:39:43 +00:00
sergei
c4d8396158
* Function RelocName made a member of TElfTarget, so it can be used outside of TElfExeOutput class.
...
* Methods ReportNonDSOReloc and ReportRelocOverflow moved to TElfExeOutput, they are applicable to all target-specific descendants.
git-svn-id: trunk@23094 -
2012-12-02 13:05:53 +00:00
sergei
d79761c607
* Changed TElfTarget from class to record, so it can contain data members while remaining statically allocated.
...
* Moved target-dependent constants into ElfTarget records, eliminates a lot of $ifdef's in ogelf.pas.
+ Added TElfTarget.loadsection hook and pass unknown sections to it.
git-svn-id: trunk@23090 -
2012-12-02 11:15:35 +00:00
sergei
a730830c19
* Factored code for allocating GOT slots into TElfExeOutput.AllocGOTSlot.
...
* Changed signature of GOTRelocPass1 to pass relocation index instead of relocation itself, because sometimes (e.g. when doing TLS relaxation) we need to process several subsequent relocations at once.
git-svn-id: trunk@23077 -
2012-11-29 06:37:28 +00:00
sergei
8ff1d76239
+ x86_64/cpuelf.pas: Support writing RELATIVE relocations separately from other ones.
...
+ i386/cpuelf.pas: Support R_386_TLS_IE and R_386_TLS_LE relocations.
git-svn-id: trunk@22961 -
2012-11-09 14:22:37 +00:00