Skip to content

Commit

Permalink
move things around, SoA value for locvar
Browse files Browse the repository at this point in the history
  • Loading branch information
vidsinghal committed Dec 2, 2024
1 parent 376c54e commit 43f07a9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
28 changes: 12 additions & 16 deletions gibbon-compiler/src/Gibbon/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
module Gibbon.Common
(
-- * Variables
Var(..), LocVar(..), Location, FieldIndex
Var(..), LocVar(..), Location, FieldIndex, DataCon
, RegVar, fromVar, toVar, varAppend, toEndV, toEndVLoc, toSeqV, cleanFunName
, TyVar(..), isUserTv
, Symbol, intern, unintern
Expand Down Expand Up @@ -66,7 +66,6 @@ import System.IO.Unsafe ( unsafePerformIO )
import System.Random ( randomIO )
import Debug.Trace
import Language.C.Quote.CUDA (ToIdent, toIdent)

import Gibbon.DynFlags

--------------------------------------------------------------------------------
Expand Down Expand Up @@ -138,21 +137,18 @@ toSeqV v = varAppend v (toVar "_seq")

-- | A location variable stores the abstract location.
type Location = Var
-- | Index position of the filed in the data constructor.
-- | The position or index of a field in a data constructor value.
type FieldIndex = Int
-- | Location of the buffer where all the data constructor tags are stored.
type DataConBuf = Location
-- | Store the name of the data constructor as a String.
type DataConName = String
-- | Store the location of the buffer with the factored out fields.
-- | Stores extra meta data like data constructor to which it comes from and the index position.
type FieldBuf = ((DataConName, FieldIndex), Location)
-- | List of field locations for a datatype
type FieldLocs = [FieldBuf]
-- | A data type that stores either a single location, AoS
-- | or a SoA representation: A data constructor buffer in addition to location for fields.
-- | LocVar can also be a pointer.
data LocVar = Single Location | SoA DataConBuf FieldLocs
-- | A data constructor is a String type in the compiler
type DataCon = String

-- | Single: For storing a single location, useful for adding a cursor in a region.
-- | SoA: A location signature for a structure of arrays representation.
-- The first location points to a location in the data constructor buffer.
-- The list includes locations for each field and a tuple storing
-- information about which data constructor and corresponding index the field
-- comes from.
data LocVar = Single Location | SoA Location [((DataCon, FieldIndex), Location)]
deriving (Show, Ord, Eq, Read, Generic, NFData, Out)

-- | Abstract region variables.
Expand Down
2 changes: 1 addition & 1 deletion gibbon-compiler/src/Gibbon/L4/Syntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ type Label = Var
type SymTable = M.Map Word16 String

type InfoTable = (M.Map L.TyCon TyConInfo)
type TyConInfo = M.Map L.DataCon DataConInfo
type TyConInfo = M.Map DataCon DataConInfo

data DataConInfo = DataConInfo
{ dcon_tag :: Tag
Expand Down
3 changes: 1 addition & 2 deletions gibbon-compiler/src/Gibbon/Language/Syntax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
module Gibbon.Language.Syntax
(
-- * Datatype definitions
DDefs, DataCon, TyCon, Tag, IsBoxed, DDef(..)
DDefs, TyCon, Tag, IsBoxed, DDef(..)
, lookupDDef, getConOrdering, getTyOfDataCon, lookupDataCon, lkp
, lookupDataCon', insertDD, emptyDD, fromListDD, isVoidDDef

Expand Down Expand Up @@ -78,7 +78,6 @@ import Gibbon.Common

type DDefs a = M.Map Var (DDef a)

type DataCon = String
type TyCon = String
type Tag = Word8

Expand Down

0 comments on commit 43f07a9

Please sign in to comment.