()
| 8 | ) |
| 9 | |
| 10 | func Example() { |
| 11 | // Parse the LLVM IR assembly file `rand.ll`. |
| 12 | m, err := asm.ParseFile("testdata/rand.ll") |
| 13 | if err != nil { |
| 14 | log.Fatalf("%+v", err) |
| 15 | } |
| 16 | // Pretty-print the data types of the parsed LLVM IR module. |
| 17 | pretty.Println(m) |
| 18 | // Output: |
| 19 | // |
| 20 | // &ir.Module{ |
| 21 | // TypeDefs: nil, |
| 22 | // Globals: { |
| 23 | // &ir.Global{ |
| 24 | // GlobalIdent: ir.GlobalIdent{GlobalName:"seed", GlobalID:0}, |
| 25 | // Immutable: false, |
| 26 | // ContentType: &types.IntType{TypeName:"", BitSize:0x20}, |
| 27 | // Init: &constant.Int{ |
| 28 | // Typ: &types.IntType{(CYCLIC REFERENCE)}, |
| 29 | // X: &big.Int{}, |
| 30 | // }, |
| 31 | // Typ: &types.PointerType{ |
| 32 | // TypeName: "", |
| 33 | // ElemType: &types.IntType{(CYCLIC REFERENCE)}, |
| 34 | // AddrSpace: 0x0, |
| 35 | // }, |
| 36 | // Linkage: 0x0, |
| 37 | // Preemption: 0x0, |
| 38 | // Visibility: 0x0, |
| 39 | // DLLStorageClass: 0x0, |
| 40 | // TLSModel: 0x0, |
| 41 | // UnnamedAddr: 0x0, |
| 42 | // AddrSpace: 0x0, |
| 43 | // ExternallyInitialized: false, |
| 44 | // Section: "", |
| 45 | // Partition: "", |
| 46 | // Comdat: (*ir.ComdatDef)(nil), |
| 47 | // Align: 0x0, |
| 48 | // FuncAttrs: nil, |
| 49 | // Metadata: nil, |
| 50 | // }, |
| 51 | // }, |
| 52 | // Funcs: { |
| 53 | // &ir.Func{ |
| 54 | // GlobalIdent: ir.GlobalIdent{GlobalName:"abs", GlobalID:0}, |
| 55 | // Sig: &types.FuncType{ |
| 56 | // TypeName: "", |
| 57 | // RetType: &types.IntType{TypeName:"", BitSize:0x20}, |
| 58 | // Params: { |
| 59 | // &types.IntType{TypeName:"", BitSize:0x20}, |
| 60 | // }, |
| 61 | // Variadic: false, |
| 62 | // }, |
| 63 | // Params: { |
| 64 | // &ir.Param{ |
| 65 | // LocalIdent: ir.LocalIdent{LocalName:"x", LocalID:0}, |
| 66 | // Typ: &types.IntType{TypeName:"", BitSize:0x20}, |
| 67 | // Attrs: nil, |
nothing calls this directly
no test coverage detected
searching dependent graphs…