codeGenNodeSetWith :: (Tag -> Vector SimpleType -> CG IR.Reg) ->
                      NodeSet -> CG IR.Reg
codeGenNodeSetWith cgNodeTy ns = do
  let (tags, argss) = unzip . Map.toList $ ns
  dst <- newReg
  nodeRegs <- zipWithM cgNodeTy tags argss
  forM_ nodeRegs $ \src -> emit IR.Move { srcReg = src, dstReg = dst }
  pure dst

-- Generate a node type from type information,
-- but preserve the first field for tag information.
codeGenNodeSetWith :: (Tag -> Vector SimpleType -> CG IR.Reg) ->
                      NodeSet -> CG IR.Reg
codeGenNodeSetWith cgNodeTy ns = do
  let (tags, argss) = unzip . Map.toList $ ns
  dst <- newReg
  nodeRegs <- zipWithM cgNodeTy tags argss
  forM_ nodeRegs $ \src -> emit IR.Move { srcReg = src, dstReg = dst }
  pure dst

-- Generate a node type from type information,
-- but preserve the first field for tag information.
codeGenNodeSetWith cgNodeTy ns = do
  let (tags, argss) = unzip . Map.toList $ ns
  dst <- newReg
  nodeRegs <- zipWithM cgNodeTy tags argss
  forM_ nodeRegs $ \src -> emit IR.Move { srcReg = src, dstReg = dst }
  pure dst

-- Generate a node type from type information,
-- but preserve the first field for tag information.