Analog Devices Blackfin back-end.
[oota-llvm.git] / lib / Target / Blackfin / README.txt
1 //===-- README.txt - Notes for Blackfin Target ------------------*- org -*-===//
2
3 * Condition codes
4 ** DONE Problem with asymmetric SETCC operations
5 The instruction
6
7   CC = R0 < 2
8
9 is not symmetric - there is no R0 > 2 instruction. On the other hand, IF CC
10 JUMP can take both CC and !CC as a condition. We cannot pattern-match (brcond
11 (not cc), target), the DAG optimizer removes that kind of thing.
12
13 This is handled by creating a pseudo-register NCC that aliases CC. Register
14 classes JustCC and NotCC are used to control the inversion of CC.
15
16 ** DONE CC as an i32 register
17 The AnyCC register class pretends to hold i32 values. It can only represent the
18 values 0 and 1, but we can copy to and from the D class. This hack makes it
19 possible to represent the setcc instruction without having i1 as a legal type.
20
21 In most cases, the CC register is set by a "CC = .." or BITTST instruction, and
22 then used in a conditional branch or move. The code generator thinks it is
23 moving 32 bits, but the value stays in CC. In other cases, the result of a
24 comparison is actually used as am i32 number, and CC will be copied to a D
25 register.
26
27 * Stack frames
28 ** TODO Use Push/Pop instructions
29 We should use the push/pop instructions when saving callee-saved
30 registers. The are smaller, and we may even use push multiple instructions.
31
32 ** TODO requiresRegisterScavenging
33 We need more intelligence in determining when the scavenger is needed. We
34 should keep track of:
35 - Spilling D16 registers
36 - Spilling AnyCC registers
37
38 * Assembler
39 ** TODO Implement PrintGlobalVariable
40 ** TODO Remove LOAD32sym
41 It's a hack combining two instructions by concatenation.
42
43 * Inline Assembly
44 ** TODO Support all register classes
45 * DAG combiner
46 ** Create test case for each Illegal SETCC case
47 The DAG combiner may someimes produce illegal i16 SETCC instructions.
48
49 *** TODO SETCC (ctlz x), 5) == const
50 *** TODO SETCC (and load, const) == const
51 *** DONE SETCC (zext x) == const
52 *** TODO SETCC (sext x) == const
53
54 * Instruction selection
55 ** TODO Better imediate constants
56 Like ARM, build constants as small imm + shift.
57
58 ** TODO Implement cycle counter
59 We have CYCLES and CYCLES2 registers, but the readcyclecounter intrinsic wants
60 to return i64, and the code generator doesn't know how to legalize that.
61
62 ** TODO Instruction alternatives
63 Some instructions come in different variants for example:
64
65   D = D + D
66   P = P + P
67
68 Cross combinations are not allowed:
69
70   P = D + D (bad)
71
72 Similarly for the subreg pseudo-instructions:
73
74  D16L = EXTRACT_SUBREG D16, bfin_subreg_lo16
75  P16L = EXTRACT_SUBREG P16, bfin_subreg_lo16
76
77 We want to take advantage of the alternative instructions. This could be done by
78 changing the DAG after instruction selection.
79
80
81 ** Multipatterns for load/store
82 We should try to identify multipatterns for load and store instructions. The
83 available instruction matrix is a bit irregular.
84
85 Loads:
86
87 | Addr       | D | P | D 16z | D 16s | D16 | D 8z | D 8s |
88 |------------+---+---+-------+-------+-----+------+------|
89 | P          | * | * | *     | *     | *   | *    | *    |
90 | P++        | * | * | *     | *     |     | *    | *    |
91 | P--        | * | * | *     | *     |     | *    | *    |
92 | P+uimm5m2  |   |   | *     | *     |     |      |      |
93 | P+uimm6m4  | * | * |       |       |     |      |      |
94 | P+imm16    |   |   |       |       |     | *    | *    |
95 | P+imm17m2  |   |   | *     | *     |     |      |      |
96 | P+imm18m4  | * | * |       |       |     |      |      |
97 | P++P       | * |   | *     | *     | *   |      |      |
98 | FP-uimm7m4 | * | * |       |       |     |      |      |
99 | I          | * |   |       |       | *   |      |      |
100 | I++        | * |   |       |       | *   |      |      |
101 | I--        | * |   |       |       | *   |      |      |
102 | I++M       | * |   |       |       |     |      |      |
103
104 Stores:
105
106 | Addr       | D | P | D16H | D16L | D 8 |
107 |------------+---+---+------+------+-----|
108 | P          | * | * | *    | *    | *   |
109 | P++        | * | * |      | *    | *   |
110 | P--        | * | * |      | *    | *   |
111 | P+uimm5m2  |   |   |      | *    |     |
112 | P+uimm6m4  | * | * |      |      |     |
113 | P+imm16    |   |   |      |      | *   |
114 | P+imm17m2  |   |   |      | *    |     |
115 | P+imm18m4  | * | * |      |      |     |
116 | P++P       | * |   | *    | *    |     |
117 | FP-uimm7m4 | * | * |      |      |     |
118 | I          | * |   | *    | *    |     |
119 | I++        | * |   | *    | *    |     |
120 | I--        | * |   | *    | *    |     |
121 | I++M       | * |   |      |      |     |
122