summaryrefslogtreecommitdiff
path: root/codegen.hs
diff options
context:
space:
mode:
Diffstat (limited to 'codegen.hs')
-rw-r--r--codegen.hs10
1 files changed, 2 insertions, 8 deletions
diff --git a/codegen.hs b/codegen.hs
index cda6239..59adb0b 100644
--- a/codegen.hs
+++ b/codegen.hs
@@ -114,12 +114,12 @@ variableStoreOperand :: Name -> CGMonad A.Operand
variableStoreOperand name = get >>= (maybe getGlobal getLocal . Map.lookup name . variables)
where
getLocal :: (Type, LLName) -> CGMonad A.Operand
- getLocal (t, nm) = return $ A.LocalReference (toLLVMType t) (A.Name nm)
+ getLocal (t, nm) = return $ A.LocalReference (A.ptr (toLLVMType t)) (A.Name nm)
getGlobal :: CGMonad A.Operand
getGlobal = do
(t, nm) <- lookupGlobalVar name
- return $ A.ConstantOperand $ A.C.GlobalReference (toLLVMType t) (A.Name nm)
+ return $ A.ConstantOperand $ A.C.GlobalReference (A.ptr (toLLVMType t)) (A.Name nm)
variableOperand :: Name -> CGMonad A.Operand
variableOperand name = get >>= (maybe getGlobal getLocal . Map.lookup name . variables)
@@ -258,12 +258,6 @@ genSingle _ _ = undefined
genExpression :: Expression -> CGMonad A.Operand
genExpression (ExLit lit (Just t)) = literalToOperand lit t
--- genExpression (ExLit (LitInt i) (Just t@(TypeInt sz))) = do
--- aname <- getNewName "t"
--- void $ addNamedInstr $ A.Name aname A.:= A.Alloca (toLLVMType t) Nothing 0 []
--- void $ addInstr $ A.Store False (A.LocalReference (toLLVMType t) (A.Name aname))
--- (A.ConstantOperand (A.C.Int (fromIntegral sz) i)) Nothing 0 []
--- return aname
genExpression (ExBinOp bo e1 e2 (Just t)) = do
e1op <- genExprArgument e1
e2op <- genExprArgument e2