Commit Graph

18398 Commits

Author SHA1 Message Date
Jonas Maebe
e93660c170 - removed ttai_lowleveltypedconstbuilder.queue_addrn(), as we are always
implicitly taking the address of a complex expression in a typed constant
    (you cannot put the contents of another memory location in a typed
    constant)

git-svn-id: trunk@31252 -
2015-07-30 16:58:07 +00:00
Jonas Maebe
0e42559047 * support for queueing an access to a series of fieldvarsyms by name in the
typed const builder

git-svn-id: trunk@31251 -
2015-07-30 16:58:04 +00:00
Jonas Maebe
6f4fe415e9 * support specifying the alignment of the start of an anonymous record
in the typed const builder (packrecords is not enough in case there are
    only fields smaller than the desired alignment)

git-svn-id: trunk@31250 -
2015-07-30 16:58:01 +00:00
Jonas Maebe
6f5905684f + support for specifying the name of fields added to anonymous record
types that are constructed on the fly by the high level typed const
    builder

git-svn-id: trunk@31249 -
2015-07-30 16:57:58 +00:00
Jonas Maebe
b55c7df996 * factored out internal type prefixes
git-svn-id: trunk@31248 -
2015-07-30 16:57:55 +00:00
Jonas Maebe
413680f593 * factored out getting a previously created internal type by name
git-svn-id: trunk@31247 -
2015-07-30 16:57:52 +00:00
Jonas Maebe
ddeab221c0 * when starting a queued expression, immediately emit any necessary padding
bytes,becayse if we emit them at the end then we may interpret the first
    padding byte as the final component of the queued expression

git-svn-id: trunk@31246 -
2015-07-30 16:57:49 +00:00
Jonas Maebe
e34a16d1f1 * change rtti_mangledname resultdef into TSymStr
git-svn-id: trunk@31245 -
2015-07-30 16:57:45 +00:00
Jeppe Johansen
ffe67a93b4 Fix is_calljmp to include call instructions. This was breaking some optimizations previously.
Add debug messages to peephole optimizations and add some extra optimizations.

git-svn-id: trunk@31244 -
2015-07-30 06:29:21 +00:00
Jeppe Johansen
55669f62b1 Added most AVR controllers.
Made absolutevarsym use PUint instead of AWord for its offset to fix range errors.

git-svn-id: trunk@31242 -
2015-07-29 21:01:21 +00:00
florian
ee89e99189 * correctly write an error if one tries to implement a method introduced in a generic in a specialization of the generic, resolves issue #23169
git-svn-id: trunk@31241 -
2015-07-28 21:16:47 +00:00
florian
d014572b8e * do not use an extra register, if CPC does a comparison with 0,
this was previously "fixed" by the peephole optimizer, but this increased
  register pressure

git-svn-id: trunk@31239 -
2015-07-27 19:49:05 +00:00
florian
df999735f3 * use R1 in comparisons if left=0 instead of loading 0 into (a) register(s)
git-svn-id: trunk@31238 -
2015-07-27 19:49:03 +00:00
florian
4d3552943d * correctly write OUTPUT_ARCH to the linker script, resolves issue #28395
git-svn-id: trunk@31236 -
2015-07-27 19:49:00 +00:00
pierre
dc06f85b58 Set ALLOW_WARNINGSS to 1 for m68k and avr compiler to allow successful fullinstall completion
git-svn-id: trunk@31214 -
2015-07-15 15:27:27 +00:00
pierre
014d2f805d Use /libexec/ld-elf.so.2 as dynamic linker for DragonFly OS
git-svn-id: trunk@31210 -
2015-07-14 21:59:23 +00:00
pierre
960a72f821 Use AnsiString and sysutils GetEnvironmentVariable function to avoid truncation of PATH to 255 chars
git-svn-id: trunk@31202 -
2015-07-11 13:59:06 +00:00
Jonas Maebe
9118146bc1 * ensure that managed out-parameters are processed before any other
parameters:
   1) since they are finalised on the caller side, if that same value
      is passed as a value parameter as well and its reference count
      was 1, then the value parameter will contain an invalid pointer
   2) since finalisation involves a call, for optimal code generation
      purposes they should also be evaluated first
    (mantis #28279, #28390)

git-svn-id: trunk@31201 -
2015-07-10 22:04:35 +00:00
Jonas Maebe
5f21d6df93 * enable -godwarfsets by default
git-svn-id: trunk@31199 -
2015-07-07 17:12:31 +00:00
Jonas Maebe
945fd4fcf5 * wait till the end of typecheckpass before we load a call context's self
parameter instead of immediately doing it in the constructor of the call
  node, and then only create it if we actually need it.

  It was previously created in the call node constructor because it needs to be
  done before pass_1 (which is where it is actually used) due to pass_1 possibly
  being performed in the context of inlining (and then a wrong self parameter
  may be found, or none at all), and it was done unconditionally because at that
  point we don't know yet whether or not a self parameter will be necessary (as
  we haven't resolved the overloads/procdef yet).

  The problem with this is that if we use the parentfpstruct way of handling
  accesses to outer scope locals/parameters, we need to know all locals/
  parameters that will be accessed from nested routines after typecheckpass,
  otherwise we get crashes. The problem was that if a call to an RTL routine was
  generated by the compiler in a routine nested inside a method during pass_1,
  and this nested routine itself did not access self of the method (so self was
  not added to its parentfpstruct during the typecheckpass), then the
  unconditional reference to self when creating the call caused a compiler
  crash (introduced in r30908)

git-svn-id: trunk@31197 -
2015-07-07 16:34:14 +00:00
Jonas Maebe
5d15a28e75 - reverted workaround from r15939 that hasn't been necessary since FPC 2.6.0,
since that version already shiped with GNU AS 2.21 (mantis #17337)

git-svn-id: trunk@31196 -
2015-07-06 08:05:37 +00:00
florian
ba1297b1ab + provide also 8 and 16 bit div/mod helper
* tmoddivnode.first_moddivint does not force a 32 bit helper, the used helper depends now on the resultdef type set by tmoddivnode.pass_typecheck

git-svn-id: trunk@31195 -
2015-07-05 20:16:50 +00:00
florian
cf64e05c6f * use generic mod/div code for avr
git-svn-id: trunk@31194 -
2015-07-05 17:05:43 +00:00
Jonas Maebe
af2c7bf00f * don't perform CSE on typeconversion nodes inserted for absolute
references, or anything below them (mantis #27210)

git-svn-id: trunk@31193 -
2015-07-04 22:28:31 +00:00
Jonas Maebe
1bcc276dcf * remove implicit typecast to extended automatically inserted for trunc/round
(due to the declaration in the system unit) on x86_64 if this allows us
    to use SSE code instead (mantis #28366)

git-svn-id: trunk@31192 -
2015-07-03 21:01:18 +00:00
Jonas Maebe
fa1ac2515e * don't look for overloaded operators in case of internally generated
type conversions (mantis #28375)

git-svn-id: trunk@31191 -
2015-07-03 20:19:48 +00:00
Jonas Maebe
ee87d3bba9 * fixed "case <string> of" with multiple labels for a single statement after
r30855 (mantis #28372)

git-svn-id: trunk@31190 -
2015-07-03 20:04:25 +00:00
Jonas Maebe
e9d2eb6cff * fixed a_load_reg_reg() when storing an array/record to another
array/record type (can happen for parameters/function results
    that got a different type for ABI reasons)

git-svn-id: trunk@31189 -
2015-07-03 20:04:22 +00:00
Jonas Maebe
36e5291d94 * converted tcgguidconstnode.pass_generate_code to use the high level typed
constant builder

git-svn-id: trunk@31188 -
2015-07-03 20:04:18 +00:00
Jonas Maebe
7a8b5fd6c5 * several fixes for emitting aggregate typed constants with C/ABI packing:
o don't emit explicit padding bytes (LLVM adds them)
   o don't mark them in LLVM as packed either

git-svn-id: trunk@31187 -
2015-07-03 20:04:15 +00:00
Jonas Maebe
4edb6e68fd * fixed emitting Pascal extended typed constants inside aggregates for llvm
(have to be emitted as arrays of bytes to ensure they don't take up
     more than 10 bytes)

git-svn-id: trunk@31186 -
2015-07-03 20:04:11 +00:00
Károly Balogh
0d1c85a095 Amiga-likes: support unit_env environment variable for unit paths
git-svn-id: trunk@31180 -
2015-06-29 21:42:40 +00:00
Károly Balogh
a5abd4acd7 AROS/x86_64: fixed resources to use res_elf, set default stacksize for the more sensible 1MB instead of 8MB
git-svn-id: trunk@31179 -
2015-06-29 21:30:53 +00:00
Károly Balogh
02b9b1743e AROS/x86_64: fixed linker support by removing duplicated code and unifying it with i386
git-svn-id: trunk@31178 -
2015-06-29 21:28:51 +00:00
Károly Balogh
77bdd83bfc AROS/x86_64: regenerated Makefiles
git-svn-id: trunk@31177 -
2015-06-29 00:09:06 +00:00
Károly Balogh
f0ccbc87f2 AROS/x86_64: enable syscalls code in the parser, fix EAX->RAX reference base while calculating syscall offset
git-svn-id: trunk@31172 -
2015-06-28 23:04:51 +00:00
florian
af6ffd751f + generate optimized code for shifts/rotates by constants
git-svn-id: trunk@31170 -
2015-06-28 20:28:51 +00:00
Károly Balogh
7ca62febcd AROS/x86_64: initial AROS/x86_64 support and implement syscalls for AROS/x86_64
git-svn-id: trunk@31169 -
2015-06-28 19:16:40 +00:00
Jonas Maebe
7866bae173 * don't crash when trying to access the call_self_node in case it doesn't
exit, but instead give an error (bug introduced in r30950, mantis #28338)

git-svn-id: trunk@31150 -
2015-06-23 21:23:29 +00:00
Jonas Maebe
b21610050f * don't store reusable defs based on other defs from localsymtables into the
static/globalsymtable. The static/global symtable is stored to the PPU
    while the localsymtables are not, which means we get dangling references
    when reloading such defs from the ppu afterwards

git-svn-id: trunk@31149 -
2015-06-23 21:23:25 +00:00
Jonas Maebe
508828958c * changed getprocaddressprocvar() into a tprocvardef.getreusableprocaddr()
class method

git-svn-id: trunk@31148 -
2015-06-23 21:23:22 +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
marco
8d145ce706 * initialize secalign before case statement to avoid warning. Mantis #28326
git-svn-id: trunk@31145 -
2015-06-22 11:48:42 +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
62784ef902 * copy the vmt_entry node in tcallnode.dogetcopy (mantis #28313)
o mention why it doesn't have to be compared in tcallnode.docompare

git-svn-id: trunk@31071 -
2015-06-16 21:24:55 +00:00
Jonas Maebe
d60f60154a * fixed the def used to load non-objc loadvmtaddr nodes (for llvm)
git-svn-id: trunk@31064 -
2015-06-13 22:48:48 +00:00
Jonas Maebe
3597e710b6 * fixed several VMT element types to correspond to the types used to
construct the VMT def in the VMT builder in r30950

git-svn-id: trunk@31063 -
2015-06-13 22:48:46 +00:00
Jonas Maebe
4c11d34169 * fixed loading the address of the string data of an ansi/unicodestring
constant in the llvm code generator (the constant is a record rather than
    a pointer to a record -> not indirect)

git-svn-id: trunk@31062 -
2015-06-13 22:48:43 +00:00
Jonas Maebe
b176ed9f80 * ensure that the llvmst is initialised before using a field's llvmfieldnr
(and at the same time take advantage of this to perform a sanity check)

git-svn-id: trunk@31061 -
2015-06-13 22:48:40 +00:00
Jonas Maebe
89c4bd8522 * index the llvm shadow symtable with a fieldvarsym rather than with the
index of the corresponding llvm fieldvar, as this index is a member
    of the fieldvarsym that only gets initialised once the llvm shadow
    symtable gets built, which in turn is triggered by trying to access
    it for the first time -> if fieldvarsym.llvmfieldnr got loaded by
    the compiler before evaluating the llvmst expression and if the
    llvmst hadn't been built yet, this llvmfieldnr was not yet initialized

git-svn-id: trunk@31060 -
2015-06-13 22:48:37 +00:00
Jonas Maebe
494206fd6a * use queue_is_active() method to determine whether the complex typed
expression queue is active rather than the existing ad hoc check,
    which failed when no item had been added to the queue yet

git-svn-id: trunk@31059 -
2015-06-13 22:48:34 +00:00
Jonas Maebe
8d0c5ecf5a * added protected queue_is_active() function to determine whether the
complex typed constant expressions queue is currently active

git-svn-id: trunk@31058 -
2015-06-13 22:48:31 +00:00
Jonas Maebe
bcd04953c2 * fixed open array constructors for llvm
git-svn-id: trunk@31057 -
2015-06-13 22:48:28 +00:00
Jonas Maebe
b9d4d9b141 * corrected type passed to a_bit_test_reg_loc_reg() (we force left into
a register of size opdef before)

git-svn-id: trunk@31056 -
2015-06-13 22:48:26 +00:00
Jonas Maebe
9175809d5d * use correct llvm type conversion operator when loading a "named register"
with a pointer value into an integer register or vice versa

git-svn-id: trunk@31055 -
2015-06-13 22:48:23 +00:00
Jonas Maebe
cf2e46c2c1 * reworked external symbol handling on llvm to deal with the fact that
a single external symbol may be used with multiple declarations that
    have different types:
   o always declare an alias with the Pascal-mangled name that aliases the
     external symbol, with the type of that Pascal declaration
   o if the external symbol is not actually external but in the same unit,
     we will determine the type of that symbol via its declaration and
     insert type conversions in the alias declarations in case they use a
     different type
   o if it is external (so there is no declaration from which we can determine
     its real type) and there are nevertheless multiple aliases for it with
     different types, we just take the type of the first alias and insert
     type conversions for the other aliases. LLVM will take care of the
     conflicting types in multiple modules when performing WPO if necessary

git-svn-id: trunk@31054 -
2015-06-13 22:48:20 +00:00
Jonas Maebe
b39bc5888a * moved the import name handling entirely to hlcgobj so it can be
overridden

git-svn-id: trunk@31053 -
2015-06-13 22:48:17 +00:00
Jonas Maebe
54dd25b448 * support llvm aliases for defs other than procdef
git-svn-id: trunk@31052 -
2015-06-13 22:48:14 +00:00
Jonas Maebe
4eea652576 * fixed writing non-default linkage and visibility of llvm alias declarations
git-svn-id: trunk@31051 -
2015-06-13 22:48:11 +00:00
Jonas Maebe
1019a6b090 * use the def of the paraloc rather than the parasym's vardef in
gen_load_para_value(), as this may be different depending on
    the calling conventions
  * adapt llvm's gen_load_cgpara_loc() to use this passed def rather
    than hardcoding the para's def (although these will normally match)

git-svn-id: trunk@31050 -
2015-06-13 22:48:08 +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
2cdf969649 * don't define asmsymbols for weak external functions as local/global
git-svn-id: trunk@31048 -
2015-06-13 22:48:02 +00:00
Jonas Maebe
75a6ba4113 - removed symcpu dependencies
git-svn-id: trunk@31047 -
2015-06-13 22:47:59 +00:00
Jonas Maebe
ab0d445999 * fixed truncation errors for a*int/word in ppudump for architectures
> 32 bits

git-svn-id: trunk@31046 -
2015-06-13 22:47:56 +00:00
Jonas Maebe
acd88cac92 * fixed selection of startup code files for all iOS and simulator targets
o in particular fixes linking for the iPhoneSimulator 8.3 and later on
     i386

git-svn-id: trunk@31045 -
2015-06-13 22:47:53 +00:00
florian
c0dd2047f9 * cosmetics, entries are now properly aligned
git-svn-id: trunk@31039 -
2015-06-13 16:55:36 +00:00
florian
919c539ff5 * better estimation of callparanode complexity
git-svn-id: trunk@31038 -
2015-06-13 16:50:55 +00:00
Jeppe Johansen
ab9c8bb569 Fixed startup assembler code for the case where there's no data in .bss and/or in .data.
Fixed _stack_top symbol calculation so it works for all controllers.
Added ATTINY2313 controller.

git-svn-id: trunk@31031 -
2015-06-13 12:30:50 +00:00
Jeppe Johansen
03880c2f74 Added some peephole optimizations, and fixed generic unconditional jump optimizations, for AVR.
Fixed multiplication code generation for AVR controllers without mul instructions.
Added handling of the old interrupt procedure directive such that procedures with that use RETI instead of RET.

git-svn-id: trunk@31030 -
2015-06-13 12:25:11 +00:00
Jeppe Johansen
c5b24c5ce3 Changed cast to allow more loop iterations than the native bit-ness of the architecture.
git-svn-id: trunk@31029 -
2015-06-13 12:20:12 +00:00
florian
b1147ba1b7 + OpCmp2Op optimization for AVR
git-svn-id: trunk@31013 -
2015-06-09 21:06:37 +00:00
Károly Balogh
0dafa78d27 ppudump: made it compile with -Sew by turning off unreachable code warning for Real80BitToStr() function
git-svn-id: trunk@31010 -
2015-06-07 23:59:24 +00:00
Károly Balogh
21329e6606 Amiga: enable using of external resources we have no internal resource support yet for Amiga Hunk executables
git-svn-id: trunk@31007 -
2015-06-07 18:07:06 +00:00
Károly Balogh
8a09c5f40d MorphOS: register ELF resources info
git-svn-id: trunk@31004 -
2015-06-07 17:37:22 +00:00
Károly Balogh
8e3ebb87cd use res_elf on MorphOS for resources
git-svn-id: trunk@31003 -
2015-06-07 16:42:32 +00:00
nickysn
318874837f + implemented 16-bit dos MZ exe header writer
git-svn-id: trunk@31002 -
2015-06-07 14:31:02 +00:00
nickysn
2c1049b5d4 + read the LEDATA omf records (i.e. the actual section data)
git-svn-id: trunk@30975 -
2015-06-04 23:03:22 +00:00
nickysn
d0d3cef868 + implemented reading of omf extdef (external symbols) records
git-svn-id: trunk@30973 -
2015-06-03 13:07:48 +00:00
Jeppe Johansen
db6093023b Fixed initialization code for MK20D7 controllers.
Added flash configuration section to RTL and linker script.

git-svn-id: trunk@30972 -
2015-06-02 22:59:03 +00:00
nickysn
096743d74d + also read the omf segment size and set objsec.Size
git-svn-id: trunk@30971 -
2015-06-01 23:31:53 +00:00
nickysn
1cae939615 + implemented parsing of omf group definitions as well
git-svn-id: trunk@30970 -
2015-06-01 23:03:48 +00:00
nickysn
5539d6366f + implemented reading of SEGDEF omf records
git-svn-id: trunk@30969 -
2015-06-01 21:28:55 +00:00
nickysn
28f7f16fc7 + implemented reading of the LNAMES omf record
git-svn-id: trunk@30968 -
2015-06-01 14:25:51 +00:00
nickysn
be57d4900d + started implementing TOmfObjInput.ReadObjData - we go through the expected
records and read them (without parsing them yet) and verify their checksums

git-svn-id: trunk@30965 -
2015-05-31 22:32:54 +00:00
florian
9216e561e2 + make use of sbi/cbi
git-svn-id: trunk@30964 -
2015-05-31 21:11:53 +00:00
florian
a3553a7320 + adds missing ct_atmega168 and ct_atmega368 symbols, thanks to mischi
git-svn-id: trunk@30960 -
2015-05-31 17:59:39 +00:00
Jonas Maebe
337716d413 * fixed subscripting classes in llvm
* fixed subscripting an objectdef in llvm if the field belongs to a
    parent type

git-svn-id: trunk@30957 -
2015-05-31 16:51:07 +00:00
Jonas Maebe
6c5f1327f4 * generate the correct llvm type description for classrefdef
git-svn-id: trunk@30956 -
2015-05-31 16:51:04 +00:00
Jonas Maebe
dd3d0ae5bc * set the type of the hidden $vmt parameter to the correct classrefdef and
adjust the parameter comparison code to ignore types of $vmt parameters
    when comparing (previously they were all voidpointer and hence also
    equal)

git-svn-id: trunk@30955 -
2015-05-31 16:51:02 +00:00
Jonas Maebe
e9800ad3f9 * make the resultdef of left and right equal when comparing a procvar
with nil (for llvm)

git-svn-id: trunk@30954 -
2015-05-31 16:50:59 +00:00
Jonas Maebe
0d00c1a19d * fixed type used when subscripting implicit pointer types (don't add
another indirection)

git-svn-id: trunk@30953 -
2015-05-31 16:50:56 +00:00
Jonas Maebe
a0a77f3105 * suppress (harmless) range error
git-svn-id: trunk@30951 -
2015-05-31 16:50:50 +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
822b943d08 - removed most special handling of self (the self parameter has had the
correct type since quite a while)
   o exceptions:
    o objects/records (self is a "var" parameter there, and sometimes
      we want to load it as a pointer to an object instead
    o Objective-C class methods, where self has to be id (to have a signature
      compatible with what Objective-C compilers generate), but when loading
      it we want a classrefdef of the current class for type check and
      method resolving

git-svn-id: trunk@30949 -
2015-05-31 16:50:44 +00:00
Jonas Maebe
fa9ba26cb4 * fixed the type of self in Objective-C category methods
git-svn-id: trunk@30948 -
2015-05-31 16:50:42 +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
033c28e5ac * removed unnecessary and potentially wrong typecast
git-svn-id: trunk@30946 -
2015-05-31 16:50:36 +00:00
Jonas Maebe
48ffe7b033 * don't create RTTI for internally generated recorddefs (doing so can cause
undefined references to RTTI for some of the fields, and we don't need
    it anyway because these types are not user-visible and we don't generate
    variables of these types)

git-svn-id: trunk@30945 -
2015-05-31 16:50:33 +00:00
Jonas Maebe
0eab091e1a * factored symansistr-define-conditional handling of fforcedprocname into
a property

git-svn-id: trunk@30944 -
2015-05-31 16:50:30 +00:00
florian
cf552b2a0b + ATmeag168/ATmeag368 support
git-svn-id: trunk@30938 -
2015-05-30 18:01:14 +00:00
florian
0cd521fc8b + ATmega48/ATmega88 support
git-svn-id: trunk@30937 -
2015-05-30 17:55:49 +00:00
florian
aadcf9f6bc * do not convert JMP into RJMP in assembler blocks, resolves issue #280208
git-svn-id: trunk@30936 -
2015-05-30 16:17:24 +00:00
florian
d58d7b7838 * fixes breakage of r30930 (+ ATtiny24/ATtiny44/ATtiny84 support)
git-svn-id: trunk@30932 -
2015-05-28 21:15:00 +00:00
florian
0f73675354 + ATtiny24/ATtiny44/ATtiny84 support
git-svn-id: trunk@30930 -
2015-05-28 21:10:39 +00:00
Jeppe Johansen
36dfe750d8 Added Freescale MK20D7 controller support.
git-svn-id: trunk@30925 -
2015-05-28 11:46:22 +00:00
Jonas Maebe
ca5addff8e * fixed memory leaks introduced in r30908
git-svn-id: trunk@30911 -
2015-05-25 15:10:16 +00:00
Jonas Maebe
0f99ae82af * increased ppu version after r30907
git-svn-id: trunk@30910 -
2015-05-25 13:04:36 +00:00
Jonas Maebe
caea5ac8be * record a load node for the self/vmt tree of the current routine in the
tcallnode constructor, so that when it's needed later during pass 1,
    its value doesn't depend on the context in which pass 1 is executed
    (e.g. when inlining) (mantis #18121)

git-svn-id: trunk@30908 -
2015-05-25 12:55:40 +00:00
Jonas Maebe
6c3f1c3722 * stop tcallnode.pass_1 after we've detected a direct call to a helper/
category method, as this may lead to an internalerror later on after
    the following commits

git-svn-id: trunk@30907 -
2015-05-25 12:55:37 +00:00
Jonas Maebe
f51b11e969 * implemented tcallnode.create_procvar on top of tcallnode.create
git-svn-id: trunk@30906 -
2015-05-25 12:55:34 +00:00
Jonas Maebe
e02e742997 * removed OS check when loading the address of a symbol on AArch64, it's
probably the same everywhere

git-svn-id: trunk@30900 -
2015-05-24 16:50:13 +00:00
Jonas Maebe
3c8068ad0b + Aarch64 support in the fpc binary (patch by Edmund Grimley Evans)
git-svn-id: trunk@30894 -
2015-05-22 09:25:08 +00:00
Jonas Maebe
8628d50aba + Linux/AArch64 compiler support (patch by Edmund Grimley Evans)
git-svn-id: trunk@30893 -
2015-05-22 09:25:05 +00:00
Jonas Maebe
89418d23e5 * regenerated Makefiles with Linux/AArch64 support
git-svn-id: trunk@30891 -
2015-05-20 20:15:10 +00:00
Jonas Maebe
b5081d76c6 * since we insert the internal ansistring record types in the symtable of
the current module, also search it only there so that it doesn't depend
    on the state of the symtablestack (hopefully fixes mantis #28109)

git-svn-id: trunk@30879 -
2015-05-17 18:11:13 +00:00
florian
b4fc11fe06 * implemented r30870 for all platforms: pass dyn. array parameters like pointer parameters so typically in a register
git-svn-id: trunk@30878 -
2015-05-17 12:29:28 +00:00
florian
b61fd60b9d + support for {$I %CURRENTROUTINE%}
* if chain changed into case statements

git-svn-id: trunk@30873 -
2015-05-16 22:22:26 +00:00
florian
afa5546ff8 * aktcommentstyle => current_commentstyle
git-svn-id: trunk@30872 -
2015-05-16 21:57:01 +00:00
florian
420309ec59 * reduce dependencies of the procinfo unit
git-svn-id: trunk@30871 -
2015-05-16 21:49:42 +00:00
florian
956883b0c7 * pass dyn. arrays in registers when i386 register calling conventions are used
git-svn-id: trunk@30870 -
2015-05-16 20:27:09 +00:00
nickysn
8515160e9d + set CObjData in the TMZExeOutput constructor
git-svn-id: trunk@30866 -
2015-05-15 22:35:32 +00:00
nickysn
27f77329e7 - removed agjasmin.pas from the ppc8086.lpi (plus other changes lazarus insists on doing)
git-svn-id: trunk@30865 -
2015-05-15 22:27:35 +00:00
nickysn
29a1c74e34 + implemented TOmfObjInput.CanReadObjData
git-svn-id: trunk@30864 -
2015-05-15 22:23:30 +00:00
nickysn
91d3cb1cd0 + initial implementation of TInternalLinkerMsDos.DefaultLinkScript
git-svn-id: trunk@30863 -
2015-05-15 22:22:36 +00:00
Jonas Maebe
ac592ed634 - removed some more unnecessary code after r30855
git-svn-id: trunk@30857 -
2015-05-14 17:44:37 +00:00
Jonas Maebe
bd8079f896 * cache and reuse procvardefs internally created to get the address of a
procdef (halves the amount of memory needed to compile the googlapi
    package using a build unit, as done by fpmake)

git-svn-id: trunk@30856 -
2015-05-14 15:36:20 +00:00
Jonas Maebe
801fc50e86 * simplified "case stringexpr of" handling and removed memory leaks due to
symbols that weren't put in any symbol table (and that couldn't be put
    anywhere, since they all had the same name)

git-svn-id: trunk@30855 -
2015-05-14 14:42:38 +00:00
Jonas Maebe
32501834c9 * fixed memory leaks due to missing frees of temporary tcgpara locations
git-svn-id: trunk@30854 -
2015-05-14 14:42:35 +00:00
Jonas Maebe
ce49f5fb41 * fixed memory leak due to double allocation of typedconstbuilder and wrong
free location

git-svn-id: trunk@30853 -
2015-05-14 14:42:32 +00:00
Jonas Maebe
d7412fb5c0 * fixed memory leaks and multiple recalculation regarding function result
locations

git-svn-id: trunk@30852 -
2015-05-14 14:42:28 +00:00
Jonas Maebe
9ceddf9b16 * fix tasmlisttypedconstbuilder memory leaks
git-svn-id: trunk@30851 -
2015-05-14 14:42:25 +00:00
Jonas Maebe
93fcdb9a5a * fixed initialisation of procvar typed const with a pointerconstn:
we start a typeconversion queue before, so we have to emit to that
    queue as well (to get all the type conversions)

git-svn-id: trunk@30850 -
2015-05-14 14:42:22 +00:00
Jonas Maebe
d71f6e9840 - removed extraneous maybe_begin_aggregate() when a procvar is initialised
with a pointerconstn, and moved the maybe_end_aggregate() for all procvar
    initialisation cases to a common location

git-svn-id: trunk@30849 -
2015-05-14 14:42:19 +00:00
Jonas Maebe
1e7fcec236 * build mka64ins by default in the compiler/utils directory (patch by
Edmund Grimley Evans)

git-svn-id: trunk@30848 -
2015-05-14 14:42:15 +00:00
Jonas Maebe
585e4a9a14 * corrected cosmetic ARM/AArch64 copy/paste leftovers (patch by
Edmund Grimley Evans)

git-svn-id: trunk@30847 -
2015-05-14 14:42:12 +00:00
Jonas Maebe
7395058cf3 * recognise tb(n)z as branch opcode (patch by Edmund Grimley Evans)
git-svn-id: trunk@30846 -
2015-05-14 14:42:03 +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
Jonas Maebe
95b900911c - removed outdated script
git-svn-id: trunk@30837 -
2015-05-09 17:25:14 +00:00
Jonas Maebe
a04cae2c4b - removed partial Alpha, IA64 and vis backends since they were never nor
will likely ever be finished

git-svn-id: trunk@30836 -
2015-05-09 17:25:11 +00:00
Jonas Maebe
1b43930749 - removed long deprecated/buggy assembler cse optimiser for i386
o bumped ppu version because optimiser settings can be embedded in generic
     token streams

git-svn-id: trunk@30835 -
2015-05-09 17:25:07 +00:00
nickysn
3b288554e7 + more msdos internal linker classes added
git-svn-id: trunk@30811 -
2015-05-06 14:49:07 +00:00
nickysn
93ec811c97 + created the msdos internal linker class (empty for now)
git-svn-id: trunk@30810 -
2015-05-06 13:45:39 +00:00
nickysn
ced1368221 * fixed emitting of RELOC_SEG and RELOC_SEGREL relocations within the same
section in the omf internal obj writer

git-svn-id: trunk@30809 -
2015-05-06 10:40:38 +00:00
nickysn
328a4fa19a + optimization: don't emit relative relocation entries to the same section in
the omf obj writer

git-svn-id: trunk@30808 -
2015-05-06 10:05:15 +00:00
nickysn
b17087a645 - removed debug writelns after r30800
git-svn-id: trunk@30802 -
2015-05-04 17:13:17 +00:00
nickysn
f1252d7582 - removed unnecessary setting of TargetMethod and TargetDatum (since these are
always set in the following 'if' statement) in TOmfRelocation.BuildOmfFixup

git-svn-id: trunk@30801 -
2015-05-04 17:11:02 +00:00
nickysn
0da38dbc79 + implemented support for the 'dgroup' (addr_dgroup) relocation type in the omf
internal object writer

git-svn-id: trunk@30800 -
2015-05-04 17:07:19 +00:00
nickysn
37840bc811 - removed commented out debug code from TOmfObjData.writeReloc
git-svn-id: trunk@30799 -
2015-05-04 16:24:28 +00:00
Jonas Maebe
6e5af0b31e * don't replace classrefdef with i64 in parameter locations (so llvm can use
the type information)

git-svn-id: trunk@30787 -
2015-05-03 16:51:23 +00:00
Jonas Maebe
fb8c61889b * when getting a copy of a special procdef (such as a con/destructor) as a
procvardef, change the proctype into a regular procedure/function,
    because there are no "con/destructor procvar" types and there is code
    in the paramanager that expects e.g. a constructor to be always owned by an
    abstractrecorddef (which is not necessarily the case for the created
    procvardefs)

git-svn-id: trunk@30786 -
2015-05-03 16:51:20 +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
8034ef1f31 * support for dynamic strings and arrays in update_reference_reg_mul()
git-svn-id: trunk@30784 -
2015-05-03 16:51:13 +00:00
Jonas Maebe
eae68e86a1 * don't insert a typeconversion from pasbool to int in case the left
location was LOC_JUMP or LOC_FLAGS, as in that case the generic
    code has already done this using location_force_reg()

git-svn-id: trunk@30783 -
2015-05-03 16:51:10 +00:00
Jonas Maebe
8f1fb60f61 * also collect the llvm type info from the initialisation data of typed
constants

git-svn-id: trunk@30782 -
2015-05-03 16:51:06 +00:00
Jonas Maebe
74da8720c5 * insert type conversions in case a symbol is declared via 'external' as an
alias for another symbol with a different type (such as
    FPC_ANSISTR_UNIQUE, which is defined as a function and referenced as a
    procedure)

git-svn-id: trunk@30781 -
2015-05-03 16:51:02 +00:00
Jonas Maebe
65bcfdc42d * support changing the tai field of a tai_simpletypedconst afterwards,
so we can insert type conversions in llvmtype if necessary

git-svn-id: trunk@30780 -
2015-05-03 16:50:58 +00:00
Jonas Maebe
d546e74d1c * don't write newlines after nested taillvm instructions (since they're
embedded in the middle of another instruction)

git-svn-id: trunk@30779 -
2015-05-03 16:50:55 +00:00
Jonas Maebe
4a5b7b7d50 * once we've defined a symbol as an alias, it's declared to the same extent
as a regular symbol definition

git-svn-id: trunk@30778 -
2015-05-03 16:50:51 +00:00
Jonas Maebe
8234fcd229 * implemented thlcgllvm.g_external_wrapper by just declaring the new symbol
as an alias for the old one (rather than creating an interprocedural
    jump, which is not possible in llvm IR and which is less efficient
    anyway) (declaration for this method was already accidentally committed
    in r30722)

git-svn-id: trunk@30777 -
2015-05-03 16:50:47 +00:00
Jonas Maebe
72277f5098 * store the used tabstractprocdef when generating an llvm call instruction,
because due to aliasing symbols a single symbol may be called using
    different procdefs (e.g. FPC_ANSISTR_UNIQUE in the system unit is defined
    as an alias for a function and called as a procedure). This means we have
    to insert extra type conversions for llvm, which requires both the source
    and destination type

git-svn-id: trunk@30776 -
2015-05-03 16:50:43 +00:00
Jeppe Johansen
6662cb6dd5 ARMv6M was missing alignments for jumptables
git-svn-id: trunk@30775 -
2015-05-03 16:16:32 +00:00
nickysn
7849ffecf7 + implemented TOmfLibObjectReader.openfile
git-svn-id: trunk@30773 -
2015-05-03 10:56:09 +00:00
nickysn
3b56a5a767 + implemented reading of the omf dictionary
git-svn-id: trunk@30772 -
2015-05-03 10:27:56 +00:00
florian
f5edf77a05 + Atmega8 support
git-svn-id: trunk@30768 -
2015-05-02 18:18:00 +00:00
florian
9f587625e7 + handle not and neg in isFoldableArithOp as well
git-svn-id: trunk@30767 -
2015-05-02 17:20:20 +00:00
florian
b222d0b663 * correctly handle LOC_SUBSETREG,LOC_CSUBSETREG,LOC_SUBSETREF,LOC_CSUBSETREF in second_int_to_bool, resolves issue #28007
git-svn-id: trunk@30765 -
2015-05-02 13:52:50 +00:00
florian
f2a5672355 * Update of German error message files by Karl-Michael Schindler, resolves issue #28010
git-svn-id: trunk@30763 -
2015-05-02 13:34:03 +00:00
nickysn
74c74b6a88 * call ArSymbols.Free instead of .Destroy in the tarobjectreader destructor
(because .destroy will cause a crash in case the object hasn't been
  initialized)

git-svn-id: trunk@30762 -
2015-05-02 10:50:29 +00:00
nickysn
5160c8f0a3 + started the omf library object reader
git-svn-id: trunk@30761 -
2015-05-02 10:32:08 +00:00
florian
9a5b458d4e * allocate registers properly before icall
* use emit_mov to load registers before icall

git-svn-id: trunk@30758 -
2015-05-02 08:02:17 +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
florian
d1e48b0f71 * correctly handle parameters on the stack with OS_NO
git-svn-id: trunk@30756 -
2015-05-01 17:14:07 +00:00
florian
d3fbfa225f * fixes ordinal comparisons with constants
git-svn-id: trunk@30751 -
2015-05-01 16:30:21 +00:00
florian
cfa68be55b * do not use 16 Bit mul helper on avr, the code generator generates
muls and adds. For simple cases this might be cause longer code than a call to a well crafted assembler helper
  but inlining the muls/adds makes register allocation more flexible

git-svn-id: trunk@30739 -
2015-04-27 20:51:32 +00:00
florian
e56d8d1c96 * fix mov rX,...; mov rX,... optimization, hp1 needs to be checked if it is really an instruction, resolves issue #27975
git-svn-id: trunk@30738 -
2015-04-27 20:36:53 +00:00
florian
3282ff0506 + remove dead moves, resolves issue #27842
git-svn-id: trunk@30735 -
2015-04-26 20:13:09 +00:00
florian
bd6c6d83f8 + do cse on length as well
git-svn-id: trunk@30734 -
2015-04-26 20:11:45 +00:00
Jeppe Johansen
b6729a8f0b Workaround for IE 20060521 when building the ARM compiler
git-svn-id: trunk@30733 -
2015-04-26 20:10:57 +00:00
florian
5c8d0d87cd o better code generation for avr:
* omit entry/exit code, if no frame pointer is used, partly fixes issue #27842
  * take advantage of adiw/sbiw
  * make more often use of ldd/std

git-svn-id: trunk@30732 -
2015-04-26 19:39:43 +00:00
florian
634a25d9f6 * cosmetics
git-svn-id: trunk@30731 -
2015-04-26 19:35:32 +00:00
florian
d180187a48 + DEBUG_AGGAS: tais like tai_marker are written as comments
git-svn-id: trunk@30730 -
2015-04-26 17:19:30 +00:00
florian
652f623983 * mulsu opcode spelling fixed
* handling mulsu in taicpu.spilling_get_operation_type

git-svn-id: trunk@30729 -
2015-04-26 16:08:52 +00:00
florian
40dc34b9d8 * several issues with the avr instruction table fixes, resolves issue #27963
git-svn-id: trunk@30727 -
2015-04-25 21:33:19 +00:00
florian
01cbf00455 * unified code to remove unnecessary type casts to support also removals of type conversions between smaller ints
* get rid of unnecessary 8->16 Bit type conversions on 8 Bit CPUs, resolves issue #27839

git-svn-id: trunk@30726 -
2015-04-25 21:18:34 +00:00
Jonas Maebe
e3ddf1c0b7 * fixed typos in error.msg (patch by Stéphane Aulery, mantis #27931)
git-svn-id: trunk@30725 -
2015-04-25 18:15:18 +00:00
Jonas Maebe
49aef02ef2 * fixed register size of uxtb in case of a 64 bit scan operation
(mantis #27954)

git-svn-id: trunk@30724 -
2015-04-25 16:36:45 +00:00
Jonas Maebe
864f9b24cc * handle indexing implicit pointer types on llvm
git-svn-id: trunk@30723 -
2015-04-25 15:51:39 +00:00
Jonas Maebe
98c5f7d20f * simplify references before generating getelementptr instructions with them
git-svn-id: trunk@30722 -
2015-04-25 15:51:36 +00:00
Jonas Maebe
78e68b89df * gen_load_cgpara_loc() should only honour reusepara if it's a memory
parameter

git-svn-id: trunk@30721 -
2015-04-25 15:51:33 +00:00
Jonas Maebe
03a3136525 * since extended values are represented as "array[1..10] of byte" in records
for llvm in order to ensure that it doesn't allocate the ABI-specified
    size, we have to convert the resulting pointer to an array of 10 bytes
    into a pointer to extended when we subscript the record (like is already
    done for arrays)

git-svn-id: trunk@30720 -
2015-04-25 15:51:30 +00:00
Jonas Maebe
b9138a1c90 * changed the llvm type of comp/currency in parameter and return type
on platforms that use the x87 for these types to extended in order
    to gaurantee the expected parameter passing conventions

git-svn-id: trunk@30719 -
2015-04-25 15:51:27 +00:00
Jonas Maebe
491d9cfff1 * fixed reuse of the same register for different types in
a_loadaddr_ref_reg()

git-svn-id: trunk@30718 -
2015-04-25 15:51:25 +00:00
Jonas Maebe
c3233b21e8 * fixed reference/register types for thlcgobj.a_bit_test_*
git-svn-id: trunk@30717 -
2015-04-25 15:51:22 +00:00
Jonas Maebe
388cef8a34 * fixed types for shortstring handling in tcgassignmentnode.pass_generate_code
git-svn-id: trunk@30716 -
2015-04-25 15:51:19 +00:00
Jonas Maebe
2102db1a0c * fixed type when passing an address parameter to another address parameter
git-svn-id: trunk@30715 -
2015-04-25 15:51:16 +00:00
Jonas Maebe
b3e786eb77 - don't specify lef_inaggregate when getting the llvm type representation
for function results and parameters (they're not in an aggregate, and this
    caused 80 bits extended floating point types to be translated into arrays
    of 10 bytes, which have different ABI meanings)

git-svn-id: trunk@30714 -
2015-04-25 15:51:13 +00:00
Jonas Maebe
bb4f8e62bf * sign/zero-extend a Pascal boolean (translated to i1) when assigning to
an i8, even though both have byte size 1

git-svn-id: trunk@30713 -
2015-04-25 15:51:09 +00:00
Jonas Maebe
394091ab75 * don't generate parameter attributes for llvm function alias declarations
git-svn-id: trunk@30712 -
2015-04-25 15:51:06 +00:00
Jonas Maebe
70ffaba901 * ensure that the loading of the uninitialised function result for llvm
doesn't result in a temp allocation, since this can happen while
    generating the exit code

git-svn-id: trunk@30711 -
2015-04-25 15:51:04 +00:00
Jonas Maebe
5418978415 * fixed types in thlcgobj.location_get_data_ref
git-svn-id: trunk@30710 -
2015-04-25 15:51:01 +00:00
Jonas Maebe
f7b5ee64ae * always insert type conversion for pasbool to int on llvm, as pasbool is
represented by i1 while equally sized integers are i8

git-svn-id: trunk@30709 -
2015-04-25 15:50:58 +00:00
Jonas Maebe
61ddaab091 * never keep a value in a register for llvm if it's typecasted on the
left-hand side of an assignment (you can't typecast lvalues in llvm)

git-svn-id: trunk@30708 -
2015-04-25 15:50:55 +00:00
Jeppe Johansen
2dae6a2dd7 Added predecrement addressing support to the AVR assembler reader
git-svn-id: trunk@30706 -
2015-04-24 17:25:57 +00:00
svenbarth
19c6d72c7b Fix for Mantis #27750.
pgenutil.pas:
  * parse_generic_parameters: create explicit undefineddefs for type parameters that don't have a constraint
  * insert_generic_parameter_types: move the created undefineddefs from the parent symtable to the generic's symtable
defcmp.pas, compare_defs_ext:
  * in case the flag for strict undefineddef checks is set don't consider two different undefineddefs as compatible
+ added tests

git-svn-id: trunk@30705 -
2015-04-24 14:51:22 +00:00
nickysn
7923b6142e + finished the internal omf library writer (implementing writing of the library
dictionary at the and of the file) and enabled it for the i8086 internal asm

git-svn-id: trunk@30701 -
2015-04-21 23:31:02 +00:00
nickysn
dbe1081389 + partially implemented the internal omf library writer; everything is written
to the file, except the dictionary

git-svn-id: trunk@30700 -
2015-04-21 20:59:36 +00:00
nickysn
3fa81fa7cd + added overloaded methods TOmfRawRecords.ReadFrom and .WriteTo for reading from
and writing to TDynamicArray

git-svn-id: trunk@30699 -
2015-04-21 20:22:30 +00:00
nickysn
a365da0b44 + added class (empty for now) TOmfLibObjectWriter and hook it as an internal ar
in the omf internal assembler constructor. Note it is not used yet, because of
  the af_needar assembler flag.

git-svn-id: trunk@30698 -
2015-04-21 19:28:51 +00:00
nickysn
bde7d0aacb + added "code segment too large" and "data segment too large" error messages
git-svn-id: trunk@30687 -
2015-04-20 23:47:22 +00:00
nickysn
211dbb9752 * set procalign and loopalign to 1 for the i8086-msdos target
git-svn-id: trunk@30686 -
2015-04-20 15:12:48 +00:00
nickysn
778a678956 * use a 4 byte alignment for the dwarf debug sections on i8086 (not sure if
that's correct for 16-bit dwarf, but currently the compiler emits 4-byte
  tai_aligns, so setting the section alignment to 4 avoids problems in the
  internal object writer)

git-svn-id: trunk@30685 -
2015-04-20 13:15:26 +00:00
nickysn
8cf469e9ef * base the default alignment on voidpointertype.alignment instead of
voidpointertype.size for all types, that are internally represented as a
  pointer (ansi/widestrings,dynarrays,classes)

git-svn-id: trunk@30683 -
2015-04-20 12:44:11 +00:00
nickysn
0675a9209d * use 16-bit alignment for class references and all pointer types on i8086
git-svn-id: trunk@30682 -
2015-04-20 12:41:55 +00:00
nickysn
030801a18b * switch the msdos target to the internal assembler/omf object writer
git-svn-id: trunk@30681 -
2015-04-20 01:53:01 +00:00
nickysn
5a1ce6162b * set the bss, rodata and rodata_norel section alignment to 2 bytes for the i8086-msdos target
git-svn-id: trunk@30680 -
2015-04-20 01:27:26 +00:00
nickysn
ae04eb258b * when splitting the section data in chunks, make sure fixups never cross chunk boundaries
git-svn-id: trunk@30679 -
2015-04-20 00:02:40 +00:00
nickysn
32e0eca0dc + added read only property TOmfSubRecord_FIXUP.LocationSize, which returns the
size in bytes of the fixup

git-svn-id: trunk@30678 -
2015-04-19 22:57:33 +00:00
Jonas Maebe
62239ba890 * handle named registers correctly for fpu and mm loads
git-svn-id: trunk@30677 -
2015-04-19 21:37:52 +00:00
Jonas Maebe
3496129f79 * only handle a_load_const_ref() directly when storing ordinals, as in case
of pointers llvm only supports 0 (as null, which we don't generate either)

git-svn-id: trunk@30676 -
2015-04-19 21:37:49 +00:00
Jonas Maebe
e2cf90ad8a * add type declarations for structure types in the llvm code so that we can
handle recursive record references (rec= record prec: ^rec)
   o llvm unfortunately does not support recursive references to array types
     or function pointers, so those will currently still result in endless
     recursion when the compiler tries to write them out. Solving those
     will require a lot of typecasting in the generated code

git-svn-id: trunk@30675 -
2015-04-19 21:37:46 +00:00
Jonas Maebe
1941e64488 + added a hook to insert object-global information into the asmlists (will
be used to insert type definitions for llvm)

git-svn-id: trunk@30674 -
2015-04-19 21:37:43 +00:00
Jonas Maebe
2bb4a729c0 * procvardefs must be encoded without any parameter attributes
git-svn-id: trunk@30673 -
2015-04-19 21:37:40 +00:00
Jonas Maebe
c8e44e4a7c * keep track of whether we're in an inline assembly block in the llvm
assembler writer, and for now skip writing labels if we are (they
    will have to emitted as part of an actual inline assembly block,
    not as llvm-style labels)

git-svn-id: trunk@30672 -
2015-04-19 21:37:37 +00:00
Jonas Maebe
4a25afb839 * load an undef value in the function result in the exit code of a pure
assembler function, as the inline assembly code itself will be
    responsible for returning the function result (we will have to add
    the "return" instruction to it) while llvm requires a terminator
    at the end of the function and it must return something

git-svn-id: trunk@30671 -
2015-04-19 21:37:34 +00:00
Jonas Maebe
ff3061a7cf + thlcgllvm.gen_load_uninitialized_function_result
git-svn-id: trunk@30670 -
2015-04-19 21:37:31 +00:00
Jonas Maebe
07141e92d3 + support for llvm "undef" operand
git-svn-id: trunk@30669 -
2015-04-19 21:37:27 +00:00
nickysn
7ff6c2a675 - rm tf_smartlink_library from targets that define tf_smartlink_sections, since
in certain places, the code in the compiler assumes that only one of the two
  is defined, resulting in libraries with missing externals when both are
  defined and there's no much point in supporting both anyway, since section
  based smartlinking achieves the same thing (in a better way) on these
  platforms.

git-svn-id: trunk@30668 -
2015-04-19 18:47:44 +00:00
nickysn
d204aaab72 * refactored "ar" object writer creation in the internal assembler to allow
having different implementations of an internal "ar" writer

git-svn-id: trunk@30667 -
2015-04-19 16:35:16 +00:00
Jonas Maebe
3684e7665d * changed temporary type_e_anonymous_function_unsupported message into an
inline comment, because using a high message number wastes space in
    the messages array

git-svn-id: trunk@30666 -
2015-04-19 14:31:35 +00:00
florian
1969abec77 * improved code generation in a_op_const_reg_internal and a_op_const_reg_reg
git-svn-id: trunk@30662 -
2015-04-19 12:51:53 +00:00
nickysn
623ea066c7 + added class for encoding/decoding an omf library end record
git-svn-id: trunk@30660 -
2015-04-19 11:25:25 +00:00
florian
e791f534d2 * fix tcgvecnode.update_reference_reg_packed if OS_INT<>OS_ADDR
git-svn-id: trunk@30659 -
2015-04-19 10:34:14 +00:00
florian
d598351664 * call also optimize_op_const in the generic a_op_const_reg_reg
git-svn-id: trunk@30658 -
2015-04-19 10:04:57 +00:00
florian
7f1585b99a * do not save registers for subroutines which never return
* do not generate any exit code for subroutines which never return

git-svn-id: trunk@30657 -
2015-04-19 08:11:28 +00:00
florian
f972398a8c + main program never returns
git-svn-id: trunk@30656 -
2015-04-19 08:10:06 +00:00
florian
6797685c86 * write set constants only as large as needed by taking care of resultdef.size, resolves issue #27886
git-svn-id: trunk@30655 -
2015-04-18 19:32:49 +00:00
florian
987b66636d + optimize LDS/STS into IN/OUT, resolves issue #27884
git-svn-id: trunk@30649 -
2015-04-18 14:43:54 +00:00
florian
9e51283ae0 + initial a_op_const_reg_reg and a_op_reg_reg_reg implementations to generate optimized 16 Bit multiplications on avr
git-svn-id: trunk@30648 -
2015-04-18 13:53:20 +00:00
florian
3e8766290d * implements RegInInstruction and fixes RegModifiedByInstruction for avr
git-svn-id: trunk@30647 -
2015-04-18 13:51:28 +00:00
nickysn
24d9c06489 + added class for encoding/decoding an omf library header record
git-svn-id: trunk@30646 -
2015-04-18 12:57:04 +00:00
nickysn
3ce29dcfb2 + added function for computing the hash for the omf libraries' dictionary
git-svn-id: trunk@30644 -
2015-04-18 10:48:49 +00:00
nickysn
cebd3de630 + added unit owomflib (empty for now), which is going to contain the internal
.lib writer for i8086-msdos

git-svn-id: trunk@30643 -
2015-04-18 09:49:38 +00:00
nickysn
7fca6dd6c1 * set the properties of the dwarf debug info sections in the omf obj writer
as required by wlink in order to be recognized and handled as debug info
  (i.e. class=DWARF, use32)

git-svn-id: trunk@30636 -
2015-04-18 00:42:17 +00:00
nickysn
fb31be4e4a * changed the default debug format for i8086-msdos from stabs to dwarf2
git-svn-id: trunk@30635 -
2015-04-17 23:47:31 +00:00
nickysn
a6e39edb8f * moved the insertion of fwaits for 8087 from the nasm asm writer to ti8086procinfo.postprocess_code
git-svn-id: trunk@30634 -
2015-04-17 23:27:03 +00:00
florian
58c66b4759 * the mul instructions do not modify the operands
git-svn-id: trunk@30633 -
2015-04-17 20:15:10 +00:00
florian
66e97549b9 * replace jmp by rjmp if possible, resolves issue #27885
git-svn-id: trunk@30632 -
2015-04-17 20:14:18 +00:00
nickysn
5c8965fea5 * in the inline asm reader, treat [var] reference as "word" instead of "dword"
when "var" is of dword size. This fixes spurious generation of a $66 prefix
  and makes the code consistent with what Tx86Operand.SetSize does (and what is
  then used for checking the operand sizes of all operands of the instruction in
  Tx86Instruction.CheckOperandSizes).

git-svn-id: trunk@30629 -
2015-04-17 19:58:06 +00:00
nickysn
3b5395e0e3 * set 16-bit opsize for OPR_SYMBOL operands on i8086
git-svn-id: trunk@30626 -
2015-04-17 19:10:13 +00:00
michael
d802842ecf * Committed working patches to error message files from Stéphane Aulery
git-svn-id: trunk@30617 -
2015-04-17 12:19:13 +00:00
nickysn
c3515f743f * generate 16-bit (instead of 32-bit) instructions for push/pop of a segment
register in an inline asm block on i8086

git-svn-id: trunk@30616 -
2015-04-17 00:51:00 +00:00
nickysn
7315175c32 * keep the proper original section name and order (and not just the type) of the
last encountered section at the object cut location when writing a smartlinked
  library with the internal assembler. This fixes the $HUGECODE directive with
  the internal assembler on i8086 and maybe other things on other platforms,
  that use library based smartlinking in combination with the internal asm.

git-svn-id: trunk@30615 -
2015-04-16 23:33:26 +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
nickysn
25a834087e + choose the correct version of "Jcc near" to use on i8086 (386+ or 8086+)
depending on the specified target cpu type
+ support the \60..\62 magic codes on i8086 in the internal asm writer

git-svn-id: trunk@30613 -
2015-04-16 19:49:22 +00:00
nickysn
2cf6852910 + added i8086 instruction entries for Jcc near (which is actually a 386+
instruction), that encode it as two i8086 compatible instructions:
    JNcc short +3
    JMP near target

git-svn-id: trunk@30612 -
2015-04-16 17:07:07 +00:00
nickysn
bfd5670cc8 + support new magic code \23 in the internal asm writer - same as \13, but with
the condition inverted; this will be used to simulate near conditional jumps
  on processors earlier than 386 (i.e. "Jcc near target" will be encoded as
  "JNcc short +3; JMP target")

git-svn-id: trunk@30611 -
2015-04-16 16:53:48 +00:00
Jonas Maebe
a56bf0f892 * regenerated message files after r30604
git-svn-id: trunk@30606 -
2015-04-15 18:29:47 +00:00
Jonas Maebe
3ab62fc36e * define TSymStr as ansistring for llvm, as its type definitions can be quite long
git-svn-id: trunk@30605 -
2015-04-15 18:29:44 +00:00
michael
b2caba585d * Patch from Stéphane Aulery to fix typos in compiler messages (bug ID 27857)
git-svn-id: trunk@30604 -
2015-04-15 17:34:56 +00:00
nickysn
c407f61107 * generate the omf alignment based on the value of SecAlign, instead of
duplicating the code from sectiontype2align in the TOmfObjSection constructor

git-svn-id: trunk@30603 -
2015-04-15 08:55:19 +00:00
nickysn
d7416afd88 * override sectiontype2align in the omf writer and set the same alignments as
the ones, currently produced by nasm

git-svn-id: trunk@30602 -
2015-04-15 08:31:06 +00:00
nickysn
955c29618a + support far calls and jumps in the internal asm writer
git-svn-id: trunk@30601 -
2015-04-15 00:12:40 +00:00
nickysn
a7e059c875 + support segment relocations in the omf writer
git-svn-id: trunk@30600 -
2015-04-14 22:46:01 +00:00
Jeppe Johansen
65a69129c5 Add initial support for STM32F429 core
git-svn-id: trunk@30599 -
2015-04-14 21:55:37 +00:00
florian
e733efbbc2 * proper tavrprocinfo.calc_stackframe_size
git-svn-id: trunk@30597 -
2015-04-14 20:48:13 +00:00
florian
3d0b1020d7 * proper alignment constants for avr-embedded
git-svn-id: trunk@30596 -
2015-04-14 20:47:47 +00:00
florian
cf58a7ad60 * cosmetics
git-svn-id: trunk@30595 -
2015-04-14 20:47:26 +00:00
nickysn
f5ddd351fe * allow use of the imm8 form of 16-bit instructions on i8086
git-svn-id: trunk@30594 -
2015-04-14 19:14:47 +00:00
florian
b84657980d * make OS_INT/OS_SINT 8 Bit on avr, should work better on avr, resolves #27840
git-svn-id: trunk@30593 -
2015-04-14 18:51:21 +00:00
nickysn
07ebd29911 * fixed warning in TOmfRecord_MODEND.DecodeFrom
git-svn-id: trunk@30592 -
2015-04-14 18:41:41 +00:00
nickysn
e0be3e49ae * when reading omf records (and subrecords), range check against
RawRecord.RecordLength instead of High(RawRecord.RawData)

git-svn-id: trunk@30591 -
2015-04-14 17:55:13 +00:00
Jeppe Johansen
f31f87e8c7 Fix spilling_get_operation_type for MRS and MSR instructions
git-svn-id: trunk@30590 -
2015-04-14 17:20:47 +00:00
nickysn
b4d044e1b2 + implemented reading of MODEND omf records
git-svn-id: trunk@30589 -
2015-04-14 16:26:40 +00:00
nickysn
4e0c77fcf4 check and cause an internal error in TOmfRecord_PUBDEF.EncodeTo when trying to
write a 16-bit record with an entry with public offset > $ffff

git-svn-id: trunk@30588 -
2015-04-14 15:35:19 +00:00
nickysn
0e10290722 + implemented writing a start address in a MODEND omf record
git-svn-id: trunk@30587 -
2015-04-14 15:24:51 +00:00
nickysn
d3cc0770ac + added properties for specifying a start address in the MODEND omf record (reading/writing them to file not yet implemented)
git-svn-id: trunk@30586 -
2015-04-14 14:55:06 +00:00
nickysn
bf0aaf5470 + implemented TOmfRecord_PUBDEF.DecodeFrom
git-svn-id: trunk@30585 -
2015-04-14 14:08:27 +00:00
nickysn
cea67320bf + implemented TOmfRecord_EXTDEF.DecodeFrom
git-svn-id: trunk@30584 -
2015-04-14 13:40:46 +00:00
nickysn
10722abfac + implemented TOmfRecord_LNAMES.DecodeFrom
git-svn-id: trunk@30583 -
2015-04-14 13:32:12 +00:00
nickysn
64cb865417 * check record type in TOmfRecord_THEADR.DecodeFrom
git-svn-id: trunk@30582 -
2015-04-14 12:04:49 +00:00
nickysn
03e8c3ae05 + support RELOC_RELATIVE relocations in the omf object writer, by using omf's
"self relative" (instead of "segment relative") fixups. "Hello world" and
  fpctris in the small memory model now work (under dosbox, at least) with the
  internal object writer.

git-svn-id: trunk@30581 -
2015-04-13 22:44:31 +00:00
nickysn
bd460eec43 * emit 16-bit addresses on i8086 for asm codes &64..&66 in the internal asm
git-svn-id: trunk@30580 -
2015-04-13 22:13:15 +00:00
florian
e559b9e3d6 + tavrshlshrnode.second_integer, does not convert the right operand to a bigger type, resolves #27841
git-svn-id: trunk@30579 -
2015-04-13 20:57:37 +00:00
florian
8b7a449cf1 * clear r1 after 8 Bit multiplication, resolves #27838
git-svn-id: trunk@30578 -
2015-04-13 20:15:30 +00:00
nickysn
22fb1a3e7e * converted all the magic nasm codes in the x86 internal asm writer from decimal
to octal in the compiler source, so they match the strings in x86ins.dat

git-svn-id: trunk@30566 -
2015-04-13 01:13:39 +00:00
Károly Balogh
68a25e154a Amiga/MorphOS: enabled resource support, to match AROS in features
git-svn-id: trunk@30565 -
2015-04-13 00:49:00 +00:00
nickysn
fe30b53e95 * use 16-bit operand types for call/jmp immediate on i8086 in taicpu.create_ot
git-svn-id: trunk@30563 -
2015-04-12 23:53:15 +00:00
nickysn
a25a906d56 * i8086 internal asm fixes for the 0324 and 0361 asm codes
git-svn-id: trunk@30562 -
2015-04-12 22:56:28 +00:00
nickysn
38c17305d3 - removed tf_smartlink_sections flags from the msdos target
git-svn-id: trunk@30561 -
2015-04-12 22:11:21 +00:00
florian
fa6bea9bbb * all the cg/hlcg routines take normally tcgint constants, so replace aint constants and casts in ncgset by tcgint ones
git-svn-id: trunk@30560 -
2015-04-12 20:32:37 +00:00
florian
4d01271944 * due to avr's harvard architecture, loads of code labels need to use the gs(...) macro
git-svn-id: trunk@30559 -
2015-04-12 20:29:13 +00:00
florian
1f20a52c85 * fix typo in comparison with constant code
git-svn-id: trunk@30556 -
2015-04-12 15:42:40 +00:00
florian
bd803769b8 * fix compilation
git-svn-id: trunk@30554 -
2015-04-12 14:58:41 +00:00
florian
9559dabe51 * function result is in r24:r25
git-svn-id: trunk@30549 -
2015-04-11 21:25:05 +00:00
florian
e34bd746ed * patch by Jeppe Johanse to take care of the fact that push is post-decrement on avr
git-svn-id: trunk@30548 -
2015-04-11 20:59:27 +00:00
florian
1ef7e36f3c * some fixes for handling parameters passed on the stack
git-svn-id: trunk@30545 -
2015-04-11 13:56:21 +00:00
florian
276d97f653 * generate better code for comparisons with constants
git-svn-id: trunk@30543 -
2015-04-11 13:52:29 +00:00
florian
e0b27e1688 * unified typing and ppu reading/writing of setdef fields regarding aint/asizeint
git-svn-id: trunk@30542 -
2015-04-11 11:36:01 +00:00
florian
4b7ae00620 * fixes several issues with parameter handling on avr
git-svn-id: trunk@30541 -
2015-04-11 11:13:20 +00:00
florian
03fa8336de o several avr fixes
* handle function result of FPC_MUL_WORD correctly
  * use mov ...,r1 to load a register with zero instead of clr ..., this might enable the register allocator to 
    coalesce these moves in the feature
  * use tst/dec instead of cpi/sub in the shifting loops, this reduces register pressure on r16 and higher

git-svn-id: trunk@30540 -
2015-04-11 11:08:01 +00:00