X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FnativeGen%2FPositionIndependentCode.hs;h=a1e11d8a34250d6f1ea288a065ea3c9894d026cc;hp=0473d91da206cff32b84f8c901ebb7943402c192;hb=232e72122fa7f08690e3be2bb9f8a7f8024e37d5;hpb=78bbce57e04a29541b7343f0b188a20cef956187 diff --git a/compiler/nativeGen/PositionIndependentCode.hs b/compiler/nativeGen/PositionIndependentCode.hs index 0473d91..a1e11d8 100644 --- a/compiler/nativeGen/PositionIndependentCode.hs +++ b/compiler/nativeGen/PositionIndependentCode.hs @@ -56,7 +56,6 @@ module PositionIndependentCode ( #include "nativeGen/NCG.h" import Cmm -import MachOp ( MachOp(MO_Add), wordRep, MachRep(..) ) import CLabel ( CLabel, pprCLabel, mkDynamicLinkerLabel, DynamicLinkerLabelInfo(..), dynamicLinkerLabelInfo, mkPicBaseLabel, @@ -66,11 +65,12 @@ import CLabel ( CLabel, pprCLabel, import CLabel ( mkForeignLabel ) #endif -import MachRegs -import MachInstrs +import Regs +import Instrs import NCGMonad ( NatM, getNewRegNat, getNewLabelNat ) import StaticFlags ( opt_PIC, opt_Static ) +import BasicTypes import Pretty import qualified Outputable @@ -118,7 +118,7 @@ cmmMakeDynamicReference dflags addImport referenceKind lbl AccessViaSymbolPtr -> do let symbolPtr = mkDynamicLinkerLabel SymbolPtr lbl addImport symbolPtr - return $ CmmLoad (cmmMakePicReference symbolPtr) wordRep + return $ CmmLoad (cmmMakePicReference symbolPtr) bWord AccessDirectly -> case referenceKind of -- for data, we might have to make some calculations: DataReference -> return $ cmmMakePicReference lbl @@ -142,7 +142,7 @@ cmmMakePicReference :: CLabel -> CmmExpr -- everything gets relocated at runtime cmmMakePicReference lbl - | (opt_PIC || not opt_Static) && absoluteLabel lbl = CmmMachOp (MO_Add wordRep) [ + | (opt_PIC || not opt_Static) && absoluteLabel lbl = CmmMachOp (MO_Add wordWidth) [ CmmReg (CmmGlobal PicBaseReg), CmmLit $ picRelative lbl ] @@ -526,7 +526,7 @@ needImportedSymbols = not opt_Static && not opt_PIC -- The label used to refer to our "fake GOT" from -- position-independent code. gotLabel = mkForeignLabel -- HACK: it's not really foreign - (fsLit ".LCTOC1") Nothing False + (fsLit ".LCTOC1") Nothing False IsData -- pprGotDeclaration -- Output whatever needs to be output once per .s file. @@ -552,12 +552,12 @@ pprImportedSymbol importedLbl ptext symbolSize <+> pprCLabel_asm lbl ] --- PLT code stubs are generated automatically be the dynamic linker. +-- PLT code stubs are generated automatically by the dynamic linker. | otherwise = empty where - symbolSize = case wordRep of - I32 -> sLit "\t.long" - I64 -> sLit "\t.quad" + symbolSize = case wordWidth of + W32 -> sLit "\t.long" + W64 -> sLit "\t.quad" _ -> panic "Unknown wordRep in pprImportedSymbol" #else @@ -616,7 +616,7 @@ initializePicBase picReg (CmmProc info lab params (ListGraph blocks) : statics) = do gotOffLabel <- getNewLabelNat - tmp <- getNewRegNat wordRep + tmp <- getNewRegNat $ intSize wordWidth let gotOffset = CmmData Text [ CmmDataLabel gotOffLabel, @@ -628,7 +628,7 @@ initializePicBase picReg (ImmCLbl mkPicBaseLabel) BasicBlock bID insns = head blocks b' = BasicBlock bID (FETCHPC picReg - : LD wordRep tmp + : LD wordSize tmp (AddrRegImm picReg offsetToOffset) : ADD picReg picReg (RIReg tmp) : insns)