llvm-6502/include/llvm
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
..
ADT Make sure that pop_back_val() result is used. 2013-08-19 22:12:00 +00:00
Analysis Add some constantness. 2013-08-20 23:04:15 +00:00
Assembly Enable *BasicBlockPass::createPrinterPass() 2013-02-08 23:37:41 +00:00
Bitcode Make .bc en/decoding of AttrKind stable 2013-07-26 04:16:55 +00:00
CodeGen [stackprotector] Refactor out the end of isInTailCallPosition into the function returnTypeIsEligibleForTailCall. 2013-08-20 08:36:50 +00:00
Config Remove all checking for the various terminfo headers (term.h and 2013-08-12 10:40:11 +00:00
DebugInfo Add LLVM-style RTTI to DIContext/DWARFContext classes 2013-08-06 10:32:39 +00:00
ExecutionEngine Fix include guards. 2013-08-20 22:52:02 +00:00
IR [mips][msa] Removed fcge, fcgt, fsge, fsgt 2013-08-20 09:41:47 +00:00
IRReader Split out the IRReader header and the utility functions it provides into 2013-03-26 02:25:37 +00:00
MC MC CFG: Add YAML MCModule representation to enable MC CFG testing. 2013-08-21 07:29:02 +00:00
Object Move #includes from .h to .cpp file. 2013-08-21 01:20:11 +00:00
Option Options: Add new option kind that consumes remaining arguments 2013-08-13 21:09:50 +00:00
Support Add Mach-O entry_point_command declaration. 2013-08-21 07:28:40 +00:00
TableGen [typo] An LLVM. 2013-08-16 23:30:19 +00:00
Target [SystemZ] Use SRST to optimize memchr 2013-08-20 09:38:48 +00:00
Transforms Fix assert with GEP ptr vector indexing structs 2013-08-19 21:43:16 +00:00
AutoUpgrade.h Remove trailing whitespace, fix file path in comment 2013-07-20 17:46:00 +00:00
CMakeLists.txt Move all of the header files which are involved in modelling the LLVM IR 2013-01-02 11:36:10 +00:00
DebugInfo.h DebugInfo: Allow the addition of other (such as static data) members to a record type after construction 2013-08-16 20:42:14 +00:00
DIBuilder.h DebugInfo: Allow the addition of other (such as static data) members to a record type after construction 2013-08-16 20:42:14 +00:00
GVMaterializer.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
InitializePasses.h DataFlowSanitizer; LLVM changes. 2013-08-07 22:47:18 +00:00
InstVisitor.h Move all of the header files which are involved in modelling the LLVM IR 2013-01-02 11:36:10 +00:00
LinkAllIR.h Rename LinkAllVMCore.h to LinkAllIR.h since VMCore directory was renamed to IR. 2013-01-10 21:55:02 +00:00
LinkAllPasses.h Remove the simplify-libcalls pass (finally) 2013-06-20 19:48:07 +00:00
Linker.h Fix a performance bug in the Linker. 2013-05-04 05:05:18 +00:00
Pass.h moves doInitialization and doFinalization to the Pass class and removes some unreachable code in MachineModuleInfo 2012-12-03 21:56:57 +00:00
PassAnalysisSupport.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00
PassManager.h This patch breaks up Wrap.h so that it does not have to include all of 2013-05-01 20:59:00 +00:00
PassManagers.h Use a DenseMap instead of a std::map for AnalysisID -> Pass* maps. This reduces the pass-manager overhead from FPPassManager::runOnFunction() by about 10%. 2013-02-26 01:31:59 +00:00
PassRegistry.h This patch breaks up Wrap.h so that it does not have to include all of 2013-05-01 20:59:00 +00:00
PassSupport.h Fix include guards so they exactly match file names. 2013-01-10 00:45:19 +00:00