hiding the method name of the wrapped routine
o also add a few more '&' prefixes to the generated wrapper code to
prevent issues when keywords are used as identifiers
git-svn-id: trunk@40634 -
hlcgllvm in the uses clause of every unit that calls create_hlcodegen
o prevents dependency cycles that can cause llvm codegen units to init
before the cpu variants, which is bad since the llvm versions have to
override the cpu variants in their init code (+ added checks in the
init code that they are in fact initialised later)
git-svn-id: branches/debug_eh@40410 -
in the i8086-msdos 'ports' unit, but will be enabled on other targets (e.g.
go32v2) in the future as well. 32-bit 'in' and 'out' not inlined on i8086, but
will be on i386 and x86_64.
git-svn-id: trunk@39362 -
and filled it with the dwarf register mapping, used by Open Watcom (Watcom
also uses this mapping on i386, but we don't need to support their debugger on
i386 for now)
git-svn-id: trunk@39097 -
information. Only enabled on i8086 (for now). Does not do much yet, but
hopefully, soon it'll start emitting line number information for i8086-msdos
that is usable by DOS debuggers.
git-svn-id: trunk@39006 -
modify the SI and DI registers. For 'register', this makes it compatible with
Borland C++'s __fastcall calling convention, while 'cdecl' becomes compatible
with Borland C, Microsoft C and Watcom C.
git-svn-id: trunk@38824 -
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 -
tcg8086.a_load_const_cgpara. This fixes passing const longint parameters in
dx:ax when using the register calling convention on i8086.
git-svn-id: trunk@38785 -
on i8086. This is compatible with Borland C++ 3.1's _fastcall. Note that
passing parameters in multiple registers is not yet implemented, so using this
will cause internal errors, but these will be fixed later (and the 'register'
calling convention was never officially supported on i8086).
git-svn-id: trunk@38784 -
models. Even though, they generate less efficient code, they are useful when
interacting with external APIs (e.g. declaring callbacks for the Win16 API).
git-svn-id: trunk@38726 -
o The @ and Addr() operators in TP or Delphi mode can now be applied to both
near and far procedures and they always produce a CodePointer, regardless of
the call model of the procedure.
o Ofs() and Seg() can now also be applied to both near and far procedures.
o The @ and Addr() operators in non-TP/Delphi modes, as well as the procedure
name itself in TP/Delphi modes now can be applied to both near and far
procedures and produce a near or a far procvar.
git-svn-id: trunk@38691 -
procvars can be declared near or far. Methodpointers/nested proc vars, etc
must still follow the default calling model of the current memory model. Note
that this feature isn't TP7 compatible (TP7 doesn't allow near procvars at
all), but is common to 16-bit C compilers and is quite useful for calling
external code (e.g. for far calling BIOS or some other real mode API entry
points from any memory model, etc.)
git-svn-id: trunk@38595 -
determine whether to issue a near or a far call in ti8086callnode.do_call_ref.
This will allow adding support for near and far procvars in any memory model.
git-svn-id: trunk@38594 -
sometimes produce a far pointer constant (depending on the memory model and
the type of 'x'), which would accidentally work for single constants, but will
fail for consts, which are a part of a record or an array. This fixes e.g.
const c:array[0..1] of word=(Ofs(a),Ofs(b)); in all memory models
git-svn-id: trunk@38121 -
in the default data segment, set their treference.segment to NR_DS, in order
to avoid creating redundant segment relocations to the default data segment
(which is a problem with win16 multiple instance applications). Redundant
segment overrides are stripped later anyway, so it doesn't hurt the generated
code.
git-svn-id: trunk@37715 -
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 -
from cpubase unit to a method in the tcg class. The reason for doing that is
that this is now a standard part of the 16-bit and 8-bit code generators and
moving to the tcg class allows doing extra checks (not done yet, but for
example, in the future, we can keep track of whether there was an extra
register allocated with getintregister and halt with an internalerror in case
GetNextReg() is called for registers, which weren't allocated as a part of a
sequence, therefore catching a certain class of 8-bit and 16-bit code
generator bugs at compile time, instead of generating wrong code).
- removed GetLastReg() from avr's cpubase unit, because it isn't used for
anything. It might be added to the tcg class, in case it's ever needed, but
for now I've left it out.
* GetOffsetReg() and GetOffsetReg64() were also moved to the tcg unit.
git-svn-id: trunk@37180 -
* 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 -
and les instructions to also support the lss, lfs and lgs instructions on i386
(won't be generated by the current code generator, but might become useful in
the future, if we start using the fs and gs segment registers as well)
git-svn-id: trunk@35858 -
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 -
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 -
uses less code repetition and allow choosing various methods (some of which
will be implemented later and selected, according to the cpu and optimization
settings (size vs speed))
git-svn-id: trunk@35743 -
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 -
Use new cs_checkpointer_called moduleswitches set element.
Use new uf_checkpointer_called PPU flag (reusing obsolete uf_local_browser flag value)
Emit warning if compiled library/program has any code using checkpointer.
* ppu.pas: New constant: uf_checkpointer_called
* globtype.pas: New constant: cs_checkpointer_called
* fppu.pas: Set uf_checkpointer_called flag if cs_checkpointer_called is set in current_settings.module_switches
* i8086/n8086mem.pas: Include cs_checkpointer_called in current_settings.moduleswitches
* ncgmem.pas: Likewise.
* msg/errore.msg: Add new message saying that -gc and -Ur options are incompatible
Add description to -gc option, saying it is experimental.
Add warning at link time for program/library if checkpointer is used in any unit or main code.
* options.pas: if -gc and -Ur options are used, never enable checkpointer code,
instead output a warning that release is incompatible with -gc option.
* pmodules.pas: proc_program: Check all modules for uf_checkpointer_called flag,
emit a warning if checkpointer is used.
* utils/ppuutils/ppudump.pp: Add code for uf_codepointer_called option.
git-svn-id: trunk@34567 -
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 -
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 -
16-bit version is picked up by default for opsize=S_NO. Previously the 386
version was picked on i8086, but the generated code was correct, because we
don't yet generate a 0x66 prefix for "\325", which leads to many 32-bit
instructions not being assembled correctly with the internal asm obj writer on
the i8086
git-svn-id: trunk@32887 -
"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 -
actually export them from the .exe or .dll, but they can now be used as
callbacks)
+ support win16 smart callbacks via the $K switch
git-svn-id: trunk@31835 -