A game about forced loneliness, made by TACStudios
at master 168 lines 4.3 kB view raw
1#if UNITY_EDITOR || BURST_INTERNAL 2namespace Unity.Burst.Editor 3{ 4 internal partial class BurstDisassembler 5 { 6 /// <summary> 7 /// <see cref="AsmTokenKind"/> provider for LLVM IR - intrinsics are not covered at this time 8 /// </summary> 9 private class LLVMIRAsmTokenKindProvider : AsmTokenKindProvider 10 { 11 12 private static readonly string[] Qualifiers = new[] 13 { 14 "to", 15 "new", 16 17 "float", 18 "double", 19 "i1", 20 "i32", 21 "i16", 22 "i64", 23 24 "eq", 25 "ne", 26 "ugt", 27 "uge", 28 "ult", 29 "ule", 30 "sgt", 31 "sge", 32 "slt", 33 "sle", 34 35 "false", 36 "true", 37 38 "oeq", 39 "ogt", 40 "oge", 41 "olt", 42 "ole", 43 "one", 44 "ord", 45 "ueq", 46 "une", 47 "uno", 48 }; 49 50 private static readonly string[] Instructions = new[] 51 { 52 "ret", 53 "br", 54 "switch", 55 "indirectbr", 56 "invoke", 57 "callbr", 58 "resume", 59 "catchswitch", 60 "catchret", 61 "cleanupret", 62 "unreachable", 63 64 "add", 65 "sub", 66 "mul", 67 "udiv", 68 "sdiv", 69 "urem", 70 "srem", 71 72 "shl", 73 "lshr", 74 "ashr", 75 "and", 76 "or", 77 "xor", 78 79 "extractvalue", 80 "insertvalue", 81 82 "alloca", 83 "load", 84 "store", 85 "fence", 86 "cmpxchg", 87 "atomicrmw", 88 "getelementptr", 89 90 "trunc", 91 "zext", 92 "sext", 93 "ptrtoint", 94 "inttoptr", 95 "bitcast", 96 "addrspacecast", 97 98 "icmp", 99 "phi", 100 "select", 101 "freeze", 102 "call", 103 "va_arg", 104 "landingpad", 105 "catchpad", 106 "cleanuppad", 107 }; 108 109 private static readonly string[] FpuInstructions = new[] 110 { 111 "fneg", 112 113 "fadd", 114 "fsub", 115 "fmul", 116 "fdiv", 117 "frem", 118 119 "fptrunc", 120 "fpext", 121 "fptoui", 122 "fptosi", 123 "uitofp", 124 "sitofp", 125 126 "fcmp", 127 }; 128 129 private static readonly string[] SimdInstructions = new[] 130 { 131 "extractelement", 132 "insertelement", 133 "shufflevector", 134 }; 135 136 private LLVMIRAsmTokenKindProvider() : base(Qualifiers.Length + Instructions.Length + FpuInstructions.Length + SimdInstructions.Length) 137 { 138 foreach (var instruction in Qualifiers) 139 { 140 AddTokenKind(instruction, AsmTokenKind.Qualifier); 141 } 142 143 foreach (var instruction in Instructions) 144 { 145 AddTokenKind(instruction, AsmTokenKind.Instruction); 146 } 147 148 foreach (var instruction in FpuInstructions) 149 { 150 AddTokenKind(instruction, AsmTokenKind.Instruction); 151 } 152 153 foreach (var instruction in SimdInstructions) 154 { 155 AddTokenKind(instruction, AsmTokenKind.InstructionSIMD); 156 } 157 } 158 159 public override SIMDkind SimdKind(StringSlice instruction) 160 { 161 throw new System.NotImplementedException("Syntax Highlighting is not implemented for LLVM IR."); 162 } 163 164 public static readonly LLVMIRAsmTokenKindProvider Instance = new LLVMIRAsmTokenKindProvider(); 165 } 166 } 167} 168#endif