pileState [Inst]
      compile' irs = concat <$> zipWithM compileIR irs (map concat $ tails $ map IR.varRefs irs)
          
      compileIR :: IR.IR -> [Var] -> State CompileState [Inst]
      compileIR ir livingVars =
          case ir of
            IR.If var csq alt ->
                do co
definePtr ptr@(Var v) = do
  defd <- alreadyDefinedPtr ptr
  when defd (error $ "already defined ptr: " ++ v)
  reg <- use (frame.ptrRest) <&> head
  frame.ptrVars %= ((ptr, reg) :)
  frame.ptrRest %= tail
  return $ reg

-- releaseVar var@(Var v) = do
--  frame.intVars %= filter ((v ==) . fst)
definePtr ptr@(Var v) = do
  defd <- alreadyDefinedPtr ptr
  when defd (error $ "already defined ptr: " ++ v)
  reg <- use (frame.ptrRest) <&> head
  frame.ptrVars %= ((ptr, reg) :)
  frame.ptrRest %= tail
  return $ reg

-- releaseVar var@(Var v) = do
--  frame.intVars %= filter ((v ==) . fst)