Commit Graph

1022 Commits

Author SHA1 Message Date
sergei
f97f223de6 x86_64 assembler reader improvements:
+ Added new value TAttSuffix.attsufINTdual, assigned it to movsX and movzX instructions
* Moved suffix-to-size translation tables from rax86att.pas to itcpugas.pas
+ Added x86_64 specific suffix-to-size translation, enabling BQ and WQ suffixes (LQ seems unnecessary at the moment)
* Fixed logic of tx86attreader.is_asmopcode so it only assigns dual suffix to instructions that explicitly allow it. This disambiguates cases like movsbq=movs+bq vs. cmovbq=cmovb+q
* As a net result: movz[bw]q and movs[bw]q now compile for x86_64; cmovbw and cmovbl which were incorrectly handled for i386 are now fixed.
+ Test for correct assembling of cmov.

git-svn-id: trunk@17353 -
2011-04-20 11:18:13 +00:00
florian
ee54a8b879 * Merged helper branch made by Sven Barth
-- Zusammenführen der Unterschiede zwischen Projektarchiv-URLs in ».«:
 U   rtl/inc/objc1.inc
U    rtl/inc/system.inc
U    rtl/objpas/typinfo.pp
A    tests/test/tchlp30.pp
A    tests/test/thlp35.pp
A    tests/test/tchlp3.pp
A    tests/test/thlp7.pp
A    tests/test/trhlp24.pp
A    tests/test/tchlp13.pp
A    tests/test/thlp44.pp
A    tests/test/thlp18.pp
A    tests/test/trhlp33.pp
A    tests/test/tchlp22.pp
A    tests/test/thlp27.pp
A    tests/test/trhlp16.pp
A    tests/test/tchlp31.pp
A    tests/test/thlp36.pp
A    tests/test/tchlp4.pp
A    tests/test/thlp8.pp
A    tests/test/trhlp25.pp
A    tests/test/trhlp1.pp
A    tests/test/uhlp41a.pp
A    tests/test/tchlp40.pp
A    tests/test/tchlp14.pp
A    tests/test/thlp19.pp
A    tests/test/trhlp34.pp
 U   tests/test/ttpara1.pp
A    tests/test/tchlp23.pp
A    tests/test/thlp28.pp
A    tests/test/urhlp14.pp
A    tests/test/trhlp17.pp
A    tests/test/tchlp32.pp
A    tests/test/uhlp43.pp
A    tests/test/thlp37.pp
A    tests/test/tchlp5.pp
A    tests/test/thlp9.pp
A    tests/test/trhlp26.pp
A    tests/test/trhlp2.pp
A    tests/test/uchlp12.pp
A    tests/test/tchlp41.pp
A    tests/test/uhlp41b.pp
A    tests/test/tchlp15.pp
A    tests/test/trhlp35.pp
 U   tests/test/ttpara2.pp
A    tests/test/tchlp50.pp
A    tests/test/tchlp24.pp
A    tests/test/thlp29.pp
A    tests/test/trhlp18.pp
A    tests/test/thlp10.pp
 U   tests/test/cg/ttincdec.pp
A    tests/test/tchlp33.pp
A    tests/test/thlp38.pp
A    tests/test/tchlp6.pp
A    tests/test/trhlp27.pp
A    tests/test/trhlp3.pp
A    tests/test/tchlp42.pp
A    tests/test/tchlp16.pp
A    tests/test/trhlp36.pp
A    tests/test/tchlp51.pp
A    tests/test/tchlp25.pp
A    tests/test/trhlp19.pp
A    tests/test/thlp11.pp
A    tests/test/tchlp34.pp
A    tests/test/thlp39.pp
A    tests/test/tchlp7.pp
A    tests/test/trhlp28.pp
A    tests/test/thlp20.pp
A    tests/test/trhlp4.pp
A    tests/test/tchlp43.pp
A    tests/test/tchlp17.pp
A    tests/test/trhlp37.pp
A    tests/test/tchlp52.pp
A    tests/test/tchlp26.pp
A    tests/test/thlp1.pp
A    tests/test/urhlp17.pp
A    tests/test/thlp12.pp
A    tests/test/tchlp35.pp
A    tests/test/tchlp8.pp
A    tests/test/trhlp29.pp
A    tests/test/thlp21.pp
A    tests/test/trhlp5.pp
A    tests/test/tchlp44.pp
A    tests/test/tchlp18.pp
A    tests/test/trhlp10.pp
A    tests/test/trhlp38.pp
A    tests/test/thlp30.pp
A    tests/test/tchlp53.pp
A    tests/test/tchlp27.pp
A    tests/test/thlp2.pp
A    tests/test/thlp13.pp
A    tests/test/tchlp36.pp
A    tests/test/tchlp9.pp
A    tests/test/thlp22.pp
A    tests/test/trhlp6.pp
A    tests/test/tchlp45.pp
A    tests/test/tchlp19.pp
A    tests/test/trhlp11.pp
A    tests/test/trhlp39.pp
A    tests/test/thlp31.pp
A    tests/test/tchlp54.pp
A    tests/test/tchlp28.pp
A    tests/test/uhlp39.pp
A    tests/test/thlp3.pp
A    tests/test/trhlp20.pp
A    tests/test/thlp40.pp
A    tests/test/thlp14.pp
A    tests/test/tchlp37.pp
A    tests/test/thlp23.pp
A    tests/test/trhlp7.pp
A    tests/test/tchlp46.pp
A    tests/test/trhlp12.pp
A    tests/test/thlp32.pp
A    tests/test/tchlp29.pp
A    tests/test/thlp4.pp
A    tests/test/trhlp21.pp
A    tests/test/tchlp10.pp
A    tests/test/thlp41.pp
A    tests/test/thlp15.pp
A    tests/test/tchlp38.pp
U    tests/test/trtti1.pp
A    tests/test/trhlp30.pp
A    tests/test/thlp24.pp
A    tests/test/trhlp8.pp
A    tests/test/uchlp18.pp
A    tests/test/tchlp47.pp
A    tests/test/trhlp13.pp
A    tests/test/thlp33.pp
A    tests/test/tchlp1.pp
A    tests/test/thlp5.pp
A    tests/test/trhlp22.pp
A    tests/test/tchlp11.pp
A    tests/test/thlp42.pp
A    tests/test/thlp16.pp
A    tests/test/tchlp39.pp
A    tests/test/uhlp3.pp
A    tests/test/trhlp31.pp
A    tests/test/tchlp20.pp
A    tests/test/uhlp31.pp
A    tests/test/thlp25.pp
A    tests/test/trhlp9.pp
A    tests/test/tchlp48.pp
A    tests/test/trhlp40.pp
A    tests/test/trhlp14.pp
A    tests/test/thlp34.pp
A    tests/test/tchlp2.pp
A    tests/test/thlp6.pp
A    tests/test/trhlp23.pp
A    tests/test/tchlp12.pp
A    tests/test/thlp43.pp
A    tests/test/thlp17.pp
A    tests/test/trhlp32.pp
A    tests/test/tchlp21.pp
A    tests/test/thlp26.pp
A    tests/test/tchlp49.pp
A    tests/test/trhlp41.pp
A    tests/test/trhlp15.pp
 U   tests/webtbf/tw13815.pp
 U   tests/tbf/tb0216.pp
U    compiler/msgtxt.inc
U    compiler/nld.pas
U    compiler/dbgdwarf.pas
U    compiler/sparc/cgcpu.pas
U    compiler/fmodule.pas
U    compiler/i386/cgcpu.pas
U    compiler/msgidx.inc
U    compiler/pdecsub.pas
U    compiler/ncgld.pas
U    compiler/symdef.pas
U    compiler/nobj.pas
U    compiler/nflw.pas
U    compiler/pdecobj.pas
U    compiler/objcdef.pas
U    compiler/pinline.pas
U    compiler/pexpr.pas
U    compiler/ncgrtti.pas
U    compiler/x86_64/cgcpu.pas
U    compiler/htypechk.pas
U    compiler/parser.pas
U    compiler/tokens.pas
U    compiler/symbase.pas
U    compiler/ncal.pas
U    compiler/symtable.pas
U    compiler/pp.lpi
U    compiler/m68k/cgcpu.pas
U    compiler/ppu.pas
U    compiler/rautils.pas
U    compiler/arm/cgcpu.pas
U    compiler/ptype.pas
U    compiler/symconst.pas
U    compiler/mips/cgcpu.pas
U    compiler/msg/errore.msg
U    compiler/psub.pas
U    compiler/utils/ppudump.pp
 U   compiler/utils
U    compiler/pdecvar.pas
U    compiler/ncgcal.pas
U    compiler/pdecl.pas
U    compiler/dbgstabs.pas
U    compiler/ppcgen/cgppc.pas
 U   packages/fcl-xml/tests/README_DOM.txt
 U   packages/unzip/src/unzip51g.pp
 U   packages/winunits-base/src/dwmapi.pp
 U   .

git-svn-id: trunk@17328 -
2011-04-16 14:01:44 +00:00
sergei
06311e5aad * i386-win32: Pass const variants by reference to safecall procedures, confirmed this behavior with Delphi (in general, safecall on win32 must behave as close as possible to stdcall).
git-svn-id: trunk@17323 -
2011-04-15 12:12:36 +00:00
svenbarth
35b47e491c Rebase to revision 17306
git-svn-id: branches/svenbarth/classhelpers@17314 -
2011-04-13 10:04:14 +00:00
florian
c97869bd89 * merge user sections support branch
git-svn-id: trunk@17285 -
2011-04-10 18:08:59 +00:00
sergei
c6accaba5c * tcg386.g_copyvaluepara_openarray, improved generated code:
- second calculation of EDI is obsolete, its value is never used.
  - calculation of ECX can be partially shared with first calculation of EDI.
  - multiplying ECX by 1 is also redundant (was happening due to a wrong condition).

git-svn-id: trunk@17260 -
2011-04-06 08:54:20 +00:00
florian
9279c6955e * support for SSSE3, SSE4,1, SSE4.2, AES instructions set by Emelyanov Roman, resolves #18527
+ test for aes support

git-svn-id: trunk@17256 -
2011-04-05 20:22:57 +00:00
florian
f328b6d635 + user section type
+ parsing of section directive for variables
  + section test
  + write section names in the assembler/binary writers correctly
  * allow section only after ; and for embedded targets

git-svn-id: branches/usersections@17154 -
2011-03-20 15:42:28 +00:00
svenbarth
96116a6c3a Several adjustments because virtual methods in helpers are just normal methods and a VMT isn't generated for them either.
* $CPU/cgcpu.pas: disable the generation of VMT loading code
* dbgstabs.pas, dbgdwarf.pas: treat virtual methods of helpers as normal methods
* ncgcal.pas: don't register virtual helper methods for WPO 
* ncgrtti.pas: write virtual helper methods as normal methods to RTTI
* nobj.pas: correctly handle final and override cases in helpers
* pdecvar.pas: property getters
* rautils.pas: no VMT offset in records

git-svn-id: branches/svenbarth/classhelpers@17150 -
2011-03-20 10:41:45 +00:00
svenbarth
d12b198c7f Rebase to revision 16888
git-svn-id: branches/svenbarth/classhelpers@16891 -
2011-02-07 20:30:48 +00:00
florian
e7fa076b70 * handle variables without explicit size prefix better in inline assembler, resolves #18009
git-svn-id: trunk@16859 -
2011-01-30 21:57:30 +00:00
florian
af020e8ebc * fix assembling of ljmp mem, resolves #18556
git-svn-id: trunk@16802 -
2011-01-23 12:18:14 +00:00
florian
0be59445f8 + basic i386-embedded implementation for multiboot by Jeppe Johansen, resolves #15676
git-svn-id: trunk@16801 -
2011-01-23 11:18:50 +00:00
Jonas Maebe
d10f46ec59 * skip instructions containing a reference with a segment prefix (fixes
mantis #18113)

git-svn-id: trunk@16619 -
2010-12-23 15:24:29 +00:00
sergei
34ffb184a8 * MASM and NASM assembler writers, added check for InlineLevel>0 so it suppresses entire source file processing, not just output of source lines. Without this, auto-generated instructions cause output of bogus line information. GAS writer already has similar check.
git-svn-id: trunk@16581 -
2010-12-17 18:03:56 +00:00
paul
56bf42de57 compiler: implement record methods and class methods:
- rename tprocdef._class to tprocdef.struct and change the type from tobjectdef to tabstractrecorddef because methods can belong not to classes only now but to records too
  - replace in many places use of current_objectdef to current_structdef with typcast where is needed
  - add an argument to comp_expr, expr, factor, sub_expr to notify that we are searching type only symbol to solve the problem with records,objects,classes which contains fields with the same name as previosly declared type (like:
  HWND = type Handle;
  rec = record 
    hWnd: HWND;
  end;)
  - disable check in factor_read_id which was made for object that only static fields can be accessed as TObjectType.FieldName outside the object because it makes SizeOf(TObjectType.FieldName) imposible and since the same method was extended to handle records it also breaks a52 package compilation
  - rename tcallcandidates.collect_overloads_in_class to tcallcandidates.collect_overloads_in_struct and addapt the code to handle overloads in records too
  - fix searchsym_type to search also in object ancestors if we found an object symtable
  - add pd_record, pd_notrecord flags to mark procedure modifies which can or can't be used with records. Disallow the next modifiers for records: abstract, dynamic, export, external, far, far16, final, forward, internconst, internproc, interrupt, message, near, override, public, reintroduce, virtual, weakexternal,
Allow the next modifiers for records: static

git-svn-id: branches/paul/extended_records@16526 -
2010-12-09 02:24:46 +00:00
Jonas Maebe
8f22a5d224 * perform simple imul->lea transformations also for Pentium 3-class target
cpus (default target, and should actually be faster there too;
    mantis #18056)

git-svn-id: trunk@16441 -
2010-11-26 10:30:46 +00:00
joost
07bf44517c * Merged XPCom branch into trunk, added support for constref and changed
the IInterface implementation to be XPCom-compatible
--- Merging r15997 through r16179 into '.':
U    rtl/inc/variants.pp
U    rtl/inc/objpash.inc
U    rtl/inc/objpas.inc
U    rtl/objpas/classes/persist.inc
U    rtl/objpas/classes/compon.inc
U    rtl/objpas/classes/classesh.inc
A    tests/test/tconstref1.pp
A    tests/test/tconstref2.pp
A    tests/test/tconstref3.pp
U    tests/test/tinterface4.pp
A    tests/test/tconstref4.pp
U    tests/webtbs/tw10897.pp
U    tests/webtbs/tw4086.pp
U    tests/webtbs/tw15363.pp
U    tests/webtbs/tw2177.pp
U    tests/webtbs/tw16592.pp
U    tests/tbs/tb0546.pp
U    compiler/sparc/cpupara.pas
U    compiler/i386/cpupara.pas
U    compiler/pdecsub.pas
U    compiler/symdef.pas
U    compiler/powerpc/cpupara.pas
U    compiler/avr/cpupara.pas
U    compiler/browcol.pas
U    compiler/defcmp.pas
U    compiler/powerpc64/cpupara.pas
U    compiler/ncgrtti.pas
U    compiler/x86_64/cpupara.pas
U    compiler/opttail.pas
U    compiler/htypechk.pas
U    compiler/tokens.pas
U    compiler/objcutil.pas
U    compiler/ncal.pas
U    compiler/symtable.pas
U    compiler/symsym.pas
U    compiler/m68k/cpupara.pas
U    compiler/regvars.pas
U    compiler/arm/cpupara.pas
U    compiler/symconst.pas
U    compiler/mips/cpupara.pas
U    compiler/paramgr.pas
U    compiler/psub.pas
U    compiler/pdecvar.pas
U    compiler/dbgstabs.pas
U    compiler/options.pas
U    packages/fcl-fpcunit/src/testutils.pp

git-svn-id: trunk@16180 -
2010-10-17 20:58:22 +00:00
mazen
b127fc154a * Fixed spell error revealed by lintian.
git-svn-id: trunk@16094 -
2010-10-06 20:33:57 +00:00
Jonas Maebe
8b0301409a + i386/iphonesim target for the new iPhoneSimulator in Xcode 3.2.4 and
later: the same as i386/darwin, except
      a) uses the non-fragile Objective-C ABI/runtime
      b) does not require stubs for direct calls/jumps (not required for
         i386/darwin under 10.6 and later either, but still generated
         there for backwards compatibility)
      c) only the same packages are enabled as for ARM/Darwin
      d) MacOSAll is compiled specifically for the iPhoneSimulator SDK
    This target also defines the symbol "darwin" apart from the target
    name "iphonesim" for source code compatibility reasons.

git-svn-id: trunk@16065 -
2010-09-29 21:56:47 +00:00
Jonas Maebe
92901a0619 - removed unused local variable after r16050
git-svn-id: trunk@16051 -
2010-09-27 09:51:40 +00:00
Jonas Maebe
f13f6627c4 * moved use_fixed_stack from cgutils to a method in paramgr so it can
be used outside the code generator
  * renamed tabstractprocdef.requiredargarea into callerargareasize,
    and also added calleeargareasize field; added init_paraloc_info(side)
    method to init the parameter locations and init those size fields and
    replaced all "if not procdef.has_paraloc_info then ..." blocks with
    procdef.init_paraloc_info(callersize)"
  * moved detection of stack tainting parameters from psub to
    symdef/tabstractprocdef
  + added tcallparanode.contains_stack_tainting_call(), which detects
    whether a parameter contains a call that makes use of stack paramters
  * record for each parameter whether or not any following parameter
    contains a call with stack parameters; if not, in case the current
    parameter itself is a stack parameter immediately place it in its
    final location also for use_fixed_stack platforms rather than
    first putting it in a temporary location (part of mantis #17442)
  * on use_fixed_stack platforms, always first evaluate parameters
    containing a stack tainting call, since those force any preceding
    stack parameters of the current call to be stored in a temp location
    and copied to the final location afterwards

git-svn-id: trunk@16050 -
2010-09-26 21:24:14 +00:00
joost
b938ea0f2a * For cdecl functions the funcret is not popped by the caller when it is passed
as a para. But in case of the safecall convention, the funcret is always
   returned as para and from the c point-of-view this is a normal para. So it has
   to be popped normally. This was done by correcting the pop_size in 
   ti386callnode.pop_parasize but it's better to do this directly in 
   tcgcallnode.pass_generate_code.

git-svn-id: trunk@15994 -
2010-09-15 20:18:36 +00:00
joost
65ab1e820b * Safecall on linux/i386 now behaves like cdecl plus hidden exception support.
* Adapted tests because safecall on linux/i386 now does not include high() 
   support anymore

git-svn-id: trunk@15913 -
2010-08-27 19:07:22 +00:00
joost
181804e4b9 * Fixed passing parameters on the stack to cdecl interface-methods. The 'call'
shifted all the parameters on the stack. Now the 'self' parameter is
   declared as var, not const, restoring its original value is not necessary
   anymore 

git-svn-id: trunk@15744 -
2010-08-08 13:27:54 +00:00
Jonas Maebe
57bd6d2685 + merged nestedprocvars branch
+ support for nested procedural variables:
    o activate using {$modeswitch nestedprocvars} (compatible with all
      regular syntax modes, enabled by default for MacPas mode)
    o activating this mode switch changes the way the frame pointer is
      passed to nested routines into the same way that Delphi uses (always
      passed via the stack, and if necessary removed from the stack by
      the caller) -- Todo: possibly also allow using this parameter
      passing convention without enabling nested procvars, maybe even
      by default in Delphi mode, see mantis #9432
    o both global and nested routines can be passed to/assigned to a
      nested procvar (and called via them). Note that converting global
      *procvars* to nested procvars is intentionally not supported, so
      that this functionality can also be implemented via compile-time
      generated trampolines if necessary (e.g. for LLVM or CIL backends
      as long as they don't support the aforementioned parameter passing
      convention)
    o a nested procvar can both be declared using a Mac/ISO Pascal style
      "inline" type declaration as a parameter type, or as a stand-alone
      type (in the latter case, add "is nested" at the end in analogy to
      "of object" for method pointers -- note that using variables of
      such a type is dangerous, because if you call them once the enclosing
      stack frame no longer exists on the stack, the results are
      undefined; this is however allowed for Metaware Pascal compatibility)

git-svn-id: trunk@15694 -
2010-08-02 22:20:36 +00:00
Jonas Maebe
9273856e84 * disallow pusha*/popa* for x86_64 (mantis #14862)
* disallow pushfd/popfd for x86_64 (mantis #14862)
  * fixed assembling popfq with the internal assembler (it needs a rex.w
    prefisx, while pushfq doesn't)
  * changed the default opcode size of pushf/popf/pusha/popa in
    {$asmmode intel} from "native size" to 16 bit (compatible with Intel
    manuals and Kylix; in AT&T mode, the default size for those operations
    remains the native one)
  * changed pushf/popf in rtl/i386/* into pushfd/popfd because of the
    previous change

git-svn-id: trunk@15546 -
2010-07-10 16:22:46 +00:00
Jonas Maebe
d3976c858b * fixed 64 bit check for "movd xmmreg, mem" and "movd mem, xmmreg" (patch by
Jasper Neumann, mantis #13294)
  * moved "reg64, xmmreg" and "xmmreg, reg64" combo's from movd to movq
    (movd is always 32 bit)

git-svn-id: trunk@15538 -
2010-07-09 21:16:48 +00:00
Jonas Maebe
574d7eb70d * use call/pop instead of call/mov/ret to get the GOT pointer on
Darwin/i386, because that's slightly faster on Core Solo and
    later CPUs (and it avoid using a non-volatile register when not
    required)

git-svn-id: trunk@15532 -
2010-07-07 18:55:43 +00:00
Jonas Maebe
15e9c54b44 * fixed ABI compliance for parameter passing and function returning on all
x86-64 platforms (except for win64, which uses another ABI and which
    already complied to it) + test
  * fixed returning records containing 1 single or double field on darwin/i386,
    these have to be returned via ST0 instead of as a regular record
  * added support for LOC_FPUREGISTER and LOC_MMREGISTER in several places
    where they can now occur due to the previous two changes
  * made a few internalerrors unique

git-svn-id: trunk@15368 -
2010-06-03 20:08:50 +00:00
Jonas Maebe
283018a3bf * changed tprocdef.funcretloc[] from a tlocation into a tcgpara so it can
represent complex locations (required for full x86-64 ABI support,
    which is not yet implemented) -> lots of special result handling
    code has been removed and replaced by the parameter handling
    routines
  + added support for composite parameters (and hence function
    results) to tcg.a_load_ref_cgpara() (so it can be used for
    handling, e.g., 64 bit parameters on 32 bit platforms)
  * the above fixed writing past the end of allocated memory when
    handling records returned in registers on x86-64 whose size is
    not a multiple of 8 bytes (mantis #16357)
  - removed the x86-64 and PPC specific versions of a_load_ref_cgpara(),
    as they are now handled correctly by the generic version
  * moved the responsibility of allocating tcgpara cpu registers
    (using paramanager.allocparaloc()) from the callers of
    cg.a_load*_cgpara() to the cg.a_load*_cgpara() methods
    themselves (so the register allocation can be done efficiently
    when dealing with function results)
  * for the above, renamed paramanager.alloc/freeparaloc() to
    paramanager.alloc/freecgpara(), and use paramanager.allocparaloc()
    to allocate individual pcgparalocations instead
  * fixed the register size of SSE2 function result registers for
    x86-64 (when used for floating point), which results in removing
    a few superfluous "movs? %xmm0,%xmm0" instructions
  * fixed compilation of paramanagers of avr, m68k and mips after r13695
    and also updated them for these new changes

git-svn-id: trunk@15350 -
2010-05-30 21:12:57 +00:00
Jonas Maebe
ffc9e07275 * only don't perform the complex mul->lea optimizations for the Pentium3
git-svn-id: trunk@15344 -
2010-05-30 12:57:52 +00:00
Jonas Maebe
9bc15a5f61 * renamed a_param_* to a_load_*_cgpara
git-svn-id: trunk@15305 -
2010-05-22 09:07:21 +00:00
Jonas Maebe
025ec34e4d + "CExtended" type that is the same as "extended", but conforming to the
properties/behaviour of the equivalent of Extended in C (i.e., to
    "long double" on i386 and x86_64 platforms that support a 10 byte
    long double, and to "double" elsewhere)

git-svn-id: trunk@14912 -
2010-02-14 13:45:58 +00:00
Jonas Maebe
b6e4896805 * small typo corrections by Adriaan Van Os (mantis #15652)
git-svn-id: trunk@14844 -
2010-02-02 10:41:38 +00:00
florian
75e702c2e8 * rename cpu instruction set define cpu386 to cpu80386. cpu386 is used already as a family define
git-svn-id: trunk@14737 -
2010-01-17 21:16:23 +00:00
florian
5acf377e31 * enable node cse for all cpus as level 2 optimization
git-svn-id: trunk@14703 -
2010-01-17 12:28:28 +00:00
Jonas Maebe
28cd8271c9 * initial version of internal Mach-O/i386 assembler by Dmitry Boyarintsev
(mantis #15163)

git-svn-id: trunk@14628 -
2010-01-12 19:52:55 +00:00
florian
34227e811d + patch by Sven Barth to add native NT rtl support to the compiler, resolves #14886
git-svn-id: trunk@14565 -
2010-01-07 17:42:11 +00:00
Jonas Maebe
b29f033afb * part of r14418, forgot to commit
git-svn-id: trunk@14437 -
2009-12-13 15:27:57 +00:00
Jonas Maebe
4838ebe73b * renamed mark_InlineStart/mark_InlineEnd to mark_NoLineinfoStart/
mark_NoLineinfoEnd
  * add "no line info" markers for try/except and try/finally internal cleanup
    code, so the debugger doesn't jump back and forth between the end and start
    of exception blocks when you arrive at the end
  * honour "no line info" markers in dbgdwarf.pas

git-svn-id: trunk@14327 -
2009-12-04 19:37:22 +00:00
Jonas Maebe
f7360d47c5 - removed aitconst_indirect_symbol, replaced with tai_directive
(patch by Dmitry Boyarintsev, mantis #15050)

git-svn-id: trunk@14157 -
2009-11-12 19:39:41 +00:00
Jonas Maebe
edacea82be * changed assembler directives for darwin lazy/non-lazy symbol pointers
and init/fini routines into their section equivalents (based on patch
    by Dmitry Boyarintsev, mantis #15037)

git-svn-id: trunk@14128 -
2009-11-09 22:20:01 +00:00
Jonas Maebe
559e284bd0 * merged r13762-14047 from trunk
git-svn-id: branches/objc@14048 -
2009-11-04 15:50:26 +00:00
florian
515774b864 * merged armthum branch
-- Zusammenführen der Unterschiede zwischen Projektarchiv-URLs in ».«:
U    rtl/arm/setjump.inc
A    rtl/arm/thumb2.inc
U    rtl/arm/divide.inc
A    rtl/embedded/arm/stm32f103.pp
U    rtl/inc/system.inc
U    compiler/alpha/cgcpu.pas
U    compiler/sparc/cgcpu.pas
U    compiler/i386/cgcpu.pas
U    compiler/ncgld.pas
U    compiler/powerpc/cgcpu.pas
U    compiler/avr/cgcpu.pas
U    compiler/aggas.pas
U    compiler/powerpc64/cgcpu.pas
U    compiler/x86_64/cgcpu.pas
U    compiler/cgobj.pas
U    compiler/psystem.pas
U    compiler/aasmtai.pas
U    compiler/m68k/cgcpu.pas
U    compiler/ncgutil.pas
U    compiler/rautils.pas
U    compiler/arm/raarmgas.pas
U    compiler/arm/armatts.inc
U    compiler/arm/cgcpu.pas
U    compiler/arm/armins.dat
U    compiler/arm/rgcpu.pas
U    compiler/arm/cpubase.pas
U    compiler/arm/agarmgas.pas
U    compiler/arm/cpuinfo.pas
U    compiler/arm/armop.inc
U    compiler/arm/narmadd.pas
U    compiler/arm/aoptcpu.pas
U    compiler/arm/armatt.inc
U    compiler/arm/aasmcpu.pas
U    compiler/systems/t_embed.pas
U    compiler/psub.pas
U    compiler/options.pas

git-svn-id: trunk@13801 -
2009-10-04 09:03:44 +00:00
Jonas Maebe
0c675a4039 * the objc1 unit has been renamed to objc
* the objc unit links against the Foundation instead of against the Cocoa
    framework, and inludes an interface to either the fragile or non-fragile
    obj-c run time depending on the target platform
  + support for the non-fragile Objective-C runtime/ABI, as used on Mac OS X
    for ARM (iPhone) 64 bit (PowerPC/64, x86_64) -- all these targets now
    are now also supported for the objectivec1 modeswitch
  + support for private_extern symbol bindings, required for the above
  * mark objcclasses that are declared in the implementation section of a
    unit as "hidden" (not sure what the effect is, since the Objective-C
    runtime does not seem to do anything with this flag)
  * enabled all obj-c tests for the newly supported platforms

git-svn-id: branches/objc@13763 -
2009-09-27 15:24:50 +00:00
Jonas Maebe
85f5cd603e Merged revisions 13694-13695 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13698 -
2009-09-12 12:47:50 +00:00
Jonas Maebe
cc5aeb09de * fixed handling the result value of functions where the result type is
forced to something else by the compiler (internal rtl functions etc),
    necessary for the objc branch
  * fixed adding all used function result registers to the list of
    registers that may need to be saved before a function call

git-svn-id: trunk@13695 -
2009-09-12 12:21:34 +00:00
Jonas Maebe
e393446769 * fixed several omissions that could cause the dynamic linker not to
register required classes:
    + add lazy references to classes referred to in the current unit
    + define reference symbols for classes defined in the current unit
    + add lazy references to parent classes of classes defined in the current
      unit

git-svn-id: branches/objc@13679 -
2009-09-08 16:05:41 +00:00
Jonas Maebe
7e7e7b34e1 - disabled cs_opt_asmcse for -O2/-O3 on i386. It can still be enabled
explicitly using -Ooasmcse for now. It will probably be completely
    removed before the next major release after 2.4.0 (fixes mantis
    #14363)

git-svn-id: trunk@13545 -
2009-08-16 15:29:47 +00:00
florian
53d60f02b2 * lying around newline fixes
git-svn-id: trunk@13513 -
2009-08-10 18:56:32 +00:00
Jonas Maebe
6505b4f9c5 * reverted rest of r13469 because it causes crashes for linux/ppc64
git-svn-id: trunk@13473 -
2009-07-29 20:35:51 +00:00
Jonas Maebe
f265fbe343 * fixed GOT loading for i386 in stubs for external procedures whose external
name is (re)defined in the implementation (mantis #14221)

git-svn-id: trunk@13469 -
2009-07-28 17:28:17 +00:00
florian
f34acc8505 * fixes compilation on i386 after r13410
git-svn-id: trunk@13414 -
2009-07-19 17:39:09 +00:00
Jonas Maebe
1f6ec379de * moved field definitions before method/property definitions (see mantis
#13971)

git-svn-id: trunk@13330 -
2009-06-27 11:27:31 +00:00
Jonas Maebe
dc00a747f4 * make references PIC-safe before pushing them as parameter (mantis #13829)
git-svn-id: trunk@13198 -
2009-05-26 16:22:41 +00:00
Jonas Maebe
c1e327c8c4 * insert register allocation/deallocation information for the exception
handling code (g_exception_reason_load() now automatically allocates
    the cpu register that it loads). This fixes the bug reported in
    http://lists.freepascal.org/lists/fpc-devel/2009-May/016773.html
    on i386 with -O2)

git-svn-id: trunk@13105 -
2009-05-06 19:11:54 +00:00
marco
6f1f21c432 * optbase empty skeleton removed with two dependancies. Duplicate unit name caused problems.
git-svn-id: trunk@13091 -
2009-05-03 21:31:33 +00:00
Jonas Maebe
9344484ea7 * allocregbetween has to update the "initialregs" parameter, because it
can remove regallocs for the allocated register and reinstert them
    before already processed instructions, thereby preventing the
    peephole optimizer from ever seeing the allocation for this register
    (mantis #13612)

git-svn-id: trunk@13085 -
2009-05-02 22:26:24 +00:00
Jonas Maebe
6165536b5e + added {$modeswitch objectivec1}/-Mobjectivec1 mode switch to enable
the use of Objective-C 1.0 constructs. Because it is a mode switch, it
    can be used cumulatively with every syntax mode. Note that a {$mode xxx}
    statement resets all mode switches as well, so you cannot use the
    -Mobjectivec1 variant if you have such a statement in a unit. This
    modeswitch is currently only enabled for Darwin/PowerPC and Darwin/i386,
    as the backend support is not yet implemented for other platforms.
  + implemented selector() statement that can be used to create an Objective-C
    selector for the message with the specified *constant* name (in the future,
    it will also work for Objective-C method identifiers)
  + added SEL type to the system unit (the selector() statement returns it)
  + added all Objective-C segments to the assembler writers
  + (currently mostly dummy) objc1 unit that is automatically included if the
    {$modeswitch objectivec1} statement is used
  + some tests for the selector() statement

git-svn-id: trunk@12870 -
2009-03-08 18:40:32 +00:00
florian
f49f148e01 + commented why wrappers for cdecl'd methods use subl/call/subl/ret instead of subl/jmp
git-svn-id: trunk@12829 -
2009-02-28 20:37:01 +00:00
florian
67d1604c49 * handle interface methods with cdecl modifier correctly, second and final part to resolve #10684
git-svn-id: trunk@12828 -
2009-02-28 20:28:33 +00:00
florian
694f563079 * fixed assembler tables for sse4 instructions, resolves #13186
git-svn-id: trunk@12787 -
2009-02-24 20:07:11 +00:00
Jonas Maebe
7d459cf12a * the compiler now explicitly keeps track of the minimally guaranteed
alignment for each memory reference (mantis #12137, and
    test/packages/fcl-registry/tregistry1.pp on sparc). This also
    enables better code generation for packed records in many cases.
  o several changes were made to the compiler to minimise the chances
    of accidentally forgetting to set the alignment of memory references
    in the future:
    - reference_reset*() now has an extra alignment parameter
    - location_reset() can now only be used for non LOC_(C)REFERENCE,
      use location_reset_ref() for those (split the tloc enum so the
      compiler can catch errors using range checking)

git-svn-id: trunk@12719 -
2009-02-08 13:00:24 +00:00
Jonas Maebe
b1c3f76ff9 * changed the supported targets for assembler writers to a set, and
(hopefully correctly) limited all assembler writers to only the
    OSes they support (mantis #11801)

git-svn-id: trunk@12622 -
2009-01-28 15:12:43 +00:00
florian
49195b0ac0 * fixes assembling of mov ax,<mem16>
* fixes assembling of test <mem8>,reg8; resolves #11786

git-svn-id: trunk@12040 -
2008-11-09 10:24:59 +00:00
Jonas Maebe
53e52ac6a9 * implementation of 32x32->64 multiplication for i386 based on patch
by Sergei Gorelkin

git-svn-id: trunk@12028 -
2008-11-06 21:03:10 +00:00
Jonas Maebe
a23630260b + "weakexternal" support for imported procedures and variables.
the syntax is exactly the same as for "external", except for
    the keyword. It is currently only active for Darwin targets.
    It should also work at least for Linux targets, but only with
    the GNU assembler (which is why it is not activated there)
  + test for this functionality

git-svn-id: trunk@12009 -
2008-11-01 18:38:32 +00:00
Jonas Maebe
4971e432de * reduced register pressure when indexing arrays with regvars (regvar
no longer needs to be copied to a temporary register if it isn't
    modified)

git-svn-id: trunk@11777 -
2008-09-14 16:11:22 +00:00
Jonas Maebe
7bfe1f7865 * fixed indentation
* fixed use of instruction instance after it has been freed

git-svn-id: trunk@11761 -
2008-09-13 12:20:01 +00:00
florian
e27937106f - removed obsolete USECMOV define
git-svn-id: trunk@11645 -
2008-08-24 12:46:42 +00:00
Jonas Maebe
6697f173b6 * the fact that a procedure is local does not mean that it by definition
does not need a GOT pointer (mantis #11852)

git-svn-id: trunk@11586 -
2008-08-16 08:12:23 +00:00
florian
572fe6282e * teach peephole optimizer about ror/rol
* md5 unit uses system.rol

git-svn-id: trunk@11468 -
2008-07-28 09:50:09 +00:00
yury
0bcaf8845f * Fixed 'mixed signed/unsigned' warnings.
* Suppressed 2 unreachable code warnings.
* Now x86 compiler compiles without warnings and notes! It will be great to keep such state in future...

git-svn-id: trunk@11455 -
2008-07-23 13:16:46 +00:00
yury
491f0fa1d8 * Replaced all user defined warnings by TODO comments to reduce compiler noise.
git-svn-id: trunk@11443 -
2008-07-23 11:00:03 +00:00
yury
fd0ed50331 * Removed/commented more unused variables.
* Fixed some uninitialized variable warnings.

git-svn-id: trunk@11442 -
2008-07-23 10:48:53 +00:00
yury
6c6bf452ca * Fixed level 2 comment warnings.
git-svn-id: trunk@11441 -
2008-07-23 10:08:48 +00:00
yury
5548824859 * Removed/ifdefed/commented unused local variables.
git-svn-id: trunk@11438 -
2008-07-23 09:22:47 +00:00
florian
a15d8778d6 + create jump tables for case statements on x86-64
git-svn-id: trunk@11377 -
2008-07-13 10:26:25 +00:00
Jonas Maebe
73a3507bac * reverted r11039, it's no good
git-svn-id: trunk@11048 -
2008-05-23 07:55:16 +00:00
Jonas Maebe
55d621fea3 * skip mark_InlineStart, mark_InlineEnd and mark_Position markers
in getnext/lastinstruction

git-svn-id: trunk@11039 -
2008-05-22 17:29:30 +00:00
Jonas Maebe
53d11b9a06 * fixed para locations at the calleeside for nostackframe assembler
routines

git-svn-id: trunk@11023 -
2008-05-21 15:11:37 +00:00
florian
35c0f78642 + Haiku support by Olivier Coursière based on old BeOS support
git-svn-id: trunk@11014 -
2008-05-19 17:33:35 +00:00
Jonas Maebe
3b72bf98b0 * fixed short/smallint add/sub peephole in case of operations with
only one operand + documented it by example (mantis #11223)
    

git-svn-id: trunk@10828 -
2008-04-27 21:01:52 +00:00
Jonas Maebe
a3b877247c * don't perform call/jmp into push/jmp in case we're generating
pic, as that optimization is invalid in that case

git-svn-id: trunk@10655 -
2008-04-13 17:03:07 +00:00
peter
f7737bebda * fix parameter allocation for left to right calling conventions
git-svn-id: trunk@10597 -
2008-04-02 08:05:31 +00:00
peter
8f239d04b6 * cleanup and simplify the set type handling
git-svn-id: trunk@10432 -
2008-03-02 17:48:27 +00:00
Jonas Maebe
f36e5411af * split cpu64bit compiler define into
a) cpu64bitaddr, which means that we are generating a compiler which
       will generate code for targets with a 64 bit address space/abi
    b) cpu64bitalu, which means that we are generating a compiler which
       will generate code for a cpu with support for 64 bit integer
       operations (possibly running in a 32 bit address space, depending
       on the cpu64bitaddr define)
   All cpus which had cpu64bit set now have both the above defines set,
   and none of the 32 bit cpus have cpu64bitalu set (and none will
   compile with it currently)
  + pint and puint types, similar to aint/aword (not pword because that
    that conflicts with pword=^word)
  * several changes from aint/aword to pint/pword
  * some changes of tcgsize2size[OS_INT] to sizeof(pint)

git-svn-id: trunk@10320 -
2008-02-13 20:44:00 +00:00
yury
ed86757898 * Pass const record parameters by reference for all calling conventions on i386-wince. It is needed to be Windows unit Delphi compatible, since WinAPI functions are cdecl on wince.
git-svn-id: trunk@10296 -
2008-02-11 15:12:41 +00:00
Jonas Maebe
058e3762aa * added missing begin/end
git-svn-id: trunk@10260 -
2008-02-10 10:07:55 +00:00
daniel
459382faa8 + Teach peephole optimizer the cmc/adc trick I used in int_str.
git-svn-id: trunk@9799 -
2008-01-19 21:47:37 +00:00
Jonas Maebe
9ec3cc2022 * fixed sign of location.size for divmodn, 64 shlshrn and for muln
git-svn-id: trunk@9646 -
2008-01-05 21:35:42 +00:00
Jonas Maebe
ca7650418d * fixed/added overflow checking in generic unarminusn code + test
+ added support for OP_NEG/OP_NOT in tcg64f386.a_op64_ref_reg (needed
    for the above)

git-svn-id: trunk@9528 -
2007-12-25 23:52:09 +00:00
Jonas Maebe
6c536dab3e * added several missing make_simple_ref() calls
* removed addr_pic again for darwin, as you have to explicitly code
    the relative address using a relsym instead of using an assembler
    directive like @GOT there

git-svn-id: trunk@9353 -
2007-11-29 22:06:14 +00:00
peter
cbac667753 * check for eax,edx,ecx,ebx that support 8,16 bit registers in shortint add/sub peephole
and update register size of substructor

git-svn-id: trunk@9351 -
2007-11-29 21:16:32 +00:00
peter
59365a6db9 - garbage was being output sometimes instead of source lines when compiling with -al. This is because lastfileinfo and lastinfile were never initialized for MASM writer. This is true for TPPCMPWAssembler, too.
- long lines were not wrapped.
- constants of type ait_comp_64bit output incorrectly.
- at end of file, current segment was not closed.
patch from Sergei Gorelkin

git-svn-id: trunk@9331 -
2007-11-25 16:46:19 +00:00
peter
fcb37c4fa4 * peephole added for non-longint:=non-longint+X
git-svn-id: trunk@9329 -
2007-11-25 14:32:59 +00:00
peter
cb24c78d4d * typecast to tenumreg before updating usedregs to prevent varset usage, patch from Sergei Gorelkin
git-svn-id: trunk@9296 -
2007-11-19 22:22:25 +00:00
peter
05e44101e8 * make call by value stdcall for records and arrays delphi compatible
git-svn-id: trunk@9280 -
2007-11-18 12:53:55 +00:00
Jonas Maebe
defe46ef42 * added missing size suffixes for several sse2 opcodes
git-svn-id: trunk@9182 -
2007-11-10 19:57:01 +00:00