Commit Graph

37 Commits

Author SHA1 Message Date
Chris Lattner
4a2e5edb94 implement the rest of correct x86-64 encoder support for
rip-relative addresses, and add a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96040 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 23:24:09 +00:00
Chris Lattner
86020e4628 give MCCodeEmitters access to the current MCContext.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96038 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 23:12:47 +00:00
Chris Lattner
835acabce1 implement infrastructure to support fixups for rip-rel
addressing.  This isn't complete because I need an MCContext
to generate new MCExprs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96036 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 23:00:36 +00:00
Chris Lattner
1e35d0e923 pull the rip-relative addressing mode case up early.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96031 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 22:47:55 +00:00
Chris Lattner
9cc48eb897 fixme resolved!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96029 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 22:39:06 +00:00
Chris Lattner
cf65339b52 start producing reloc_pcrel_4byte/reloc_pcrel_1byte for calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96028 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 22:36:47 +00:00
Chris Lattner
0d8db8e0a8 add a bunch of mod/rm encoding types for fixed mod/rm bytes.
This will work better for the disassembler for modeling things
like lfence/monitor/vmcall etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95960 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 02:06:33 +00:00
Chris Lattner
c4d3f662fc fix the encodings of monitor and mwait, which were completely
busted in both encoders.  I'm not bothering to fix it in the
old one at this point.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95947 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-12 01:06:22 +00:00
Chris Lattner
7e85180d15 add a new MCInstPrinter::getOpcodeName interface, when it is
implemented, llvm-mc --show-inst now uses it to print the
instruction opcode as well as the number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95929 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 22:39:10 +00:00
Chris Lattner
8d31de6268 make getFixupKindInfo return a const reference, allowing
the tables to be const.  Teach MCCodeEmitter to handle
the target-indep kinds so that we don't crash on them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95924 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 21:27:18 +00:00
Chris Lattner
11eafa8bed switch to target-indep fixups for 1/2/4/8 byte data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 21:17:54 +00:00
Chris Lattner
bd13fb6254 refactor the conditional jump instructions in the .td file to
use a multipattern that generates both the 1-byte and 4-byte 
versions from the same defm


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95901 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 19:25:55 +00:00
Chris Lattner
ecfb3c3d66 dont' call getX86RegNum on X86::RIP, it doesn't like that. This
fixes the remaining x86-64 jit failures afaik.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95867 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 08:45:56 +00:00
Chris Lattner
5526b69901 fix a really nasty bug I introduced in r95693: r12 (and r12d,
r12b, etc) also encodes to a R/M value of 4, which is just
as illegal as ESP/RSP for the non-sib version an address.

This fixes x86-64 jit miscompilations of a bunch of programs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 08:41:21 +00:00
Chris Lattner
8b0f7a7d86 Add and commonize encoder support for all immediates.
Stub out some dummy fixups to make things work.

We can now emit fixups like this:
	subl	$20, %esp               ## encoding: [0x83,0xec,A]
                                        ##   fixup A - offset: 2, value: 20, kind: fixup_1byte_imm

Emitting $20 as a single-byte fixup to be later resolved
by the assembler is ridiculous of course (vs just emitting
the byte) but this is a failure of the matcher, which 
should be producing an imm of 20, not an MCExpr of 20.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 07:06:31 +00:00
Chris Lattner
a38c707d82 generalize EmitDisplacementField to work with any size
and rename it to EmitImmediate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95859 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 06:54:23 +00:00
Chris Lattner
0e410918b8 eliminate the dead IsPCRel argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95858 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 06:51:36 +00:00
Chris Lattner
1b67060645 eliminate the dead "PCAdj" logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95857 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-11 06:49:52 +00:00
Chris Lattner
5dccfadbf4 emit some simple (and probably incorrect) fixups for symbolic
displacement values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95773 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 06:52:12 +00:00
Chris Lattner
37ce80eca3 keep track of what the current byte being emitted is
throughout the X86 encoder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95771 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 06:41:02 +00:00
Chris Lattner
8496a26113 simplify displacement handling, emit displacements by-operand
even for the immediate case.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95770 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-10 06:30:00 +00:00
Daniel Dunbar
73c557458c MC: First cut at MCFixup, for getting fixup/relocation information out of an MCCodeEmitter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95708 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 22:59:55 +00:00
Chris Lattner
a8168ec732 port encoder enhancements over to the new encoder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-09 21:57:34 +00:00
Chris Lattner
faa75f6f6f add note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95445 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 22:48:33 +00:00
Chris Lattner
39a612e6f9 port X86InstrInfo::determineREX over to the new encoder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95440 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 22:10:22 +00:00
Chris Lattner
00cb3fe786 wire up 64-bit MCCodeEmitter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95438 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 21:51:35 +00:00
Chris Lattner
be1778fea7 really kill off the last MRMInitReg inst, remove logic from encoder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95437 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 21:34:18 +00:00
Chris Lattner
82ed17eb47 implement the rest of the encoding types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95414 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 19:37:31 +00:00
Chris Lattner
74a2151392 move functions for decoding X86II values into the X86II namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 19:24:13 +00:00
Chris Lattner
a3a0db0121 change getSizeOfImm and getBaseOpcodeFor to just take
TSFlags directly instead of a TargetInstrDesc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95405 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 19:16:26 +00:00
Chris Lattner
daa4555793 add some more encodings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95403 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 19:04:37 +00:00
Chris Lattner
0e73c39c70 implement the non-relocation forms of memory operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95368 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 06:16:07 +00:00
Chris Lattner
1ac23b1038 start adding MRMDestMem, which requires memory form mod/rm encoding
to start limping.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95350 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 02:18:40 +00:00
Chris Lattner
28249d98e1 Add a few more encodings, we can now encode all of:
pushl	%ebp
	movl	%esp, %ebp
	movl	$42, %eax
	popl	%ebp
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95344 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 01:53:19 +00:00
Chris Lattner
1e80f403e2 enhance new encoder to support prefixes + RawFrm
instructions with no operands.  It can now handle

define void @test2() nounwind { ret void }



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95261 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03 21:57:59 +00:00
Chris Lattner
92b1dfe5d8 set up some infrastructure, some minor cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95260 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03 21:43:43 +00:00
Chris Lattner
4576247928 stub out a new X86 encoder, which can be tried with
-enable-new-x86-encoder until its stable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95256 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03 21:24:49 +00:00