123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- #if UNITY_EDITOR || BURST_INTERNAL
- namespace Unity.Burst.Editor
- {
- internal partial class BurstDisassembler
- {
- /// <summary>
- /// <see cref="AsmTokenKind"/> provider for LLVM IR - intrinsics are not covered at this time
- /// </summary>
- private class LLVMIRAsmTokenKindProvider : AsmTokenKindProvider
- {
-
- private static readonly string[] Qualifiers = new[]
- {
- "to",
- "new",
-
- "float",
- "double",
- "i1",
- "i32",
- "i16",
- "i64",
-
- "eq",
- "ne",
- "ugt",
- "uge",
- "ult",
- "ule",
- "sgt",
- "sge",
- "slt",
- "sle",
-
- "false",
- "true",
-
- "oeq",
- "ogt",
- "oge",
- "olt",
- "ole",
- "one",
- "ord",
- "ueq",
- "une",
- "uno",
- };
-
- private static readonly string[] Instructions = new[]
- {
- "ret",
- "br",
- "switch",
- "indirectbr",
- "invoke",
- "callbr",
- "resume",
- "catchswitch",
- "catchret",
- "cleanupret",
- "unreachable",
-
- "add",
- "sub",
- "mul",
- "udiv",
- "sdiv",
- "urem",
- "srem",
-
- "shl",
- "lshr",
- "ashr",
- "and",
- "or",
- "xor",
-
- "extractvalue",
- "insertvalue",
-
- "alloca",
- "load",
- "store",
- "fence",
- "cmpxchg",
- "atomicrmw",
- "getelementptr",
-
- "trunc",
- "zext",
- "sext",
- "ptrtoint",
- "inttoptr",
- "bitcast",
- "addrspacecast",
-
- "icmp",
- "phi",
- "select",
- "freeze",
- "call",
- "va_arg",
- "landingpad",
- "catchpad",
- "cleanuppad",
- };
-
- private static readonly string[] FpuInstructions = new[]
- {
- "fneg",
-
- "fadd",
- "fsub",
- "fmul",
- "fdiv",
- "frem",
-
- "fptrunc",
- "fpext",
- "fptoui",
- "fptosi",
- "uitofp",
- "sitofp",
-
- "fcmp",
- };
-
- private static readonly string[] SimdInstructions = new[]
- {
- "extractelement",
- "insertelement",
- "shufflevector",
- };
-
- private LLVMIRAsmTokenKindProvider() : base(Qualifiers.Length + Instructions.Length + FpuInstructions.Length + SimdInstructions.Length)
- {
- foreach (var instruction in Qualifiers)
- {
- AddTokenKind(instruction, AsmTokenKind.Qualifier);
- }
-
- foreach (var instruction in Instructions)
- {
- AddTokenKind(instruction, AsmTokenKind.Instruction);
- }
-
- foreach (var instruction in FpuInstructions)
- {
- AddTokenKind(instruction, AsmTokenKind.Instruction);
- }
-
- foreach (var instruction in SimdInstructions)
- {
- AddTokenKind(instruction, AsmTokenKind.InstructionSIMD);
- }
- }
-
- public override SIMDkind SimdKind(StringSlice instruction)
- {
- throw new System.NotImplementedException("Syntax Highlighting is not implemented for LLVM IR.");
- }
-
- public static readonly LLVMIRAsmTokenKindProvider Instance = new LLVMIRAsmTokenKindProvider();
- }
- }
- }
- #endif
|