• Andreas Klebinger's avatar
    Give Uniq[D]FM a phantom type for its key. · c4de6a7a
    Andreas Klebinger authored
    This fixes #17667 and should help to avoid such issues going forward.
    
    The changes are mostly mechanical in nature. With two notable
    exceptions.
    
    * The register allocator.
    
      The register allocator references registers by distinct uniques.
      However they come from the types of VirtualReg, Reg or Unique in
      various places. As a result we sometimes cast the key type of the
      map and use functions which operate on the now typed map but take
      a raw Unique as actual key. The logic itself has not changed it
      just becomes obvious where we do so now.
    
    * <Type>Env Modules.
    
    As an example a ClassEnv is currently queried using the types `Class`,
    `Name`, and `TyCon`. This is safe since for a distinct class value all
    these expressions give the same unique.
    
        getUnique cls
        getUnique (classTyCon cls)
        getUnique (className cls)
        getUnique (tcName $ classTyCon cls)
    
    This is for the most part contained within the modules defining the
    interface. However it requires ...
    c4de6a7a
SpillCost.hs 11 KB