X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FPositionIndependentCode.hs;h=edb884677f764605f86119a2f73e2f9c37b05fc2;hb=7fbdd9e0bccec89c958e2a1e36d5ec058fc69a3d;hp=3f32c38e5281a691cffcf1c4ededad7dc89b32ad;hpb=e8a512cc8142e7589d6a29ccb4bade021d94d44e;p=ghc-hetmet.git diff --git a/compiler/nativeGen/PositionIndependentCode.hs b/compiler/nativeGen/PositionIndependentCode.hs index 3f32c38..edb8846 100644 --- a/compiler/nativeGen/PositionIndependentCode.hs +++ b/compiler/nativeGen/PositionIndependentCode.hs @@ -14,6 +14,8 @@ module PositionIndependentCode ( initializePicBase ) where +#include "HsVersions.h" + {- This module handles generation of position independent code and dynamic-linking related issues for the native code generator. @@ -54,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, @@ -116,7 +117,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 @@ -140,7 +141,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 ] @@ -550,12 +551,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 @@ -614,7 +615,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, @@ -626,7 +627,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)