[project @ 2005-11-24 16:51:18 by simonmar]
[ghc-hetmet.git] / ghc / compiler / nativeGen / MachInstrs.hs
index 40d1766..0f718d3 100644 (file)
@@ -41,6 +41,7 @@ import CLabel           ( CLabel, pprCLabel )
 import Panic           ( panic )
 import Outputable
 import FastString
+import Constants       ( wORD_SIZE )
 
 import GLAEXTS
 
@@ -85,6 +86,8 @@ data Cond
   | POS
   | CARRY
   | OFLO
+  | PARITY
+  | NOTPARITY
 #endif
 #if sparc_TARGET_ARCH
   = ALWAYS     -- What's really used? ToDo
@@ -502,17 +505,22 @@ bit or 64 bit precision.
        | JMP         Operand
        | JXX         Cond BlockId  -- includes unconditional branches
        | JMP_TBL     Operand [BlockId]  -- table jump
-       | CALL        (Either Imm Reg)
+       | CALL        (Either Imm Reg) [Reg]
 
 -- Other things.
        | CLTD MachRep   -- sign extend %eax into %edx:%eax
 
-       | FETCHGOT    Reg  -- pseudo-insn for position-independent code
+       | FETCHGOT    Reg  -- pseudo-insn for ELF position-independent code
                            -- pretty-prints as
                            --       call 1f
                            -- 1:    popl %reg
                            --       addl __GLOBAL_OFFSET_TABLE__+.-1b, %reg
-                    
+       | FETCHPC     Reg  -- pseudo-insn for Darwin position-independent code
+                           -- pretty-prints as
+                           --       call 1f
+                           -- 1:    popl %reg
+
+
 data Operand
   = OpReg  Reg         -- register
   | OpImm  Imm         -- immediate value
@@ -530,9 +538,9 @@ i386_insert_ffrees insns
 
 ffree_before_nonlocal_transfers insn
    = case insn of
-        CALL _  -> [GFREE, insn]
-        JMP _   -> [GFREE, insn]
-        other   -> [insn]
+        CALL _ _ -> [GFREE, insn]
+        JMP _    -> [GFREE, insn]
+        other    -> [insn]
 
 
 -- if you ever add a new FP insn to the fake x86 FP insn set,
@@ -604,12 +612,9 @@ is_G_instr instr
              | BI            Cond Bool Imm -- cond, annul?, target
              | BF            Cond Bool Imm -- cond, annul?, target
 
-             | JMP           DestInfo AddrMode      -- target
+             | JMP           AddrMode     -- target
              | CALL          (Either Imm Reg) Int Bool -- target, args, terminal
 
-data RI = RIReg Reg
-       | RIImm Imm
-
 riZero :: RI -> Bool
 
 riZero (RIImm (ImmInt 0))          = True
@@ -622,12 +627,12 @@ riZero _                      = False
 -- alas -- can't have fpRelEA here because of module dependencies.
 fpRelEA :: Int -> Reg -> Instr
 fpRelEA n dst
-   = ADD False False fp (RIImm (ImmInt (n * BYTES_PER_WORD))) dst
+   = ADD False False fp (RIImm (ImmInt (n * wORD_SIZE))) dst
 
 -- Code to shift the stack pointer by n words.
 moveSp :: Int -> Instr
 moveSp n
-   = ADD False False sp (RIImm (ImmInt (n * BYTES_PER_WORD))) sp
+   = ADD False False sp (RIImm (ImmInt (n * wORD_SIZE))) sp
 
 -- Produce the second-half-of-a-double register given the first half.
 fPair :: Reg -> Reg