Mercurial > hg > CbC > CbC_llvm
diff docs/MIRLangRef.rst @ 148:63bd29f05246
merged
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 19:46:37 +0900 |
parents | c2174574ed3a |
children |
line wrap: on
line diff
--- a/docs/MIRLangRef.rst Sun Dec 23 19:23:36 2018 +0900 +++ b/docs/MIRLangRef.rst Wed Aug 14 19:46:37 2019 +0900 @@ -60,6 +60,11 @@ ``llc -stop-after=machine-cp bug-trigger.ll > test.mir`` +If the same pass is run multiple times, a run index can be included +after the name with a comma. + + ``llc -stop-after=dead-mi-elimination,1 bug-trigger.ll > test.mir`` + After generating the input MIR file, you'll have to add a run line that uses the ``-run-pass`` option to it. In order to test the post register allocation pseudo instruction expansion pass on X86-64, a run line like the one shown @@ -135,7 +140,7 @@ - The target-specific ``MachineConstantPoolValue`` subclasses (in the ARM and SystemZ backends) aren't serialized at the moment. -- The ``MCSymbol`` machine operands are only printed, they can't be parsed. +- The ``MCSymbol`` machine operands don't support temporary or local symbols. - A lot of the state in ``MachineModuleInfo`` isn't serialized - only the CFI instructions and the variable debug information from MMI is serialized right @@ -143,9 +148,9 @@ These limitations impose restrictions on what you can test with the MIR format. For now, tests that would like to test some behaviour that depends on the state -of certain ``MCSymbol`` operands or the exception handling state in MMI, can't -use the MIR format. As well as that, tests that test some behaviour that -depends on the state of the target specific ``MachineFunctionInfo`` or +of temporary or local ``MCSymbol`` operands or the exception handling state in +MMI, can't use the MIR format. As well as that, tests that test some behaviour +that depends on the state of the target specific ``MachineFunctionInfo`` or ``MachineConstantPoolValue`` subclasses can't use the MIR format at the moment. High Level Structure @@ -185,15 +190,19 @@ name: inc tracksRegLiveness: true liveins: - - { reg: '%rdi' } + - { reg: '$rdi' } + callSites: + - { bb: 0, offset: 3, fwdArgRegs: + - { arg: 0, reg: '$edi' } } body: | bb.0.entry: - liveins: %rdi + liveins: $rdi - %eax = MOV32rm %rdi, 1, _, 0, _ - %eax = INC32r killed %eax, implicit-def dead %eflags - MOV32mr killed %rdi, 1, _, 0, _, %eax - RETQ %eax + $eax = MOV32rm $rdi, 1, _, 0, _ + $eax = INC32r killed $eax, implicit-def dead $eflags + MOV32mr killed $rdi, 1, _, 0, _, $eax + CALL64pcrel32 @foo <regmask...> + RETQ $eax ... The document above consists of attributes that represent the various @@ -205,6 +214,9 @@ The attribute ``body`` is a `YAML block literal string`_. Its value represents the function's machine basic blocks and their machine instructions. +The attribute ``callSites`` is a representation of call site information which +keeps track of call instructions and registers used to transfer call arguments. + Machine Instructions Format Reference ===================================== @@ -307,7 +319,7 @@ .. code-block:: text bb.0.entry: - liveins: %edi, %esi + liveins: $edi, $esi The list of live in registers and successors can be empty. The language also allows multiple live in register and successor lists - they are combined into @@ -344,7 +356,7 @@ .. code-block:: text - RETQ %eax + RETQ $eax However, if the machine instruction has one or more explicitly defined register operands, the instruction's name has to be specified after them. The example @@ -353,7 +365,7 @@ .. code-block:: text - %sp, %fp, %lr = LDPXpost %sp, 2 + $sp, $fp, $lr = LDPXpost $sp, 2 The instruction names are serialized using the exact definitions from the target's ``*InstrInfo.td`` files, and they are case sensitive. This means that @@ -370,11 +382,11 @@ .. code-block:: text - %fp = frame-setup ADDXri %sp, 0, 0 + $fp = frame-setup ADDXri $sp, 0, 0 .. code-block:: text - %x21, %x20 = frame-destroy LDPXi %sp + $x21, $x20 = frame-destroy LDPXi $sp .. _registers: @@ -385,9 +397,9 @@ .. code-block:: text - BUNDLE implicit-def %r0, implicit-def %r1, implicit %r2 { - %r0 = SOME_OP %r2 - %r1 = ANOTHER_OP internal %r0 + BUNDLE implicit-def $r0, implicit-def $r1, implicit $r2 { + $r0 = SOME_OP $r2 + $r1 = ANOTHER_OP internal $r0 } The first instruction is often a bundle header. The instructions between ``{`` @@ -397,28 +409,28 @@ --------- Registers are one of the key primitives in the machine instructions -serialization language. They are primarly used in the +serialization language. They are primarily used in the :ref:`register machine operands <register-operands>`, but they can also be used in a number of other places, like the :ref:`basic block's live in list <bb-liveins>`. -The physical registers are identified by their name. They use the following -syntax: +The physical registers are identified by their name and by the '$' prefix sigil. +They use the following syntax: .. code-block:: text - %<name> + $<name> The example below shows three X86 physical registers: .. code-block:: text - %eax - %r15 - %eflags + $eax + $r15 + $eflags -The virtual registers are identified by their ID number. They use the following -syntax: +The virtual registers are identified by their ID number and by the '%' sigil. +They use the following syntax: .. code-block:: text @@ -431,7 +443,7 @@ %0 The null registers are represented using an underscore ('``_``'). They can also be -represented using a '``%noreg``' named register, although the former syntax +represented using a '``$noreg``' named register, although the former syntax is preferred. .. _machine-operands: @@ -439,9 +451,8 @@ Machine Operands ---------------- -There are seventeen different kinds of machine operands, and all of them, except -the ``MCSymbol`` operand, can be serialized. The ``MCSymbol`` operands are -just printed out - they can't be parsed back yet. +There are seventeen different kinds of machine operands, and all of them can be +serialized. Immediate Operands ^^^^^^^^^^^^^^^^^^ @@ -452,7 +463,7 @@ .. code-block:: text - %eax = MOV32ri -42 + $eax = MOV32ri -42 An immediate operand is also used to represent a subregister index when the machine instruction has one of the following opcodes: @@ -510,7 +521,7 @@ .. code-block:: text - dead %eax = XOR32rr undef %eax, undef %eax, implicit-def dead %eflags, implicit-def %al + dead $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $al .. _register-flags: @@ -630,7 +641,7 @@ .. code-block:: text - %rax = MOV64rm %rip, 1, _, @G, _ + $rax = MOV64rm $rip, 1, _, @G, _ The named global values are represented using an identifier with the '@' prefix. If the identifier doesn't match the regular expression @@ -652,7 +663,7 @@ .. code-block:: text - %sgpr2 = S_ADD_U32 _, target-index(amdgpu-constdata-start) + 8, implicit-def _, implicit-def _ + $sgpr2 = S_ADD_U32 _, target-index(amdgpu-constdata-start) + 8, implicit-def _, implicit-def _ Jump-table Index Operands ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -661,7 +672,7 @@ .. code-block:: text - tBR_JTr killed %r0, %jump-table.0 + tBR_JTr killed $r0, %jump-table.0 A machine jump-table entry contains a list of ``MachineBasicBlocks``. When serializing all the function's jump-table entries, the following format is used: @@ -690,7 +701,7 @@ External Symbol Operands ^^^^^^^^^^^^^^^^^^^^^^^^^ -An external symbol operand is represented using an identifier with the ``$`` +An external symbol operand is represented using an identifier with the ``&`` prefix. The identifier is surrounded with ""'s and escaped if it has any special non-printable characters in it. @@ -698,7 +709,7 @@ .. code-block:: text - CALL64pcrel32 $__stack_chk_fail, csr_64, implicit %rsp, implicit-def %rsp + CALL64pcrel32 &__stack_chk_fail, csr_64, implicit $rsp, implicit-def $rsp MCSymbol Operands ^^^^^^^^^^^^^^^^^ @@ -725,7 +736,7 @@ .. code-block:: text - CFI_INSTRUCTION offset %w30, -16 + CFI_INSTRUCTION offset $w30, -16 which may be emitted later in the MC layer as: @@ -742,7 +753,7 @@ .. code-block:: text - %x0 = COPY intrinsic(@llvm.returnaddress) + $x0 = COPY intrinsic(@llvm.returnaddress) Predicate Operands ^^^^^^^^^^^^^^^^^^