* records are passed by value
* records with size of 1,2 or 4 are returned in registers
* parameters with size<4 are justified on the stack according to big-endian target
Now everything except floating-point parameters is compatible with C code compiled with "-malign-int -mrtd".
Compatibility with "-mno-align-int" is achievable by changing target_info.maxCrecordalign to 2, but doings so causes a lot more troubles because RTL (incorrectly) assumes that records declared with {$PACKRECORDS C} are aligned to pointer size.
+ Reuse parameter locations. Since everything is passed on stack, it reduces code size quite a bit.
- tm68kparamanager.getintparaloc removed, generic implementation has been tested and works as expected.
git-svn-id: trunk@28083 -
or delphi mode is selected. This fixes the error "Selected assembler reader
not supported" in programs that specify $mode tp/delphi, but do not explicitly
set $asmmode intel.
git-svn-id: trunk@28068 -
* Change register type of second operand in CTC1 and CFC1 instructions to R_SPECIALREGISTER, so it is not output using a symbolic name. Mantis #26380.
git-svn-id: trunk@28034 -
constant values (i.e., anything non-value/const/constref) (mantis #263363)
o fixed default parameter value for var-parameter in chmreader
git-svn-id: trunk@28016 -
the value set by -Ch or the second parameter to the $M directive). This is
equivalent to the heapmin value in Turbo Pascal 7 and ensures that the program
has at least this amount of heap space available (otherwise DOS will show a
'not enough memory' error and will refuse to load the program).
git-svn-id: trunk@28002 -
While it can be correct from some point of view, it does not prevent aliasing a single-precision register into upper half of double-precision one. This is currently handled by making only even floating-point registers available to RA. At the same time, it somehow (possibly due to another bug in RA) generates a lot of unnecessary moves, as if physical double-precision registers conflict with each other. Anyway, removing it considerably improves the code without regressions in the test suite.
git-svn-id: trunk@27999 -
* cpubase.pas, std_regname: changed logic to lookup known names for special registers before resorting to default name, so that $fcc0..$fcc7 can be used as operands.
git-svn-id: trunk@27992 -
the result of a objtype.method2 call, ensure that we call method2 with
objtype as methdpointer rather than the self node of the current routine
(mantis #24844)
git-svn-id: trunk@27977 -
o this reverts the support that was added for such declarations when
mantis #4676 was fixed, but this was done for Delphi compatibility
and
a) current Delphi versions don't accept such declarations anymore either
b) such declarations are meaningless
o fixed a number of such invalid property declarations in packages
git-svn-id: trunk@27966 -
o only create an accessor wrapping the inherited accessor at a
potentially lower visibility level if the overriding property
itself does not specify a different accessor to use
o simplified code
o tests
git-svn-id: trunk@27954 -
existing getter setter (at a different visibility level) with a different
name, since the new one will have a unique name and not override anything
else
git-svn-id: trunk@27953 -
pbase.pas:
+ add an overload for identifier_not_found for which the file position can be supplied
pexpr.pas, factor_read_id:
* store the file position before reading the identiifer token
* use the new identiifer_not_found overload to explicitely set the file position
* set the file position of the created node
git-svn-id: trunk@27947 -
-> fixes failed compilation of webtbs/25600 with debug info
(broken since 6 June, possibly because of r27874)
* don't allocate class fields defined in generic types, as the
only reason for this was to have valid debug info
git-svn-id: trunk@27928 -
The code generator gets two new methods, a_mul_reg_reg_pair and g_div_const_reg_reg. The first one is basically 32x32 to 64 bits multiplication (or any other size, with result having twice the size of arguments), which must be implemented for every target. The second one actually does the job, its default implementation taken from powerpc64 and is sufficiently good for all three-address targets.
+ Enabled optimized division for MIPS target, target-specific changes are under 30 lines.
git-svn-id: trunk@27904 -
as well. Even though, in these models, the stack is dynamically allocated
(because it goes on top of the heap, but the heap is variable size), there are
still benefits:
1) the program will run on a larger stack during initialization, before the
actual stack (and heap) are ready
2) in cases, when the system is extremely low on memory, DOS will reject to
load the program if there's not enough memory for the stack the program
requires. This way the startup code can be further simplified by omitting
the 'not enough memory' check in the future (when we add the minimum heap
size to the executable reserved space as well).
git-svn-id: trunk@27903 -
"sign:=left sar sizeof(left)*8-1; result:=(((left xor sign)-sign) and 2**N-1) xor sign)-sign;"
This solution yields larger code than one suggested by Mantis #21152, however its speed on i386 is approximately the same, and it is also suitable for all operand sizes, all powers of two and all targets.
git-svn-id: trunk@27891 -
* "Shift" parameter for signed calculation changed from aint to byte, since it only holds values up to 63. It is consistent with unsigned routine.
git-svn-id: trunk@27883 -
pdecobj.pas, object_dec:
* Always check for genericdef and genericlist and not genericdef and ifnot then genericlist.
+ added test
git-svn-id: trunk@27877 -
ninl.pas, tinlinenode.pass_typecheck:
* if the first parameter of an Assert is a undefineddef node then accept it as well if the node is part of a generic function/method
+ added test
git-svn-id: trunk@27875 -
ptype.pas, read_named_type:
* array_dec & procvar_dec: set df_generic of the array/procvar if parse_generic was originally set
+ added test
git-svn-id: trunk@27874 -
ptype.pas:
* read_named_type: change hadtypetoken from a value to a var parameter and set it to false if a type helper is parsed so that calling code does not handle it as unique
* read_anon_type: handle that hadtypetoken is now a var parameter
pgenutil.pas, generate_specialization:
* handle that hadtypetoken of read_named_type is now a var parameter
+ added test
git-svn-id: trunk@27870 -
For partial specialization only the declaration is reparsed, but not method bodies.
The way generic parameters are passed around inside the compiler is changed: instead of creating new type symbols we keep a (name,def) pair so that the code in insert_generic_parameter_types can decide whether it needs to add a type symbol (for new undefined defs) or not (for real types and undefined defs that were passed on from the parent generic). This required the tfpobjectlist type of the genericlist variables/parameters to be changed to tfphashobjectlist.
For correctly parsing Delphi specializations as parameters in functions of records (or objects) the relationship between the def and its typesym must already be established during the parsing. For this the checks for forcing a "type is not completely defined" message needed to be adjusted to correctly handle nested types as well. This should as a sideeffect also allow the usage of nested constants, etc like was fixed for classes some months ago.
ToDo:
- if a generic is specialized with only fully defined types then we could generate the in the unit where it's used. This is not yet done.
- currently we don't specialize generics that are currently parsed; maybe this could be improved in the future for better type compatibility checks
- check whether the pausing of token recording for partial specializations works correct in context of hint modifiers
pgenutil.pas:
* parse_generic_parameters: return a tfphashobjectlist instead of a tfpobjectlist (requires a few type adjustments in various other declarations)
* maybe_insert_generic_rename_symbol, insert_generic_parameter_types: change genericlist from tfpobjectlist to tfphashobjectlist
* parse_generic_specialization_types_internal: use is_generic instead of checking for df_generic
* generate_specialization:
+ add a nested function to disable the requirement to check for method bodies
* use the "simple" parameter parsing only for error recovery
* instead of already creating a new type symbol for a parameter we use the found symbol's name and its def and maybe create it later on (therefor the type of tfpobjectlist was changed to tfphashobjectlist)
* a partial specialization is specialized into the symtable of the def it is specialized in instead of one of the two global symtables
* for now we handle partial specializations of generics we are currently parsing like before
* don't continue recording generic tokens while we do a partial specialization
* use the new unset_forwarddef function on the newly created defs
* insert_generic_parameter_types: only create a new type symbol if the found type symbol does not yet have an owner (thus was freshly created for this generic declaration)
pdecobj.pas, object_dec:
* change type of genericlist from tfpobjectlist to tfphashobjectlist
* set the type sym for all object types that can be generic or inside a generic (needed for correctly parsing Delphi style generic declarations)
pdecsub.pas, parse_proc_head:
* consume_generic_interface: always generate the specialization name as now all generics are "specialized" inside a generic
* the assumption that the def index numbers are the same is no longer true as the genericdef might contain the defs of partial specializations which are not generated for full specializations
pdecvar.pas, read_record_fields:
* we also need to check nested types whether they contain a not yet completely parsed record or object
ptype.pas:
* read_named_type:
* change genericlist from tfpobjectlist to tfphashobjectlist
* pass the typesymbol along to record_dec
* resolve_forward_types: use is_generic instead of checking for df_generic
* single_type:
* use is_generic instead of checking for df_generic
* no need to check generic parameters
* parse_record_members:
+ add parameter for the record's type symbol
* setup the typesym <=> def relationship
+ record_dec: add parameter for the type symbol and pass it to parse_record_members
* read_named_type, expr_type: use is_generic instead of checking for df_generic
* array_dec & procvar_dec: change genericlist from tfpobjectlist to tfphashobjectlist
symdef.pas, tstoreddef:
* improve the checks used in is_generic and is_specialization to really only work on true generics and true (and partial) specializations respectively
* don't search the type parameters in the symtable, but store them in the PPU and load them from there
- remove fillgenericparas method (including the calls in the descendants tarraydef, tprocvardef, tobjectdef and trecorddef)
defcmp.pas, compare_defs_ext:
* handle partial specializations: specializations with only undefineddefs are compatible to generic defs
pdecl.pas, types_dec:
* switch generictypelist from tfpobjectlist to tfphashobjectlist
ppu.pas:
* increase PPU version
+ added tests that ensure that "not completely defined" checks for records (and objects) still work correctly
git-svn-id: trunk@27861 -
- RTL: removed MIPS,SPARC and m68k-specific implementations of Abs(longint), and marked the generic one as required for bootstrapping purposes only.
git-svn-id: trunk@27857 -
nestedprocpointertype; this was done initially before the JVM target knew
about the voidpointertype, but is no longer necessary (also fixes
mantis #26251)
git-svn-id: trunk@27838 -
itself (instead of having a fixed 16k stack in the startup code). This allows
setting the stack size in these models with the -Cs option.
git-svn-id: trunk@27820 -
so it doesn't truncate mangled names for the JVM target (it's
used there since r27149)
o adapted a number of WPO helpers to use tsymstr instead of
shortstring, but the WPO devirtualization functionality is
still limited to shortstrings internally
git-svn-id: trunk@27741 -
specified, but equal to DS in the current memory model -> call the high level
code generator with a near pointer type in order to force the segment to be
ignored
git-svn-id: trunk@27716 -
segment to survive e.g. several nested vecnodes, which cause the base register
to change from BP to something else. In the cases where the ss: prefix is not
needed, it is removed by make_simple_ref.
+ remove the ss: prefix in the several cases where make_simple_ref isn't called
(namely spilling and tcg8086.a_call_reg_far)
git-svn-id: trunk@27714 -
base, because base may in some cases call cg.a_loadaddr_ref_reg, which will
overwrite the next register, if the source reference contains a segment
git-svn-id: trunk@27713 -
generator, so it handles i8086 near and far pointers generically
- removed t8086typeconvnode.second_nil_to_methodprocvar, since it's no longer
necessary
git-svn-id: trunk@27678 -
generator, so it can now handle i8086 near and far pointers generically
- removed almost all of t8086typeconvnode.second_proc_procvar, since it's no
longer needed. Only a few assertions are left there to ensure that we don't
accidentally attempt to take the address of a near procedure in a far code
memory model, because the calling conventions are incompatible.
git-svn-id: trunk@27677 -
because they:
- worsen readability (especially if we add cpu8bitalu as well, for
completeness)
- are not needed, because the else clause of the previous if ensures that we
have (sizeleft<=sizeof(aint)) and sizeof(aint) follows the target cpu alu
size
git-svn-id: trunk@27664 -
(leftover from my initial hacky implementation of returning int64 function
results in ax:bx:cx:dx, that is no longer in use?)
git-svn-id: trunk@27662 -
side constant with 31 (instead of 15 or 7), because that's how the 16-bit and
8-bit x86 shl/shr instructions behave (even on 16-bit CPUs like 286). The
change does not affect 32-bit and 64-bit platforms, because there the shift
is always done in at least 32 bits.
git-svn-id: trunk@27638 -
models, because in these models, interrupt procedures are treated as far and
an appropriate far call (or push cs+near call if in the same segment) is made
anyway
git-svn-id: trunk@27622 -
* Improved peephole optimizer to remove these instructions if preceded by flag-setting instruction that operates on same location and followed by conditional jump, and change them back into "test %reg,%reg" otherwise.
git-svn-id: trunk@27617 -
memory models. Enabled by the new directive {$hugecode on}. The directive is
ignored in the near code memory models. When enabled, it forces each procedure
to be in a separate segment and disables mixing near and far procedures (so
'near' and {$F-} are ignored in this mode). Note that {$hugecode on} does not
count as a different memory model, because you can freely link modules (units)
compiled with {$hugecode on} and {$hugecode off}.
git-svn-id: trunk@27615 -
* force the left operand into a register if both the left and
right are constants (can happen because not all set add-nodes
are handled in taddnode.simplify) because the code below
expects at least one register operand. Fixes the compilation of a.o.
taddset2 with -O3 on ppc (constant propagagation -> 2 constant
operands)
git-svn-id: trunk@27607 -
after r27581 in regard to floating point comparisons. The tcmpnan.pp test now
almost works (i.e. fails due to only one error, instead of many).
git-svn-id: trunk@27605 -
otherwise data in initialised packed records gets aligned wrongly. This
should probably also be done for other targets that automatically
align .short/.long/...
git-svn-id: trunk@27600 -
models. The $F directive and the 'near' and 'far' procedure modifiers should
now work as expected in the far code memory models (they are still ignored in
the near code memory models). The compiler defaults to the {$F+} state,
because {$F-} requires adding 'far' to a lot of procedures in the rtl,
packages and tests.
git-svn-id: trunk@27590 -
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 -
+ added helper function to i8086's symcpu is_proc_far that dispatches the call
to the proper is_far method (because we can't make a cpu specific descendant
of tabstractprocdef and add it there)
* all checks for (po_far in procoptions) in the i8086 code generator replaced
with calls to is_proc_far
git-svn-id: trunk@27559 -
6-byte method pointers and other i8086 types that use loc.registerhi
* changed the i8086 specific code in tcgassignmentnode.pass_generate_code to
use hlcg.a_load_loc_ref
git-svn-id: trunk@27555 -
o The checks for types that need special handling moved to separate methods,
because they'll probably be used by the other hlcg.a_load*loc* methods as
well.
o Use voidcodepointertype and voidpointertype to avoid the ifs for checking
the memory model.
git-svn-id: trunk@27554 -
are called, when the 'near' or 'far' directive is parsed in a procedure
definition. This allows overriding and implementing them on architectures,
which support near and far calls.
git-svn-id: trunk@27545 -