1. Vincenzo Ampolo
  2. gdc

Commits

Iain Buclaw  committed a1674a5

GNU indentation - start with all headers.

  • Participants
  • Parent commits 522f00d
  • Branches default

Comments (0)

Files changed (16)

File d/d-asm-i386.h

View file
-/* GDC -- D front-end for GCC
-   Copyright (C) 2004 David Friedman
+// GDC -- D front-end for GCC
+// Copyright (C) 2004 David Friedman
 
-   Modified by
-    Michael Parrott, (C) 2009
-    Vincenzo Ampolo, Iain Buclaw, (C) 2010, 2011
+// Modified by Iain Buclaw, (C) 2010, 2011, 2012
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 enum Reg
 {
-    Reg_Invalid = -1,
-    Reg_EAX = 0,
-    Reg_EBX,
-    Reg_ECX,
-    Reg_EDX,
-    Reg_ESI,
-    Reg_EDI,
-    Reg_EBP,
-    Reg_ESP,
-    Reg_ST,
-    Reg_ST1, Reg_ST2, Reg_ST3, Reg_ST4, Reg_ST5, Reg_ST6, Reg_ST7,
-    Reg_MM0, Reg_MM1, Reg_MM2, Reg_MM3, Reg_MM4, Reg_MM5, Reg_MM6, Reg_MM7,
-    Reg_XMM0, Reg_XMM1, Reg_XMM2, Reg_XMM3, Reg_XMM4, Reg_XMM5, Reg_XMM6, Reg_XMM7,
-
-    Reg_RAX, Reg_RBX, Reg_RCX, Reg_RDX, Reg_RSI, Reg_RDI, Reg_RBP, Reg_RSP,
-    Reg_R8, Reg_R9, Reg_R10, Reg_R11, Reg_R12, Reg_R13, Reg_R14, Reg_R15,
-    Reg_R8B, Reg_R9B, Reg_R10B, Reg_R11B, Reg_R12B, Reg_R13B, Reg_R14B, Reg_R15B,
-    Reg_R8W, Reg_R9W, Reg_R10W, Reg_R11W, Reg_R12W, Reg_R13W, Reg_R14W, Reg_R15W,
-    Reg_R8D, Reg_R9D, Reg_R10D, Reg_R11D, Reg_R12D, Reg_R13D, Reg_R14D, Reg_R15D,
-    Reg_XMM8, Reg_XMM9, Reg_XMM10, Reg_XMM11, Reg_XMM12, Reg_XMM13, Reg_XMM14, Reg_XMM15,
-    Reg_RIP,
-    Reg_SIL, Reg_DIL, Reg_BPL, Reg_SPL,
-
-    Reg_EFLAGS,
-    Reg_CS,
-    Reg_DS,
-    Reg_SS,
-    Reg_ES,
-    Reg_FS,
-    Reg_GS,
-    Reg_AX, Reg_BX, Reg_CX, Reg_DX, Reg_SI, Reg_DI, Reg_BP, Reg_SP,
-    Reg_AL, Reg_AH, Reg_BL, Reg_BH, Reg_CL, Reg_CH, Reg_DL, Reg_DH,
-    Reg_CR0, Reg_CR2, Reg_CR3, Reg_CR4,
-    Reg_DR0, Reg_DR1, Reg_DR2, Reg_DR3, Reg_DR6, Reg_DR7,
-    Reg_TR3, Reg_TR4, Reg_TR5, Reg_TR6, Reg_TR7,
-
-    Reg_MAX
+  Reg_Invalid = -1,
+  Reg_EAX = 0,
+  Reg_EBX,
+  Reg_ECX,
+  Reg_EDX,
+  Reg_ESI,
+  Reg_EDI,
+  Reg_EBP,
+  Reg_ESP,
+  Reg_ST,
+  Reg_ST1, Reg_ST2, Reg_ST3, Reg_ST4, Reg_ST5, Reg_ST6, Reg_ST7,
+  Reg_MM0, Reg_MM1, Reg_MM2, Reg_MM3, Reg_MM4, Reg_MM5, Reg_MM6, Reg_MM7,
+  Reg_XMM0, Reg_XMM1, Reg_XMM2, Reg_XMM3, Reg_XMM4, Reg_XMM5, Reg_XMM6, Reg_XMM7,
+  
+  Reg_RAX, Reg_RBX, Reg_RCX, Reg_RDX, Reg_RSI, Reg_RDI, Reg_RBP, Reg_RSP,
+  Reg_R8, Reg_R9, Reg_R10, Reg_R11, Reg_R12, Reg_R13, Reg_R14, Reg_R15,
+  Reg_R8B, Reg_R9B, Reg_R10B, Reg_R11B, Reg_R12B, Reg_R13B, Reg_R14B, Reg_R15B,
+  Reg_R8W, Reg_R9W, Reg_R10W, Reg_R11W, Reg_R12W, Reg_R13W, Reg_R14W, Reg_R15W,
+  Reg_R8D, Reg_R9D, Reg_R10D, Reg_R11D, Reg_R12D, Reg_R13D, Reg_R14D, Reg_R15D,
+  Reg_XMM8, Reg_XMM9, Reg_XMM10, Reg_XMM11, Reg_XMM12, Reg_XMM13, Reg_XMM14, Reg_XMM15,
+  Reg_RIP,
+  Reg_SIL, Reg_DIL, Reg_BPL, Reg_SPL,
+  
+  Reg_EFLAGS,
+  Reg_CS,
+  Reg_DS,
+  Reg_SS,
+  Reg_ES,
+  Reg_FS,
+  Reg_GS,
+  Reg_AX, Reg_BX, Reg_CX, Reg_DX, Reg_SI, Reg_DI, Reg_BP, Reg_SP,
+  Reg_AL, Reg_AH, Reg_BL, Reg_BH, Reg_CL, Reg_CH, Reg_DL, Reg_DH,
+  Reg_CR0, Reg_CR2, Reg_CR3, Reg_CR4,
+  Reg_DR0, Reg_DR1, Reg_DR2, Reg_DR3, Reg_DR6, Reg_DR7,
+  Reg_TR3, Reg_TR4, Reg_TR5, Reg_TR6, Reg_TR7,
+  
+  Reg_MAX
 };
 
 static const int N_Regs = Reg_MAX;
 
-static struct
+struct RegInfo
 {
-    const char * name;
-    tree gccName; // GAS will take upper case, but GCC won't (needed for the clobber list)
-    Identifier * ident;
-    char size;
-    char baseReg; // %% todo: Reg, Reg_XX
-} regInfo[N_Regs] = {
+  const char * name;
+  tree gccName; // GAS will take upper case, but GCC won't (needed for the clobber list)
+  Identifier * ident;
+  char size;
+  char baseReg; // %% todo: Reg, Reg_XX
+};
+
+static const RegInfo regInfo[N_Regs] =
+{
     { "EAX", NULL_TREE, NULL, 4,  Reg_EAX },
     { "EBX", NULL_TREE, NULL, 4,  Reg_EBX },
     { "ECX", NULL_TREE, NULL, 4,  Reg_ECX },
 
 enum TypeNeeded
 {
-    No_Type_Needed,
-    Int_Types,
-    Word_Types, // same as Int_Types, but byte is not allowed
-    FP_Types,
-    FPInt_Types,
-    Byte_NoType, // byte only, but no type suffix
+  No_Type_Needed,
+  Int_Types,
+  Word_Types, // same as Int_Types, but byte is not allowed
+  FP_Types,
+  FPInt_Types,
+  Byte_NoType, // byte only, but no type suffix
 };
 
 enum OpLink
 {
-    No_Link,
-    Out_Mnemonic,
-    Next_Form
+  No_Link,
+  Out_Mnemonic,
+  Next_Form
 };
 
 enum ImplicitClober
 {
-    Clb_SizeAX   = 0x01,
-    Clb_SizeDXAX = 0x02,
-    Clb_EAX      = 0x03,
-    Clb_DXAX_Mask = 0x03,
-
-    Clb_Flags    = 0x04,
-    Clb_DI       = 0x08,
-    Clb_SI       = 0x10,
-    Clb_CX       = 0x20,
-    Clb_ST       = 0x40,
-    Clb_SP       = 0x80 // Doesn't actually let GCC know the frame pointer is modified
+  Clb_SizeAX   = 0x01,
+  Clb_SizeDXAX = 0x02,
+  Clb_EAX      = 0x03,
+  Clb_DXAX_Mask = 0x03,
+  
+  Clb_Flags    = 0x04,
+  Clb_DI       = 0x08,
+  Clb_SI       = 0x10,
+  Clb_CX       = 0x20,
+  Clb_ST       = 0x40,
+  Clb_SP       = 0x80 // Doesn't actually let GCC know the frame pointer is modified
 };
 
 // "^ +/..\([A-Za-z_0-9]+\).*" -> "    \1,"
 enum AsmOp
 {
-    Op_Invalid,
-    Op_Adjust,
-    Op_Dst,
-    Op_Upd,
-    Op_DstW,
-    Op_DstF,
-    Op_UpdF,
-    Op_DstQ,
-    Op_DstSrc,
-    Op_DstSrcF,
-    Op_UpdSrcF,
-    Op_DstSrcFW,
-    Op_UpdSrcFW,
-    Op_DstSrcSSE,
-    Op_DstSrcMMX,
-    Op_DstSrcImmS,
-    Op_DstSrcImmM,
-    Op_DstSrcXmmS,
-    Op_UpdSrcShft,
-    Op_DstSrcNT,
-    Op_UpdSrcNT,
-    Op_DstMemNT,
-    Op_DstRMBNT,
-    Op_DstRMWNT,
-    Op_UpdUpd,
-    Op_UpdUpdF,
-    Op_Src,
-    Op_SrcRMWNT,
-    Op_SrcW,
-    Op_SrcImm,
-    Op_Src_DXAXF,
-    Op_SrcMemNT,
-    Op_SrcMemNTF,
-    Op_SrcSrc,
-    Op_SrcSrcF,
-    Op_SrcSrcFW,
-    Op_SrcSrcSSEF,
-    Op_SrcSrcMMX,
-    Op_Shift,
-    Op_Branch,
-    Op_CBranch,
-    Op_0,
-    Op_0_AX,
-    Op_0_DXAX,
-    Op_Loop,
-    Op_Flags,
-    Op_F0_ST,
-    Op_F0_P,
-    Op_Fs_P,
-    Op_Fis,
-    Op_Fis_ST,
-    Op_Fis_P,
-    Op_Fid,
-    Op_Fid_P,
-    Op_FidR_P,
-    Op_Ffd,
-    Op_FfdR,
-    Op_Ffd_P,
-    Op_FfdR_P,
-    Op_FfdRR_P,
-    Op_Fd_P,
-    Op_FdST,
-    Op_FMath,
-    Op_FMath0,
-    Op_FMath2,
-    Op_FdSTiSTi,
-    Op_FdST0ST1,
-    Op_FPMath,
-    Op_FCmp,
-    Op_FCmp1,
-    Op_FCmpP,
-    Op_FCmpP1,
-    Op_FCmpFlg0,
-    Op_FCmpFlg1,
-    Op_FCmpFlg,
-    Op_FCmpFlgP0,
-    Op_FCmpFlgP1,
-    Op_FCmpFlgP,
-    Op_fld,
-    Op_fldR,
-    Op_fxch,
-    Op_fxch1,
-    Op_fxch0,
-    Op_SizedStack,
-    Op_bound,
-    Op_bswap,
-    Op_cmps,
-    Op_cmpsd,
-    Op_cmpsX,
-    Op_cmpxchg,
-    Op_cmpxchg8b,
-    Op_cpuid,
-    Op_enter,
-    Op_fdisi,
-    Op_feni,
-    Op_fsetpm,
-    Op_fXstsw,
-    Op_imul,
-    Op_imul2,
-    Op_imul1,
-    Op_in,
-    Op_ins,
-    Op_insX,
-    Op_iret,
-    Op_iretd,
-    Op_iretq,
-    Op_lods,
-    Op_lodsX,
-    Op_movs,
-    Op_movsd,
-    Op_movsX,
-    Op_movsx,
-    Op_movzx,
-    Op_mul,
-    Op_out,
-    Op_outs,
-    Op_outsX,
-    Op_push,
-    Op_pushq,
-    Op_ret,
-    Op_retf,
-    Op_scas,
-    Op_scasX,
-    Op_stos,
-    Op_stosX,
-    Op_xlat,
-    N_AsmOpInfo,
-    Op_Align,
-    Op_Even,
-    Op_Naked,
-    Op_db,
-    Op_ds,
-    Op_di,
-    Op_dl,
-    Op_df,
-    Op_dd,
-    Op_de
+  Op_Invalid,
+  Op_Adjust,
+  Op_Dst,
+  Op_Upd,
+  Op_DstW,
+  Op_DstF,
+  Op_UpdF,
+  Op_DstQ,
+  Op_DstSrc,
+  Op_DstSrcF,
+  Op_UpdSrcF,
+  Op_DstSrcFW,
+  Op_UpdSrcFW,
+  Op_DstSrcSSE,
+  Op_DstSrcMMX,
+  Op_DstSrcImmS,
+  Op_DstSrcImmM,
+  Op_DstSrcXmmS,
+  Op_UpdSrcShft,
+  Op_DstSrcNT,
+  Op_UpdSrcNT,
+  Op_DstMemNT,
+  Op_DstRMBNT,
+  Op_DstRMWNT,
+  Op_UpdUpd,
+  Op_UpdUpdF,
+  Op_Src,
+  Op_SrcRMWNT,
+  Op_SrcW,
+  Op_SrcImm,
+  Op_Src_DXAXF,
+  Op_SrcMemNT,
+  Op_SrcMemNTF,
+  Op_SrcSrc,
+  Op_SrcSrcF,
+  Op_SrcSrcFW,
+  Op_SrcSrcSSEF,
+  Op_SrcSrcMMX,
+  Op_Shift,
+  Op_Branch,
+  Op_CBranch,
+  Op_0,
+  Op_0_AX,
+  Op_0_DXAX,
+  Op_Loop,
+  Op_Flags,
+  Op_F0_ST,
+  Op_F0_P,
+  Op_Fs_P,
+  Op_Fis,
+  Op_Fis_ST,
+  Op_Fis_P,
+  Op_Fid,
+  Op_Fid_P,
+  Op_FidR_P,
+  Op_Ffd,
+  Op_FfdR,
+  Op_Ffd_P,
+  Op_FfdR_P,
+  Op_FfdRR_P,
+  Op_Fd_P,
+  Op_FdST,
+  Op_FMath,
+  Op_FMath0,
+  Op_FMath2,
+  Op_FdSTiSTi,
+  Op_FdST0ST1,
+  Op_FPMath,
+  Op_FCmp,
+  Op_FCmp1,
+  Op_FCmpP,
+  Op_FCmpP1,
+  Op_FCmpFlg0,
+  Op_FCmpFlg1,
+  Op_FCmpFlg,
+  Op_FCmpFlgP0,
+  Op_FCmpFlgP1,
+  Op_FCmpFlgP,
+  Op_fld,
+  Op_fldR,
+  Op_fxch,
+  Op_fxch1,
+  Op_fxch0,
+  Op_SizedStack,
+  Op_bound,
+  Op_bswap,
+  Op_cmps,
+  Op_cmpsd,
+  Op_cmpsX,
+  Op_cmpxchg,
+  Op_cmpxchg8b,
+  Op_cpuid,
+  Op_enter,
+  Op_fdisi,
+  Op_feni,
+  Op_fsetpm,
+  Op_fXstsw,
+  Op_imul,
+  Op_imul2,
+  Op_imul1,
+  Op_in,
+  Op_ins,
+  Op_insX,
+  Op_iret,
+  Op_iretd,
+  Op_iretq,
+  Op_lods,
+  Op_lodsX,
+  Op_movs,
+  Op_movsd,
+  Op_movsX,
+  Op_movsx,
+  Op_movzx,
+  Op_mul,
+  Op_out,
+  Op_outs,
+  Op_outsX,
+  Op_push,
+  Op_pushq,
+  Op_ret,
+  Op_retf,
+  Op_scas,
+  Op_scasX,
+  Op_stos,
+  Op_stosX,
+  Op_xlat,
+  N_AsmOpInfo,
+  Op_Align,
+  Op_Even,
+  Op_Naked,
+  Op_db,
+  Op_ds,
+  Op_di,
+  Op_dl,
+  Op_df,
+  Op_dd,
+  Op_de
 };
 
 enum OprVals
 {
-    Opr_None      = 0x0,
-    OprC_MRI      = 0x1,
-    OprC_MR       = 0x2,
-    OprC_Mem      = 0x4,
-    OprC_Reg      = 0x8,
-    OprC_Imm      = 0x10,
-    OprC_SSE      = 0x20,
-    OprC_SSE_Mem  = 0x40,
-    OprC_R32      = 0x80,
-    OprC_RWord    = 0x100,
-    OprC_RFP      = 0x200,
-    OprC_AbsRel   = 0x400,
-    OprC_Relative = 0x800,
-    OprC_Port     = 0x1000, // DX or imm
-    OprC_AX       = 0x2000, // AL,AX,EAX,RAX
-    OprC_DX       = 0x4000, // only DX
-    OprC_MMX      = 0x8000,
-    OprC_MMX_Mem  = 0x10000,
-    OprC_Shift    = 0x20000, // imm or CL
-
-    Opr_ClassMask = 0x40000,
-
-    Opr_Dest      = 0x80000,
-    Opr_Update    = 0x100000,
-
-    Opr_NoType    = 0x80000000,
+  Opr_None      = 0x0,
+  OprC_MRI      = 0x1,
+  OprC_MR       = 0x2,
+  OprC_Mem      = 0x4,
+  OprC_Reg      = 0x8,
+  OprC_Imm      = 0x10,
+  OprC_SSE      = 0x20,
+  OprC_SSE_Mem  = 0x40,
+  OprC_R32      = 0x80,
+  OprC_RWord    = 0x100,
+  OprC_RFP      = 0x200,
+  OprC_AbsRel   = 0x400,
+  OprC_Relative = 0x800,
+  OprC_Port     = 0x1000, // DX or imm
+  OprC_AX       = 0x2000, // AL,AX,EAX,RAX
+  OprC_DX       = 0x4000, // only DX
+  OprC_MMX      = 0x8000,
+  OprC_MMX_Mem  = 0x10000,
+  OprC_Shift    = 0x20000, // imm or CL
+  
+  Opr_ClassMask = 0x40000,
+  
+  Opr_Dest      = 0x80000,
+  Opr_Update    = 0x100000,
+  
+  Opr_NoType    = 0x80000000,
 };
 
 
 
 struct AsmOpInfo
 {
-    Opr operands[3];
-    unsigned char
-        needsType : 3,
-        implicitClobbers : 8,
-        linkType : 2;
-    unsigned link;
-
-    unsigned nOperands()
-    {
-        if (!operands[0])
-            return 0;
-        else if (!operands[1])
-            return 1;
-        else if (!operands[2])
-            return 2;
-        else
-            return 3;
-    }
+  Opr operands[3];
+  unsigned char
+    needsType : 3,
+      	      implicitClobbers : 8,
+      	      linkType : 2;
+  unsigned link;
+  
+  unsigned nOperands() {
+      if (!operands[0])
+	return 0;
+      else if (!operands[1])
+	return 1;
+      else if (!operands[2])
+	return 2;
+      else
+	return 3;
+  }
 };
 
 enum Alternate_Mnemonics
 {
-    Mn_fdisi,
-    Mn_feni,
-    Mn_fsetpm,
-    Mn_iretw,
-    Mn_iret,
-    Mn_iretq,
-    Mn_lret,
-    N_AltMn
+  Mn_fdisi,
+  Mn_feni,
+  Mn_fsetpm,
+  Mn_iretw,
+  Mn_iret,
+  Mn_iretq,
+  Mn_lret,
+  N_AltMn
 };
 
-static const char * alternateMnemonics[N_AltMn] = {
-    ".byte 0xdb, 0xe1",
-    ".byte 0xdb, 0xe0",
-    ".byte 0xdb, 0xe4",
-    "iretw",
-    "iret",
-    "iretq",
-    "lret",
+static const char * alternateMnemonics[N_AltMn] =
+{
+  ".byte 0xdb, 0xe1",
+  ".byte 0xdb, 0xe0",
+  ".byte 0xdb, 0xe4",
+  "iretw",
+  "iret",
+  "iretq",
+  "lret",
 };
 
 #define mri  OprC_MRI
 //#define L    Opr_Label
 
 // D=dest, N=notype
-static AsmOpInfo asmOpInfo[N_AsmOpInfo] = {
-    /* Op_Invalid   */  {},
-    /* Op_Adjust    */  { 0,0,0,             0, Clb_EAX /*just AX*/ },
-    /* Op_Dst       */  { D|mr,  0,    0,    1  },
-    /* Op_Upd       */  { U|mr,  0,    0,    1  },
-    /* Op_DstW      */  { D|mr,  0,    0,    Word_Types  },
-    /* Op_DstF      */  { D|mr,  0,    0,    1, Clb_Flags },
-    /* Op_UpdF      */  { U|mr,  0,    0,    1, Clb_Flags },
-    /* Op_DstQ      */  { D|mr,  0,    0,    0  },
-    /* Op_DstSrc    */  { D|mr,  mri,  0,/**/1  },
-    /* Op_DstSrcF   */  { D|mr,  mri,  0,/**/1, Clb_Flags },
-    /* Op_UpdSrcF   */  { U|mr,  mri,  0,/**/1, Clb_Flags },
-    /* Op_DstSrcFW  */  { D|mr,  mri,  0,/**/Word_Types, Clb_Flags },
-    /* Op_UpdSrcFW  */  { U|mr,  mri,  0,/**/Word_Types, Clb_Flags },
-    /* Op_DstSrcSSE */  { U|sse, ssem, 0     },  // some may not be update %%
-    /* Op_DstSrcMMX */  { U|mmx, mmxm, 0     },  // some may not be update %%
-    /* Op_DstSrcImmS*/  { U|sse, ssem, N|imm  }, // some may not be update %%
-    /* Op_DstSrcImmM*/  { U|mmx, mmxm, N|imm  }, // some may not be update %%
-    /* Op_DstSrcXmmS*/  { U|sse, ssem, N|mmx  }, // some may not be update %%
-    /* Op_UpdSrcShft*/  { U|mr,  reg,  N|shft, 1, Clb_Flags }, // 16/32 only
-    /* Op_DstSrcNT  */  { D|mr,  mr,   0,    0 }, // used for movd .. operands can be rm32,sse,mmx
-    /* Op_UpdSrcNT  */  { U|mr,  mr,   0,    0 }, // used for movd .. operands can be rm32,sse,mmx
-    /* Op_DstMemNT  */  { D|mem, 0,    0     },
-    /* Op_DstRMBNT  */  { D|mr,  0,    0,    Byte_NoType },
-    /* Op_DstRMWNT  */  { D|mr,  0,    0     },
-    /* Op_UpdUpd    */  { U|mr,U|mr,   0,/**/1  },
-    /* Op_UpdUpdF   */  { U|mr,U|mr,   0,/**/1, Clb_Flags },
-    /* Op_Src       */  {   mri, 0,    0,    1  },
-    /* Op_SrcRMWNT  */  {   mr,  0,    0,    0  },
-    /* Op_SrcW      */  {   mri, 0,    0,    Word_Types  },
-    /* Op_SrcImm    */  {   imm },
-    /* Op_Src_DXAXF */  {   mr,  0,    0,    1, Clb_SizeDXAX|Clb_Flags },
-    /* Op_SrcMemNT  */  {   mem, 0,    0     },
-    /* Op_SrcMemNTF */  {   mem, 0,    0,    0, Clb_Flags },
-    /* Op_SrcSrc    */  {   mr,  mri,  0,    1  },
-    /* Op_SrcSrcF   */  {   mr,  mri,  0,    1, Clb_Flags },
-    /* Op_SrcSrcFW  */  {   mr,  mri,  0,    Word_Types, Clb_Flags },
-    /* Op_SrcSrcSSEF*/  {   sse, ssem, 0,    0, Clb_Flags },
-    /* Op_SrcSrcMMX */  {   mmx, mmx,  0, },
-    /* Op_Shift     */  { D|mr,N|shft, 0,/**/1, Clb_Flags },
-    /* Op_Branch    */  {   mri },
-    /* Op_CBranch   */  {   imm },
-    /* Op_0         */  {   0,0,0 },
-    /* Op_0_AX      */  {   0,0,0,           0, Clb_SizeAX },
-    /* Op_0_DXAX    */  {   0,0,0,           0, Clb_SizeDXAX }, // but for cwd/cdq -- how do know the size..
-    /* Op_Loop      */  {   imm, 0,    0,    0, Clb_CX },
-    /* Op_Flags     */  {   0,0,0,           0, Clb_Flags },
-    /* Op_F0_ST     */  {   0,0,0,           0, Clb_ST },
-    /* Op_F0_P      */  {   0,0,0,           0, Clb_ST }, // push, pops, etc. not sure how to inform gcc..
-    /* Op_Fs_P      */  {   mem, 0,    0,    0, Clb_ST }, // "
-    /* Op_Fis       */  {   mem, 0,    0,    FPInt_Types }, // only 16bit and 32bit, DMD defaults to 16bit
-    /* Op_Fis_ST    */  {   mem, 0,    0,    FPInt_Types, Clb_ST }, // "
-    /* Op_Fis_P     */  {   mem, 0,    0,    FPInt_Types, Clb_ST }, // push and pop, fild so also 64 bit
-    /* Op_Fid       */  { D|mem, 0,    0,    FPInt_Types }, // only 16bit and 32bit, DMD defaults to 16bit
-    /* Op_Fid_P     */  { D|mem, 0,    0,    FPInt_Types, Clb_ST, Next_Form, Op_FidR_P }, // push and pop, fild so also 64 bit
-    /* Op_FidR_P    */  { D|mem,rfp,   0,    FPInt_Types, Clb_ST }, // push and pop, fild so also 64 bit
-    /* Op_Ffd       */  { D|mfp, 0,    0,    FP_Types, 0, Next_Form, Op_FfdR }, // only 16bit and 32bit, DMD defaults to 16bit, reg form doesn't need type
-    /* Op_FfdR      */  { D|rfp, 0,    0  },
-    /* Op_Ffd_P     */  { D|mfp, 0,    0,    FP_Types, Clb_ST, Next_Form, Op_FfdR_P, }, // pop, fld so also 80 bit, "
-    /* Op_FfdR_P    */  { D|rfp, 0,    0,    0,        Clb_ST, Next_Form, Op_FfdRR_P },
-    /* Op_FfdRR_P   */  { D|rfp, rfp,  0,    0,        Clb_ST },
-    /* Op_Fd_P      */  { D|mem, 0,    0,    0,        Clb_ST }, // "
-    /* Op_FdST      */  { D|rfp, 0,    0  },
-    /* Op_FMath     */  {   mfp, 0,    0,    FP_Types, Clb_ST, Next_Form, Op_FMath0  }, // and only single or double prec
-    /* Op_FMath0    */  { 0,     0,    0,    0,        Clb_ST, Next_Form, Op_FMath2  },
-    /* Op_FMath2    */  { D|rfp, rfp,  0,    0,        Clb_ST, Next_Form, Op_FdST0ST1 },
-    /* Op_FdSTiSTi  */  { D|rfp, rfp,  0  },
-    /* Op_FdST0ST1  */  { 0,     0,    0  },
-    /* Op_FPMath    */  { D|rfp, rfp,  0,    0,        Clb_ST, Next_Form, Op_F0_P }, // pops
-    /* Op_FCmp      */  {   mfp, 0,    0,    FP_Types, 0,      Next_Form, Op_FCmp1 }, // DMD defaults to float ptr
-    /* Op_FCmp1     */  {   rfp, 0,    0,    0,        0,      Next_Form, Op_0 },
-    /* Op_FCmpP     */  {   mfp, 0,    0,    FP_Types, 0,      Next_Form, Op_FCmpP1 }, // pops
-    /* Op_FCmpP1    */  {   rfp, 0,    0,    0,        0,      Next_Form, Op_F0_P }, // pops
-    /* Op_FCmpFlg0  */  {   0,   0,    0,    0,        Clb_Flags },
-    /* Op_FCmpFlg1  */  {   rfp, 0,    0,    0,        Clb_Flags, Next_Form, Op_FCmpFlg0 },
-    /* Op_FCmpFlg   */  {   rfp, rfp,  0,    0,        Clb_Flags, Next_Form, Op_FCmpFlg1 },
-    /* Op_FCmpFlgP0 */  {   0,   0,    0,    0,        Clb_Flags }, // pops
-    /* Op_FCmpFlgP1 */  {   rfp, 0,    0,    0,        Clb_Flags, Next_Form, Op_FCmpFlgP0 }, // pops
-    /* Op_FCmpFlgP  */  {   rfp, rfp,  0,    0,        Clb_Flags, Next_Form, Op_FCmpFlgP1 }, // pops
-    /* Op_fld       */  {   mfp, 0,    0,    FP_Types, Clb_ST, Next_Form, Op_fldR },
-    /* Op_fldR      */  {   rfp, 0,    0,    0,        Clb_ST },
-    /* Op_fxch      */  { D|rfp,D|rfp, 0,    0,        Clb_ST, Next_Form, Op_fxch1 }, // not in intel manual?, but DMD allows it (gas won't), second arg must be ST
-    /* Op_fxch1     */  { D|rfp, 0,    0,    0,        Clb_ST, Next_Form, Op_fxch0 },
-    /* Op_fxch0     */  {   0,   0,    0,    0,        Clb_ST }, // Also clobbers ST(1)
-    /* Op_SizedStack*/  {   0,   0,    0,    0,        Clb_SP }, // type suffix special case
-    /* Op_bound     */  {   mr,  mri,  0,    Word_Types  }, // operands *not* reversed for gas
-    /* Op_bswap     */  { D|r32      },
-    /* Op_cmps      */  {   mem, mem, 0,     1, Clb_DI|Clb_SI|Clb_Flags },
-    /* Op_cmpsd     */  {   0,   0,   0,     0, Clb_DI|Clb_SI|Clb_Flags, Next_Form, Op_DstSrcImmS },
-    /* Op_cmpsX     */  {   0,   0,   0,     0, Clb_DI|Clb_SI|Clb_Flags },
-    /* Op_cmpxchg   */  { D|mr,  reg, 0,     1, Clb_SizeAX|Clb_Flags },
-    /* Op_cmpxchg8b */  { D|mem/*64*/,0,0,   0, Clb_SizeDXAX/*32*/|Clb_Flags },
-    /* Op_cpuid     */  {   0,0,0 },    // Clobbers eax, ebx, ecx, and edx. Handled specially below.
-    /* Op_enter     */  {   imm, imm }, // operands *not* reversed for gas, %% inform gcc of EBP clobber?,
-    /* Op_fdisi     */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_fdisi },
-    /* Op_feni      */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_feni },
-    /* Op_fsetpm    */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_fsetpm },
-    /* Op_fXstsw    */  { D|mr,  0,   0,     }, // ax is the only allowed register
-    /* Op_imul      */  { D|reg, mr,  imm,   1, Clb_Flags, Next_Form, Op_imul2 }, // 16/32 only
-    /* Op_imul2     */  { D|reg, mri, 0,     1, Clb_Flags, Next_Form, Op_imul1 }, // 16/32 only
-    /* Op_imul1     */  {   mr,  0,   0,     1, Clb_Flags|Clb_SizeDXAX },
-    /* Op_in        */  { D|ax,N|port,0,     1  },
-    /* Op_ins       */  {   mem,N|dx, 0,     1, Clb_DI }, // can't override ES segment for this one
-    /* Op_insX      */  {   0,   0,   0,     0, Clb_DI }, // output segment overrides %% needs work
-    /* Op_iret      */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_iretw },
-    /* Op_iretd     */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_iret },
-    /* Op_iretq     */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_iretq },
-    /* Op_lods      */  {   mem, 0,   0,     1, Clb_SI },
-    /* Op_lodsX     */  {   0,   0,   0,     0, Clb_SI },
-    /* Op_movs      */  {   mem, mem, 0,     1, Clb_DI|Clb_SI }, // only src/DS can be overridden
-    /* Op_movsd     */  {   0,   0,   0,     0, Clb_DI|Clb_SI, Next_Form, Op_DstSrcSSE }, // %% gas doesn't accept movsd .. has to movsl
-    /* Op_movsX     */  {   0,   0,   0,     0, Clb_DI|Clb_SI },
-    /* Op_movsx     */  { D|reg, mr,  0,     1 }, // type suffix is special case
-    /* Op_movzx     */  { D|reg, mr,  0,     1 }, // type suffix is special case
-    /* Op_mul       */  { U|ax,  mr,  0,     1, Clb_SizeDXAX|Clb_Flags, Next_Form, Op_Src_DXAXF },
-    /* Op_out       */  { N|port,ax,  0,     1  },
-    /* Op_outs      */  { N|dx,  mem, 0,     1, Clb_SI },
-    /* Op_outsX     */  {   0,   0,   0,     0, Clb_SI },
-    /* Op_push      */  {   mri, 0,    0,    Word_Types, Clb_SP }, // would be Op_SrcW, but DMD defaults to 32-bit for immediate form
-    /* Op_pushq     */  {   mri, 0,    0,    0, Clb_SP },
-    /* Op_ret       */  {   imm, 0,   0,     0, 0, Next_Form, Op_0  },
-    /* Op_retf      */  {   0,   0,   0,     0, 0, Out_Mnemonic, Mn_lret  },
-    /* Op_scas      */  {   mem, 0,   0,     1, Clb_DI|Clb_Flags },
-    /* Op_scasX     */  {   0,   0,   0,     0, Clb_DI|Clb_Flags },
-    /* Op_stos      */  {   mem, 0,   0,     1, Clb_DI },
-    /* Op_stosX     */  {   0,   0,   0,     0, Clb_DI },
-    /* Op_xlat      */  {   mem, 0,   0,     0, Clb_SizeAX, Next_Form, Op_0_AX }
-
-    /// * Op_arpl      */  { D|mr,  reg }, // 16 only -> DstSrc
-    /// * Op_bsX       */  {   rw,  mrw,  0,    1, Clb_Flags },//->srcsrcf
-    /// * Op_bt        */  {   mrw, riw,  0,    1, Clb_Flags },//->srcsrcf
-    /// * Op_btX       */  { D|mrw, riw,  0,    1, Clb_Flags },//->dstsrcf .. immediate does not contribute to size
-    /// * Op_cmovCC    */  { D|rw,  mrw,  0,    1 } // ->dstsrc
+static const AsmOpInfo asmOpInfo[N_AsmOpInfo] =
+{
+  /* Op_Invalid   */  {},
+  /* Op_Adjust    */  { 0,0,0,             0, Clb_EAX /*just AX*/ },
+  /* Op_Dst       */  { D|mr,  0,    0,    1  },
+  /* Op_Upd       */  { U|mr,  0,    0,    1  },
+  /* Op_DstW      */  { D|mr,  0,    0,    Word_Types  },
+  /* Op_DstF      */  { D|mr,  0,    0,    1, Clb_Flags },
+  /* Op_UpdF      */  { U|mr,  0,    0,    1, Clb_Flags },
+  /* Op_DstQ      */  { D|mr,  0,    0,    0  },
+  /* Op_DstSrc    */  { D|mr,  mri,  0,/**/1  },
+  /* Op_DstSrcF   */  { D|mr,  mri,  0,/**/1, Clb_Flags },
+  /* Op_UpdSrcF   */  { U|mr,  mri,  0,/**/1, Clb_Flags },
+  /* Op_DstSrcFW  */  { D|mr,  mri,  0,/**/Word_Types, Clb_Flags },
+  /* Op_UpdSrcFW  */  { U|mr,  mri,  0,/**/Word_Types, Clb_Flags },
+  /* Op_DstSrcSSE */  { U|sse, ssem, 0     },  // some may not be update %%
+  /* Op_DstSrcMMX */  { U|mmx, mmxm, 0     },  // some may not be update %%
+  /* Op_DstSrcImmS*/  { U|sse, ssem, N|imm  }, // some may not be update %%
+  /* Op_DstSrcImmM*/  { U|mmx, mmxm, N|imm  }, // some may not be update %%
+  /* Op_DstSrcXmmS*/  { U|sse, ssem, N|mmx  }, // some may not be update %%
+  /* Op_UpdSrcShft*/  { U|mr,  reg,  N|shft, 1, Clb_Flags }, // 16/32 only
+  /* Op_DstSrcNT  */  { D|mr,  mr,   0,    0 }, // used for movd .. operands can be rm32,sse,mmx
+  /* Op_UpdSrcNT  */  { U|mr,  mr,   0,    0 }, // used for movd .. operands can be rm32,sse,mmx
+  /* Op_DstMemNT  */  { D|mem, 0,    0     },
+  /* Op_DstRMBNT  */  { D|mr,  0,    0,    Byte_NoType },
+  /* Op_DstRMWNT  */  { D|mr,  0,    0     },
+  /* Op_UpdUpd    */  { U|mr,U|mr,   0,/**/1  },
+  /* Op_UpdUpdF   */  { U|mr,U|mr,   0,/**/1, Clb_Flags },
+  /* Op_Src       */  {   mri, 0,    0,    1  },
+  /* Op_SrcRMWNT  */  {   mr,  0,    0,    0  },
+  /* Op_SrcW      */  {   mri, 0,    0,    Word_Types  },
+  /* Op_SrcImm    */  {   imm },
+  /* Op_Src_DXAXF */  {   mr,  0,    0,    1, Clb_SizeDXAX|Clb_Flags },
+  /* Op_SrcMemNT  */  {   mem, 0,    0     },
+  /* Op_SrcMemNTF */  {   mem, 0,    0,    0, Clb_Flags },
+  /* Op_SrcSrc    */  {   mr,  mri,  0,    1  },
+  /* Op_SrcSrcF   */  {   mr,  mri,  0,    1, Clb_Flags },
+  /* Op_SrcSrcFW  */  {   mr,  mri,  0,    Word_Types, Clb_Flags },
+  /* Op_SrcSrcSSEF*/  {   sse, ssem, 0,    0, Clb_Flags },
+  /* Op_SrcSrcMMX */  {   mmx, mmx,  0, },
+  /* Op_Shift     */  { D|mr,N|shft, 0,/**/1, Clb_Flags },
+  /* Op_Branch    */  {   mri },
+  /* Op_CBranch   */  {   imm },
+  /* Op_0         */  {   0,0,0 },
+  /* Op_0_AX      */  {   0,0,0,           0, Clb_SizeAX },
+  /* Op_0_DXAX    */  {   0,0,0,           0, Clb_SizeDXAX }, // but for cwd/cdq -- how do know the size..
+  /* Op_Loop      */  {   imm, 0,    0,    0, Clb_CX },
+  /* Op_Flags     */  {   0,0,0,           0, Clb_Flags },
+  /* Op_F0_ST     */  {   0,0,0,           0, Clb_ST },
+  /* Op_F0_P      */  {   0,0,0,           0, Clb_ST }, // push, pops, etc. not sure how to inform gcc..
+  /* Op_Fs_P      */  {   mem, 0,    0,    0, Clb_ST }, // "
+  /* Op_Fis       */  {   mem, 0,    0,    FPInt_Types }, // only 16bit and 32bit, DMD defaults to 16bit
+  /* Op_Fis_ST    */  {   mem, 0,    0,    FPInt_Types, Clb_ST }, // "
+  /* Op_Fis_P     */  {   mem, 0,    0,    FPInt_Types, Clb_ST }, // push and pop, fild so also 64 bit
+  /* Op_Fid       */  { D|mem, 0,    0,    FPInt_Types }, // only 16bit and 32bit, DMD defaults to 16bit
+  /* Op_Fid_P     */  { D|mem, 0,    0,    FPInt_Types, Clb_ST, Next_Form, Op_FidR_P }, // push and pop, fild so also 64 bit
+  /* Op_FidR_P    */  { D|mem,rfp,   0,    FPInt_Types, Clb_ST }, // push and pop, fild so also 64 bit
+  /* Op_Ffd       */  { D|mfp, 0,    0,    FP_Types, 0, Next_Form, Op_FfdR }, // only 16bit and 32bit, DMD defaults to 16bit, reg form doesn't need type
+  /* Op_FfdR      */  { D|rfp, 0,    0  },
+  /* Op_Ffd_P     */  { D|mfp, 0,    0,    FP_Types, Clb_ST, Next_Form, Op_FfdR_P, }, // pop, fld so also 80 bit, "
+  /* Op_FfdR_P    */  { D|rfp, 0,    0,    0,        Clb_ST, Next_Form, Op_FfdRR_P },
+  /* Op_FfdRR_P   */  { D|rfp, rfp,  0,    0,        Clb_ST },
+  /* Op_Fd_P      */  { D|mem, 0,    0,    0,        Clb_ST }, // "
+  /* Op_FdST      */  { D|rfp, 0,    0  },
+  /* Op_FMath     */  {   mfp, 0,    0,    FP_Types, Clb_ST, Next_Form, Op_FMath0  }, // and only single or double prec
+  /* Op_FMath0    */  { 0,     0,    0,    0,        Clb_ST, Next_Form, Op_FMath2  },
+  /* Op_FMath2    */  { D|rfp, rfp,  0,    0,        Clb_ST, Next_Form, Op_FdST0ST1 },
+  /* Op_FdSTiSTi  */  { D|rfp, rfp,  0  },
+  /* Op_FdST0ST1  */  { 0,     0,    0  },
+  /* Op_FPMath    */  { D|rfp, rfp,  0,    0,        Clb_ST, Next_Form, Op_F0_P }, // pops
+  /* Op_FCmp      */  {   mfp, 0,    0,    FP_Types, 0,      Next_Form, Op_FCmp1 }, // DMD defaults to float ptr
+  /* Op_FCmp1     */  {   rfp, 0,    0,    0,        0,      Next_Form, Op_0 },
+  /* Op_FCmpP     */  {   mfp, 0,    0,    FP_Types, 0,      Next_Form, Op_FCmpP1 }, // pops
+  /* Op_FCmpP1    */  {   rfp, 0,    0,    0,        0,      Next_Form, Op_F0_P }, // pops
+  /* Op_FCmpFlg0  */  {   0,   0,    0,    0,        Clb_Flags },
+  /* Op_FCmpFlg1  */  {   rfp, 0,    0,    0,        Clb_Flags, Next_Form, Op_FCmpFlg0 },
+  /* Op_FCmpFlg   */  {   rfp, rfp,  0,    0,        Clb_Flags, Next_Form, Op_FCmpFlg1 },
+  /* Op_FCmpFlgP0 */  {   0,   0,    0,    0,        Clb_Flags }, // pops
+  /* Op_FCmpFlgP1 */  {   rfp, 0,    0,    0,        Clb_Flags, Next_Form, Op_FCmpFlgP0 }, // pops
+  /* Op_FCmpFlgP  */  {   rfp, rfp,  0,    0,        Clb_Flags, Next_Form, Op_FCmpFlgP1 }, // pops
+  /* Op_fld       */  {   mfp, 0,    0,    FP_Types, Clb_ST, Next_Form, Op_fldR },
+  /* Op_fldR      */  {   rfp, 0,    0,    0,        Clb_ST },
+  /* Op_fxch      */  { D|rfp,D|rfp, 0,    0,        Clb_ST, Next_Form, Op_fxch1 }, // not in intel manual?, but DMD allows it (gas won't), second arg must be ST
+  /* Op_fxch1     */  { D|rfp, 0,    0,    0,        Clb_ST, Next_Form, Op_fxch0 },
+  /* Op_fxch0     */  {   0,   0,    0,    0,        Clb_ST }, // Also clobbers ST(1)
+  /* Op_SizedStack*/  {   0,   0,    0,    0,        Clb_SP }, // type suffix special case
+  /* Op_bound     */  {   mr,  mri,  0,    Word_Types  }, // operands *not* reversed for gas
+  /* Op_bswap     */  { D|r32      },
+  /* Op_cmps      */  {   mem, mem, 0,     1, Clb_DI|Clb_SI|Clb_Flags },
+  /* Op_cmpsd     */  {   0,   0,   0,     0, Clb_DI|Clb_SI|Clb_Flags, Next_Form, Op_DstSrcImmS },
+  /* Op_cmpsX     */  {   0,   0,   0,     0, Clb_DI|Clb_SI|Clb_Flags },
+  /* Op_cmpxchg   */  { D|mr,  reg, 0,     1, Clb_SizeAX|Clb_Flags },
+  /* Op_cmpxchg8b */  { D|mem/*64*/,0,0,   0, Clb_SizeDXAX/*32*/|Clb_Flags },
+  /* Op_cpuid     */  {   0,0,0 },    // Clobbers eax, ebx, ecx, and edx. Handled specially below.
+  /* Op_enter     */  {   imm, imm }, // operands *not* reversed for gas, %% inform gcc of EBP clobber?,
+  /* Op_fdisi     */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_fdisi },
+  /* Op_feni      */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_feni },
+  /* Op_fsetpm    */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_fsetpm },
+  /* Op_fXstsw    */  { D|mr,  0,   0,     }, // ax is the only allowed register
+  /* Op_imul      */  { D|reg, mr,  imm,   1, Clb_Flags, Next_Form, Op_imul2 }, // 16/32 only
+  /* Op_imul2     */  { D|reg, mri, 0,     1, Clb_Flags, Next_Form, Op_imul1 }, // 16/32 only
+  /* Op_imul1     */  {   mr,  0,   0,     1, Clb_Flags|Clb_SizeDXAX },
+  /* Op_in        */  { D|ax,N|port,0,     1  },
+  /* Op_ins       */  {   mem,N|dx, 0,     1, Clb_DI }, // can't override ES segment for this one
+  /* Op_insX      */  {   0,   0,   0,     0, Clb_DI }, // output segment overrides %% needs work
+  /* Op_iret      */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_iretw },
+  /* Op_iretd     */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_iret },
+  /* Op_iretq     */  {   0,0,0,           0, 0, Out_Mnemonic, Mn_iretq },
+  /* Op_lods      */  {   mem, 0,   0,     1, Clb_SI },
+  /* Op_lodsX     */  {   0,   0,   0,     0, Clb_SI },
+  /* Op_movs      */  {   mem, mem, 0,     1, Clb_DI|Clb_SI }, // only src/DS can be overridden
+  /* Op_movsd     */  {   0,   0,   0,     0, Clb_DI|Clb_SI, Next_Form, Op_DstSrcSSE }, // %% gas doesn't accept movsd .. has to movsl
+  /* Op_movsX     */  {   0,   0,   0,     0, Clb_DI|Clb_SI },
+  /* Op_movsx     */  { D|reg, mr,  0,     1 }, // type suffix is special case
+  /* Op_movzx     */  { D|reg, mr,  0,     1 }, // type suffix is special case
+  /* Op_mul       */  { U|ax,  mr,  0,     1, Clb_SizeDXAX|Clb_Flags, Next_Form, Op_Src_DXAXF },
+  /* Op_out       */  { N|port,ax,  0,     1  },
+  /* Op_outs      */  { N|dx,  mem, 0,     1, Clb_SI },
+  /* Op_outsX     */  {   0,   0,   0,     0, Clb_SI },
+  /* Op_push      */  {   mri, 0,    0,    Word_Types, Clb_SP }, // would be Op_SrcW, but DMD defaults to 32-bit for immediate form
+  /* Op_pushq     */  {   mri, 0,    0,    0, Clb_SP },
+  /* Op_ret       */  {   imm, 0,   0,     0, 0, Next_Form, Op_0  },
+  /* Op_retf      */  {   0,   0,   0,     0, 0, Out_Mnemonic, Mn_lret  },
+  /* Op_scas      */  {   mem, 0,   0,     1, Clb_DI|Clb_Flags },
+  /* Op_scasX     */  {   0,   0,   0,     0, Clb_DI|Clb_Flags },
+  /* Op_stos      */  {   mem, 0,   0,     1, Clb_DI },
+  /* Op_stosX     */  {   0,   0,   0,     0, Clb_DI },
+  /* Op_xlat      */  {   mem, 0,   0,     0, Clb_SizeAX, Next_Form, Op_0_AX }
+  
+  /// * Op_arpl      */  { D|mr,  reg }, // 16 only -> DstSrc
+  /// * Op_bsX       */  {   rw,  mrw,  0,    1, Clb_Flags },//->srcsrcf
+  /// * Op_bt        */  {   mrw, riw,  0,    1, Clb_Flags },//->srcsrcf
+  /// * Op_btX       */  { D|mrw, riw,  0,    1, Clb_Flags },//->dstsrcf .. immediate does not contribute to size
+  /// * Op_cmovCC    */  { D|rw,  mrw,  0,    1 } // ->dstsrc
 };
 
 #undef mri
 
 struct AsmOpEnt
 {
-    const char * inMnemonic;
-    AsmOp asmOp;
+  const char * inMnemonic;
+  AsmOp asmOp;
 };
 
 /* Some opcodes which have data size restrictions, but we don't check
-
+   
    cmov, l<segreg> ?, lea, lsl, shld
-
-   todo: push <immediate> is always the 32-bit form, even tho push <mem> is 16-bit
+   
+todo: push <immediate> is always the 32-bit form, even tho push <mem> is 16-bit
 */
 
-static AsmOpEnt opData[] = {
+static const AsmOpEnt opData[] =
+{
     { "__emit", Op_db },  // %% Not sure...
     { "_emit",  Op_db },
     { "aaa",    Op_Adjust },
     { "xorps",  Op_DstSrcSSE },
 };
 
-static AsmOpEnt opData64[] = {
+static const AsmOpEnt opData64[] =
+{
     { "aaa",    Op_Invalid },
     { "aad",    Op_Invalid },
     { "aam",    Op_Invalid },
 
 enum PtrType
 {
-    Default_Ptr = 0,
-    Byte_Ptr = 1,
-    Short_Ptr = 2,
-    Int_Ptr = 4,
-    Long_Ptr =  8,
-    Float_Ptr = 4,
-    Double_Ptr = 8,
-    Extended_Ptr = 10,
-    Near_Ptr = 98,
-    Far_Ptr = 99,
-    N_PtrTypes
+  Default_Ptr = 0,
+  Byte_Ptr = 1,
+  Short_Ptr = 2,
+  Int_Ptr = 4,
+  Long_Ptr =  8,
+  Float_Ptr = 4,
+  Double_Ptr = 8,
+  Extended_Ptr = 10,
+  Near_Ptr = 98,
+  Far_Ptr = 99,
+  N_PtrTypes
 };
 
 static const int N_PtrNames = 8;
-static const char * ptrTypeNameTable[N_PtrNames] = {
-    "word", "dword", "qword",
-    "float", "double", "extended",
-    "near",  "far"
+static const char * ptrTypeNameTable[N_PtrNames] =
+{
+  "word", "dword", "qword",
+  "float", "double", "extended",
+  "near",  "far"
 };
 
 static Identifier * ptrTypeIdentTable[N_PtrNames];
-static PtrType ptrTypeValueTable[N_PtrNames] = {
-    Short_Ptr, Int_Ptr, Long_Ptr,
-    Float_Ptr, Double_Ptr, Extended_Ptr,
-    Near_Ptr, Far_Ptr
+static const PtrType ptrTypeValueTable[N_PtrNames] =
+{
+  Short_Ptr, Int_Ptr, Long_Ptr,
+  Float_Ptr, Double_Ptr, Extended_Ptr,
+  Near_Ptr, Far_Ptr
 };
 
 enum OperandClass
 {
-    Opr_Invalid,
-    Opr_Immediate,
-    Opr_Reg,
-    Opr_Mem
+  Opr_Invalid,
+  Opr_Immediate,
+  Opr_Reg,
+  Opr_Mem
 };
 
 /* kill inlining if we reference a local? */
 
 struct AsmProcessor
 {
-    struct Operand
-    {
+    struct Operand {
         int inBracket;
         int hasBracket;
         int hasNumber;

File d/d-codegen.h

View file
-/* GDC -- D front-end for GCC
-   Copyright (C) 2004 David Friedman
+// GDC -- D front-end for GCC
+// Copyright (C) 2004 David Friedman
 
-   Modified by
-    Michael Parrot, (C) 2009, 2010
-    Iain Buclaw, (C) 2011
+// Modified by Iain Buclaw, (C) 2011, 2012
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 #ifndef GCC_DCMPLR_CODEGEN_H
 #define GCC_DCMPLR_CODEGEN_H
 
 enum LibCall
 {
-    LIBCALL_ASSERT,
-    LIBCALL_ASSERT_MSG,
-    LIBCALL_ARRAY_BOUNDS,
-    LIBCALL_SWITCH_ERROR,
-    LIBCALL_INVARIANT,
-    LIBCALL_NEWCLASS,
-    LIBCALL_NEWARRAYT,
-    LIBCALL_NEWARRAYIT,
-    //LIBCALL_NEWARRAYMT,
-    LIBCALL_NEWARRAYMTP,
-    //LIBCALL_NEWARRAYMIT,
-    LIBCALL_NEWARRAYMITP,
+  LIBCALL_ASSERT,
+  LIBCALL_ASSERT_MSG,
+  LIBCALL_ARRAY_BOUNDS,
+  LIBCALL_SWITCH_ERROR,
+  LIBCALL_INVARIANT,
+  LIBCALL_NEWCLASS,
+  LIBCALL_NEWARRAYT,
+  LIBCALL_NEWARRAYIT,
+  //LIBCALL_NEWARRAYMT,
+  LIBCALL_NEWARRAYMTP,
+  //LIBCALL_NEWARRAYMIT,
+  LIBCALL_NEWARRAYMITP,
 #if V2
-    LIBCALL_ALLOCMEMORY,
+  LIBCALL_ALLOCMEMORY,
 #endif
-    LIBCALL_DELCLASS,
-    LIBCALL_DELINTERFACE,
-    LIBCALL_DELARRAY,
-    LIBCALL_DELMEMORY,
-    LIBCALL_CALLFINALIZER,
-    LIBCALL_CALLINTERFACEFINALIZER,
-    LIBCALL_ARRAYSETLENGTHT,
-    LIBCALL_ARRAYSETLENGTHIT,
-    LIBCALL_DYNAMIC_CAST,
-    LIBCALL_INTERFACE_CAST,
-    LIBCALL_ADEQ,
-    LIBCALL_ADEQ2,
-    LIBCALL_ADCMP,
-    LIBCALL_ADCMP2,
-    LIBCALL_ADCMPCHAR,
-    LIBCALL_AAEQUAL,
-    LIBCALL_AALEN,
-    /*LIBCALL_AAIN,
+  LIBCALL_DELCLASS,
+  LIBCALL_DELINTERFACE,
+  LIBCALL_DELARRAY,
+  LIBCALL_DELMEMORY,
+  LIBCALL_CALLFINALIZER,
+  LIBCALL_CALLINTERFACEFINALIZER,
+  LIBCALL_ARRAYSETLENGTHT,
+  LIBCALL_ARRAYSETLENGTHIT,
+  LIBCALL_DYNAMIC_CAST,
+  LIBCALL_INTERFACE_CAST,
+  LIBCALL_ADEQ,
+  LIBCALL_ADEQ2,
+  LIBCALL_ADCMP,
+  LIBCALL_ADCMP2,
+  LIBCALL_ADCMPCHAR,
+  LIBCALL_AAEQUAL,
+  LIBCALL_AALEN,
+  /*LIBCALL_AAIN,
     LIBCALL_AAGET,
     LIBCALL_AAGETRVALUE,
     LIBCALL_AADEL,*/
-    LIBCALL_AAINP,
-    LIBCALL_AAGETP,
-    LIBCALL_AAGETRVALUEP,
-    LIBCALL_AADELP,
-    LIBCALL_ARRAYCAST,
-    LIBCALL_ARRAYCOPY,
-    LIBCALL_ARRAYCATT,
-    LIBCALL_ARRAYCATNT,
-    LIBCALL_ARRAYAPPENDT,
-    //LIBCALL_ARRAYAPPENDCT,
-    LIBCALL_ARRAYAPPENDCTP,
-    LIBCALL_ARRAYAPPENDCD,
-    LIBCALL_ARRAYAPPENDWD,
+  LIBCALL_AAINP,
+  LIBCALL_AAGETP,
+  LIBCALL_AAGETRVALUEP,
+  LIBCALL_AADELP,
+  LIBCALL_ARRAYCAST,
+  LIBCALL_ARRAYCOPY,
+  LIBCALL_ARRAYCATT,
+  LIBCALL_ARRAYCATNT,
+  LIBCALL_ARRAYAPPENDT,
+  //LIBCALL_ARRAYAPPENDCT,
+  LIBCALL_ARRAYAPPENDCTP,
+  LIBCALL_ARRAYAPPENDCD,
+  LIBCALL_ARRAYAPPENDWD,
 #if V2
-    LIBCALL_ARRAYASSIGN,
-    LIBCALL_ARRAYCTOR,
-    LIBCALL_ARRAYSETASSIGN,
-    LIBCALL_ARRAYSETCTOR,
-    LIBCALL_DELARRAYT,
+  LIBCALL_ARRAYASSIGN,
+  LIBCALL_ARRAYCTOR,
+  LIBCALL_ARRAYSETASSIGN,
+  LIBCALL_ARRAYSETCTOR,
+  LIBCALL_DELARRAYT,
 #endif
-    LIBCALL_MONITORENTER,
-    LIBCALL_MONITOREXIT,
-    LIBCALL_CRITICALENTER,
-    LIBCALL_CRITICALEXIT,
-    LIBCALL_THROW,
-    LIBCALL_SWITCH_STRING,
-    LIBCALL_SWITCH_USTRING,
-    LIBCALL_SWITCH_DSTRING,
-    LIBCALL_ASSOCARRAYLITERALTP,
-    LIBCALL_ARRAYLITERALTP,
+  LIBCALL_MONITORENTER,
+  LIBCALL_MONITOREXIT,
+  LIBCALL_CRITICALENTER,
+  LIBCALL_CRITICALEXIT,
+  LIBCALL_THROW,
+  LIBCALL_SWITCH_STRING,
+  LIBCALL_SWITCH_USTRING,
+  LIBCALL_SWITCH_DSTRING,
+  LIBCALL_ASSOCARRAYLITERALTP,
+  LIBCALL_ARRAYLITERALTP,
 #if V2
-    LIBCALL_UNITTEST,
-    LIBCALL_UNITTEST_MSG,
-    LIBCALL_HIDDEN_FUNC,
+  LIBCALL_UNITTEST,
+  LIBCALL_UNITTEST_MSG,
+  LIBCALL_HIDDEN_FUNC,
 #endif
-    LIBCALL_count
+  LIBCALL_count
 };
 
 enum BinOp
 {
-    opComp,
-    opBinary,
-    opAssign,
+  opComp,
+  opBinary,
+  opAssign,
 };
 
 struct FuncFrameInfo
 {
-    bool creates_frame;     // Function creates nested frame.
-    bool static_chain;      // Function has static chain passed via PARM_DECL
-    bool is_closure;        // Frame is a closure (initialised on the heap).
-    union
-    {
-        tree closure_rec;   // Frame type for static chain
-        tree frame_rec;
-    };
+  bool creates_frame;     // Function creates nested frame.
+  bool static_chain;      // Function has static chain passed via PARM_DECL
+  bool is_closure;        // Frame is a closure (initialised on the heap).
+  union {
+      tree closure_rec;   // Frame type for static chain
+      tree frame_rec;
+  };
 };
 
 class ArrayScope;
 
 struct IRState : IRBase
 {
-    // %% intrinsic and math functions in alphabetical order for bsearch
-    enum Intrinsic
-    {
-        INTRINSIC_BSF, INTRINSIC_BSR,
-        INTRINSIC_BSWAP,
-        INTRINSIC_BT, INTRINSIC_BTC, INTRINSIC_BTR, INTRINSIC_BTS,
-        INTRINSIC_INP, INTRINSIC_INPL, INTRINSIC_INPW,
-        INTRINSIC_OUTP, INTRINSIC_OUTPL, INTRINSIC_OUTPW,
+  // %% intrinsic and math functions in alphabetical order for bsearch
+  enum Intrinsic {
+      INTRINSIC_BSF, INTRINSIC_BSR,
+      INTRINSIC_BSWAP,
+      INTRINSIC_BT, INTRINSIC_BTC, INTRINSIC_BTR, INTRINSIC_BTS,
+      INTRINSIC_INP, INTRINSIC_INPL, INTRINSIC_INPW,
+      INTRINSIC_OUTP, INTRINSIC_OUTPL, INTRINSIC_OUTPW,
 
-        INTRINSIC_COS, INTRINSIC_FABS,
-        INTRINSIC_LDEXP, INTRINSIC_RINT,
-        INTRINSIC_RNDTOL, INTRINSIC_SIN,
-        INTRINSIC_SQRT,
+      INTRINSIC_COS, INTRINSIC_FABS,
+      INTRINSIC_LDEXP, INTRINSIC_RINT,
+      INTRINSIC_RNDTOL, INTRINSIC_SIN,
+      INTRINSIC_SQRT,
 
-        INTRINSIC_STD_VA_ARG,
-        INTRINSIC_C_VA_ARG,
-        INTRINSIC_C_VA_START,
-        INTRINSIC_count,
-    };
+      INTRINSIC_STD_VA_ARG,
+      INTRINSIC_C_VA_ARG,
+      INTRINSIC_C_VA_START,
+      INTRINSIC_count,
+  };
 
-    static tree declContext(Dsymbol * d_sym);
-    static void doLineNote(const Loc & loc);
+  static tree declContext(Dsymbol * d_sym);
+  static void doLineNote(const Loc & loc);
 
-    // ** Local variables
-    void emitLocalVar(VarDeclaration * v, bool no_init = false);
-    tree localVar(tree t_type);
-    tree localVar(Type * e_type);
+  // ** Local variables
+  void emitLocalVar(VarDeclaration * v, bool no_init = false);
+  tree localVar(tree t_type);
+  tree localVar(Type * e_type);
 
-    tree exprVar(tree t_type);
-    tree maybeExprVar(tree exp, tree * out_var);
-    void expandDecl(tree t_decl);
+  tree exprVar(tree t_type);
+  tree maybeExprVar(tree exp, tree * out_var);
+  void expandDecl(tree t_decl);
 
-    tree var(VarDeclaration * v);
+  tree var(VarDeclaration * v);
 
-    // ** Type conversion
+  // ** Type conversion
 
-    // 'convertTo' just to give it a different name from the extern "C" convert
-    tree convertTo(Expression * exp, Type * target_type);
-    tree convertTo(tree exp, Type * exp_type, Type * target_type);
+  // 'convertTo' just to give it a different name from the extern "C" convert
+  tree convertTo(Expression * exp, Type * target_type);
+  tree convertTo(tree exp, Type * exp_type, Type * target_type);
 
-    tree convertForAssignment(Expression * exp, Type * target_type);
-    tree convertForAssignment(tree exp_tree, Type * exp_type, Type * target_type);
-    tree convertForArgument(Expression * exp, Parameter * arg);
-    tree convertForCondition(Expression * exp);
-    tree convertForCondition(tree exp_tree, Type * exp_type);
-    tree toDArray(Expression * exp);
+  tree convertForAssignment(Expression * exp, Type * target_type);
+  tree convertForAssignment(tree exp_tree, Type * exp_type, Type * target_type);
+  tree convertForArgument(Expression * exp, Parameter * arg);
+  tree convertForCondition(Expression * exp);
+  tree convertForCondition(tree exp_tree, Type * exp_type);
+  tree toDArray(Expression * exp);
 
-    // ** Type management
-    static bool typesSame(Type * t1, Type * t2);
-    static bool typesCompatible(Type * t1, Type * t2);
-    static Type * getDType(tree t);
-    static Type * getObjectType();
+  // ** Type management
+  static bool typesSame(Type * t1, Type * t2);
+  static bool typesCompatible(Type * t1, Type * t2);
+  static Type * getDType(tree t);
+  static Type * getObjectType();
 
-    // Routines to handle variables that are references.
-    static bool isDeclarationReferenceType(Declaration * decl);
-    static tree trueDeclarationType(Declaration * decl);
-    static bool isArgumentReferenceType(Parameter * arg);
-    static tree trueArgumentType(Parameter * arg);
+  // Routines to handle variables that are references.
+  static bool isDeclarationReferenceType(Declaration * decl);
+  static tree trueDeclarationType(Declaration * decl);
+  static bool isArgumentReferenceType(Parameter * arg);
+  static tree trueArgumentType(Parameter * arg);
 
-    static tree arrayType(Type * d_type, uinteger_t size); // %% use of dinteger_t
-    static tree arrayType(tree type_node, uinteger_t size);
+  static tree arrayType(Type * d_type, uinteger_t size); // %% use of dinteger_t
+  static tree arrayType(tree type_node, uinteger_t size);
 
-    static bool haveLongDouble();
+  static bool haveLongDouble();
 
-    static tree addTypeAttribute(tree type, const char * attrname, tree value = NULL_TREE);
-    static void addDeclAttribute(tree type, const char * attrname, tree value = NULL_TREE);
-    static tree attributes(Expressions * in_attrs);
-    static tree addTypeModifiers(tree type, unsigned mod);
+  static tree addTypeAttribute(tree type, const char * attrname, tree value = NULL_TREE);
+  static void addDeclAttribute(tree type, const char * attrname, tree value = NULL_TREE);
+  static tree attributes(Expressions * in_attrs);
+  static tree addTypeModifiers(tree type, unsigned mod);
 
-    // ** Simple constants
-    static tree integerConstant(dinteger_t value, Type * type);
-    static tree integerConstant(dinteger_t value, tree type = integer_type_node);
-    static tree floatConstant(const real_t & value, Type * target_type);
+  // ** Simple constants
+  static tree integerConstant(dinteger_t value, Type * type);
+  static tree integerConstant(dinteger_t value, tree type = integer_type_node);
+  static tree floatConstant(const real_t & value, Type * target_type);
 
-    static dinteger_t hwi2toli(HOST_WIDE_INT low, HOST_WIDE_INT high);
-    static dinteger_t hwi2toli(double_int cst);
+  static dinteger_t hwi2toli(HOST_WIDE_INT low, HOST_WIDE_INT high);
+  static dinteger_t hwi2toli(double_int cst);
 
-    // ** Routines for built in structured types
-    static tree realPart(tree c);
-    static tree imagPart(tree c);
+  // ** Routines for built in structured types
+  static tree realPart(tree c);
+  static tree imagPart(tree c);
 
-    // ** Dynamic arrays
-    static tree darrayLenRef(tree exp);
-    static tree darrayPtrRef(tree exp);
-    tree darrayPtrRef(Expression * e);
+  // ** Dynamic arrays
+  static tree darrayLenRef(tree exp);
+  static tree darrayPtrRef(tree exp);
+  tree darrayPtrRef(Expression * e);
 
-    tree darrayVal(tree type, tree len, tree data);
-    // data may be NULL for a null pointer value
-    tree darrayVal(Type * type, uinteger_t len, tree data);
-    tree darrayVal(tree type, uinteger_t len, tree data);
-    tree darrayString(const char * str);
+  tree darrayVal(tree type, tree len, tree data);
+  // data may be NULL for a null pointer value
+  tree darrayVal(Type * type, uinteger_t len, tree data);
+  tree darrayVal(tree type, uinteger_t len, tree data);
+  tree darrayString(const char * str);
 
-    static char * hostToTargetString(char * str, size_t length, unsigned unit_size);
+  static char * hostToTargetString(char * str, size_t length, unsigned unit_size);
 
-    // Length of either a static or dynamic array
-    tree arrayLength(Expression * exp);
-    static tree arrayLength(tree exp, Type * exp_type);
+  // Length of either a static or dynamic array
+  tree arrayLength(Expression * exp);
+  static tree arrayLength(tree exp, Type * exp_type);
 
-    // Delegates
-    static tree delegateMethodRef(tree exp);
-    static tree delegateObjectRef(tree exp);
-    static tree delegateVal(tree method_exp, tree object_exp, Type * d_type);
-    // These are for references to nested functions/methods as opposed to a variable of
-    // type Tdelegate
-    tree methodCallExpr(tree callee, tree object, Type * d_type);
-    void extractMethodCallExpr(tree mcr, tree & callee_out, tree & object_out);
-    tree objectInstanceMethod(Expression * obj_exp, FuncDeclaration * func, Type * d_type);
+  // Delegates
+  static tree delegateMethodRef(tree exp);
+  static tree delegateObjectRef(tree exp);
+  static tree delegateVal(tree method_exp, tree object_exp, Type * d_type);
+  // These are for references to nested functions/methods as opposed to a variable of
+  // type Tdelegate
+  tree methodCallExpr(tree callee, tree object, Type * d_type);
+  void extractMethodCallExpr(tree mcr, tree & callee_out, tree & object_out);
+  tree objectInstanceMethod(Expression * obj_exp, FuncDeclaration * func, Type * d_type);
 
-    static tree twoFieldType(tree rec_type, tree ft1, tree ft2, Type * d_type = 0, const char * n1 = "_a", const char * n2 = "_b");
-    static tree twoFieldType(Type * ft1, Type * ft2, Type * d_type = 0, const char * n1 = "_a", const char * n2 = "_b");
-    static tree twoFieldCtor(tree rec_type, tree f1, tree f2, int storage_class = 0);
+  static tree twoFieldType(tree rec_type, tree ft1, tree ft2, Type * d_type = 0, const char * n1 = "_a", const char * n2 = "_b");
+  static tree twoFieldType(Type * ft1, Type * ft2, Type * d_type = 0, const char * n1 = "_a", const char * n2 = "_b");
+  static tree twoFieldCtor(tree rec_type, tree f1, tree f2, int storage_class = 0);
 
-    // ** Temporaries (currently just SAVE_EXPRs)
+  // ** Temporaries (currently just SAVE_EXPRs)
 
-    // Create a SAVE_EXPR if 't' might have unwanted side effects if referenced
-    // more than once in an expression.
-    tree maybeMakeTemp(tree t);
+  // Create a SAVE_EXPR if 't' might have unwanted side effects if referenced
+  // more than once in an expression.
+  tree maybeMakeTemp(tree t);
 
-    // Return true if t can be evaluated multiple times (i.e., in a loop body)
-    // without unwanted side effects.  This is a stronger test than
-    // the one used for maybeMakeTemp.
-    static bool isFreeOfSideEffects(tree t);
+  // Return true if t can be evaluated multiple times (i.e., in a loop body)
+  // without unwanted side effects.  This is a stronger test than
+  // the one used for maybeMakeTemp.
+  static bool isFreeOfSideEffects(tree t);
 
-    // ** Various expressions
-    tree toElemLvalue(Expression * e);
+  // ** Various expressions
+  tree toElemLvalue(Expression * e);
 
-    static tree addressOf(Dsymbol *d);
-    static tree addressOf(tree exp);
+  static tree addressOf(Dsymbol *d);
+  static tree addressOf(tree exp);
 
-    /* Cast exp (which should be a pointer) to TYPE* and then indirect.  The
-       back-end requires this cast in many cases. */
-    static tree indirect(tree exp, tree type);
-    static tree indirect(tree exp);
+  /* Cast exp (which should be a pointer) to TYPE* and then indirect.  The
+     back-end requires this cast in many cases. */
+  static tree indirect(tree exp, tree type);
+  static tree indirect(tree exp);
 
-    static tree vmodify(tree dst, tree src);
-    static tree vinit(tree dst, tree src);
+  static tree vmodify(tree dst, tree src);
+  static tree vinit(tree dst, tree src);
 
-    tree pointerIntSum(Expression * ptr_exp, Expression * idx_exp);
-    tree pointerIntSum(tree ptr_node, tree idx_exp);
-//  static tree pointIntOp(int op, tree ptr, tree idx);
-    static tree pointerOffsetOp(int op, tree ptr, tree idx);
-    static tree pointerOffset(tree ptr_node, tree byte_offset);
+  tree pointerIntSum(Expression * ptr_exp, Expression * idx_exp);
+  tree pointerIntSum(tree ptr_node, tree idx_exp);
+  //  static tree pointIntOp(int op, tree ptr, tree idx);
+  static tree pointerOffsetOp(int op, tree ptr, tree idx);
+  static tree pointerOffset(tree ptr_node, tree byte_offset);
 
-    static tree nop(tree e, tree t);
-    static tree vconvert(tree e, tree t);
+  static tree nop(tree e, tree t);
+  static tree vconvert(tree e, tree t);
 
-    // DMD allows { void[] a; & a[3]; }
-    static tree pvoidOkay(tree t);
-    tree boolOp(enum tree_code code, tree a, tree b);
+  // DMD allows { void[] a; & a[3]; }
+  static tree pvoidOkay(tree t);
+  tree boolOp(enum tree_code code, tree a, tree b);
 
-    tree checkedIndex(Loc loc, tree index, tree upper_bound, bool inclusive);
-    tree boundsCond(tree index, tree upper_bound, bool inclusive);
-    int arrayBoundsCheck();
+  tree checkedIndex(Loc loc, tree index, tree upper_bound, bool inclusive);
+  tree boundsCond(tree index, tree upper_bound, bool inclusive);
+  int arrayBoundsCheck();
 
-    tree arrayElemRef(IndexExp * aer_exp, ArrayScope * aryscp);
+  tree arrayElemRef(IndexExp * aer_exp, ArrayScope * aryscp);
 
-    static tree binding(tree var_chain, tree body);
-    static tree compound(tree a, tree b, tree type = 0);
-    tree voidCompound(tree a, tree b);
-    tree maybeCompound(tree a, tree b);
-    tree maybeVoidCompound(tree a, tree b);
-    static tree component(tree v, tree f);
+  static tree binding(tree var_chain, tree body);
+  static tree compound(tree a, tree b, tree type = 0);
+  tree voidCompound(tree a, tree b);
+  tree maybeCompound(tree a, tree b);
+  tree maybeVoidCompound(tree a, tree b);
+  static tree component(tree v, tree f);
 
-    // Giving error_mark_node a type allows for some assumptions about
-    // the type of an arbitrary expression.
-    static tree errorMark(Type * t);
-    static bool isErrorMark(tree t);
+  // Giving error_mark_node a type allows for some assumptions about
+  // the type of an arbitrary expression.
+  static tree errorMark(Type * t);
+  static bool isErrorMark(tree t);
 
-    // ** Helpers for call
-    static TypeFunction * getFuncType(Type * t);
-    static bool isFuncType(tree t);
+  // ** Helpers for call
+  static TypeFunction * getFuncType(Type * t);
+  static bool isFuncType(tree t);
 
-    // ** Function calls
-    tree call(Expression * expr, Expressions * arguments);
-    tree call(FuncDeclaration * func_decl, Expressions * args);
-    tree call(FuncDeclaration * func_decl, tree object, Expressions * args);
-    tree call(TypeFunction *guess, tree callable, tree object, Expressions * arguments);
+  // ** Function calls
+  tree call(Expression * expr, Expressions * arguments);
+  tree call(FuncDeclaration * func_decl, Expressions * args);
+  tree call(FuncDeclaration * func_decl, tree object, Expressions * args);
+  tree call(TypeFunction *guess, tree callable, tree object, Expressions * arguments);
 
-    tree assertCall(Loc loc, LibCall libcall = LIBCALL_ASSERT);
-    tree assertCall(Loc loc, Expression * msg);
-    static FuncDeclaration * getLibCallDecl(LibCall lib_call);
-    static void replaceLibCallDecl(FuncDeclaration * d_decl);
-    // This does not perform conversions on the arguments.  This allows
-    // arbitrary data to be passed through varargs without going through the
-    // usual conversions.
-    static tree libCall(LibCall lib_call, unsigned n_args, tree *args, tree force_result_type = 0);
-    static tree buildCall(tree type, tree callee, tree args);
-    static tree buildCall(tree callee, int n_args, ...);
+  tree assertCall(Loc loc, LibCall libcall = LIBCALL_ASSERT);
+  tree assertCall(Loc loc, Expression * msg);
+  static FuncDeclaration * getLibCallDecl(LibCall lib_call);
+  static void replaceLibCallDecl(FuncDeclaration * d_decl);
+  // This does not perform conversions on the arguments.  This allows
+  // arbitrary data to be passed through varargs without going through the
+  // usual conversions.
+  static tree libCall(LibCall lib_call, unsigned n_args, tree *args, tree force_result_type = 0);
+  static tree buildCall(tree type, tree callee, tree args);
+  static tree buildCall(tree callee, int n_args, ...);
 
-    tree assignValue(Expression * e, VarDeclaration * v);
+  tree assignValue(Expression * e, VarDeclaration * v);
 
-    static TemplateEmission emitTemplates;
-    static bool splitDynArrayVarArgs;
-    static bool useInlineAsm;
-    static bool useBuiltins;
+  static TemplateEmission emitTemplates;
+  static bool splitDynArrayVarArgs;
+  static bool useInlineAsm;
+  static bool useBuiltins;
 
-    // %%
-    static bool originalOmitFramePointer;
+  // %%
+  static bool originalOmitFramePointer;
 
 #if V2
-    // Variables that are in scope that will need destruction later
-    static VarDeclarations * varsInScope;
+  // Variables that are in scope that will need destruction later
+  static VarDeclarations * varsInScope;
 #endif
 
 protected:
-    tree maybeExpandSpecialCall(tree call_exp);
-    static tree expandPortIntrinsic(Intrinsic code, tree port, tree value, int outp);
+  tree maybeExpandSpecialCall(tree call_exp);
+  static tree expandPortIntrinsic(Intrinsic code, tree port, tree value, int outp);
 public:
-    tree floatMod(tree a, tree b, tree type);
+  tree floatMod(tree a, tree b, tree type);
 
-    tree typeinfoReference(Type * t);
+  tree typeinfoReference(Type * t);
 
-    dinteger_t getTargetSizeConst(tree t);
+  dinteger_t getTargetSizeConst(tree t);
 
-    static Module * builtinsModule;
-    static Module * intrinsicModule;
-    static Module * intrinsicCoreModule;
-    static Module * mathModule;
-    static Module * mathCoreModule;
-    static TemplateDeclaration * stdargTemplateDecl;
-    static TemplateDeclaration * cstdargStartTemplateDecl;
-    static TemplateDeclaration * cstdargArgTemplateDecl;
+  static Module * builtinsModule;
+  static Module * intrinsicModule;
+  static Module * intrinsicCoreModule;
+  static Module * mathModule;
+  static Module * mathCoreModule;
+  static TemplateDeclaration * stdargTemplateDecl;
+  static TemplateDeclaration * cstdargStartTemplateDecl;
+  static TemplateDeclaration * cstdargArgTemplateDecl;
 
-    static void setBuiltinsModule(Module * mod)
-    {
-        builtinsModule = mod;
-    }
+  static void setBuiltinsModule(Module * mod) {
+      builtinsModule = mod;
+  }
 
-    static void setIntrinsicModule(Module * mod, bool coremod)
-    {
-        if (coremod)
-            intrinsicCoreModule = mod;
-        else
-            intrinsicModule = mod;
-    }
+  static void setIntrinsicModule(Module * mod, bool coremod) {
+      if (coremod)
+	intrinsicCoreModule = mod;
+      else
+	intrinsicModule = mod;
+  }
 
-    static void setMathModule(Module * mod, bool coremod)
-    {
-        if (coremod)
-            mathCoreModule = mod;
-        else
-            mathModule = mod;
-    }
+  static void setMathModule(Module * mod, bool coremod) {
+      if (coremod)
+	mathCoreModule = mod;
+      else
+	mathModule = mod;
+  }
 
-    static void setStdArg(TemplateDeclaration * td)
-    {
-        stdargTemplateDecl = td;
-    }
+  static void setStdArg(TemplateDeclaration * td) {
+      stdargTemplateDecl = td;
+  }
+  
+  static void setCStdArgStart(TemplateDeclaration * td) {
+      cstdargStartTemplateDecl = td;
+  }
 
-    static void setCStdArgStart(TemplateDeclaration * td)
-    {
-        cstdargStartTemplateDecl = td;
-    }
+  static void setCStdArgArg(TemplateDeclaration * td) {
+      cstdargArgTemplateDecl = td;
+  }
 
-    static void setCStdArgArg(TemplateDeclaration * td)
-    {
-        cstdargArgTemplateDecl = td;
-    }
+  static bool maybeSetUpBuiltin(Declaration * decl);
 
-    static bool maybeSetUpBuiltin(Declaration * decl);
+  static tree functionPointer(FuncDeclaration * func_decl);
+  // Returns the D object that was thrown.  Different from the generic exception pointer
+  static tree exceptionObject();
 
-    static tree functionPointer(FuncDeclaration * func_decl);
-    // Returns the D object that was thrown.  Different from the generic exception pointer
-    static tree exceptionObject();
+  static tree label(Loc loc, Identifier * ident = 0);
 
-    static tree label(Loc loc, Identifier * ident = 0);
+  // Static chain of function, for D2, this is a closure.
+  void useChain(FuncDeclaration * f, tree l) {
+      _chainLink = l;
+      _chainFunc = f;
+  }
 
-    // Static chain of function, for D2, this is a closure.
-    void useChain(FuncDeclaration * f, tree l)
-    {
-        _chainLink = l;
-        _chainFunc = f;
-    }
+  void useParentChain() {
+      if (parent)
+	{
+	  _chainLink = ((IRState *)parent)->_chainLink;
+	  _chainFunc = ((IRState *)parent)->_chainFunc;
+	}
+  }
 
-    void useParentChain()
-    {
-        if (parent)
-        {
-            _chainLink = ((IRState *)parent)->_chainLink;
-            _chainFunc = ((IRState *)parent)->_chainFunc;
-        }
-    }
+  tree chainLink() {
+      return _chainLink;
+  }
 
-    tree chainLink()
-    {
-        return _chainLink;
-    }
-
-    FuncDeclaration * chainFunc()
-    {
-        return _chainFunc;
-    }
+  FuncDeclaration * chainFunc() {
+      return _chainFunc;
+  }
 
 protected:
-    tree getFrameForSymbol(Dsymbol * nested_sym);
-    tree getFrameRef(FuncDeclaration *outer_func);
-    FuncDeclaration * _chainFunc;
-    tree _chainLink;
+  tree getFrameForSymbol(Dsymbol * nested_sym);
+  tree getFrameRef(FuncDeclaration *outer_func);
+  FuncDeclaration * _chainFunc;
+  tree _chainLink;
 
 public:
-    void buildChain(FuncDeclaration * func);
-    static FuncFrameInfo * getFrameInfo(FuncDeclaration *fd);
-    static bool functionNeedsChain(FuncDeclaration *f);
+  void buildChain(FuncDeclaration * func);
+  static FuncFrameInfo * getFrameInfo(FuncDeclaration *fd);
+  static bool functionNeedsChain(FuncDeclaration *f);
 
-    // Check for nested functions/class/structs
-    static bool isClassNestedIn(ClassDeclaration *inner, ClassDeclaration *outer);
-    static bool isFuncNestedIn(FuncDeclaration * inner, FuncDeclaration * outer);
-    static FuncDeclaration * isClassNestedInFunction(ClassDeclaration * cd);
+  // Check for nested functions/class/structs
+  static bool isClassNestedIn(ClassDeclaration *inner, ClassDeclaration *outer);
+  static bool isFuncNestedIn(FuncDeclaration * inner, FuncDeclaration * outer);
+  static FuncDeclaration * isClassNestedInFunction(ClassDeclaration * cd);
 
-    tree getVThis(Dsymbol * decl, Expression * e);
+  tree getVThis(Dsymbol * decl, Expression * e);
 
-    // Static chain for nested functions
-    tree getFrameForFunction(FuncDeclaration * f);
-    tree getFrameForNestedClass(ClassDeclaration * c);
+  // Static chain for nested functions
+  tree getFrameForFunction(FuncDeclaration * f);
+  tree getFrameForNestedClass(ClassDeclaration * c);
 
 #if V2
-    // %% D2.0 - handle structs too
-    static FuncDeclaration * isStructNestedInFunction(StructDeclaration * sd);
-    tree getFrameForNestedStruct(StructDeclaration * s);
+  // %% D2.0 - handle structs too
+  static FuncDeclaration * isStructNestedInFunction(StructDeclaration * sd);
+  tree getFrameForNestedStruct(StructDeclaration * s);
 #endif
 
-    // ** Instruction stream manipulation
-    void startCond(Statement * stmt, tree t_cond);
-    void startCond(Statement * stmt, Expression * e_cond);
-    void startElse();
-    void endCond();
-    void startLoop(Statement * stmt);
-    void continueHere();
-    void setContinueLabel(tree lbl);
-    void exitIfFalse(tree t_cond, bool is_top_cond = 0);
-    void exitIfFalse(Expression * e_cond, bool is_top_cond = 0);
-    void endLoop();
-    void startCase(Statement * stmt, tree t_cond, int has_vars = 0);
-    void doCase(tree t_value, tree t_label);
-    void endCase(tree t_cond);
-    void continueLoop(Identifier * ident);
-    void exitLoop(Identifier * ident);
-    void startTry(Statement * stmt);
-    void startCatches();
-    void startCatch(tree t_type);
-    void endCatch();
-    void endCatches();
-    void startFinally();
-    void endFinally();
-    void doReturn(tree t_value);
-    void doJump(Statement * stmt, tree t_label);
+  // ** Instruction stream manipulation
+  void startCond(Statement * stmt, tree t_cond);
+  void startCond(Statement * stmt, Expression * e_cond);
+  void startElse();
+  void endCond();
+  void startLoop(Statement * stmt);
+  void continueHere();
+  void setContinueLabel(tree lbl);
+  void exitIfFalse(tree t_cond, bool is_top_cond = 0);
+  void exitIfFalse(Expression * e_cond, bool is_top_cond = 0);
+  void endLoop();
+  void startCase(Statement * stmt, tree t_cond, int has_vars = 0);
+  void doCase(tree t_value, tree t_label);
+  void endCase(tree t_cond);
+  void continueLoop(Identifier * ident);
+  void exitLoop(Identifier * ident);
+  void startTry(Statement * stmt);
+  void startCatches();
+  void startCatch(tree t_type);
+  void endCatch();
+  void endCatches();
+  void startFinally();
+  void endFinally();
+  void doReturn(tree t_value);
+  void doJump(Statement * stmt, tree t_label);
 
-    void doExp(tree t);
-    void doExp(Expression * e);
-    void doAsm(tree insn_tmpl, tree outputs, tree inputs, tree clobbers);
+  void doExp(tree t);
+  void doExp(Expression * e);
+  void doAsm(tree insn_tmpl, tree outputs, tree inputs, tree clobbers);
 
-    // ** Goto/Label statement evaluation
-    void pushLabel(LabelDsymbol * l);
-    void checkSwitchCase(Statement * stmt, int default_flag = 0);
-    void checkGoto(Statement * stmt, LabelDsymbol * label);
-    void checkPreviousGoto(Array * refs);
+  // ** Goto/Label statement evaluation
+  void pushLabel(LabelDsymbol * l);
+  void checkSwitchCase(Statement * stmt, int default_flag = 0);
+  void checkGoto(Statement * stmt, LabelDsymbol * label);
+  void checkPreviousGoto(Array * refs);
 };
 
 struct GlobalValues
 {
-    ObjectFile * ofile;
-    IRState    * irs;
-    Module     * mod;
-    ModuleInfo * mi()
-    {
-        return ofile->moduleInfo;
-    }
+  ObjectFile * ofile;
+  IRState    * irs;
+  Module     * mod;
+  ModuleInfo * mi() {
+      return ofile->moduleInfo;
+  }
 };
 
 extern GlobalValues g;
 
 struct WrappedExp : Expression
 {
-    tree exp_node;
-    WrappedExp(Loc loc, enum TOK op, tree exp_node, Type * type);
-    void toCBuffer(OutBuffer *buf);
-    elem *toElem(IRState *irs);
+  tree exp_node;
+  WrappedExp(Loc loc, enum TOK op, tree exp_node, Type * type);
+  void toCBuffer(OutBuffer *buf);
+  elem *toElem(IRState *irs);
 };
 
 struct ListMaker
 {
-    tree head;
-    tree * ptail;
-    ListMaker() : head(NULL_TREE), ptail(& head) { }
-    ListMaker(tree * alt_head) : head(NULL_TREE), ptail(alt_head) { }
+  tree head;
+  tree * ptail;
+  ListMaker() : head(NULL_TREE), ptail(& head) { }
+  ListMaker(tree * alt_head) : head(NULL_TREE), ptail(alt_head) { }
 
-    void chain(tree t)
-    {
-        *ptail = t;
-        ptail = & TREE_CHAIN(t);
-    }
+  void chain(tree t) {
+      *ptail = t;
+      ptail = & TREE_CHAIN(t);
+  }
 
-    void cons(tree p, tree v)
-    {
-        *ptail = tree_cons(p,v,NULL_TREE);
-        ptail = & TREE_CHAIN(*ptail);
-    }
+  void cons(tree p, tree v) {
+      *ptail = tree_cons(p,v,NULL_TREE);
+      ptail = & TREE_CHAIN(*ptail);
+  }
 
-    void cons(tree v)
-    {
-        cons(NULL_TREE, v);
-    }
+  void cons(tree v) {
+      cons(NULL_TREE, v);
+  }
 };
 
 struct CtorEltMaker
 {
-    VEC(constructor_elt,gc) *head;
-    CtorEltMaker() : head(NULL) { }
+  VEC(constructor_elt,gc) *head;
+  CtorEltMaker() : head(NULL) { }
 
-    void reserve(int i)
-    {
-        VEC_reserve(constructor_elt,gc,head,i);
-    }
+  void reserve(int i) {
+      VEC_reserve(constructor_elt,gc,head,i);
+  }
 
-    void cons(tree p, tree v)
-    {
-        constructor_elt * ce;
-        ce = VEC_safe_push(constructor_elt,gc,head,NULL);
-        ce->index = p;
-        ce->value = v;
-    }
+  void cons(tree p, tree v) {
+      constructor_elt * ce;
+      ce = VEC_safe_push(constructor_elt,gc,head,NULL);
+      ce->index = p;
+      ce->value = v;
+  }
 
-    void cons(tree v)
-    {
-        cons(NULL_TREE, v);
-    }
+  void cons(tree v) {
+      cons(NULL_TREE, v);
+  }
 };
 
 class FieldVisitor
 {
 public:
-    AggregateDeclaration * aggDecl;
-    FieldVisitor(AggregateDeclaration * decl) : aggDecl(decl) { }
-    //virtual doField(VarDeclaration * field) = 0;
-    virtual void doFields(VarDeclarations * fields, AggregateDeclaration * agg) = 0;
-    virtual void doInterfaces(BaseClasses * bases, AggregateDeclaration * agg) = 0;
+  AggregateDeclaration * aggDecl;
+  FieldVisitor(AggregateDeclaration * decl) : aggDecl(decl) { }
+  //virtual doField(VarDeclaration * field) = 0;
+  virtual void doFields(VarDeclarations * fields, AggregateDeclaration * agg) = 0;
+  virtual void doInterfaces(BaseClasses * bases, AggregateDeclaration * agg) = 0;
 
-    void go()
-    {
-        visit(aggDecl);
-    }
+  void go() {
+      visit(aggDecl);
+  }
 
-    void visit(AggregateDeclaration * decl);
+  void visit(AggregateDeclaration * decl);
 };
 
 class AggLayout : public FieldVisitor
 {
 public:
-    tree aggType;
-    ListMaker fieldList;
-    AggLayout(AggregateDeclaration * ini_agg_decl, tree ini_agg_type) :
-        FieldVisitor(ini_agg_decl),
-        aggType(ini_agg_type),
-        fieldList(& TYPE_FIELDS(aggType)) { }
-    void doFields(VarDeclarations * fields, AggregateDeclaration * agg);
-    void doInterfaces(BaseClasses * bases, AggregateDeclaration * agg);
-    void addField(tree field_decl, size_t offset);
-    void finish(Expressions * attrs);
+  tree aggType;
+  ListMaker fieldList;
+  AggLayout(AggregateDeclaration * ini_agg_decl, tree ini_agg_type) :
+    FieldVisitor(ini_agg_decl),
+    aggType(ini_agg_type),
+    fieldList(& TYPE_FIELDS(aggType)) { }
+  void doFields(VarDeclarations * fields, AggregateDeclaration * agg);
+  void doInterfaces(BaseClasses * bases, AggregateDeclaration * agg);
+  void addField(tree field_decl, size_t offset);
+  void finish(Expressions * attrs);
 };
 
 class ArrayScope
 {
-    VarDeclaration * v;
-    IRState * irs;
+  VarDeclaration * v;
+  IRState * irs;
 public:
-    ArrayScope(IRState * ini_irs, VarDeclaration * ini_v, const Loc & loc);
-    tree setArrayExp(tree e, Type * t);
-    tree finish(tree e);
+  ArrayScope(IRState * ini_irs, VarDeclaration * ini_v, const Loc & loc);
+  tree setArrayExp(tree e, Type * t);
+  tree finish(tree e);
 };
 
 class AddrOfExpr
 {
 public:
-    tree var;
+  tree var;
 
-    AddrOfExpr()
-    {
-        var = NULL_TREE;
-    }
+  AddrOfExpr() {
+      var = NULL_TREE;
+  }
 
-    tree set(IRState * irs, tree exp)
-    {
-        return irs->addressOf(irs->maybeExprVar(exp, & var));
-    }
+  tree set(IRState * irs, tree exp) {
+      return irs->addressOf(irs->maybeExprVar(exp, & var));
+  }
 
-    tree finish(IRState * irs, tree e2)
-    {
-        return var ? irs->binding(var, e2) : e2;
-    }
+  tree finish(IRState * irs, tree e2) {
+      return var ? irs->binding(var, e2) : e2;
+  }
 };
 
 class CallExpr
 {
 public:
-    tree ce;
-    int argi;
-    CallExpr(tree ce_) : ce(ce_), argi(0) { }
+  tree ce;
+  int argi;
+  CallExpr(tree ce_) : ce(ce_), argi(0) { }
 
-    tree callee()
-    {
-        return CALL_EXPR_FN(ce);
-    }
+  tree callee() {
+      return CALL_EXPR_FN(ce);
+  }
 
-    tree nextArg()
-    {
-        tree result = argi < call_expr_nargs(ce) ?
-            CALL_EXPR_ARG(ce, argi) : NULL_TREE;
-        ++argi;
-        return result;
-    }
+  tree nextArg() {
+      tree result = argi < call_expr_nargs(ce) ?
+	CALL_EXPR_ARG(ce, argi) : NULL_TREE;
+      ++argi;
+      return result;
+  }
 
 private:
-    CallExpr() { }
+  CallExpr() { }
 };
 
 #endif

File d/d-dmd-gcc.h

View file
-/* GDC -- D front-end for GCC
-   Copyright (C) 2004 David Friedman
+// GDC -- D front-end for GCC
+// Copyright (C) 2004 David Friedman
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 /* This file contains declarations used by the modified DMD front-end to
    interact with GCC-specific code. */
 struct Symbol;
 enum RTLSYM
 {
-    RTLSYM_DHIDDENFUNC,
-    N_RTLSYM
+  RTLSYM_DHIDDENFUNC,
+  N_RTLSYM
 };
 extern Symbol* rtlsym[N_RTLSYM];
 #endif

File d/d-gcc-complex_t.h

View file
 
 struct complex_t
 {
-    real_t re;
-    real_t im;
+  real_t re;
+  real_t im;
 
-    complex_t() { this->re = 0; this->im = 0; }
-    complex_t(real_t re) { this->re = re; this->im = 0; }
-    complex_t(real_t re, real_t im) { this->re = re; this->im = im; }
+  complex_t() { this->re = 0; this->im = 0; }
+  complex_t(real_t re) { this->re = re; this->im = 0; }
+  complex_t(real_t re, real_t im) { this->re = re; this->im = im; }
 
-    complex_t operator + (complex_t y) { complex_t r; r.re = re + y.re; r.im = im + y.im; return r; }
-    complex_t operator - (complex_t y) { complex_t r; r.re = re - y.re; r.im = im - y.im; return r; }
-    complex_t operator - () { complex_t r; r.re = -re; r.im = -im; return r; }
-    complex_t operator * (complex_t y) { return complex_t(re * y.re - im * y.im, im * y.re + re * y.im); }
+  complex_t operator + (complex_t y) { complex_t r; r.re = re + y.re; r.im = im + y.im; return r; }
+  complex_t operator - (complex_t y) { complex_t r; r.re = re - y.re; r.im = im - y.im; return r; }
+  complex_t operator - () { complex_t r; r.re = -re; r.im = -im; return r; }
+  complex_t operator * (complex_t y) { return complex_t(re * y.re - im * y.im, im * y.re + re * y.im); }
 
-    complex_t operator / (complex_t y)
-    {
-        real_t abs_y_re = y.re.isNegative() ? -y.re : y.re;
-        real_t abs_y_im = y.im.isNegative() ? -y.im : y.im;
-        real_t r, den;
+  complex_t operator / (complex_t y) {
+      real_t abs_y_re = y.re.isNegative() ? -y.re : y.re;
+      real_t abs_y_im = y.im.isNegative() ? -y.im : y.im;
+      real_t r, den;
 
-        if (abs_y_re < abs_y_im)
-        {
-            r = y.re / y.im;
-            den = y.im + r * y.re;
-            return complex_t((re * r + im) / den,
-                             (im * r - re) / den);
-        }
-        else
-        {
-            r = y.im / y.re;
-            den = y.re + r * y.im;
-            return complex_t((re + r * im) / den,
-                             (im - r * re) / den);
-        }
-    }
+      if (abs_y_re < abs_y_im)
+	{
+	  r = y.re / y.im;
+	  den = y.im + r * y.re;
+	  return complex_t((re * r + im) / den,
+			   (im * r - re) / den);
+	}
+      else
+	{
+	  r = y.im / y.re;
+	  den = y.re + r * y.im;
+	  return complex_t((re + r * im) / den,
+			   (im - r * re) / den);
+	}
+  }
 
-    operator bool () { return !re.isZero() || !im.isZero(); }
+  operator bool () { return !re.isZero() || !im.isZero(); }
 
-    int operator == (complex_t y) { return re == y.re && im == y.im; }
-    int operator != (complex_t y) { return re != y.re || im != y.im; }
+  int operator == (complex_t y) { return re == y.re && im == y.im; }
+  int operator != (complex_t y) { return re != y.re || im != y.im; }
 };
 
 inline complex_t operator * (real_t x, complex_t y) { return complex_t(x) * y; }
 
 inline real_t creall(complex_t x)
 {
-    return x.re;
+  return x.re;
 }
 
 inline real_t cimagl(complex_t x)
 {
-    return x.im;
+  return x.im;
 }
 
 #endif