Changes between Version 39 and Version 40 of Commentary/CodingStyle


Ignore:
Timestamp:
Aug 3, 2011 11:55:14 PM (4 years ago)
Author:
dterei
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/CodingStyle

    v39 v40  
    216216=== Platform tests ===
    217217
    218 Please read [wiki:CrossCompilation this wiki page] on cross compilation for a better understanding of the situation here. There are three platforms of interest to GHC when compiling and running:
    219  
    220  * The '''Build''' platform. This is the platform on which we are building GHC.
    221  * The '''Host''' platform. This is the platform on which we are going to run this GHC binary, and associated tools.
    222  * The '''Target''' platform. This is the platform for which this GHC binary will generate code.
    223 
    224 At the moment, there is limited support for having different values for build, host, and target. Please refer to the [wiki:CrossCompilation cross compilation] page for more details.
    225 
    226 In the compiler's source code, you may make use of the following CPP symbols:
    227 
    228  * ''xxx''`_TARGET_ARCH`
    229  * ''xxx''`_TARGET_VENDOR`
    230  * ''xxx''`_TARGET_OS`
    231  * ''xxx''`_HOST_ARCH`
    232  * ''xxx''`_HOST_VENDOR`
    233  * ''xxx''`_HOST_OS`
    234 
    235 where ''xxx'' is the appropriate value: eg. `i386_TARGET_ARCH`. However GHC is moving away from using CPP for this purpose in many cases due to the problems it creates with supporting cross compilation. So instead it the new plan is to always build GHC as a cross compiler and select the appropriate values and backend code generator to run and runtime. For this purpose there is the Platform module ([[GhcFile(compiler/utils/Platform.hs)]]). That contains various methods for querying the !DynFlags ([[GhcFile(compiler/main/DynFlags.hs)]]) value for what platform GHC is currently compiling for. You should use these when appropriate over the CPP methods.
     218Please refer to [wiki:Commentary/PlatformNaming Platforms and Conventions] wiki page for an overview of how to handle target specific code in GHC.