README.txt revision a3c4454c5fb70ab94c7de4faf2600ed729fffda0
1TODO:
2* gpr0 allocation
3* implement do-loop -> bdnz transform
4* implement powerpc-64 for darwin
5* use stfiwx in float->int
6* 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
10
11* 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
28* Support 'update' load/store instructions.  These are cracked on the G5, but
29  are still a codesize win.
30
31* 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
49* 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:
51	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
54
55===-------------------------------------------------------------------------===
56
57* 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
76===-------------------------------------------------------------------------===
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===-------------------------------------------------------------------------===
104