calling conventions on i386
* generated code at the caller side for pocall_pascal routines on i386 no longer
assumes the routine destroys all registers (except ebp) - instead now it
assumes that it preserves the ebx,esi,edi and ebp registers. This is
compatible with the pascal calling convention of 32-bit delphi and was already
honoured by FPC on the callee side.
* updated the list of calling conventions that save all registers, used in
tx86callnode.can_call_ref, so it is accurate on all x86 platforms - i8086,
i386 and x86_64.
git-svn-id: trunk@38904 -
so that they can still be freed after the reference has been changed
(e.g. in case of array indexing or record field accesses) (mantis #33628)
git-svn-id: trunk@38814 -
tcpuparamanager, very similar to the existing get_volatile_registers_XXX. The
new methods are called get_saved_registers_XXX, where XXX is the register
type ("int", "address", "fpu" or "mm")
git-svn-id: trunk@38794 -
retfq x86 instructions. These are variants of the ret instruction with the
return offset size set explicitly, e.g. retfw is a 16-bit far ret (i.e. pops
a 16-bit offset and a 16-bit segment), retfd is a 32-bit far ret (pops a
32-bit offset, followed by a 16-bit segment), etc.
git-svn-id: trunk@37571 -
(movs, cmps, scas, lods, stos, ins, outs) in the inline asm of the i8086, i386
and x86_64 targets. Both intel and at&t syntax is supported.
* NEC V20/V30 instruction 'ins' (available only on the i8086 target, because it
is incompatible with 386+ instructions) renamed 'nec_ins', to avoid conflict
with the 186+ 'ins' instruction.
git-svn-id: trunk@37446 -
(16-bit and 32-bit), i386 (16-bit and 32-bit) and x86_64 (32-bit and 64-bit).
Known bug: 32-bit addresses with an offset have their offset truncated to its
low 16-bits on i8086
git-svn-id: trunk@37409 -
easily and so that all the values are now available to the compiler
(previously, there were several, which were mapped to the same value and thus
were only used to make x86ins.dat easier to read)
git-svn-id: trunk@37299 -
* compinnr.inc include file converted to a unit
* inline number field size stored in ppu increased from byte to longint
* inlines in the parse tree (when written with the -vp option) now printed with
their enum name, instead of number
git-svn-id: trunk@36174 -
i386's TCpuAsmOptimizer.RegReadByInstruction:
* mul doesn't read edx (unless included in operand)
* 8-bit mul and imul don't read ah (unless included in operand)
* 8-bit div and idiv don't read edx (unless included in operand)
git-svn-id: trunk@35958 -
i386's TCpuAsmOptimizer.RegReadByInstruction. Previously, the lack of this
check could generate false reads on some other register types (e.g. mmx/xmm/
flags, etc.), and this could worsen optimizations.
git-svn-id: trunk@35957 -
this removes the limit of 3 Ch_XXX flags per instruction (thus allowing adding
more precise flags, e.g. for tracking only certain bits of the flags register,
etc.) and avoids the ugliness of having the Ch_None filler, which makes
x86ins.dat less readable.
git-svn-id: trunk@35850 -
* AAA and AAS also read flags (AF)
* CMC reads and writes flags (it inverts CF)
* CMPSx and SCASx write flags
* CMPSx, SCASx, LODSx, STOSx, MOVSx read the direction flag
* NOT doesn't affect flags
* REP isn't affected by and doesn't affect flags
* REPE/REPNE/REPZ/REPNZ/REPC/REPNC don't write flags, only read them
* ROL and ROR don't read flags
* SAL doesn't read flags
* SHLD and SHRD don't read flags
git-svn-id: trunk@35849 -
reg, with a value >=32. The instruction is redundant, because the SHL/SHR
instructions already AND mask the shift count by 31.
git-svn-id: trunk@35836 -
be used (TBD in a future commit) for optimizing x:=-x and x:=not x on CPUs
that support performing these operations directly in memory (such as x86)
git-svn-id: trunk@35749 -
63, instead of comparing it to 64 and branching. Note that, although this
changes the behaviour of 64-bit shifts by values larger than 64 (when stored
in a variable), it actually makes them consistent with both the code,
generated on x86_64, as well as with 64-bit shift by constant on i386 itself.
git-svn-id: trunk@35727 -
ad hoc set constants containing varying number cdecl-like calling
conventions
o added pocall_sysv_abi_cdecl and pocall_ms_abi_cdecl to cstylearrayofconst
o also allow C-style blocks with mwpascal instead of cdecl (mwpascal = cdecl
with "const" = "constref" for record parameters)
o did not touch cases related to name mangling and import/export names,
because those are a real mess and easily break things left and right :/
git-svn-id: trunk@35479 -
o separate information for reading and writing, because e.g. in a
try-block, only the writes to local variables and parameters are
volatile (they have to be committed immediately in case the next
instruction causes an exception)
o for now, only references to absolute memory addresses are marked
as volatile
o the volatily information is (should be) properly maintained throughout
all code generators for all archictures with this patch
o no optimizers or other compiler infrastructure uses the volatility
information yet
o this functionality is not (yet) exposed at the language level, it
is only for internal code generator use right now
git-svn-id: trunk@34996 -
* It is now only used to select size of vector instructions (i.e. 128 or 256 bits)
* Scalar instructions reverted to use attsufINT suffix (selecting between 32 or 64 bits).
* Additionally, vcvtsi2sd and vcvtsi2ss with rm64 operand are x86_64 only.
git-svn-id: trunk@34942 -
it was AT_NONE, which is invalid and should never be used
* explicitly pass the correct value for all calls to those methods elsewhere
in the compiler
git-svn-id: trunk@34250 -
symbol is defined
o removed all places where AB_INDIRECT symbols were explicitly generated
o only generate AB_INDIRECT symbols for AT_DATA on systems_indirect_var_imports
o for some symbols an indirect symbol is always required (because they are
dereferenced by code in RTL units) -> use new AT_DATA_FORCEINDIRECT type
git-svn-id: trunk@34165 -
tasmdata.DefineAsmSymbol() and all routines that call it
o will be used to automatically generate AB_INDIRECT sybols when
necessary
git-svn-id: trunk@34164 -
--- Reverse-merging r33524 into '.':
U compiler\i386\popt386.pas
U compiler\x86\cgx86.pas
--- Recording mergeinfo for reverse merge of r33524 into '.':
U .
git-svn-id: trunk@33527 -
optimizer which cannot do this properly due to missing information about flags. By doing
so the size of the compiler executable gets reduced by ~1 %
git-svn-id: trunk@33524 -
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 -
x86/cgx86.pas, tcgx86:
+ new method make_direct_ref() which is used to convert an indirect reference into a direct one (uses the boolean field in_make_direct_ref to avoid recursive calls)
* make_simple_ref: call make_direct_ref() before anything else
* a_loadaddr_ref_ref: call make_direct_ref() (the loading could probably be folded into the loadaddr method, but for now that is sufficent)
i386/cgcpu.pas, tcg386:
* a_loadaddr_ref_cgpara: call make_direct_ref(); the same remark as for a_loadaddr_ref_ref() applies here
git-svn-id: trunk@33280 -
* a_load_ref_cgpara: call make_simple_ref() before calling the base a_load_ref_cgpara()
x86/cgx86.pas, tcgx86:
* a_loadfpu_ref_reg, a_loadfpu_reg_ref, g_concatcopy: call make_simple_ref() on the passed references
git-svn-id: trunk@33277 -
i386/popt386.pas, PeepHoleOptPass1:
* disable the call to RegLoadedWithNewValue() as that method isn't implemented for any of the x86 optimizers (but add a ToDo so that it isn't forgotten)
git-svn-id: trunk@33273 -
"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 -
It fixes PIC code generation with GOT for i386 with enabled optimizations. Bugs #28667, #28668.
Prior the fix I have not been able to compile even RTL with -O2 due to not enough free registers, since EBX is reserved for GOT.
It can be further optimized to teach register allocator to not spill the GOT register if possible.
git-svn-id: trunk@32020 -
* 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 -