Write() public abstract method

public abstract Write ( bool fExplicit, MachineInstructionWriter writer ) : void
fExplicit bool
writer MachineInstructionWriter
return void
Example #1
0
 protected virtual void RenderOperand(MachineOperand operand, MachineInstructionWriter writer, MachineInstructionWriterOptions options)
 {
     operand.Write(writer, options);
 }
Example #2
0
 public void Write(MachineOperand op, MachineInstructionWriter writer)
 {
     var imm = op as ImmediateOperand;
     if (imm != null)
     {
         writer.Write("#");
         int imm8 = imm.Value.ToInt32();
         if (imm8 > 256 && ((imm8 & (imm8 - 1)) == 0))
         {
             /* only one bit set, and that later than bit 8.
              * Represent as 1<<... .
              */
             writer.Write("1<<");
             {
                 uint n = 0;
                 while ((imm8 & 15) == 0)
                 {
                     n += 4; imm8 = imm8 >> 4;
                 }
                 // Now imm8 is 1, 2, 4 or 8. 
                 n += (uint)((0x30002010 >> (int)(4 * (imm8 - 1))) & 15);
                 writer.Write(n);
             }
         }
         else
         {
             var fmt = (-9 <= imm8 && imm8 <= 9) ? "{0}{1}" : "&{0}{1:X}";
             var sign = "";
             if (((int)imm8) < 0 && ((int)imm8) > -100)
             {
                 imm8 = -imm8;
                 sign = "-";
             }
             writer.Write(fmt,sign,imm8);
         }
         return;
     }
     var adr = op as AddressOperand;
     if (adr != null)
     {
         adr.Write(false, writer);
         return;
     }
     var mem = op as ArmMemoryOperand;
     if (mem != null)
     {
         mem.Write(false, writer);
         return;
     }
     var sh = op as ShiftOperand;
     if (sh != null)
     {
         sh.Write(false, writer);
         return;
     }
     if (op == null)
         writer.Write("<null>");
     else 
         op.Write(false, writer);
 }