Kalle Raiskila
917df2ee14
Improve code layout, mostly indentation.
...
No functionality change.
llvm-svn: 119142
2010-11-15 10:12:32 +00:00
Chris Lattner
c00f41ef21
Wire up primitive support in the assembler backend for writing .o files
...
directly on the mac. This is very early, doesn't support relocations and
has a terrible hack to avoid .machine from being printed, but despite
that it generates an bitwise-identical-to-cctools .o file for stuff like
this:
define i32 @test() nounwind { ret i32 42 }
I don't plan to continue pushing this forward, but if anyone else was
interested in doing it, it should be really straight-forward.
llvm-svn: 119136
2010-11-15 08:49:58 +00:00
Chris Lattner
51793c5b92
split out an encoder for memri operands, allowing a relocation to be plopped
...
into the immediate field. This allows us to encode stuff like this:
lbz r3, lo16(__ZL4init)(r4) ; globalopt.cpp:5
; encoding: [0x88,0x64,A,A]
; fixup A - offset: 0, value: lo16(__ZL4init), kind: fixup_ppc_lo16
stw r3, lo16(__ZL1s)(r5) ; globalopt.cpp:6
; encoding: [0x90,0x65,A,A]
; fixup A - offset: 0, value: lo16(__ZL1s), kind: fixup_ppc_lo16
With this, we should have a completely function MCCodeEmitter for PPC, wewt.
llvm-svn: 119134
2010-11-15 08:22:03 +00:00
Chris Lattner
96f8078924
add support for encoding the lo14 forms used for a few PPC64 addressing
...
modes. For example, we now get:
ld r3, lo16(_G)(r3) ; encoding: [0xe8,0x63,A,0bAAAAAA00]
; fixup A - offset: 0, value: lo16(_G), kind: fixup_ppc_lo14
llvm-svn: 119133
2010-11-15 08:02:41 +00:00
Chris Lattner
a028364bcd
fix a regression with the new instprinter: we lost the ability to
...
print DBG_VALUE instructions. This should unbreak the llvm-gcc-powerpc-darwin9
buildbot.
llvm-svn: 119132
2010-11-15 07:52:06 +00:00
Chris Lattner
ac5f6ff408
implement the start of support for lo16 and ha16, allowing us to get stuff like:
...
lis r4, ha16(__ZL4init) ; encoding: [0x3c,0x80,A,A]
; fixup A - offset: 0, value: ha16(__ZL4init), kind: fixup_ppc_ha16
llvm-svn: 119127
2010-11-15 06:33:39 +00:00
Chris Lattner
f04cb8ebad
add a fixup for conditional branches, giving us output like this:
...
beq cr0, LBB0_4 ; encoding: [0x41,0x82,A,0bAAAAAA00]
; fixup A - offset: 0, value: LBB0_4, kind: fixup_ppc_brcond14
llvm-svn: 119126
2010-11-15 06:12:22 +00:00
Chris Lattner
8b6744a612
change direct branches to encode with the same encoding method
...
as direct calls. Change conditional branches to encode with
their own method, simplifying the JIT encoder and making room
for adding an mc fixup.
llvm-svn: 119125
2010-11-15 06:09:35 +00:00
Chris Lattner
4795a876f6
eliminate a now-unneeded operand printer.
...
llvm-svn: 119124
2010-11-15 06:01:10 +00:00
Chris Lattner
37bebc344a
split call operands out to their own encoding class, simplifying
...
code in the JIT. Use this to form the first fixup for the PPC backend,
giving us stuff like this:
bl L_foo$stub ; encoding: [0b010010AA,A,A,0bAAAAAA01]
; fixup A - offset: 0, value: L_foo$stub, kind: fixup_ppc_br24
llvm-svn: 119123
2010-11-15 05:57:53 +00:00
Chris Lattner
6eb2a0b277
add proper encoding for MTCRF instead of using a hack.
...
llvm-svn: 119121
2010-11-15 05:19:25 +00:00
Chris Lattner
b2daeac125
add fields to the .td files unconditionally, simplifying tblgen a bit.
...
Switch the ARM backend to use 'let' instead of 'set' with this change.
llvm-svn: 119120
2010-11-15 05:19:05 +00:00
Chris Lattner
6f23a467b0
add basic encoding support for immediates and registers, allowing us
...
to encode all of these instructions correctly (for example):
mflr r0 ; encoding: [0x7c,0x08,0x02,0xa6]
stw r0, 8(r1) ; encoding: [0x90,0x01,0x00,0x08]
stwu r1, -64(r1) ; encoding: [0x94,0x21,0xff,0xc0]
llvm-svn: 119118
2010-11-15 04:51:55 +00:00
Chris Lattner
ca7d8427c9
add a dummy entry to fix a build error
...
llvm-svn: 119117
2010-11-15 04:47:16 +00:00
Chris Lattner
d5a087b439
Implement a basic MCCodeEmitter for PPC. This doesn't handle
...
fixups yet, and doesn't handle actually encoding operand values,
but this is enough for llc -show-mc-encoding to show the base
instruction encoding information, e.g.:
mflr r0 ; encoding: [0x7c,0x08,0x02,0xa6]
stw r0, 8(r1) ; encoding: [0x90,0x00,0x00,0x00]
stwu r1, -64(r1) ; encoding: [0x94,0x00,0x00,0x00]
Ltmp0:
lhz r4, 4(r3) ; encoding: [0xa0,0x00,0x00,0x00]
cmplwi cr0, r4, 8 ; encoding: [0x28,0x00,0x00,0x00]
beq cr0, LBB0_2 ; encoding: [0x40,0x00,0x00,0x00]
llvm-svn: 119116
2010-11-15 04:16:32 +00:00
Chris Lattner
d79d1b6297
dissolve some more hacks.
...
llvm-svn: 119115
2010-11-15 03:53:53 +00:00
Chris Lattner
3ee55a9b8d
fix some fixme's, removing dead code.
...
llvm-svn: 119114
2010-11-15 03:51:13 +00:00
Chris Lattner
8fa38e3222
remove asmstrings (which can never be printed) from pseudo
...
instructions, allowing is to eliminate some dead operand
printing methods from the instprinter.
llvm-svn: 119113
2010-11-15 03:48:58 +00:00
Chris Lattner
5f571f5a13
strength reduce TOC temp label generation, no functionality change.
...
llvm-svn: 119112
2010-11-15 03:42:54 +00:00
Chris Lattner
38e49f3f11
rip out a ton of old instruction printing junk now that the
...
new instprinting logic is there.
llvm-svn: 119111
2010-11-15 03:39:06 +00:00
Evan Cheng
73e79b8a9c
Make sure ARM multi load / store pass copies memoperands when forming ldrd / strd. pr8113.
...
llvm-svn: 119109
2010-11-15 03:30:30 +00:00
Chris Lattner
9ffced5b9d
Turn on the new instprinter by default.
...
The only change in the output is:
1) we get a better comment on mfcr, we get:
mfcr r2 ; cr2
instead of:
mfcr r2 ; 32
2) we no longer emit $stub's on powerpc/leopard. The Leopard
linker autosynthesizes them.
llvm-svn: 119108
2010-11-15 03:27:05 +00:00
Chris Lattner
e50d695490
convert the operand bits into bitfields since they are all combinable in
...
different ways. Add $non_lazy_ptr support, and proper lowering for
global values.
Now all the ppc regression tests pass with the new instruction printer.
llvm-svn: 119106
2010-11-15 03:13:19 +00:00
Chris Lattner
9a0a840839
add targetoperand flags for jump tables, constant pool and block address
...
nodes to indicate when ha16/lo16 modifiers should be used. This lets
us pass PowerPC/indirectbr.ll.
The one annoying thing about this patch is that the MCSymbolExpr isn't
expressive enough to represent ha16(label1-label2) which we need on
PowerPC. I have a terrible hack in the meantime, but this will have
to be revisited at some point.
Last major conversion item left is global variable references.
llvm-svn: 119105
2010-11-15 02:46:57 +00:00
Chris Lattner
7743db8f20
remove some extraneous quotes to make the new instprinter match.
...
llvm-svn: 119104
2010-11-15 02:43:46 +00:00
Chris Lattner
11e50c531a
silence a ton of warnings from clang.
...
llvm-svn: 119102
2010-11-15 01:45:44 +00:00
Anton Korobeynikov
794259aec0
Attempt to unbreak cmake-based builds
...
llvm-svn: 119098
2010-11-15 00:48:12 +00:00
Anton Korobeynikov
76c52dcf44
First step of huge frame-related refactoring: move emit{Prologue,Epilogue} out of TargetRegisterInfo to TargetFrameInfo, which is definitely much better suitable place
...
llvm-svn: 119097
2010-11-15 00:06:54 +00:00
Anton Korobeynikov
33f85080b4
Whitespace cleanup
...
llvm-svn: 119096
2010-11-15 00:06:05 +00:00
Chris Lattner
3512e07ecf
implement support for the MO_DARWIN_STUB TargetOperand flag,
...
and have isel apply to to call operands as required. This allows
us to get $stub suffixes on label references on ppc/tiger with the
new instprinter, fixing two tests. Only 2 to go.
llvm-svn: 119093
2010-11-14 23:42:06 +00:00
Chris Lattner
b347be831c
tidy up, no functionality change.
...
llvm-svn: 119092
2010-11-14 23:32:42 +00:00
Chris Lattner
6af9d8969d
with the picbase nonsense starting to be figured out, implement
...
lowering support for MovePCtoLR[8]. Down to 4 failures again.
llvm-svn: 119090
2010-11-14 22:56:43 +00:00
Chris Lattner
51168d6510
move the pic base symbol stuff up to MachineFunction
...
since it is trivial and will be shared between ppc and x86.
This substantially simplifies the X86 backend also.
llvm-svn: 119089
2010-11-14 22:48:15 +00:00
Chris Lattner
09ea2ce78f
simplify getPICBaseSymbol a bit.
...
llvm-svn: 119088
2010-11-14 22:37:11 +00:00
Chris Lattner
fc626aa37d
reimplement ppc asmprinter "toc" handling to use a VariantKind
...
on the operand, required for .o file writing and fixing
the PowerPC/mult-alt-generic-powerpc64.ll failure with the new
instprinter.
llvm-svn: 119087
2010-11-14 22:22:59 +00:00
Chris Lattner
3c8d9ea286
lower PPC::MFCRpseud when transforming to MC, avoiding calling
...
the aborting printSpecial() method. This gets us to 8 failures.
llvm-svn: 119084
2010-11-14 22:03:15 +00:00
Chris Lattner
36fad020cd
make the stubbed-out printer methods abort instead of
...
printing nothing. This gets us back up to 24 failures.
llvm-svn: 119083
2010-11-14 21:54:34 +00:00
Chris Lattner
331d966779
wire up a few more things, down to 4 test failures, all
...
about handling $stub, lo/hi etc.
llvm-svn: 119082
2010-11-14 21:51:37 +00:00
Chris Lattner
3959bd7fb4
properly wire up the instprinter to the ppc64 backend, down to 5 failures.
...
llvm-svn: 119081
2010-11-14 21:42:53 +00:00
Chris Lattner
27b65608d0
implement pretty printing support for the various pseudo
...
ops the asmprinter supported, fixing PowerPC/rlwimi2.ll
among others. Down to 20 failures.
llvm-svn: 119080
2010-11-14 21:39:51 +00:00
Chris Lattner
437623476f
Wire up symbol hi/lo printing. We don't print hi()/lo(), but this gets
...
us further along. Only 28 failures now.
llvm-svn: 119079
2010-11-14 21:33:07 +00:00
Chris Lattner
b12ecaae5a
implement basic support for symbol operand lowering,
...
and printing support for call operands. Down to 77 failures.
llvm-svn: 119078
2010-11-14 21:20:46 +00:00
Chris Lattner
3bf85b2f4b
trim #includes.
...
llvm-svn: 119075
2010-11-14 21:16:04 +00:00
Chris Lattner
32848508af
switch PPC to a simplified MCInstLowering model.
...
llvm-svn: 119074
2010-11-14 21:12:33 +00:00
Chris Lattner
163fbca360
fix PPC.h to not pull in TargetMachine.h
...
llvm-svn: 119072
2010-11-14 21:09:28 +00:00
Chris Lattner
3a01d37b66
rename LowerToMCInst -> LowerARMMachineInstrToMCInst.
...
llvm-svn: 119071
2010-11-14 21:00:02 +00:00
Chris Lattner
4dac1b2742
even more simplifications. ARM MCInstLowering is now just
...
a single function instead of a class. It doesn't need the
complexity that X86 does.
llvm-svn: 119070
2010-11-14 20:58:38 +00:00
Chris Lattner
3ebf1f315e
more shrinkification
...
llvm-svn: 119068
2010-11-14 20:41:53 +00:00
Chris Lattner
758bc06aff
more simplifications.
...
llvm-svn: 119067
2010-11-14 20:40:08 +00:00
Chris Lattner
2393da7c40
simplify and tidy up
...
llvm-svn: 119066
2010-11-14 20:31:06 +00:00