blob: c6c59560eb941c0ed84fa9fe85f04b1e3df27683 [file] [log] [blame]
Nate Begemanb64af912004-08-10 20:42:36 +00001TODO:
Nate Begemanef9531e2005-04-11 20:48:57 +00002* gpr0 allocation
Nate Begeman4a0de072004-10-26 04:10:53 +00003* implement do-loop -> bdnz transform
Nate Begemanca068e82004-08-14 22:16:36 +00004* implement powerpc-64 for darwin
Nate Begemand332fd52004-08-29 22:02:43 +00005* use stfiwx in float->int
Nate Begeman4ad870d2005-07-26 18:59:06 +00006* be able to combine sequences like the following into 2 instructions:
7 lis r2, ha16(l2__ZTV4Cell)
8 la r2, lo16(l2__ZTV4Cell)(r2)
9 addi r2, r2, 8
Chris Lattnerb65975a2005-07-26 19:07:51 +000010
Nate Begeman5a014812005-08-14 01:17:16 +000011* Teach LLVM how to codegen this:
12unsigned short foo(float a) { return a; }
13as:
14_foo:
15 fctiwz f0,f1
16 stfd f0,-8(r1)
17 lhz r3,-2(r1)
18 blr
19not:
20_foo:
21 fctiwz f0, f1
22 stfd f0, -8(r1)
23 lwz r2, -4(r1)
24 rlwinm r3, r2, 0, 16, 31
25 blr
26
27
Chris Lattner6281ae42005-08-05 19:18:32 +000028* Support 'update' load/store instructions. These are cracked on the G5, but
29 are still a codesize win.
30
Chris Lattnerc7e18a12005-08-09 22:30:57 +000031* Add a custom legalizer for the GlobalAddress node, to move the funky darwin
32 stub stuff from the instruction selector to the legalizer (exposing low-level
33 operations to the dag for optzn. For example, we want to codegen this:
34
35 int A = 0;
36 void B() { A++; }
37 as:
38 lis r9,ha16(_A)
39 lwz r2,lo16(_A)(r9)
40 addi r2,r2,1
41 stw r2,lo16(_A)(r9)
42 not:
43 lis r2, ha16(_A)
44 lwz r2, lo16(_A)(r2)
45 addi r2, r2, 1
46 lis r3, ha16(_A)
47 stw r2, lo16(_A)(r3)
48
Misha Brukman4ce5ce22004-07-27 18:43:04 +000049* should hint to the branch select pass that it doesn't need to print the
50 second unconditional branch, so we don't end up with things like:
Misha Brukman4ce5ce22004-07-27 18:43:04 +000051 b .LBBl42__2E_expand_function_8_674 ; loopentry.24
52 b .LBBl42__2E_expand_function_8_42 ; NewDefault
53 b .LBBl42__2E_expand_function_8_42 ; NewDefault
Chris Lattner424dcbd2005-08-23 06:27:59 +000054
Chris Lattnera3c44542005-08-24 18:15:24 +000055===-------------------------------------------------------------------------===
56
Chris Lattner424dcbd2005-08-23 06:27:59 +000057* Codegen this:
58
59 void test2(int X) {
60 if (X == 0x12345678) bar();
61 }
62
63 as:
64
65 xoris r0,r3,0x1234
66 cmpwi cr0,r0,0x5678
67 beq cr0,L6
68
69 not:
70
71 lis r2, 4660
72 ori r2, r2, 22136
73 cmpw cr0, r3, r2
74 bne .LBB_test2_2
75
Chris Lattnera3c44542005-08-24 18:15:24 +000076===-------------------------------------------------------------------------===
77
78Lump the constant pool for each function into ONE pic object, and reference
79pieces of it as offsets from the start. For functions like this (contrived
80to have lots of constants obviously):
81
82double X(double Y) { return (Y*1.23 + 4.512)*2.34 + 14.38; }
83
84We generate:
85
86_X:
87 lis r2, ha16(.CPI_X_0)
88 lfd f0, lo16(.CPI_X_0)(r2)
89 lis r2, ha16(.CPI_X_1)
90 lfd f2, lo16(.CPI_X_1)(r2)
91 fmadd f0, f1, f0, f2
92 lis r2, ha16(.CPI_X_2)
93 lfd f1, lo16(.CPI_X_2)(r2)
94 lis r2, ha16(.CPI_X_3)
95 lfd f2, lo16(.CPI_X_3)(r2)
96 fmadd f1, f0, f1, f2
97 blr
98
99It would be better to materialize .CPI_X into a register, then use immediates
100off of the register to avoid the lis's. This is even more important in PIC
101mode.
102
103===-------------------------------------------------------------------------===
Nate Begeman92cce902005-09-06 15:30:48 +0000104
105Implement Newton-Rhapson method for improving estimate instructions to the
106correct accuracy, and implementing divide as multiply by reciprocal when it has
107more than one use. Itanium will want this too.