Commit Graph

165 Commits

Author SHA1 Message Date
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
b9c9422fa7 * fixed type of reference used to store an ansichar that was converted
inline to a shortstring

git-svn-id: trunk@31049 -
2015-06-13 22:48:05 +00:00
Jonas Maebe
582aee4d90 * fixed the type of FPC_EMPTYCHAR when referencing it
git-svn-id: trunk@30785 -
2015-05-03 16:51:16 +00:00
Jonas Maebe
bd203a5b57 * synchronised with trunk till r30240
git-svn-id: branches/hlcgllvm@30241 -
2015-03-15 19:44:58 +00:00
Károly Balogh
0021ad714f * fixed some ancient code behind cpu_uses_separate_address_registers define to at least compile again, for some m68k experiment
git-svn-id: trunk@30130 -
2015-03-07 22:11:43 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
Jonas Maebe
2c3aa7cee0 * give an internal error in second_int_to_bool() if left.expectloc was not
in [LOC_FLAGS,LOC_JUMP], but it's actual location is one of those

git-svn-id: trunk@29587 -
2015-01-30 19:31:31 +00:00
Jonas Maebe
3a78f4f580 * use the correct destination def for loading a simple proc2procvar
git-svn-id: branches/hlcgllvm@28479 -
2014-08-19 20:22:19 +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
Jonas Maebe
2c7a1b4e91 * fixed optimisation from r25067 for the generic case where a signed value
is converted to a larger unsigned value (e.g. OS_S16 -> OS_32)

git-svn-id: trunk@28251 -
2014-07-23 14:06:06 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
sergei
04eb925776 * tcgtypeconvnode.second_int_to_int: disabled optimization from r25067 for m68k, because reg_cgsize() does not return expected values on that target.
git-svn-id: trunk@28093 -
2014-06-27 19:49:18 +00:00
nickysn
cb05907e18 * fixed the global function to nested procvar conversion in the i8086 far data
memory models

git-svn-id: trunk@27814 -
2014-05-23 20:59:07 +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
nickysn
4ab9c6f206 + fixed tcgtypeconvnode.second_class_to_intf for i8086 far data memory models
git-svn-id: trunk@27692 -
2014-04-30 14:05:35 +00:00
nickysn
a17c04c3e0 * fixed array to pointer conversion in i8086 far data memory models
git-svn-id: trunk@27683 -
2014-04-28 12:36:38 +00:00
nickysn
e8b9d9bf41 * converted tcgtypeconvnode.second_nil_to_methodprocvar to the high level code
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 -
2014-04-28 01:05:14 +00:00
nickysn
187c2af20e * tcgtypeconvnode.second_proc_to_procvar converted to the high level code
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 -
2014-04-27 23:18:05 +00:00
florian
0a7b795744 * fix for the regressions caused by r27417
git-svn-id: trunk@27433 -
2014-04-01 19:34:21 +00:00
florian
73cf0b62f2 * relaxed conditions for floats in int registers, this improved softfloat code significantly
git-svn-id: trunk@27417 -
2014-03-31 21:14:16 +00:00
nickysn
0aab7fcc9c * fixed tcgtypeconvnode.second_cstring_to_pchar for i8086 far data memory models by using the high level code generator
git-svn-id: trunk@27324 -
2014-03-28 18:36:14 +00:00
nickysn
2644d7566c * refactored tcgtypeconvnode.second_pointer_to_array to use
hlcg.reference_reset_base, which removes the need for i8086-specific ifdefs

git-svn-id: trunk@27311 -
2014-03-28 00:10:29 +00:00
nickysn
bd75abb64b + fill the treference.segment in tcgtypeconvnode.second_pointer_to_array when
the source type is a far (or huge) pointer

git-svn-id: trunk@27279 -
2014-03-25 01:46:45 +00:00
nickysn
a9f56d2714 * refactored tcgtypeconvnode.second_ansistring_to_pchar to use the high level
code generator and work in all i8086 memory models. Removed the i8086-specific
  overriden version.

git-svn-id: trunk@27278 -
2014-03-25 01:27:58 +00:00
Jonas Maebe
d46c353849 * migrated JVM-specific second_nil_to_methodprocvar code to njvmcnv
git-svn-id: trunk@27150 -
2014-03-16 11:24:29 +00:00
Jonas Maebe
4065483a50 * completed thlcgobj.location_force_fpureg(), use it everywhere and removed
ncgutil/thlcg2ll.location_force_fpureg()

git-svn-id: trunk@27071 -
2014-03-10 09:01:05 +00:00
Jonas Maebe
cdfb23bf6c * converted some leftovers in tcgtypeconvnode.second_int_to_int/
second_real_to_real to thlcgobj
  + added type conversion to second_pointer_to_array for llvm

git-svn-id: branches/hlcgllvm@27000 -
2014-03-06 21:41:27 +00:00
Jeppe Johansen
07b2982e77 Don't do ARM FoldShiftLdrStr peephole optimization if there's an offset in the reference.
Use UXTH+UXTB instructions instead of two shifts on processors that supports that.
Eliminate internalerror when constant pointers are typecast as arrays.

git-svn-id: trunk@26647 -
2014-02-01 13:29:35 +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
svenbarth
76f6de5cf1 Refactor tobjectdef.find_implemented_interface out into unit defcmp so that the recently introduced cycle between symdef and defcmp can be broken again.
defcmp.pas:
  + add function "find_implemented_interface"
  * change method call of "find_implemented_interface" into function call
symdef.pas:
  - tobjectdef: remove method "find_implemented_interface"
  - remove use of unit "defcmp"
pgenutil.pas:
  * change method call of "find_implemented_interface" into function call
  + add use of unit "defcmp"
ncgcnv.pas, ncnv.pas, pdecobj.pas, pdecsub.pas, pdecvar.pas:
  * change method call of "find_implemented_interface" into function call

git-svn-id: trunk@25844 -
2013-10-23 19:05:00 +00:00
sergei
f80ce76a69 + MIPS: emulate "flags", i.e. support LOC_FLAGS location. This allows to generate differently optimized code for branching and for conversion to register, typically saving a register and instruction per compare.
git-svn-id: trunk@25131 -
2013-07-19 14:06:47 +00:00
nickysn
7a0bf4fa54 * the change in r25067 disabled for 16-bit and 8-bit CPUs, because it relies on reg_cgsize, which gives wrong results on archs that use GetNextReg()
git-svn-id: trunk@25086 -
2013-07-11 12:28:26 +00:00
sergei
f3a1c749fb * tcgtypeconvnode.second_int_to_int: reuse 8 and 16-bit-sized register locations on targets with 32-bit-only registers when casting to larger size (except ShortInt to Word cast). This is possible because upper bits of such registers are always kept valid by code generators (see 'maybeadjustresult' method in cgcpu.pas). Removes a lot of useless register moves.
git-svn-id: trunk@25067 -
2013-07-08 13:27:03 +00:00
florian
19495439b1 * do not destroy the left operand in second_ansistring_to_pchar if it is a register
git-svn-id: trunk@24954 -
2013-06-23 15:16:33 +00:00
Jonas Maebe
5051453806 + support for LOC_(C)MMREGISTER in hlcg
o migrated location_force_mmregister_scalar from ncgutil to hlcgobj

git-svn-id: trunk@24661 -
2013-05-31 12:05:14 +00:00
Jonas Maebe
5152c86932 * set the location size of load nodes of procsyms without methodpointer/
framepointer
  * fixed conversion of procedure of object/nested procedure into a procvar
    that only contains the code address

git-svn-id: trunk@23928 -
2013-03-19 12:27:57 +00:00
florian
5a81601565 * type casting could force pointers into sub registers, so handle them when converting the pointer to an array
git-svn-id: trunk@23591 -
2013-02-10 20:50:12 +00:00
paul
5d74e0578a compiler: remove unused variables and unneeded assignments
git-svn-id: trunk@23467 -
2013-01-21 01:24:36 +00:00
florian
4d4561923e * nil method pointers can be kept in registers
git-svn-id: trunk@22340 -
2012-09-06 15:11:54 +00:00
florian
d8161c185c + track usage of flags by using a new register RS_/NR_DEFAULTFLAGS
git-svn-id: trunk@22179 -
2012-08-22 19:37:51 +00:00
Jonas Maebe
edd42aa42a * moved subsetref/reg and bit_set/test support from cgobj to hlcgobj for
future use by high level code generator targets
   o this in turn required that all a_load*_loc* methods are called via
     hlcg rather than via cg, since a location can be a subsetref/reg and
     and those are no longer handled in tcg
   o that then required moving several force_location_* routines into
     thlcg because they use a_load_loc*, but did not take tdef size
     parameters (which are required by the thlcg a_load_loc* routines)
   o the only practical consequence is that from now on, you have to
     use hlcg.location_force_mem/reg() (fpureg not yet) and
     hlcg.gen_load_loc_cgpara() instead of the removed versions from ncgutil,
     and hlcg.a_load*loc*() instead of cg.a_load*loc* if a subsetref/reg
     might be involved

git-svn-id: trunk@21287 -
2012-05-13 12:33:10 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
florian
111d05c68f o patch by Alexander Shishkin, resolves #20409
* eliminate warnings in compiler (i386 & i368->x86_64) and minor refactorings
    - comment out unused vars and types
    - comment out unneeded comparisons (Longword <=> 0)
    - suppress some "comparison always true|false" warnings
    - tweak visiblity sections

git-svn-id: trunk@19385 -
2011-10-05 20:11:09 +00:00
Jonas Maebe
c22394a9f4 * converted second_array_to_pointer() to thlcg
git-svn-id: branches/jvmbackend@18775 -
2011-08-20 08:34:51 +00:00
Jonas Maebe
7f22a2f223 + support for range checking calculations with hlcgobj
* added runerror number to JVM FpcRunTimeError exceptions
  * enabled calling errorproc when a run time error occurs on the
    JVM target

git-svn-id: branches/jvmbackend@18749 -
2011-08-20 08:32:31 +00:00
Jonas Maebe
979f55e1db + support for procedural variables for the JVM target
o every porocedural variable type is represented by a class with one
     public "invoke" method whose signature matches the signature of the
     procvar
   o internally, dispatching happens via java.lang.reflect.Method.invoke().
     WARNING: while this allows calling private/protected or other methods
     that are normally not accessible from another context, a security
     manger can override this. If such a security manager is installed,
     most procvars will cause security exceptions
   o such dispatching also requires that all arguments are wrapped, but
     that's done in the compiler-generated body of the invoke method,
     so that procvars can also be called conveniently from Java code
   o typecasting between a procedure of object and tmethod is supported,
     as well as Delphi-style replacing of only the method pointer via
     @procvar1=@procvar2.
   o nested procvars are not yet supported, but most of the basic
     infrastructure for them is already present
  * all units/programs now get an internal __FPC_JVM_Module_Class_Alias$
    type when compiled for the JVM target, which is an "external" class
    that maps to the unit name. This is required to look up the
    JLRMethod instances for regular functions/procedures
  + new tabstractprocdef.copyas() method that allows to create a procvar
    from a procdef and vice versa

git-svn-id: branches/jvmbackend@18690 -
2011-08-20 08:24:58 +00:00
Jonas Maebe
085d0efead * some fixes for fake procvar support
git-svn-id: branches/jvmbackend@18680 -
2011-08-20 08:24:02 +00:00
Jonas Maebe
6857dde33e + shortstring support for the JVM target (including accessing character 0 as
the "length byte")

git-svn-id: branches/jvmbackend@18570 -
2011-08-20 08:11:28 +00:00
Jonas Maebe
aa1f299a17 + added hook for "individual value to open array of one element"-conversion,
so it can be intercepted by the JVM backend (it has to create an actual
    array)
  + JVM support for the elem_2_open_array hook

git-svn-id: branches/jvmbackend@18561 -
2011-08-20 08:10:31 +00:00
Jonas Maebe
d1a1d30e04 * unless compiled with -dnounsupported, the compiler will now accept not
only JVM constructs that are already implemented, but also ones that
    will be supported in the future but that aren't implemented yet (to
    make it easier to already adapt code to the future changes)

git-svn-id: branches/jvmbackend@18498 -
2011-08-20 08:04:51 +00:00