Commit Graph

151 Commits

Author SHA1 Message Date
paul
4b24a58871 compiler: remove/hide few unused variables
git-svn-id: trunk@18912 -
2011-08-30 01:32:23 +00:00
florian
87696a4b70 * cr*, dr*, tr* registers are 64 bit on x86-64
git-svn-id: trunk@18243 -
2011-08-17 11:42:11 +00:00
florian
8308b46a94 + support for assembler instructions with four operands
+ support for insertq, resolves #19910

git-svn-id: trunk@18206 -
2011-08-14 16:46:35 +00:00
pierre
8a0ed92957 * Remove useless code for i386
git-svn-id: trunk@17806 -
2011-06-23 14:50:31 +00:00
sergei
354d0520b7 + x86 assembler: fixed MOVABS instruction (it is a x86_64-only subset of MOV with 8-byte immediates/offsets) and same-form encodings of MOV instruction.
git-svn-id: trunk@17666 -
2011-06-05 17:32:18 +00:00
sergei
d89aeeadaf x86 assembler:
* Adjust rip-relative offsets using values known from calcsize, instead of reinterpreting the tail of instruction. This is simpler and remains the same regardless of particular codes used in opcode table.
* Reduced maxinfolen to 8.
- 'jmp imm64' and 64-bit versions of 'in' do not exist, removed.

git-svn-id: trunk@17546 -
2011-05-23 20:43:50 +00:00
sergei
9e8a31193b x86 assembler:
* Optimized the opcode representation of movq and remaining 3DNow instructions
* Disallow immediates not fitting in 32 bits (Mantis #14685) + test
* Disallow push/pop with 32-bit operands in x86_64 + test

git-svn-id: trunk@17490 -
2011-05-17 20:06:12 +00:00
sergei
d908fb42f7 x86 assembler fixes:
* Factored repeating REX operations into a separate function.
* Fixed instruction matching bug which was preventing compilation of 3-operand SIMD instructions with RIP-relative operand + test.
* Do not adjust offset of RIP-relative reference if it is a literal number, this was causing 0x123(%rip) to assemble as 0x122(%rip) in 3-operand instructions. Now tasm2.pp is the same with and without -Aas. Also fixed the expected result, improved verbosity of diagnostic and removed %norun, so it is actually executed.
+ Disallow high-byte registers in instructions requiring REX + test.

git-svn-id: trunk@17478 -
2011-05-16 20:18:03 +00:00
sergei
86d0c7f4c5 * x86 assembler: write REX prefix before the first literal byte of instruction (this becomes possible once the instruction table has all $66,$F2,$F3 prefixes changed to non-literal control codes). This way it is no longer necessary to manually specify position of REX in every instruction entry (code \323 becomes obsolete), and the situation when REX is not written (IE 200603191) is hopefully gone forever.
git-svn-id: trunk@17456 -
2011-05-14 16:02:31 +00:00
sergei
6d0d8734e0 * x86 assembler: operand type declarations rewritten using expressions instead of literal numbers where possible. Reassigned bit values to match the current NASM (the values themselves don't actually matter and can be chosen pretty arbitrary. What matters is the clean separation between different parts of the bitmask. In particular, the old value of XMM register class bit was equal to OT_BITS80, causing matching algorithm to effectively ignore it and accept e.g. MMX registers in place of XMM ones, part of Mantis #14387).
* Fixed matching of memory references with OT_XMMRM and OT_MMXRM.

git-svn-id: trunk@17449 -
2011-05-14 00:07:07 +00:00
sergei
de8ae0f873 x86 assembler improvements:
* Simplified REX handling: instead of useless adjusting instruction length on every REX change, adjust it just once, based on the final REX value.
* Similar for omitting REX.W in certain instructions: set a flag and consider it once the entire instruction has been processed. This removes the requirement for \335 to be the last opcode.
* maybewriterex also after $F2 prefix
* Fixed behavior of codes \310 and \311 (16- and 32-bit address respectively), this is needed for a few fancy instructions like LOOP and JCXZ, which honor address-size prefix instead of REX.
+ control code \361 for $66 prefix
+ IF_SSSE3, IF_SSE41, IF_SSE42 instruction flags (with dummy values)

x86/x86ins.dat:
* replaced literal $67 prefixes with \310 or \311
* marked encodings containing code \310 as NOX86_64
* replaced literal $48 prefixes with \326

git-svn-id: trunk@17433 -
2011-05-12 13:09:51 +00:00
sergei
d288592c5a + Declared operand types OT_XMMRM (matches either xmm register or 128-bit memory reference) and OT_MMXRM (same for mmx).
* Modified taicpu.Pass2 to exclude non-definitely assigned variable and issue InternalError if impossible segment prefix is used.

git-svn-id: trunk@17374 -
2011-04-26 16:34:36 +00:00
Jonas Maebe
0da9d36116 * fixed internal assembler for x86-64 so that it correctly handles
relocations for addr_pic_no_got references (do not go via the GOT)
  * fixed code generator so that it generates addr_pic_no_got references
    also for platforms that use the internal assembler (this will break linking
    of some tests that check static data > 2GB on Linux/x86-64, but they were
    already broken before as well because we don't use the "huge" x86-64
    execution model)
  * fixed x86-64 Linux syscall code to not expect GOT-based relocations for
    the system unit's errno variable (it's an implementation-only variable)

git-svn-id: trunk@16717 -
2011-01-06 09:28:25 +00:00
pierre
386478cd77 * Allow any register for GOT if current procedure has assembler code
git-svn-id: trunk@16110 -
2010-10-08 13:20:28 +00:00
pierre
d2939bce3d * i386 _GLOBAL_OFFSET_TABLE_ label special treatment moved to taicpu.pass2
git-svn-id: trunk@16100 -
2010-10-07 14:14:25 +00:00
mazen
b127fc154a * Fixed spell error revealed by lintian.
git-svn-id: trunk@16094 -
2010-10-06 20:33:57 +00:00
pierre
292e85a59a * Partial fix for i386 linux PIC code generation
git-svn-id: trunk@16080 -
2010-10-05 08:07:15 +00:00
Jonas Maebe
28cd8271c9 * initial version of internal Mach-O/i386 assembler by Dmitry Boyarintsev
(mantis #15163)

git-svn-id: trunk@14628 -
2010-01-12 19:52:55 +00:00
florian
4123e0425c * don't generate instruction alignment fill bytes in non exectuable sections
git-svn-id: trunk@14251 -
2009-11-21 22:34:46 +00:00
Jonas Maebe
ec8fee45fe * do not access local data via the GOT on x86_64, because
a) it's unnecessary
   b) it's slower than "direct" RIP-relative accessing
   c) it's not supported on darwin/x86_64 in certain cases
  * never use absolute addressing on darwin/x86_64 (like on win64)
  * when not generating PIC, make sure that a_loadaddr_ref_reg on x86_64
    also uses RIP-relative addressing for darwin/x86_64 and win64

git-svn-id: trunk@13760 -
2009-09-27 13:43:56 +00:00
Jonas Maebe
146a819615 * fixed spilling of and operations on spilled 32 bit values for x86_64
(mantis #14403)

git-svn-id: trunk@13573 -
2009-08-21 16:20:16 +00:00
yury
92ad06f1e8 * Always use RIP relative symbol addressing for x86_64 Windows targets. Bug #13657.
* Support for simple form of RIP relative addressing by x86_64 assembler writer. Example: movl rax,SomeSymbol(%rip)

git-svn-id: trunk@13135 -
2009-05-13 10:07:44 +00:00
florian
80ff09c6f4 * correct handling of constant operands of aad/aam
git-svn-id: trunk@12158 -
2008-11-18 16:21:58 +00:00
florian
145dc4d8d6 * write assembler error at the correct position, first fix for #12595
git-svn-id: trunk@12157 -
2008-11-18 16:08:22 +00:00
florian
53ffda14f3 * fixes taking the address of an assembler block defined label
* create short jumps also for asm blocks, thanks to Sergej Gorelkin for the patch, resolves #11638

git-svn-id: trunk@12043 -
2008-11-09 21:14:45 +00:00
yury
5e11e697b4 * Use unsigned integers for sizes and positions to break 2GB limit in tdynamicarray, object writer, internal linker, coff and PE headers.
git-svn-id: trunk@11480 -
2008-07-28 20:29:25 +00:00
yury
0bcaf8845f * Fixed 'mixed signed/unsigned' warnings.
* Suppressed 2 unreachable code warnings.
* Now x86 compiler compiles without warnings and notes! It will be great to keep such state in future...

git-svn-id: trunk@11455 -
2008-07-23 13:16:46 +00:00
florian
82c7896d8d * more ins. dat issues popped up, did I mention I start to hate it :(?
git-svn-id: trunk@8968 -
2007-10-28 14:08:04 +00:00
peter
d74bd34a91 * fix 32bit truncation in type determination of constant operands
git-svn-id: trunk@8909 -
2007-10-22 16:36:41 +00:00
peter
c19217f846 * only for jump instructions we need to look at the relative
offset of an symbol

git-svn-id: trunk@8664 -
2007-09-27 20:10:30 +00:00
Jonas Maebe
b4b715f213 * make sure tai_align.calculatefillbuf no longer destroys the fillsize
field, because it can still be read afterwards

git-svn-id: trunk@8602 -
2007-09-22 13:01:30 +00:00
peter
67e16340be * revert r8118
git-svn-id: trunk@8139 -
2007-07-22 19:59:00 +00:00
daniel
21293f5818 + Add common type integer promotion.
- {$intpromotion common_type} or -CIcommon_type switches to common type promotion.
    - {$intpromotion native_integer} or -CIcommon_type switches to current behaviour.
    - Default in tp mode is common_type, native_integer in other modes
    - Compiler can cycle with -CIcommon_type
    - Still needs checking on other architectures than i386

git-svn-id: trunk@8118 -
2007-07-21 19:16:24 +00:00
daniel
9adb202a92 * Rework the constexprint to allow operations from low(int64) to high(qword).
+ Some initial work on a formaldef which also carries the typinfo of a parameter.

git-svn-id: trunk@7639 -
2007-06-13 07:41:18 +00:00
florian
0e96eda236 + some sse4 instructions supported, resolves #9046
git-svn-id: trunk@7613 -
2007-06-09 19:45:06 +00:00
daniel
182fca72f2 * Change spill_* routines to return Taicpu instead of Tai to increase
strong typing.
  * Fix PowerPC R0 register allocation

git-svn-id: trunk@7317 -
2007-05-12 15:43:16 +00:00
florian
d55dbf92d3 * fixed assembling of cvt(t)ss2si
git-svn-id: trunk@6918 -
2007-03-18 17:35:22 +00:00
Jonas Maebe
9813a8708c * fixed encoding of jcxz
git-svn-id: trunk@6398 -
2007-02-10 20:38:38 +00:00
florian
db3f8575ae * fixed library creating on x86_64-linux
git-svn-id: trunk@5828 -
2007-01-06 20:27:59 +00:00
florian
c759b114bf * allow second operand being am imm in intel assembler, fixed #7719
git-svn-id: trunk@5823 -
2007-01-05 23:15:25 +00:00
Jonas Maebe
a23fa2e81e * moved (unfinished) routines related to writing taicpu's to ppu files
from x86/aasmcpu to aasmtai and (new) aasmsym, so that when they're
    finished they're available for all targets
  * added dummy implementation of tai_cpu_abstract.pass1 and pass2 so there
    are no more hundreds of warnings on non-x86 about constructing taicpu
    instances with abstract methods

git-svn-id: trunk@5787 -
2007-01-02 18:28:05 +00:00
florian
ef7bd58c54 * germanism removed (aktfilepos -> current_filepos)
git-svn-id: trunk@5099 -
2006-10-30 22:37:31 +00:00
peter
1de2f94b28 * fixed typo in r4848
git-svn-id: trunk@4966 -
2006-10-18 20:19:44 +00:00
peter
71665dbc4c * initial addr_pic support for x86_64 binary writer
git-svn-id: trunk@4848 -
2006-10-10 18:36:41 +00:00
florian
fb5e396881 + experimental -Sv option to support vector arithmetics
git-svn-id: trunk@4825 -
2006-10-07 21:39:48 +00:00
micha
d704af7216 fix compilation for {$T+} linux/win
git-svn-id: trunk@4794 -
2006-10-04 20:43:55 +00:00
Jonas Maebe
51259b697b * more mmx/sse register spilling fixes:
* operand read/write info for movaps and movapd
    * use "movapd reg,reg" instead of "movaps reg,reg" if appropriate
      so the spilling code can spill the correct size to memory
    * replace movaps/movapd with movss/movsd when spilling to memory
      instead of movq

git-svn-id: trunk@4612 -
2006-09-12 11:07:45 +00:00
florian
e1d1f92672 * don't write rex twice
git-svn-id: trunk@4525 -
2006-08-31 21:58:13 +00:00
florian
5118e35016 * another mayewriterex added, fixes #7261
git-svn-id: trunk@4511 -
2006-08-27 18:49:12 +00:00
peter
34a58e5287 * fix alignment padding for x86_64
git-svn-id: trunk@4001 -
2006-06-29 20:34:54 +00:00