[LoongArch64] Part-5:add loongarch support in some files for LoongArch64. (#21769)
[mono-project.git] / mcs / ilasm / scanner / InstrToken.cs
blobf4d996aeb1032292c8817f63dfc39d0651d4363b
1 // InstrToken.cs
2 // Author: Sergey Chaban (serge@wildwestsoftware.com)
4 #if !MOBILE
6 using System;
7 using System.Reflection.Emit;
9 namespace Mono.ILASM {
11 public class InstrToken : ILToken {
14 /// <summary>
15 /// </summary>
16 public InstrToken (OpCode opcode)
18 this.val = opcode;
19 token = GetInstrType (opcode);
23 /// <summary>
24 /// </summary>
25 /// <param name="opcode"></param>
26 /// <returns></returns>
27 public static int GetInstrType (OpCode opcode)
29 OperandType t = opcode.OperandType;
30 int token = Token.UNKNOWN;
32 switch (t) {
34 case OperandType.InlineBrTarget:
35 case OperandType.ShortInlineBrTarget:
36 token = Token.INSTR_BRTARGET;
37 break;
39 case OperandType.InlineField:
40 token = Token.INSTR_FIELD;
41 break;
43 case OperandType.InlineI:
44 case OperandType.ShortInlineI:
45 token = Token.INSTR_I;
46 break;
48 case OperandType.InlineI8:
49 token = Token.INSTR_I8;
50 break;
52 case OperandType.InlineMethod:
53 token = Token.INSTR_METHOD;
54 break;
56 case OperandType.InlineNone:
57 token = Token.INSTR_NONE;
58 break;
59 #pragma warning disable 618
60 case OperandType.InlinePhi:
61 token = Token.INSTR_PHI;
62 break;
63 #pragma warning restore 618
65 case OperandType.InlineR:
66 case OperandType.ShortInlineR:
67 token = Token.INSTR_R;
68 break;
71 case OperandType.InlineRVA:
72 token = Token.INSTR_RVA;
73 break;
76 case OperandType.InlineSig:
77 token = Token.INSTR_SIG;
78 break;
80 case OperandType.InlineString:
81 token = Token.INSTR_STRING;
82 break;
84 case OperandType.InlineSwitch:
85 token = Token.INSTR_SWITCH;
86 break;
88 case OperandType.InlineTok:
89 token = Token.INSTR_TOK;
90 break;
92 case OperandType.InlineType:
93 token = Token.INSTR_TYPE;
94 break;
96 case OperandType.InlineVar:
97 case OperandType.ShortInlineVar:
98 token = Token.INSTR_VAR;
99 break;
102 return token;
110 #endif