* LdcInstr.cs: New file - lcd* instructions
[mono.git] / mcs / ilasm / codegen / LdcInstr.cs
1 //
2 // Mono.ILASM.LdcInstr
3 //
4 // Author(s):
5 //  Jackson Harper (Jackson@LatitudeGeo.com)
6 //
7 // (C) 2003 Jackson Harper, All rights reserved
8 //
9
10
11 using System;
12
13 namespace Mono.ILASM {
14
15         public class LdcInstr : IInstr {
16
17                 private MiscInstr op;
18                 private double d_operand;
19                 private long l_operand;
20
21                 public LdcInstr (MiscInstr op, double operand)
22                 {
23                         this.op = op;
24                         d_operand = operand;
25                 }
26
27                 public LdcInstr (MiscInstr op, long operand)
28                 {
29                         this.op = op;
30                         l_operand = operand;
31                 }
32
33                 public void Emit (CodeGen code_gen, PEAPI.CILInstructions cil)
34                 {
35                         switch (op) {
36                         case MiscInstr.ldc_r8:
37                                 cil.ldc_r8 (d_operand);
38                                 break;
39                         case MiscInstr.ldc_r4:
40                                 cil.ldc_r4 ((float) d_operand);
41                                 break;
42                         case MiscInstr.ldc_i8:
43                                 cil.ldc_i8 (l_operand);
44                                 break;
45                         }
46                 }
47
48         }
49
50 }
51