OLD | NEW |
1 Target-specific lowering in ICE | 1 Target-specific lowering in ICE |
2 =============================== | 2 =============================== |
3 | 3 |
4 This document discusses several issues around generating target-specific ICE | 4 This document discusses several issues around generating target-specific ICE |
5 instructions from high-level ICE instructions. | 5 instructions from high-level ICE instructions. |
6 | 6 |
7 Meeting register address mode constraints | 7 Meeting register address mode constraints |
8 ----------------------------------------- | 8 ----------------------------------------- |
9 | 9 |
10 Target-specific instructions often require specific operands to be in physical | 10 Target-specific instructions often require specific operands to be in physical |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 instruction. Using pseudocode:: | 211 instruction. Using pseudocode:: |
212 | 212 |
213 t1:eax = call foo(arg1, ...) | 213 t1:eax = call foo(arg1, ...) |
214 InstFakeKill // eax, ecx, edx | 214 InstFakeKill // eax, ecx, edx |
215 t2:edx = InstFakeDef(t1) | 215 t2:edx = InstFakeDef(t1) |
216 v_result_low = t1 | 216 v_result_low = t1 |
217 v_result_high = t2 | 217 v_result_high = t2 |
218 | 218 |
219 If ``v_result_high`` is live but ``v_result_low`` is dead, adding ``t1`` as an | 219 If ``v_result_high`` is live but ``v_result_low`` is dead, adding ``t1`` as an |
220 argument to ``InstFakeDef`` suffices to keep the ``call`` instruction live. | 220 argument to ``InstFakeDef`` suffices to keep the ``call`` instruction live. |
| 221 |
| 222 Instructions modifying source operands |
| 223 -------------------------------------- |
| 224 |
| 225 Some native instructions may modify one or more source operands. For example, |
| 226 the x86 ``xadd`` and ``xchg`` instructions modify both source operands. Some |
| 227 analysis needs to identify every place a ``Variable`` is modified, and it uses |
| 228 the presence of a ``Dest`` variable for this analysis. Since ICE instructions |
| 229 have at most one ``Dest``, the ``xadd`` and ``xchg`` instructions need special |
| 230 treatment. |
| 231 |
| 232 A ``Variable`` that is not the ``Dest`` can be marked as modified by adding an |
| 233 ``InstFakeDef``. However, this is not sufficient, as the ``Variable`` may have |
| 234 no more live uses, which could result in the ``InstFakeDef`` being dead-code |
| 235 eliminated. The solution is to add an ``InstFakeUse`` as well. |
| 236 |
| 237 To summarize, for every source ``Variable`` that is not equal to the |
| 238 instruction's ``Dest``, append an ``InstFakeDef`` and ``InstFakeUse`` |
| 239 instruction to provide the necessary analysis information. |
OLD | NEW |