Commit Graph

252 Commits

Author SHA1 Message Date
nickysn
c39128708e + implemented inc/dec for huge pointers
git-svn-id: trunk@29251 -
2014-12-10 23: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
dd67fa8c5c * fixed DFA warnings for i8086
git-svn-id: trunk@28504 -
2014-08-20 15:49:27 +00:00
nickysn
94bcb9878a * reimplemented r28329 in a different way, as suggested by Jonas
git-svn-id: trunk@28332 -
2014-08-07 19:36:52 +00:00
nickysn
3164bf66f5 + implemented correct [] indexing of huge pointers
git-svn-id: trunk@28330 -
2014-08-07 09:11:21 +00:00
nickysn
4ea551a0f7 * is_farpointer and is_hugepointer moved from defutil to symcpu
git-svn-id: trunk@28328 -
2014-08-06 20:32:41 +00:00
nickysn
36d63b953e + added an i8086 specific boolean property is_huge to the tarraydef. For now it
will only be used for indexing huge pointers (i.e. only huge arrays with the
  ado_IsConvertedPointer array option will be supported). In the distant future,
  regular huge arrays may be supported as well (but that would require
  substantially more work, including adding hugeness support to other structures
  such as records, objects and classes, so I'm not planning on doing it anytime
  soon).

git-svn-id: trunk@28270 -
2014-07-26 13:27:46 +00:00
nickysn
33dac14554 * defutil.get_int_type_for_pointer_arithmetic replaced with a virtual method
tpointerdef.pointer_arithmetic_int_type

git-svn-id: trunk@28258 -
2014-07-24 14:18:57 +00:00
nickysn
d86a8ebc99 * defutil.get_int_result_type_from_pointer_subtraction moved to a virtual
method tpointerdef.pointer_subtraction_result_type

git-svn-id: trunk@28219 -
2014-07-14 23:30:29 +00:00
nickysn
99c555cea8 + implemented huge pointer subtraction
* the result of far pointer subtraction changed to word (for TP7 compatibility)

git-svn-id: trunk@28218 -
2014-07-13 23:40:43 +00:00
nickysn
200df7a136 * set expectloc correctly for far pointer comparison as well
git-svn-id: trunk@28217 -
2014-07-13 16:25:20 +00:00
nickysn
04234c733f * set expectloc correctly (LOC_JUMP instead of LOC_FLAGS) for non-normalized
huge pointer comparison

git-svn-id: trunk@28216 -
2014-07-13 15:20:58 +00:00
nickysn
5818451bb5 * non-normalized huge pointer comparison made unsigned
git-svn-id: trunk@28214 -
2014-07-13 12:54:12 +00:00
nickysn
8604372da3 + implemented far pointer comparison operating only on the offset (+ added test)
git-svn-id: trunk@28179 -
2014-07-06 22:45:19 +00:00
nickysn
3bb730d5b9 + implemented normalized huge pointer comparison
git-svn-id: trunk@28157 -
2014-07-04 23:22:33 +00:00
nickysn
aee568e6fc * cs_hugeptr_normalization renamed to cs_hugeptr_arithmetic_normalization,
because we're going to also introduce cs_hugeptr_comparison_normalization as
  an independent option

git-svn-id: trunk@28149 -
2014-07-04 13:14:06 +00:00
nickysn
d9e94ffab7 + implemented huge pointer arithmetic
git-svn-id: trunk@28139 -
2014-07-03 16:53:22 +00:00
nickysn
1910177cf0 + added heapmax support to the $M directive on i8086-msdos. It is currently
only implemented in the near data memory models. The far data models support
  is still a TODO.

git-svn-id: trunk@28039 -
2014-06-23 20:17:17 +00:00
nickysn
7cfd7a66cd + create a special 'heap' segment with reserved space equal to heapsize (i.e.
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 -
2014-06-19 14:14:01 +00:00
nickysn
8ad63788c7 - do not emit a stack segment in the tiny memory model
- rm the reference to the top of the stack segment from the startup code in tiny
  model

git-svn-id: trunk@27956 -
2014-06-14 15:56:44 +00:00
sergei
dc628b8969 * x86: Completely skip instructions that do not exist for target CPU bit width. The existing behavior of writing mnemonics and properties but no encoding allows an invalid instruction to be recognized by assembler reader or even generated by compiler, but it but won't assemble anyway.
git-svn-id: trunk@27934 -
2014-06-11 22:31:40 +00:00
nickysn
73d7f2aa18 * let the compiler generate the stack segment in i8086 near data memory models
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 -
2014-06-08 21:14:57 +00:00
nickysn
70732aedbb * ti8086nodeutils.InsertMemorySizes: stack segment creation moved to a separate
method

git-svn-id: trunk@27851 -
2014-06-04 13:44:10 +00:00
nickysn
47a7a9835a * added hack to support stack exceeding 32kb in size in the i8086 far data
memory models

git-svn-id: trunk@27827 -
2014-05-29 17:07:01 +00:00
nickysn
e9cb275f66 * put the i8086-msdos stack segment in a separate object file
git-svn-id: trunk@27825 -
2014-05-29 16:04:15 +00:00
nickysn
3cc8ff11e3 + generate the stack segment for i8086 far data memory models from within fpc
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 -
2014-05-27 23:29:50 +00:00
nickysn
24fcac9f87 + added support for nested procvars in the i8086 far data memory models
git-svn-id: trunk@27812 -
2014-05-22 23:44:09 +00:00
nickysn
feb840b47f * support reg=NR_NO in thlcgcpu.reference_reset_base on i8086. This fixes test
webtbs/tw26162.pp in the i8086 far data memory models.

git-svn-id: trunk@27807 -
2014-05-21 13:26:02 +00:00
nickysn
683478f00c + added a proper far pointer inc/dec implementation (operating only on the offset,
without touching the segment)

git-svn-id: trunk@27805 -
2014-05-19 16:24:25 +00:00
nickysn
791cd932fd + support i8086 far data memory models in tcg8086.g_intf_wrapper
git-svn-id: trunk@27722 -
2014-05-03 14:17:54 +00:00
nickysn
906d828ee0 * tcg8086.g_copyvaluepara_openarray: fix for the case where ref.segment is
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 -
2014-05-01 22:28:07 +00:00
nickysn
c9c29a3cd4 + ignore the source segment, when the destination cgpara is a near pointer in
tcg8086.a_loadaddr_ref_cgpara

git-svn-id: trunk@27715 -
2014-05-01 21:56:04 +00:00
nickysn
c9f8703679 + set ref.segment to NR_SS for all temps/localvars on i8086. This allows the
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 -
2014-05-01 21:18:47 +00:00
nickysn
38aec68d6f * ti8086vecnode.update_reference_reg_mul: remove the segment before calling
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 -
2014-05-01 19:39:52 +00:00
nickysn
3dfc6ac7e1 * fixed the passing of extended floating type parameters on i8086 for
pocall_register after r24761 (it is the same change as in r24766, but for
  pocall_register)

git-svn-id: trunk@27709 -
2014-05-01 16:45:49 +00:00
nickysn
906412411f * fixed the passing of pushaddr paramaters for pocall_register in i8086 far data
memory models

git-svn-id: trunk@27708 -
2014-05-01 16:43:35 +00:00
nickysn
7da8719036 + support near pointers, bound to a segment register in hlcg.reference_reset_base
on i8086

git-svn-id: trunk@27688 -
2014-04-29 23:15:20 +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
nickysn
313240b9e8 * use a better way (suggested by Jonas) to determine whether a procedure is from
the same unit

git-svn-id: trunk@27629 -
2014-04-21 23:14:16 +00:00
nickysn
8a606761cd * don't push cs in ti8086callnode.extra_interrupt_code in the far code memory
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 -
2014-04-21 00:56:51 +00:00
nickysn
70a7ecd0fa + use 'push cs + call near' (which is both shorter and faster), instead of far
call, when calling a far proc in the same segment

git-svn-id: trunk@27621 -
2014-04-21 00:44:45 +00:00
nickysn
597f110eb9 + added support for units with code larger than 64kb in the far code i8086
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 -
2014-04-20 19:03:14 +00:00
nickysn
bf6ad0ff78 * fixed tcg8086.g_flags2reg, so it behaves the same way as tcgx86.g_flags2reg
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 -
2014-04-19 22:54:29 +00:00
nickysn
9a44ab2fc2 * always treat interrupt routines as far, so their address can be taken even in
{$F-} mode

git-svn-id: trunk@27591 -
2014-04-16 23:37:28 +00:00
nickysn
d6ad2b1f8a + added support for mixing near and far procedures in the i8086 far code memory
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 -
2014-04-16 23:09:18 +00:00
sergei
98de3c4e40 * tcg8086.g_flags2reg: call virtual method a_jmp_flags instead of duplicating its functionality, it prevents further changes to this method when adding support for unordered comparison results.
git-svn-id: trunk@27579 -
2014-04-14 00:20:06 +00:00
nickysn
ce0bd81273 + show an error message 'procedure must be far' if an attempt is made to convert
a near proc to a procvar in a i8086 far code memory model

git-svn-id: trunk@27567 -
2014-04-13 19:29:28 +00:00
nickysn
d8d3706462 + override hlcg.a_call_name for i8086 and dispatch to the appropriate type of
call (near or far), according to whether the procdef is near or far, instead
  of relying on the default for the memory model

git-svn-id: trunk@27562 -
2014-04-13 15:17:43 +00:00