summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Pedro Magalhaes <jpm@cs.uu.nl>2011-05-04 13:11:16 +0200
committerJose Pedro Magalhaes <jpm@cs.uu.nl>2011-05-04 13:11:16 +0200
commit91a75b9af1015b053e6904f4ff7bf36c5b1e0ad1 (patch)
tree305ced403a68d8d1814deb0f752654e77f03f91d
parentada48bbc7f6a43b2c042df629327902d82cea681 (diff)
parentac51be0997c4d0cf65cb3635b936ddf011e372bd (diff)
downloadhaskell-91a75b9af1015b053e6904f4ff7bf36c5b1e0ad1.tar.gz
Merge branch 'master' of http://darcs.haskell.org/ghc into ghc-generics
-rw-r--r--compiler/nativeGen/AsmCodeGen.lhs38
-rw-r--r--compiler/nativeGen/X86/Instr.hs2
-rw-r--r--compiler/nativeGen/X86/Regs.hs22
-rw-r--r--mk/build.mk.sample9
4 files changed, 41 insertions, 30 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs
index 06e6d6d4a0..27858dc847 100644
--- a/compiler/nativeGen/AsmCodeGen.lhs
+++ b/compiler/nativeGen/AsmCodeGen.lhs
@@ -372,10 +372,25 @@ cmmNativeGen dflags us cmm count
, Nothing
, mPprStats)
- ---- generate jump tables
+ ---- x86fp_kludge. This pass inserts ffree instructions to clear
+ ---- the FPU stack on x86. The x86 ABI requires that the FPU stack
+ ---- is clear, and library functions can return odd results if it
+ ---- isn't.
+ ----
+ ---- NB. must happen before shortcutBranches, because that
+ ---- generates JXX_GBLs which we can't fix up in x86fp_kludge.
+ let kludged =
+#if i386_TARGET_ARCH
+ {-# SCC "x86fp_kludge" #-}
+ map x86fp_kludge alloced
+#else
+ alloced
+#endif
+
+ ---- generate jump tables
let tabled =
{-# SCC "generateJumpTables" #-}
- alloced ++ generateJumpTables alloced
+ generateJumpTables kludged
---- shortcut branches
let shorted =
@@ -387,27 +402,18 @@ cmmNativeGen dflags us cmm count
{-# SCC "sequenceBlocks" #-}
map sequenceTop shorted
- ---- x86fp_kludge
- let kludged =
-#if i386_TARGET_ARCH
- {-# SCC "x86fp_kludge" #-}
- map x86fp_kludge sequenced
-#else
- sequenced
-#endif
-
- ---- expansion of SPARC synthetic instrs
+ ---- expansion of SPARC synthetic instrs
#if sparc_TARGET_ARCH
let expanded =
{-# SCC "sparc_expand" #-}
- map expandTop kludged
+ map expandTop sequenced
dumpIfSet_dyn dflags
Opt_D_dump_asm_expanded "Synthetic instructions expanded"
(vcat $ map (docToSDoc . pprNatCmmTop) expanded)
#else
let expanded =
- kludged
+ sequenced
#endif
return ( usAlloc
@@ -615,8 +621,8 @@ makeFarBranches = id
generateJumpTables
:: [NatCmmTop Instr] -> [NatCmmTop Instr]
generateJumpTables xs = concatMap f xs
- where f (CmmProc _ _ (ListGraph xs)) = concatMap g xs
- f _ = []
+ where f p@(CmmProc _ _ (ListGraph xs)) = p : concatMap g xs
+ f p = [p]
g (BasicBlock _ xs) = catMaybes (map generateJumpTableForInstr xs)
-- -----------------------------------------------------------------------------
diff --git a/compiler/nativeGen/X86/Instr.hs b/compiler/nativeGen/X86/Instr.hs
index e934a6d4ef..92655d1693 100644
--- a/compiler/nativeGen/X86/Instr.hs
+++ b/compiler/nativeGen/X86/Instr.hs
@@ -746,7 +746,7 @@ i386_insert_ffrees blocks
where p insn r = case insn of
CALL _ _ -> GFREE : insn : r
JMP _ -> GFREE : insn : r
- JXX_GBL _ _ -> GFREE : insn : r
+ JXX_GBL _ _ -> panic "i386_insert_ffrees: cannot handle JXX_GBL"
_ -> insn : r
-- if you ever add a new FP insn to the fake x86 FP insn set,
diff --git a/compiler/nativeGen/X86/Regs.hs b/compiler/nativeGen/X86/Regs.hs
index dc0df49874..28d148c12c 100644
--- a/compiler/nativeGen/X86/Regs.hs
+++ b/compiler/nativeGen/X86/Regs.hs
@@ -332,10 +332,24 @@ fake5 = regSingle 21
{-
AMD x86_64 architecture:
-- Registers 0-16 have 32-bit counterparts (eax, ebx etc.)
-- Registers 0-7 have 16-bit counterparts (ax, bx etc.)
-- Registers 0-3 have 8 bit counterparts (ah, bh etc.)
-
+- All 16 integer registers are addressable as 8, 16, 32 and 64-bit values:
+
+ 8 16 32 64
+ ---------------------
+ al ax eax rax
+ bl bx ebx rbx
+ cl cx ecx rcx
+ dl dx edx rdx
+ sil si esi rsi
+ dil si edi rdi
+ bpl bp ebp rbp
+ spl sp esp rsp
+ r10b r10w r10d r10
+ r11b r11w r11d r11
+ r12b r12w r12d r12
+ r13b r13w r13d r13
+ r14b r14w r14d r14
+ r15b r15w r15d r15
-}
rax, rbx, rcx, rdx, rsp, rbp, rsi, rdi,
diff --git a/mk/build.mk.sample b/mk/build.mk.sample
index a7764e2e46..216ca66c1b 100644
--- a/mk/build.mk.sample
+++ b/mk/build.mk.sample
@@ -136,15 +136,6 @@ endif
# -----------------------------------------------------------------------------
# Other settings that might be useful
-# profiled RTS
-#GhcRtsCcOpts = -pg -g
-
-# Optimised/profiled RTS
-#GhcRtsCcOpts = -O2 -pg
-
-#GhcRtsWithFrontPanel = YES
-#SRC_HC_OPTS += `gtk-config --libs`
-
# NoFib settings
NoFibWays =
STRIP_CMD = :