Commit Graph

74 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
sergei
f69f6336e9 * Replaced hacks with resetting 'c' to zero and decreasing inputpointer by boolean parameter to skipcomment and skipoldtpcomment. This parameter specifies whether first character of comment should be read.
- in_asm_string also rendered useless by r32828, removed.

git-svn-id: trunk@32836 -
2016-01-03 17:07:15 +00:00
sergei
bbfbab7e0c * Moved handling of comments and line breaks in assembler blocks from scanner to tokenizer level. Handling them at character level was causing compiler to accept comments in the middle of any assembler token, which should never happen. It was also causing Mantis #27459: a newline immediately after closing 'end' token was first handled in asmgetchar and then by normal parser, causing all subsequent line numbering to be off by one.
git-svn-id: trunk@32828 -
2016-01-02 06:17:14 +00:00
Jonas Maebe
fd0c2f36e5 * don't parse "flags" as a register name in the Intel assembler reader
(mantis #29040)

git-svn-id: trunk@32368 -
2015-11-19 19:40:06 +00:00
nickysn
a553b15a1c + handle properly inline asm segment constants different than word:
o 'DB SEG symbol' produces an error
  o 'DD SEG symbol' (and anything larger than DW, like DQ) adds extra high zeros
    to the segment constant (this is Turbo Pascal 7 compatible)

git-svn-id: trunk@32283 -
2015-11-10 21:18:34 +00:00
nickysn
606b64a7f1 * fixed indentation
git-svn-id: trunk@32282 -
2015-11-10 20:57:52 +00:00
nickysn
3b80ca4376 + implemented the 'SEG @CODE' inline assembler directive for i8086
git-svn-id: trunk@32281 -
2015-11-10 18:02:10 +00:00
nickysn
995ca4fb12 + implemented the 'SEG @DATA' inline assembler directive for i8086
git-svn-id: trunk@32280 -
2015-11-10 17:26:21 +00:00
nickysn
43dabca8ab * moved the handling of the @Code and @Data inline assembler symbols to new methods Tx86operand.SetupCode and .SetupData
git-svn-id: trunk@32279 -
2015-11-10 14:04:40 +00:00
nickysn
ca24b006ef + support 'dw SEG symbol' in the inline assembler on i8086
git-svn-id: trunk@32256 -
2015-11-06 15:35:20 +00:00
nickysn
2e30b92c79 * removed the 'near ignored' and 'far ignored' inline asm warning messages on
the i8086, as 'near' and 'far' actually work there. Some forms may even work
  on the i386, but that's not tested very well for now, so we leave the messages
  there on i386 and x86_64.

git-svn-id: trunk@32195 -
2015-10-29 22:47:40 +00:00
nickysn
9e110e8e7e * treat interrupt procedures as 'near' in the i8086 inline assembler for TP7
compatibility

git-svn-id: trunk@32194 -
2015-10-29 22:43:41 +00:00
nickysn
dd9e5ea6f6 * convert 'call/jmp [proc]' properly to a near or far call/jmp, depending on
proc's call model

git-svn-id: trunk@32193 -
2015-10-29 22:05:09 +00:00
nickysn
ed09b4fcaa * in i8086 inline asm, convert 'call/jmp [proc/label]' to 'call/jmp proc/label'.
This is BP7 compatible and fixes e.g. 'call near ptr label' and 'call far ptr label'.

git-svn-id: trunk@32192 -
2015-10-29 17:07:23 +00:00
nickysn
77159d2806 + also add a cs: prefix to references such as [2+label]
git-svn-id: trunk@32191 -
2015-10-29 16:17:34 +00:00
nickysn
823deb39ac + also add an implicit cs: prefix on i8086 in tx86intreader.BuildOperand.AddLabelOperand
git-svn-id: trunk@32189 -
2015-10-29 15:35:09 +00:00
nickysn
92a39c93f5 + add a CS: override for references without an explicitly set segment override, which are relative to a function entry point
git-svn-id: trunk@32187 -
2015-10-29 14:48:59 +00:00
nickysn
ef5e368327 + support local label data access in the i8086 inline asm (fixes test tlbldat1.pp)
git-svn-id: trunk@32179 -
2015-10-28 17:22:37 +00:00
nickysn
dc6119bab7 * also convert 'jmp farprocsymbol' to 'jmp far farprocsymbol' in the i8086
inline assembler

git-svn-id: trunk@32170 -
2015-10-28 00:19:42 +00:00
nickysn
cb36b2d3bd * i8086 inline asm: convert 'call symbol' to 'call far symbol' only for symbols
that are an entry point of a function with a far call model

git-svn-id: trunk@32169 -
2015-10-28 00:17:54 +00:00
nickysn
c068c96302 * on i8086 convert the 'ret' inline asm instruction to either 'retn' or 'retf',
depending on the call model of the current function (which is BP7 compatible
  behaviour)

git-svn-id: trunk@32157 -
2015-10-26 16:01:50 +00:00
nickysn
b3c2765da9 * on i8086, for BP7 compatibility, assemble 'call/jmp dword [ref]' as a far call
git-svn-id: trunk@31945 -
2015-10-05 00:47:17 +00:00
nickysn
e9c790f4eb + support 'SEG' in the i8086 inline assembler
git-svn-id: trunk@31428 -
2015-08-26 15:57:44 +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
florian
d6e4af8279 + applied remaining patches of Torsten Grundke: adds gather instructions of avx2
git-svn-id: trunk@29745 -
2015-02-17 21:43:46 +00:00
sergei
475a9e1617 * Asm readers: allow using procedure symbols in references, resolves #22376.
* rax86int.pas: reject RIP-relative references to locals/parameters.

git-svn-id: trunk@29087 -
2014-11-17 05:34:55 +00:00
sergei
42d251da1c - x86 assembler readers: cleaned out operand swapping code. Operands of TInstruction are kept in AT&T order, Intel reader attaches operands right-to-left. It was effectively the same way before the change (except Intel reader attaching operands left-to-right, followed by a single swap), operand order checks all over the place were just reducing readability.
git-svn-id: trunk@29081 -
2014-11-16 16:37:26 +00:00
sergei
de42f2f2f7 * Fixed handling of sign in constant expressions in Intel x86 assembler reader. Mantis #26668.
git-svn-id: trunk@28731 -
2014-10-03 15:51:38 +00:00
nickysn
9b560ffd64 * x86 intel syntax inline asm: allow a segment override (segcs,segds,seges,etc.)
to be followed by an instruction on the same line as the override

git-svn-id: trunk@28066 -
2014-06-25 21:06:19 +00:00
sergei
e7cd5319f0 * Put under {$ifndef x86_64} more cases of instructions that do not exist in 64-bit mode.
git-svn-id: trunk@27933 -
2014-06-11 12:51:38 +00:00
sergei
5c48804240 * Moved local label infrastructure into tasmreader, reduces number of global vars. Functionality is not changed.
git-svn-id: trunk@27477 -
2014-04-05 09:43:13 +00:00
sergei
9c54cdc85d * x86: Cleaned out addr_far,addr_far_ref used to encode far calls/jumps. NASM (and FPC x86 assembler based on it) already have opsize=S_FAR for this purpose.
git-svn-id: trunk@27037 -
2014-03-08 22:54:43 +00:00
nickysn
4f96e8a20d * convert i8086 inline asm instruction 'call symbol' to 'call far symbol' in memory models with far code
git-svn-id: trunk@25438 -
2013-09-08 16:34:12 +00:00
sergei
ea65e272dd * Changed global variable into field.
git-svn-id: trunk@25217 -
2013-08-05 16:32:37 +00:00
svenbarth
b6bfa864d4 Disallow the usage of the inline assembler inside generics, because there are currently two problems:
1. At least on x86 the assembler reader initializes the parameter location informations which results in InternalError 200301231
2. Assembler tokens are not stored in the token stream and thus won't be reproduced during specialization

x86/rax86int.pas, tx86intreader.Assemble:
  * check for "parse_generic" before calling generate_parameter_info
pstatmnt.pas, assembler_block & statement:
  * generate an error message if an asm statement should be parsed inside a generic

+ added test

git-svn-id: trunk@24892 -
2013-06-13 19:42:49 +00:00
florian
283ff05127 * merged avx support in inline assembler developed by Torsten Grundke
git-svn-id: trunk@22568 -
2012-10-06 19:47:18 +00:00
Jonas Maebe
68d9e95120 * if the size of an operand is not explicitly forced in intel assembler
(e.g. via "dword ptr"), let the size of accessed fields in memory
    expressions override the default size (mantis #18019)

git-svn-id: trunk@22250 -
2012-08-26 17:05:31 +00:00
Jonas Maebe
4d0e4e1b56 * treat "[var + rip]" in intel assembler mode as addr_pic_no_got on x86-64
(mantis #22665)
  + support "[var wrt ..gotpcrel]" nasm/yasm syntax in intel assembler mode
    for GOT-relative accesses on x86-64, + give an error when trying to do
    this on win64 (it doesn't have a GOT)
  * moved code that give a warning when using GOT-relative accesses to
    static data on x86-64 from the AT&T reader to rax86 so it's also
    active for the Intel assembler reader
  + added warning when not using GOT-relative accesses (but plain
    RIP-relative instead) to global data on non-Win64 x86-64

git-svn-id: trunk@22243 -
2012-08-25 15:12:49 +00:00
Jonas Maebe
2c43e084f0 * disabled "[reg].offset globalvar" pic syntax in intel assembler mode for
x86-64, because it does not specify whether the code should be got-based
    or not

git-svn-id: trunk@22242 -
2012-08-25 15:12:44 +00:00
florian
860d753055 * treat registers (and identifiers of register parameter) as normal identifiers when parsing record fields in intel assembler, resolves #19555
git-svn-id: trunk@18268 -
2011-08-18 21:58:30 +00:00
sergei
08ff5ff051 * x86 Intel assembler reader: disallow more than one register name per register operand, resolves #15672.
git-svn-id: trunk@17507 -
2011-05-19 20:00:15 +00:00
florian
e7fa076b70 * handle variables without explicit size prefix better in inline assembler, resolves #18009
git-svn-id: trunk@16859 -
2011-01-30 21:57:30 +00:00
pierre
ba6a4760e9 * fix regression 16700 introduced in rev 16104
git-svn-id: trunk@16133 -
2010-10-11 21:23:11 +00:00
pierre
586dd1ee49 * fix go32v2 assembler parsing failure introduced in rev 16104
git-svn-id: trunk@16132 -
2010-10-11 20:53:19 +00:00
pierre
207e0b58f5 * Support Intel [ebx].offset var PIC construct
git-svn-id: trunk@16109 -
2010-10-08 13:19:50 +00:00
pierre
7f200ab27e * Use asmsearchsym in assembler readers
git-svn-id: trunk@16104 -
2010-10-08 07:58:18 +00:00
mazen
b127fc154a * Fixed spell error revealed by lintian.
git-svn-id: trunk@16094 -
2010-10-06 20:33:57 +00:00
Jonas Maebe
9273856e84 * disallow pusha*/popa* for x86_64 (mantis #14862)
* disallow pushfd/popfd for x86_64 (mantis #14862)
  * fixed assembling popfq with the internal assembler (it needs a rex.w
    prefisx, while pushfq doesn't)
  * changed the default opcode size of pushf/popf/pusha/popa in
    {$asmmode intel} from "native size" to 16 bit (compatible with Intel
    manuals and Kylix; in AT&T mode, the default size for those operations
    remains the native one)
  * changed pushf/popf in rtl/i386/* into pushfd/popfd because of the
    previous change

git-svn-id: trunk@15546 -
2010-07-10 16:22:46 +00:00
Jonas Maebe
6d6892bec6 * fixed "byte/word/... ptr []" and "byte/word/..([])" typecasted expressions
in case the memory expression contains a record subscription (mantis
    #16700)

git-svn-id: trunk@15408 -
2010-06-11 14:51:58 +00:00
Jonas Maebe
8542632ebe * fixed evaluating constant expressions consisting of more than one term and
that start with a minus in the intel assembler reader (mantis #15843)

git-svn-id: trunk@15041 -
2010-03-24 20:52:31 +00:00