Mercurial > hg > Members > tobaru > cbc > CbC_llvm
comparison docs/CodeGenerator.rst @ 83:60c9769439b8
LLVM 3.7
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 18 Feb 2015 14:55:36 +0900 |
parents | 54457678186b |
children | afa8332a0e37 |
comparison
equal
deleted
inserted
replaced
78:af83660cff7b | 83:60c9769439b8 |
---|---|
288 supported by the target. Descriptions define things like the mnemonic for | 288 supported by the target. Descriptions define things like the mnemonic for |
289 the opcode, the number of operands, the list of implicit register uses and defs, | 289 the opcode, the number of operands, the list of implicit register uses and defs, |
290 whether the instruction has certain target-independent properties (accesses | 290 whether the instruction has certain target-independent properties (accesses |
291 memory, is commutable, etc), and holds any target-specific flags. | 291 memory, is commutable, etc), and holds any target-specific flags. |
292 | 292 |
293 The ``TargetFrameInfo`` class | 293 The ``TargetFrameLowering`` class |
294 ----------------------------- | 294 --------------------------------- |
295 | 295 |
296 The ``TargetFrameInfo`` class is used to provide information about the stack | 296 The ``TargetFrameLowering`` class is used to provide information about the stack |
297 frame layout of the target. It holds the direction of stack growth, the known | 297 frame layout of the target. It holds the direction of stack growth, the known |
298 stack alignment on entry to each function, and the offset to the local area. | 298 stack alignment on entry to each function, and the offset to the local area. |
299 The offset to the local area is the offset from the stack pointer on function | 299 The offset to the local area is the offset from the stack pointer on function |
300 entry to the first location where function data (local variables, spill | 300 entry to the first location where function data (local variables, spill |
301 locations) can be stored. | 301 locations) can be stored. |
462 | 462 |
463 ;; X is in EAX, Y is in ECX | 463 ;; X is in EAX, Y is in ECX |
464 mov %EAX, %EDX | 464 mov %EAX, %EDX |
465 sar %EDX, 31 | 465 sar %EDX, 31 |
466 idiv %ECX | 466 idiv %ECX |
467 ret | 467 ret |
468 | 468 |
469 This approach is extremely general (if it can handle the X86 architecture, it | 469 This approach is extremely general (if it can handle the X86 architecture, it |
470 can handle anything!) and allows all of the target specific knowledge about the | 470 can handle anything!) and allows all of the target specific knowledge about the |
471 instruction stream to be isolated in the instruction selector. Note that | 471 instruction stream to be isolated in the instruction selector. Note that |
472 physical registers should have a short lifetime for good code generation, and | 472 physical registers should have a short lifetime for good code generation, and |
846 The ``-view-sunit-dags`` displays the Scheduler's dependency graph. This graph | 846 The ``-view-sunit-dags`` displays the Scheduler's dependency graph. This graph |
847 is based on the final SelectionDAG, with nodes that must be scheduled together | 847 is based on the final SelectionDAG, with nodes that must be scheduled together |
848 bundled into a single scheduling-unit node, and with immediate operands and | 848 bundled into a single scheduling-unit node, and with immediate operands and |
849 other nodes that aren't relevant for scheduling omitted. | 849 other nodes that aren't relevant for scheduling omitted. |
850 | 850 |
851 The option ``-filter-view-dags`` allows to select the name of the basic block | |
852 that you are interested to visualize and filters all the previous | |
853 ``view-*-dags`` options. | |
854 | |
851 .. _Build initial DAG: | 855 .. _Build initial DAG: |
852 | 856 |
853 Initial SelectionDAG Construction | 857 Initial SelectionDAG Construction |
854 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 858 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
855 | 859 |