diff options
author | Ben.Lippmeier@anu.edu.au <unknown> | 2009-02-15 06:23:21 +0000 |
---|---|---|
committer | Ben.Lippmeier@anu.edu.au <unknown> | 2009-02-15 06:23:21 +0000 |
commit | 20c0e6ccf28b0961d2c5f6516b57e52fa2c13b33 (patch) | |
tree | f3c0afa976874ce7141ba8a7058038efff0db962 /compiler/nativeGen | |
parent | 17839aa386be663260622e5b86980e6fd9bb89a4 (diff) | |
download | haskell-20c0e6ccf28b0961d2c5f6516b57e52fa2c13b33.tar.gz |
NCG: Validate fixes for x86-linux
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r-- | compiler/nativeGen/AsmCodeGen.lhs | 2 | ||||
-rw-r--r-- | compiler/nativeGen/PPC/CodeGen.hs | 7 | ||||
-rw-r--r-- | compiler/nativeGen/X86/Cond.hs | 2 | ||||
-rw-r--r-- | compiler/nativeGen/X86/Instr.hs | 19 | ||||
-rw-r--r-- | compiler/nativeGen/X86/Ppr.hs | 8 | ||||
-rw-r--r-- | compiler/nativeGen/X86/RegInfo.hs | 32 | ||||
-rw-r--r-- | compiler/nativeGen/X86/Regs.hs | 1 |
7 files changed, 39 insertions, 32 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs index 8613a8ed1f..d4fa102591 100644 --- a/compiler/nativeGen/AsmCodeGen.lhs +++ b/compiler/nativeGen/AsmCodeGen.lhs @@ -401,7 +401,7 @@ cmmNativeGen dflags us cmm count #if i386_TARGET_ARCH -x86fp_kludge :: NatCmmTop -> NatCmmTop +x86fp_kludge :: NatCmmTop Instr -> NatCmmTop Instr x86fp_kludge top@(CmmData _ _) = top x86fp_kludge top@(CmmProc info lbl params (ListGraph code)) = CmmProc info lbl params (ListGraph $ i386_insert_ffrees code) diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs index 6661a3ec92..e57d3ca052 100644 --- a/compiler/nativeGen/PPC/CodeGen.hs +++ b/compiler/nativeGen/PPC/CodeGen.hs @@ -55,6 +55,11 @@ import Data.Bits import Data.Int import Data.Word +#if darwin_TARGET_OS || linux_TARGET_OS +import BasicTypes +import FastString +#endif + -- ----------------------------------------------------------------------------- -- Top-level of the instruction selector @@ -1053,7 +1058,7 @@ genCCall target dest_regs argsAndHints do dflags <- getDynFlagsNat mopExpr <- cmmMakeDynamicReference dflags addImportNat CallReference $ - mkForeignLabel functionName Nothing True + mkForeignLabel functionName Nothing True IsFunction let mopLabelOrExpr = case mopExpr of CmmLit (CmmLabel lbl) -> Left lbl _ -> Right mopExpr diff --git a/compiler/nativeGen/X86/Cond.hs b/compiler/nativeGen/X86/Cond.hs index 60e40b9654..4907059ae7 100644 --- a/compiler/nativeGen/X86/Cond.hs +++ b/compiler/nativeGen/X86/Cond.hs @@ -26,7 +26,7 @@ data Cond | OFLO | PARITY | NOTPARITY - + deriving Eq condUnsigned :: Cond -> Bool condUnsigned GU = True diff --git a/compiler/nativeGen/X86/Instr.hs b/compiler/nativeGen/X86/Instr.hs index b4b6fb5f4b..26da90778c 100644 --- a/compiler/nativeGen/X86/Instr.hs +++ b/compiler/nativeGen/X86/Instr.hs @@ -23,6 +23,8 @@ import BlockId import Cmm import FastString import FastBool +import Outputable +import Constants (rESERVED_C_STACK_BYTES) import CLabel import Panic @@ -655,6 +657,23 @@ x86_mkLoadInstr _ _ _ = panic "X86.RegInfo.mkLoadInstr: not defined for this architecture." #endif +spillSlotSize :: Int +spillSlotSize = IF_ARCH_i386(12, 8) + +maxSpillSlots :: Int +maxSpillSlots = ((rESERVED_C_STACK_BYTES - 64) `div` spillSlotSize) - 1 + +-- convert a spill slot number to a *byte* offset, with no sign: +-- decide on a per arch basis whether you are spilling above or below +-- the C stack pointer. +spillSlotToOffset :: Int -> Int +spillSlotToOffset slot + | slot >= 0 && slot < maxSpillSlots + = 64 + spillSlotSize * slot + | otherwise + = pprPanic "spillSlotToOffset:" + ( text "invalid spill location: " <> int slot + $$ text "maxSpillSlots: " <> int maxSpillSlots) -------------------------------------------------------------------------------- diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 3f181fc056..ffd839a608 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -379,7 +379,7 @@ pprSectionHeader seg RelocatableReadOnlyData -> ptext (sLit ".const_data\n.align 2") UninitialisedData -> ptext (sLit ".data\n\t.align 2") ReadOnlyData16 -> ptext (sLit ".const\n.align 4") - OtherSection sec -> panic "X86.Ppr.pprSectionHeader: unknown section" + OtherSection _ -> panic "X86.Ppr.pprSectionHeader: unknown section" # else pprSectionHeader seg @@ -390,7 +390,7 @@ pprSectionHeader seg RelocatableReadOnlyData -> ptext (sLit ".section .data\n\t.align 4") UninitialisedData -> ptext (sLit ".section .bss\n\t.align 4") ReadOnlyData16 -> ptext (sLit ".section .rodata\n\t.align 16") - OtherSection sec -> panic "X86.Ppr.pprSectionHeader: unknown section" + OtherSection _ -> panic "X86.Ppr.pprSectionHeader: unknown section" # endif @@ -404,7 +404,7 @@ pprSectionHeader seg RelocatableReadOnlyData -> ptext (sLit ".const_data\n.align 3") UninitialisedData -> ptext (sLit ".data\n\t.align 3") ReadOnlyData16 -> ptext (sLit ".const\n.align 4") - OtherSection sec -> panic "PprMach.pprSectionHeader: unknown section" + OtherSection _ -> panic "PprMach.pprSectionHeader: unknown section" # else pprSectionHeader seg @@ -415,7 +415,7 @@ pprSectionHeader seg RelocatableReadOnlyData -> ptext (sLit ".section .data\n\t.align 8") UninitialisedData -> ptext (sLit ".section .bss\n\t.align 8") ReadOnlyData16 -> ptext (sLit ".section .rodata.cst16\n\t.align 16") - OtherSection sec -> panic "PprMach.pprSectionHeader: unknown section" + OtherSection _ -> panic "PprMach.pprSectionHeader: unknown section" # endif diff --git a/compiler/nativeGen/X86/RegInfo.hs b/compiler/nativeGen/X86/RegInfo.hs index 58d063bd88..a3bf8e4655 100644 --- a/compiler/nativeGen/X86/RegInfo.hs +++ b/compiler/nativeGen/X86/RegInfo.hs @@ -5,10 +5,6 @@ module X86.RegInfo ( JumpDest, canShortcut, shortcutJump, - - spillSlotSize, - maxSpillSlots, - spillSlotToOffset, shortcutStatic, regDotColor @@ -29,9 +25,13 @@ import Cmm import CLabel import BlockId import Outputable -import Constants ( rESERVED_C_STACK_BYTES ) import Unique +#if i386_TARGET_ARCH || x86_64_TARGET_ARCH +import UniqFM +#endif + + mkVReg :: Unique -> Size -> Reg mkVReg u size | not (isFloatSize size) = VirtualRegI u @@ -61,26 +61,6 @@ shortcutJump fn insn@(JXX cc id) = shortcutJump _ other = other - -spillSlotSize :: Int -spillSlotSize = IF_ARCH_i386(12, 8) - -maxSpillSlots :: Int -maxSpillSlots = ((rESERVED_C_STACK_BYTES - 64) `div` spillSlotSize) - 1 - --- convert a spill slot number to a *byte* offset, with no sign: --- decide on a per arch basis whether you are spilling above or below --- the C stack pointer. -spillSlotToOffset :: Int -> Int -spillSlotToOffset slot - | slot >= 0 && slot < maxSpillSlots - = 64 + spillSlotSize * slot - | otherwise - = pprPanic "spillSlotToOffset:" - ( text "invalid spill location: " <> int slot - $$ text "maxSpillSlots: " <> int maxSpillSlots) - - -- Here because it knows about JumpDest shortcutStatic :: (BlockId -> Maybe JumpDest) -> CmmStatic -> CmmStatic shortcutStatic fn (CmmStaticLit (CmmLabel lab)) @@ -116,6 +96,7 @@ regDotColor reg = let Just str = lookupUFM regColors reg in text str +regColors :: UniqFM [Char] regColors = listToUFM $ [ (eax, "#00ff00") @@ -138,6 +119,7 @@ regDotColor reg = let Just str = lookupUFM regColors reg in text str +regColors :: UniqFM [Char] regColors = listToUFM $ [ (rax, "#00ff00"), (eax, "#00ff00") diff --git a/compiler/nativeGen/X86/Regs.hs b/compiler/nativeGen/X86/Regs.hs index 87564b860c..5db3ab1fa6 100644 --- a/compiler/nativeGen/X86/Regs.hs +++ b/compiler/nativeGen/X86/Regs.hs @@ -66,6 +66,7 @@ import FastBool #if defined(i386_TARGET_ARCH) || defined(x86_64_TARGET_ARCH) import Constants +import Outputable (ppr, pprPanic) #endif |