allocFor :: Name -> GenState () 
allocFor n1 = 
    do 
      mstate <- get
      let nt = mm mstate
          table = ct mstate
          (smem,gmem) = (shared mstate,global mstate)
          --(smem',gmem') = freeDead' smem gmem table nt prev_names ns 
          (smem',gmem',addr) = 
              case typeof n1 table of
                Global_Array _ -> 
                    let (m,a) = allocate gmem (bytes n1 table)
                    in  (smem,m,a)
                Shared_Array _ -> 
                    let (m,a) = allocate smem (bytes n1 table)
                    in  (m,gmem,a)
                Constant_Array _ -> 
                    error "Impossible to allocate constant arrays"
          nt' = Map.insert n1 (addr,typeof n1 table) nt
      put (mstate {shared = smem',global = gmem',mm = nt'})



-- -----------------------------------------------------------------------------
allocFor :: Name -> GenState ()
allocFor n1 = 
    do 
      mstate <- get
      let nt = mm mstate
          table = ct mstate
          (smem,gmem) = (shared mstate,global mstate)
          --(smem',gmem') = freeDead' smem gmem table nt prev_names ns 
          (smem',gmem',addr) = 
              case typeof n1 table of
                Global_Array _ -> 
                    let (m,a) = allocate gmem (bytes n1 table)
                    in  (smem,m,a)
                Shared_Array _ -> 
                    let (m,a) = allocate smem (bytes n1 table)
                    in  (m,gmem,a)
                Constant_Array _ -> 
                    error "Impossible to allocate constant arrays"
          nt' = Map.insert n1 (addr,typeof n1 table) nt
      put (mstate {shared = smem',global = gmem',mm = nt'})



-- -----------------------------------------------------------------------------
allocFor n1 = 
    do 
      mstate <- get
      let nt = mm mstate
          table = ct mstate
          (smem,gmem) = (shared mstate,global mstate)
          --(smem',gmem') = freeDead' smem gmem table nt prev_names ns 
          (smem',gmem',addr) = 
              case typeof n1 table of
                Global_Array _ -> 
                    let (m,a) = allocate gmem (bytes n1 table)
                    in  (smem,m,a)
                Shared_Array _ -> 
                    let (m,a) = allocate smem (bytes n1 table)
                    in  (m,gmem,a)
                Constant_Array _ -> 
                    error "Impossible to allocate constant arrays"
          nt' = Map.insert n1 (addr,typeof n1 table) nt
      put (mstate {shared = smem',global = gmem',mm = nt'})



-- -----------------------------------------------------------------------------