Commit Graph

393 Commits

Author SHA1 Message Date
Jonas Maebe
aa1be3276f - removed default value of _typ parameter of TAsmData.(Weak)RefAsmSymbol():
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 -
2016-08-05 07:09:16 +00:00
Jonas Maebe
a0efde8167 * automatically generate necessary indirect symbols when a new assembler
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 -
2016-07-20 20:53:03 +00:00
Jonas Maebe
2bd2e03309 * no longer use the synthetickind field of a procdef to determine whether
it's an automatically generated getter/setter, but a procoption. This
    way we no longer have to save/restore the synthetickind procdef field
    to/from ppu's. This way we can modify the field also after the interface
    has been parsed without affecting the crc (e.g. when creating wrappers
    for high level targets for routines that are only declared as "external"
    in the implementation)

git-svn-id: trunk@34129 -
2016-07-14 15:25:30 +00:00
Jonas Maebe
f5e4265b1e * "push" zero-sized value parameters for LLVM and JVM, because all parameters
are part of the signature on those platforms (fixes e.g. tbs/tb0408.pp for
    LLVM)

git-svn-id: trunk@34128 -
2016-07-14 15:24:50 +00:00
Jonas Maebe
996e325175 * converted range checking for open arrays/array of const from the code
generator to the typecheck pass, so that it also works for platforms
    that use the parentfpstruct way to handle accesses to nested frames
    in case the array has been migrated to such a parentfpstruct
   o additionally, the number of comparisons for such range checks
     has been reduced from 3 (for signed indices) or 2 (for unsigned
     indices) to 1 in all cases
   o the range checking code is disabled for the JVM target, as the
     JVM automatically range checks all array accesses itself anyway

git-svn-id: trunk@34034 -
2016-06-30 15:33:47 +00:00
Jonas Maebe
531ce3be61 * fixed initialising an array of ansichar typed constant using a string
constant: directly encode the character values in the constant, rather
    than letting unicodestr_to_chararray handle the conversion (which
    implies a codepage conversion)

git-svn-id: trunk@33158 -
2016-03-05 15:32:18 +00:00
Jonas Maebe
74eb0de460 * fixed mangled names for nested procedures on the JVM platform after r32153
git-svn-id: trunk@33156 -
2016-03-05 15:31:51 +00:00
nickysn
e1f21fb1e3 + handle the asd_cpu directive (commented out, but without producing an internal
error) on all the remaining external assemblers, so it is safe to emit on all
  platforms

git-svn-id: trunk@33122 -
2016-02-26 20:50:41 +00:00
Jonas Maebe
49a83b2872 * allow targets to keep certain type conversions for equal types in
inserttypeconv()
   o keep typeconversions between structurally equivalent but semantically
     different procvardefs for LLVM and JVM, because they're different
     types there

git-svn-id: trunk@32904 -
2016-01-10 14:01:46 +00:00
Jonas Maebe
bf735c7e58 * cleanup
git-svn-id: trunk@32877 -
2016-01-07 22:04:44 +00:00
Jonas Maebe
8917633199 * implement sizeof/typeof completely at the node level, based on
loadvmtaddr and vmt_def
   o give an error when trying to use sizeof on a class/object when
     targeting the JVM (can't get/load the data size there)

git-svn-id: trunk@32764 -
2015-12-27 14:22:06 +00:00
Jonas Maebe
6735def16f * fixed jvm compilation after r32517
git-svn-id: trunk@32549 -
2015-11-29 21:45:47 +00:00
Jonas Maebe
c4b347c271 * support anonymous procvar definitions for jvm outside parameter lists (in a
parameter list they represent nested procvars, which aren't supported yet)

git-svn-id: trunk@32454 -
2015-11-22 10:52:20 +00:00
svenbarth
0ac12f0eaf Extend tstaticvarsym (and by extension tabstractnormalvarsym) with the capability to create it as unregistered if needed.
git-svn-id: trunk@32373 -
2015-11-20 11:15:30 +00:00
svenbarth
922646d106 Adjust tfieldvarsym (and by extension tabstractvarsym) so that it can be created as not registered if needed.
git-svn-id: trunk@32372 -
2015-11-20 10:43:25 +00:00
Jonas Maebe
fa3b0ca312 * support marking defs created via the getreusable*() class methods as
"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 -
2015-11-04 20:46:18 +00:00
Jonas Maebe
5f4ba2c227 * ensure that the tai is an instruction in PostPeepHoleOptsCpu before
casting as such

git-svn-id: trunk@32231 -
2015-11-04 20:46:02 +00:00
Jonas Maebe
2cea723a0d * only write the parts of the unit localsymtables that are actually needed:
the defs and syms (recursively) referred by inline routines and by the WPO
    info
   o defs and syms are no longer added immediately to the module's deflist/
     symlist, even if they are created as "registered". Instead,
     "doregister=true" simply means "add it to the symbol table at the
     top of the symtable stack"
   o normally only when a sym/def is deref'ed, it gets added to the module
     symlist/deflist and defid/symid gets a (unique) value
   o in cases where we use(d) the defid to construct unique names within the
     current module, you now have to call call the tdef.new unique_id_str()
     method. If the def was not yet registered, we will reserve room for it
     in the deflist (to get a unique id), but the defid gets set to a
     negative value computed from its position in the deflist. Should it
     have to be written to the ppu file later on, the defid will be
     modified to the actual position in the deflist. For both values,
     new unique_id_str() will return the same result so that references
     to this def before and after actual registrations are the same (needed
     for the JVM backend, but also a good principle in general)

   Overall: don't directly use symid/defid anymore to get unique identifiers,
     but use tdef.new unique_id_str() instead (if necessary, a similar routine
     for tsym can be added)

   The result is the ppu file size gets reduced significantly after its big
   increase as a result of the high level typed constant builder (which creates
   a lot of defs). The result is even more efficient than before, as other
   unneeded defs/syms from the localsymtables don't get saved/restored anymore
   either.

git-svn-id: trunk@32153 -
2015-10-25 19:22:00 +00:00
Jonas Maebe
d214ea56ee * filedef is an implicit pointer type on the JVM platform, since it's a
record

git-svn-id: trunk@31778 -
2015-09-22 19:59:40 +00:00
svenbarth
529677cc79 ncal.pas:
* 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 -
2015-09-18 14:48:54 +00:00
Jonas Maebe
06feac07a5 + support for the text/file types on the JVM platform
git-svn-id: trunk@31683 -
2015-09-15 11:51:19 +00:00
Jonas Maebe
b12bedb9f8 - disabled InsertResStrTablesTable and InsertResStrInits for the JVM target
(they were not functional, but now cause internalerrors due to
     invocations of the high level typed constant builder rather than their
     output gets ignored)

git-svn-id: trunk@31667 -
2015-09-13 19:06:25 +00:00
Jonas Maebe
f4c868b06a * fixed infinite Java assembler writer create loop after r31625
git-svn-id: trunk@31666 -
2015-09-13 19:06:22 +00:00
Jonas Maebe
0ea38852ac * fixed compilation of the jvm compiler after r31591 - r31593
git-svn-id: trunk@31665 -
2015-09-13 19:06:19 +00:00
Jonas Maebe
991e1f49bd * store a pointer to the used tasminfo record in every assembler writer, so
that we can use assembler writers with different conventions from the
    currently set target_asm (e.g. an x86 assembler writer for inline assembly
    in LLVM IR)

git-svn-id: trunk@31628 -
2015-09-12 23:32:13 +00:00
Jonas Maebe
b3d0197f98 * factored out the output file handling (mostly writing data) from the
external assembler writer, so we can reuse the archtecture-specific
    writers to write inline assembly in LLVM IR files

git-svn-id: trunk@31625 -
2015-09-12 23:32:01 +00:00
Jeppe Johansen
3cb9be73bc Moved tcontrollerdatatype out into cpuinfo.
Added cputype and fputype info to tcontrollerdatatype arrays.

git-svn-id: trunk@31574 -
2015-09-07 20:36:54 +00:00
Jonas Maebe
32c3f05522 + peepholeoptimizations to remove swap instructions
git-svn-id: trunk@31456 -
2015-08-29 21:06:29 +00:00
Jonas Maebe
dde8e323e0 * insert swap instructions if it results in store/regdealloc/load
sequences

git-svn-id: trunk@31455 -
2015-08-29 21:06:26 +00:00
Jonas Maebe
51864b0458 * skip temp (de)allocs when looking for store/regdealloc/load and
regalloc/regdealloc sequences

git-svn-id: trunk@31454 -
2015-08-29 21:06:23 +00:00
Jonas Maebe
8c8657e2d5 * base optimiser support for the JVM target
o jump threading only works for unconditional branches until now,
     as conditional ones have limited offsets

git-svn-id: trunk@31448 -
2015-08-29 10:08:19 +00:00
Jonas Maebe
0fc1fd6ac1 * replaced current_procinfo.currtrue/falselabel with storing the true/false
labels of LOC_JUMP in the node's location. This generates some extra jumps
    for short circuit boolean and/or-expressions if optimizations are off, but
    with optimisations enabled the generated code is the same (except for JVM
    because the jump threading optimisation isn't enabled there yet).

git-svn-id: trunk@31431 -
2015-08-27 18:28:57 +00:00
Jonas Maebe
e06181749c * guarantee the order of parameter pushes again after r31201 on platforms
that don't use a fixed stack (mantis #28454)
   o moved the code to finalise managed out parameters from ncgcal to ncal,
     and add it to the init code of the call node (so it's evaluated before
     any parameters are processed, ensuring that mantis #28390 stays fixed)

git-svn-id: trunk@31328 -
2015-08-16 12:47:09 +00:00
Jonas Maebe
f40ea04540 * changed getarraydef() into a tarraydef.getreusable() class method
git-svn-id: trunk@31147 -
2015-06-23 21:23:18 +00:00
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
3f736f6114 * handle the loading of VMT entries at the node level, so it's done in a
type-safe way (for LLVM, and also internal consistency checking between
    the VMT as generated in nobj.pas and ncgvmt.pas)
   o also converted the VMT validity checking to the node level

git-svn-id: trunk@30950 -
2015-05-31 16:50:47 +00:00
Jonas Maebe
703e31512d * moved JVM-specific code of tloadvmtaddrnode.pass_1 to njvmmem
* create separate nodes for Objective-C in tloadvmtaddrnode.pass_1
    instead of implicitly relying on the fact that the Objective-C
    ISA field is at the same offset as the VMT of Object-Pascal
    classes
   o translate the resulting loads of ISA field into direct pointer
     accesses, so that even on non-fragile ABI platforms we don't
     go via an indirection (like clang/gcc)

git-svn-id: trunk@30947 -
2015-05-31 16:50:39 +00:00
Jonas Maebe
edceff5756 * moved Jasmin assembler writer to jvm backend directory
git-svn-id: trunk@30838 -
2015-05-09 17:25:18 +00:00
florian
7dd1d6aa77 o fixes handling of iso i/o parameters/program parameters:
* explicit reset is needed
  * variable must be declared again

git-svn-id: trunk@30757 -
2015-05-01 20:58:31 +00:00
Jonas Maebe
3be51e1455 * fixed endless recursion in tabstractrecorddef.contains_float_field() in
case a record contains an internal typed constant of its own type
    (which happened becuase such a typed constant is also fieldvarsym, solved
     by checking for sp_static) (mantis #27880)
  * fixed several other similar cases in the compiler where we are only
    interested in instance fields, but processed all fieldvarsyms

git-svn-id: trunk@30614 -
2015-04-16 21:25:22 +00:00
Jonas Maebe
61e4a1b811 + added tasmlist parameter to getintparaloc() (needed for llvm)
git-svn-id: trunk@30429 -
2015-04-04 14:29:16 +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
2ab7f5c35d * moved x86-specific requirements from the generic bsr/bsf code to the
x86 code generator (register size constraints)

git-svn-id: trunk@29984 -
2015-02-23 22:57:18 +00:00
Jonas Maebe
a7d36de9ae * associate debug information for local variables with the second instead of
first java bytecode of a method, because when using javac for code
    completion (as done by NetBeans), it assumes that all variable debug info
    associated with the first byte code is for parameters. Furthermore, this
    code in javac contains a range error when a lot of extra "parameters" are
    declared this way, so it used to crash in some cases.

git-svn-id: trunk@29301 -
2014-12-16 20:52:46 +00:00
florian
5c67fcc43f + change always floating point divisions into multiplications if they are a power of two,
this is an exact operation so it is always allowed
* change only divisions by normal numbers into multiplications

git-svn-id: trunk@29085 -
2014-11-16 20:47:38 +00:00
Tomas Hajny
3ee3542744 * boolean constant instead of IFDEFs for detection of microcontroller support
git-svn-id: trunk@29052 -
2014-11-10 12:34:59 +00:00
Károly Balogh
b13ef4e3bb * fixed DFA warnings for JVM target
git-svn-id: trunk@28503 -
2014-08-20 15:48:42 +00:00
Jonas Maebe
9880b53242 * changed all alignment parameters in the temp manager to shortint
git-svn-id: branches/hlcgllvm@28489 -
2014-08-19 20:22:45 +00:00
Jonas Maebe
dd733bd5b5 * changed all size parameters in the temp manager from longint to asizeint
git-svn-id: branches/hlcgllvm@28488 -
2014-08-19 20:22:42 +00:00
Jonas Maebe
344acef9b5 * separate tracking the def of a temp and whether or not it needs to be
finalised (for llvm, we always keep track of the def)

git-svn-id: branches/hlcgllvm@28485 -
2014-08-19 20:22:34 +00:00