llvm-6502/include/llvm/MC
Ahmed Bougacha 171ac8ca17 MC CFG: Add YAML MCModule representation to enable MC CFG testing.
Like yaml ObjectFiles, this will be very useful for testing the MC CFG
implementation (mostly MCObjectDisassembler), by matching the output
with YAML, and for potential users of the MC CFG, by using it as an input.

There isn't much to the actual format, it is just a serialization of the
MCModule class. Of note:
  - Basic block references (pred/succ, ..) are represented by the BB's
    start address.
  - Just as in the MC CFG, instructions are MCInsts with a size.
  - Operands have a prefix representing the type (only register and
    immediate supported here).
  - Instruction opcodes are represented by their names; enum values aren't
    stable, enum names mostly are: usually, a change to a name would need
    lots of changes in the backend anyway.
    Same with registers.

All in all, an example is better than 1000 words, here goes:

A simple binary:

  Disassembly of section __TEXT,__text:
  _main:
  100000f9c:      48 8b 46 08             movq    8(%rsi), %rax
  100000fa0:      0f be 00                movsbl  (%rax), %eax
  100000fa3:      3b 04 25 48 00 00 00    cmpl    72, %eax
  100000faa:      0f 8c 07 00 00 00       jl      7 <.Lend>
  100000fb0:      2b 04 25 48 00 00 00    subl    72, %eax
  .Lend:
  100000fb7:      c3                      ret

And the (pretty verbose) generated YAML:

  ---
  Atoms:
    - StartAddress:    0x0000000100000F9C
      Size:            20
      Type:            Text
      Content:
        - Inst:            MOV64rm
          Size:            4
          Ops:             [ RRAX, RRSI, I1, R, I8, R ]
        - Inst:            MOVSX32rm8
          Size:            3
          Ops:             [ REAX, RRAX, I1, R, I0, R ]
        - Inst:            CMP32rm
          Size:            7
          Ops:             [ REAX, R, I1, R, I72, R ]
        - Inst:            JL_4
          Size:            6
          Ops:             [ I7 ]
    - StartAddress:    0x0000000100000FB0
      Size:            7
      Type:            Text
      Content:
        - Inst:            SUB32rm
          Size:            7
          Ops:             [ REAX, REAX, R, I1, R, I72, R ]
    - StartAddress:    0x0000000100000FB7
      Size:            1
      Type:            Text
      Content:
        - Inst:            RET
          Size:            1
          Ops:             [  ]
  Functions:
    - Name:            __text
      BasicBlocks:
        - Address:         0x0000000100000F9C
          Preds:           [  ]
          Succs:           [ 0x0000000100000FB7, 0x0000000100000FB0 ]
     <snip>
  ...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188890 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-21 07:29:02 +00:00
..
MCParser Support C99 hexadecimal floating-point literals in assembly 2013-08-14 14:23:31 +00:00
MachineLocation.h Remove the MachineMove class. 2013-05-13 01:16:13 +00:00
MCAsmBackend.h Renamed MCInstFragment to MCRelaxableFragment and added some comments. 2013-01-08 00:22:56 +00:00
MCAsmInfo.h Remove address spaces from MC. 2013-07-02 15:49:13 +00:00
MCAsmInfoCOFF.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCAsmInfoDarwin.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCAsmLayout.h [MC] Bundle alignment: Invalidate relaxed fragments 2013-02-05 17:55:27 +00:00
MCAssembler.h Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCAtom.h MC CFG: uint64_t -> size_t for vector size. 2013-08-21 07:27:44 +00:00
MCCodeEmitter.h Add more reset methods to make all objects that the backend may use for outputting code have a reset, some are not used but were declared for completeness 2012-12-14 18:52:11 +00:00
MCCodeGenInfo.h Fix typo in comment. 2012-02-17 16:39:47 +00:00
MCContext.h MC: Implement COFF .linkonce directive 2013-07-06 12:13:10 +00:00
MCDirectives.h Refactor data-in-code annotations. 2012-05-18 19:12:01 +00:00
MCDisassembler.h Follow up of the introduction of MCSymbolizer. 2013-05-24 22:51:52 +00:00
MCDwarf.h [MC/DWARF] Support .debug_frame / .debug_line code alignment factors 2013-06-12 14:46:54 +00:00
MCELF.h ELF symbol table field st_other support, 2013-02-19 21:57:35 +00:00
MCELFObjectWriter.h Cleanup relocation sorting for ELF. 2013-05-15 18:22:01 +00:00
MCELFStreamer.h [CodeGen] prevent abnormal on invalid attributes 2013-08-09 01:52:03 +00:00
MCELFSymbolFlags.h
MCExpr.h [PowerPC] Revert r185476 and fix up TLS variant kinds 2013-07-09 16:41:09 +00:00
MCExternalSymbolizer.h Add MCSymbolizer for symbolic/annotated disassembly. 2013-05-24 00:39:57 +00:00
MCFixedLenDisassembler.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
MCFixup.h Convert assert(0) to llvm_unreachable 2012-02-05 22:14:15 +00:00
MCFixupKindInfo.h Tidy up. Trailing whitespace. 2012-05-11 01:39:13 +00:00
MCFunction.h MC CFG: Split MCBasicBlocks to mirror atom splitting. 2013-08-21 07:28:24 +00:00
MCInst.h Simplify the MCInst operator iterator declaration. 2013-04-15 17:40:45 +00:00
MCInstBuilder.h Decouple MCInstBuilder from the streamer per Eli's request. 2012-11-26 18:05:52 +00:00
MCInstPrinter.h Fixed the Intel-syntax X86 disassembler to respect the (existing) option for hexadecimal immediates, to match AT&T syntax. This also brings a new option for C-vs-MASM-style hex. 2013-08-01 21:18:16 +00:00
MCInstrAnalysis.h MC: Disassembled CFG reconstruction. 2013-05-24 01:07:04 +00:00
MCInstrDesc.h MC: mayAffectControlFlow() handling for variadic instructions. 2013-07-22 17:45:55 +00:00
MCInstrInfo.h Revert r152202: "Use uint16_t to store InstrNameIndices in MCInstrInfo." 2012-03-15 18:05:57 +00:00
MCInstrItineraries.h Machine Model: Add MicroOpBufferSize and resource BufferSize. 2013-06-15 04:49:57 +00:00
MCLabel.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCMachObjectWriter.h [MC/Mach-O] Add support for linker options in Mach-O files. 2013-01-18 01:26:07 +00:00
MCMachOSymbolFlags.h
MCModule.h MC CFG: Split MCBasicBlocks to mirror atom splitting. 2013-08-21 07:28:24 +00:00
MCModuleYAML.h MC CFG: Add YAML MCModule representation to enable MC CFG testing. 2013-08-21 07:29:02 +00:00
MCObjectDisassembler.h MC CFG: Support disassembly at arbitrary addresses in MCObjectDisassembler. 2013-08-21 07:28:55 +00:00
MCObjectFileInfo.h Track the compact unwind encoding for when we are unable to generate compact unwind information. 2013-04-10 21:42:06 +00:00
MCObjectStreamer.h Remove address spaces from MC. 2013-07-02 15:49:13 +00:00
MCObjectSymbolizer.h MC: ObjectSymbolizer can now recognize external function stubs. 2013-08-21 07:28:13 +00:00
MCObjectWriter.h Fix unnecessary removal of const through cast machinery 2013-02-11 01:16:51 +00:00
MCRegisterInfo.h Make SubRegIndex size mandatory, following r183020. 2013-05-31 23:45:26 +00:00
MCRelocationInfo.h Add MCSymbolizer for symbolic/annotated disassembly. 2013-05-24 00:39:57 +00:00
MCSchedule.h Machine Model: Add MicroOpBufferSize and resource BufferSize. 2013-06-15 04:49:57 +00:00
MCSection.h Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCSectionCOFF.h MC: Implement COFF .linkonce directive 2013-07-06 12:13:10 +00:00
MCSectionELF.h Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCSectionMachO.h Add support for subsections to the ELF assembler. Fixes PR8717. 2013-04-17 21:18:16 +00:00
MCStreamer.h [CodeGen] prevent abnormal on invalid attributes 2013-08-09 01:52:03 +00:00
MCSubtargetInfo.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCSymbol.h Fix Doxygen issues: 2012-09-14 14:57:36 +00:00
MCSymbolizer.h Add MCSymbolizer for symbolic/annotated disassembly. 2013-05-24 00:39:57 +00:00
MCTargetAsmParser.h Split generated asm mnemonic matching table into a separate table for each asm variant. 2013-07-24 07:33:14 +00:00
MCValue.h Sort the #include lines for the include/... tree with the script. 2012-12-03 17:02:12 +00:00
MCWin64EH.h
MCWinCOFFObjectWriter.h MC: Support COFF image-relative MCSymbolRefs 2013-04-10 23:28:17 +00:00
SectionKind.h
SubtargetFeature.h Update documentation. 2013-04-08 18:52:58 +00:00