1module IRTS.CodegenC (codegenC) where
7import IRTS.CodegenCommon
16import System.Directory
17import System.FilePath ((</>), (<.>))
20codegenC :: [(Name, SDecl)] ->
21 String -> -- output file name
22 OutputType -> -- generate executable if True, only .o if False
23 [FilePath] -> -- include files
24 String -> -- extra object files
25 String -> -- extra compiler flags
28codegenC defs out exec incs objs libs dbg
30 let bc = map toBC defs
31 let h = concatMap toDecl (map fst bc)
32 let cc = concatMap (uncurry toC) bc
34 mprog <- readFile (d </> "rts" </> "idris_main" <.> "c")
35 let cout = headers incs ++ debug dbg ++ h ++ cc ++
36 (if (exec == Executable) then mprog else "")
38 Raw -> writeFile out cout
40 (tmpn, tmph) <- tempfile
46 libFlags <- getLibFlags
47 incFlags <- getIncFlags
48 let gcc = comp ++ " " ++
50 " -I. " ++ objs ++ " -x c " ++
51 (if (exec == Executable) then "" else " -c ") ++
59 when (exit /= ExitSuccess) $
60 putStrLn ("FAILURE: " ++ gcc)
64 (\h -> "#include <" ++ h ++ ">\n")
65 (xs ++ ["idris_rts.h", "idris_stdfgn.h", "gmp.h", "assert.h"])
67debug TRACE = "#define IDRIS_TRACE\n\n"
74cname :: Name -> String
75cname n = "_idris_" ++ concatMap cchar (show n)
76 where cchar x | isAlpha x || isDigit x = [x]
77 | otherwise = "_" ++ show (fromEnum x) ++ "_"
79indent :: Int -> String
80indent n = replicate (n*4) ' '
83creg (L i) = "LOC(" ++ show i ++ ")"
84creg (T i) = "TOP(" ++ show i ++ ")"
87toDecl :: Name -> String
88toDecl f = "void " ++ cname f ++ "(VM*, VAL*);\n"
90toC :: Name -> [BC] -> String
92 = -- "/* " ++ show code ++ "*/\n\n" ++
93 "void " ++ cname f ++ "(VM* vm, VAL* oldbase) {\n" ++
94 indent 1 ++ "INITFRAME;\n" ++
95 concatMap (bcc 1) code ++ "}\n\n"
97bcc :: Int -> BC -> String
98bcc i (ASSIGN l r) = indent i ++ creg l ++ " = " ++ creg r ++ ";\n"
99bcc i (ASSIGNCONST l c)
100 = indent i ++ creg l ++ " = " ++ mkConst c ++ ";\n"
102 mkConst (I i) = "MKINT(" ++ show i ++ ")"
103 mkConst (BI i) | i < (2^30) = "MKINT(" ++ show i ++ ")"
104 | otherwise = "MKBIGC(vm,\"" ++ show i ++ "\")"
105 mkConst (Fl f) = "MKFLOAT(vm, " ++ show f ++ ")"
106 mkConst (Ch c) = "MKINT(" ++ show (fromEnum c) ++ ")"
107 mkConst (Str s) = "MKSTR(vm, " ++ show s ++ ")"
108 mkConst _ = "MKINT(42424242)"
109bcc i (UPDATE l r) = indent i ++ creg l ++ " = " ++ creg r ++ ";\n"
110bcc i (MKCON l tag args)
111 = indent i ++ "allocCon(" ++ creg Tmp ++ ", vm, " ++ show tag ++ "," ++
112 show (length args) ++ ", 0);\n" ++
113 indent i ++ setArgs 0 args ++ "\n" ++
114 indent i ++ creg l ++ " = " ++ creg Tmp ++ ";\n"
116-- "MKCON(vm, " ++ creg l ++ ", " ++ show tag ++ ", " ++
117-- show (length args) ++ concatMap showArg args ++ ");\n"
118 where showArg r = ", " ++ creg r
120 setArgs i (x : xs) = "SETARG(" ++ creg Tmp ++ ", " ++ show i ++ ", " ++ creg x ++
121 "); " ++ setArgs (i + 1) xs
123bcc i (PROJECT l loc a) = indent i ++ "PROJECT(vm, " ++ creg l ++ ", " ++ show loc ++
124 ", " ++ show a ++ ");\n"
125bcc i (PROJECTINTO r t idx)
126 = indent i ++ creg r ++ " = GETARG(" ++ creg t ++ ", " ++ show idx ++ ");\n"
127bcc i (CASE True r code def)
128 | length code < 4 = showCase i def code
130 showCode :: Int -> [BC] -> String
131 showCode i bc = "{\n" ++ indent i ++ concatMap (bcc (i + 1)) bc ++
134 showCase :: Int -> Maybe [BC] -> [(Int, [BC])] -> String
135 showCase i Nothing [(t, c)] = showCode i c
136 showCase i (Just def) [] = showCode i def
137 showCase i def ((t, c) : cs)
138 = "if (CTAG(" ++ creg r ++ ") == " ++ show t ++ ") " ++ showCode i c
139 ++ "else " ++ showCase i def cs
141bcc i (CASE safe r code def)
142 = indent i ++ "switch(" ++ ctag safe ++ "(" ++ creg r ++ ")) {\n" ++
143 concatMap (showCase i) code ++
150 showCase i (t, bc) = indent i ++ "case " ++ show t ++ ":\n"
151 ++ concatMap (bcc (i+1)) bc ++ indent (i + 1) ++ "break;\n"
152 showDef i Nothing = ""
153 showDef i (Just c) = indent i ++ "default:\n"
154 ++ concatMap (bcc (i+1)) c ++ indent (i + 1) ++ "break;\n"
155bcc i (CONSTCASE r code def)
157-- = indent i ++ "switch(GETINT(" ++ creg r ++ ")) {\n" ++
158-- concatMap (showCase i) code ++
161 = concatMap (iCase (creg r)) code ++
162 indent i ++ "{\n" ++ showDefS i def ++ indent i ++ "}\n"
164 = concatMap (strCase ("GETSTR(" ++ creg r ++ ")")) code ++
165 indent i ++ "{\n" ++ showDefS i def ++ indent i ++ "}\n"
167 = concatMap (biCase (creg r)) code ++
168 indent i ++ "{\n" ++ showDefS i def ++ indent i ++ "}\n"
169 | otherwise = error $ "Can't happen: Can't compile const case " ++ show code
171 intConsts ((I _, _ ) : _) = True
172 intConsts ((Ch _, _ ) : _) = True
175 bigintConsts ((BI _, _ ) : _) = True
176 bigintConsts _ = False
178 strConsts ((Str _, _ ) : _) = True
182 indent i ++ "if (strcmp(" ++ sv ++ ", " ++ show s ++ ") == 0) {\n" ++
183 concatMap (bcc (i+1)) bc ++ indent i ++ "} else\n"
184 biCase bv (BI b, bc) =
185 indent i ++ "if (bigEqConst(" ++ bv ++ ", " ++ show b ++ ")) {\n"
186 ++ concatMap (bcc (i+1)) bc ++ indent i ++ "} else\n"
188 indent i ++ "if (GETINT(" ++ v ++ ") == " ++ show b ++ ") {\n"
189 ++ concatMap (bcc (i+1)) bc ++ indent i ++ "} else\n"
191 indent i ++ "if (GETINT(" ++ v ++ ") == " ++ show b ++ ") {\n"
192 ++ concatMap (bcc (i+1)) bc ++ indent i ++ "} else\n"
194 showCase i (t, bc) = indent i ++ "case " ++ show t ++ ":\n"
195 ++ concatMap (bcc (i+1)) bc ++
196 indent (i + 1) ++ "break;\n"
197 showDef i Nothing = ""
198 showDef i (Just c) = indent i ++ "default:\n"
199 ++ concatMap (bcc (i+1)) c ++
200 indent (i + 1) ++ "break;\n"
201 showDefS i Nothing = ""
202 showDefS i (Just c) = concatMap (bcc (i+1)) c
204bcc i (CALL n) = indent i ++ "CALL(" ++ cname n ++ ");\n"
205bcc i (TAILCALL n) = indent i ++ "TAILCALL(" ++ cname n ++ ");\n"
206bcc i (SLIDE n) = indent i ++ "SLIDE(vm, " ++ show n ++ ");\n"
207bcc i REBASE = indent i ++ "REBASE;\n"
208bcc i (RESERVE 0) = ""
209bcc i (RESERVE n) = indent i ++ "RESERVE(" ++ show n ++ ");\n"
211bcc i (ADDTOP n) = indent i ++ "ADDTOP(" ++ show n ++ ");\n"
212bcc i (TOPBASE n) = indent i ++ "TOPBASE(" ++ show n ++ ");\n"
213bcc i (BASETOP n) = indent i ++ "BASETOP(" ++ show n ++ ");\n"
214bcc i STOREOLD = indent i ++ "STOREOLD;\n"
215bcc i (OP l fn args) = indent i ++ doOp (creg l ++ " = ") fn args ++ ";\n"
216bcc i (FOREIGNCALL l LANG_C rty fn args)
218 c_irts rty (creg l ++ " = ")
219 (fn ++ "(" ++ showSep "," (map fcall args) ++ ")") ++ ";\n"
220 where fcall (t, arg) = irts_c t (creg arg)
221bcc i (NULL r) = indent i ++ creg r ++ " = NULL;\n" -- clear, so it'll be GCed
222bcc i (ERROR str) = indent i ++ "fprintf(stderr, " ++ show str ++ "); assert(0); exit(-1);"
223-- bcc i _ = indent i ++ "// not done yet\n"
225c_irts FInt l x = l ++ "MKINT((i_int)(" ++ x ++ "))"
226c_irts FChar l x = l ++ "MKINT((i_int)(" ++ x ++ "))"
227c_irts FString l x = l ++ "MKSTR(vm, " ++ x ++ ")"
229c_irts FPtr l x = l ++ "MKPTR(vm, " ++ x ++ ")"
230c_irts FDouble l x = l ++ "MKFLOAT(vm, " ++ x ++ ")"
231c_irts FAny l x = l ++ x
233irts_c FInt x = "GETINT(" ++ x ++ ")"
234irts_c FChar x = "GETINT(" ++ x ++ ")"
235irts_c FString x = "GETSTR(" ++ x ++ ")"
237irts_c FPtr x = "GETPTR(" ++ x ++ ")"
238irts_c FDouble x = "GETFLOAT(" ++ x ++ ")"
241doOp v LPlus [l, r] = v ++ "ADD(" ++ creg l ++ ", " ++ creg r ++ ")"
242doOp v LMinus [l, r] = v ++ "INTOP(-," ++ creg l ++ ", " ++ creg r ++ ")"
243doOp v LTimes [l, r] = v ++ "MULT(" ++ creg l ++ ", " ++ creg r ++ ")"
244doOp v LDiv [l, r] = v ++ "INTOP(/," ++ creg l ++ ", " ++ creg r ++ ")"
245doOp v LMod [l, r] = v ++ "INTOP(%," ++ creg l ++ ", " ++ creg r ++ ")"
246doOp v LAnd [l, r] = v ++ "INTOP(&," ++ creg l ++ ", " ++ creg r ++ ")"
247doOp v LOr [l, r] = v ++ "INTOP(|," ++ creg l ++ ", " ++ creg r ++ ")"
248doOp v LXOr [l, r] = v ++ "INTOP(^," ++ creg l ++ ", " ++ creg r ++ ")"
249doOp v LSHL [l, r] = v ++ "INTOP(<<," ++ creg l ++ ", " ++ creg r ++ ")"
250doOp v LSHR [l, r] = v ++ "INTOP(>>," ++ creg l ++ ", " ++ creg r ++ ")"
251doOp v LCompl [x] = v ++ "INTOP(~," ++ creg x ++ ")"
252doOp v LEq [l, r] = v ++ "INTOP(==," ++ creg l ++ ", " ++ creg r ++ ")"
253doOp v LLt [l, r] = v ++ "INTOP(<," ++ creg l ++ ", " ++ creg r ++ ")"
254doOp v LLe [l, r] = v ++ "INTOP(<=," ++ creg l ++ ", " ++ creg r ++ ")"
255doOp v LGt [l, r] = v ++ "INTOP(>," ++ creg l ++ ", " ++ creg r ++ ")"
256doOp v LGe [l, r] = v ++ "INTOP(>=," ++ creg l ++ ", " ++ creg r ++ ")"
258doOp v LFPlus [l, r] = v ++ "FLOATOP(+," ++ creg l ++ ", " ++ creg r ++ ")"
259doOp v LFMinus [l, r] = v ++ "FLOATOP(-," ++ creg l ++ ", " ++ creg r ++ ")"
260doOp v LFTimes [l, r] = v ++ "FLOATOP(*," ++ creg l ++ ", " ++ creg r ++ ")"
261doOp v LFDiv [l, r] = v ++ "FLOATOP(/," ++ creg l ++ ", " ++ creg r ++ ")"
262doOp v LFEq [l, r] = v ++ "FLOATBOP(==," ++ creg l ++ ", " ++ creg r ++ ")"
263doOp v LFLt [l, r] = v ++ "FLOATBOP(<," ++ creg l ++ ", " ++ creg r ++ ")"
264doOp v LFLe [l, r] = v ++ "FLOATBOP(<=," ++ creg l ++ ", " ++ creg r ++ ")"
265doOp v LFGt [l, r] = v ++ "FLOATBOP(>," ++ creg l ++ ", " ++ creg r ++ ")"
266doOp v LFGe [l, r] = v ++ "FLOATBOP(>=," ++ creg l ++ ", " ++ creg r ++ ")"
268doOp v LBPlus [l, r] = v ++ "idris_bigPlus(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
269doOp v LBMinus [l, r] = v ++ "idris_bigMinus(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
270doOp v LBDec [l] = v ++ "idris_bigMinus(vm, " ++ creg l ++ ", MKINT(1))"
271doOp v LBTimes [l, r] = v ++ "idris_bigTimes(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
272doOp v LBDiv [l, r] = v ++ "idris_bigDivide(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
273doOp v LBMod [l, r] = v ++ "idris_bigMod(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
274doOp v LBEq [l, r] = v ++ "idris_bigEq(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
275doOp v LBLt [l, r] = v ++ "idris_bigLt(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
276doOp v LBLe [l, r] = v ++ "idris_bigLe(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
277doOp v LBGt [l, r] = v ++ "idris_bigGt(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
278doOp v LBGe [l, r] = v ++ "idris_bigGe(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
280doOp v LStrConcat [l,r] = v ++ "idris_concat(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
281doOp v LStrLt [l,r] = v ++ "idris_strlt(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
282doOp v LStrEq [l,r] = v ++ "idris_streq(vm, " ++ creg l ++ ", " ++ creg r ++ ")"
283doOp v LStrLen [x] = v ++ "idris_strlen(vm, " ++ creg x ++ ")"
285doOp v LIntFloat [x] = v ++ "idris_castIntFloat(" ++ creg x ++ ")"
286doOp v LFloatInt [x] = v ++ "idris_castFloatInt(" ++ creg x ++ ")"
287doOp v LIntStr [x] = v ++ "idris_castIntStr(vm, " ++ creg x ++ ")"
288doOp v LStrInt [x] = v ++ "idris_castStrInt(vm, " ++ creg x ++ ")"
289doOp v LIntBig [x] = v ++ "idris_castIntBig(vm, " ++ creg x ++ ")"
290doOp v LBigInt [x] = v ++ "idris_castBigInt(vm, " ++ creg x ++ ")"
291doOp v LStrBig [x] = v ++ "idris_castStrBig(vm, " ++ creg x ++ ")"
292doOp v LBigStr [x] = v ++ "idris_castBigStr(vm, " ++ creg x ++ ")"
293doOp v LFloatStr [x] = v ++ "idris_castFloatStr(vm, " ++ creg x ++ ")"
294doOp v LStrFloat [x] = v ++ "idris_castStrFloat(vm, " ++ creg x ++ ")"
296doOp v LReadStr [x] = v ++ "idris_readStr(vm, GETPTR(" ++ creg x ++ "))"
297doOp _ LPrintNum [x] = "printf(\"%ld\\n\", GETINT(" ++ creg x ++ "))"
298doOp _ LPrintStr [x] = "fputs(GETSTR(" ++ creg x ++ "), stdout)"
300doOp v LIntB8 [x] = v ++ "idris_b8(vm, " ++ creg x ++ ")"
301doOp v LIntB16 [x] = v ++ "idris_b16(vm, " ++ creg x ++ ")"
302doOp v LIntB32 [x] = v ++ "idris_b32(vm, " ++ creg x ++ ")"
303doOp v LIntB64 [x] = v ++ "idris_b64(vm, " ++ creg x ++ ")"
305doOp v LB32Int [x] = v ++ "idris_castB32Int(vm, " ++ creg x ++ ")"
307doOp v LB8Lt [x, y] = v ++ "idris_b8Lt(vm, " ++ creg x ++ "," ++ creg y ++ ")"
308doOp v LB8Lte [x, y] = v ++ "idris_b8Lte(vm, " ++ creg x ++ "," ++ creg y ++ ")"
309doOp v LB8Eq [x, y] = v ++ "idris_b8Eq(vm, " ++ creg x ++ "," ++ creg y ++ ")"
310doOp v LB8Gte [x, y] = v ++ "idris_b8Gte(vm, " ++ creg x ++ "," ++ creg y ++ ")"
311doOp v LB8Gt [x, y] = v ++ "idris_b8Gt(vm, " ++ creg x ++ "," ++ creg y ++ ")"
313doOp v LB8Shl [x, y] = v ++ "idris_b8Shl(vm, " ++ creg x ++ "," ++ creg y ++ ")"
314doOp v LB8LShr [x, y] = v ++ "idris_b8Shr(vm, " ++ creg x ++ "," ++ creg y ++ ")"
315doOp v LB8AShr [x, y] = v ++ "idris_b8AShr(vm, " ++ creg x ++ "," ++ creg y ++ ")"
316doOp v LB8And [x, y] = v ++ "idris_b8And(vm, " ++ creg x ++ "," ++ creg y ++ ")"
317doOp v LB8Or [x, y] = v ++ "idris_b8Or(vm, " ++ creg x ++ "," ++ creg y ++ ")"
318doOp v LB8Xor [x, y] = v ++ "idris_b8Xor(vm, " ++ creg x ++ "," ++ creg y ++ ")"
319doOp v LB8Compl [x, y] = v ++ "idris_b8Compl(vm, " ++ creg x ++ "," ++ creg y ++ ")"
321doOp v LB8Plus [x, y] = v ++ "idris_b8Plus(vm, " ++ creg x ++ "," ++ creg y ++ ")"
322doOp v LB8Minus [x, y] = v ++ "idris_b8Minus(vm, " ++ creg x ++ "," ++ creg y ++ ")"
323doOp v LB8Times [x, y] = v ++ "idris_b8Times(vm, " ++ creg x ++ "," ++ creg y ++ ")"
324doOp v LB8UDiv [x, y] = v ++ "idris_b8UDiv(vm, " ++ creg x ++ "," ++ creg y ++ ")"
325doOp v LB8SDiv [x, y] = v ++ "idris_b8SDiv(vm, " ++ creg x ++ "," ++ creg y ++ ")"
327doOp v LB8Z16 [x] = v ++ "idris_b8Z16(vm, " ++ creg x ++ ")"
328doOp v LB8Z32 [x] = v ++ "idris_b8Z32(vm, " ++ creg x ++ ")"
329doOp v LB8Z64 [x] = v ++ "idris_b8Z64(vm, " ++ creg x ++ ")"
330doOp v LB8S16 [x] = v ++ "idris_b8S16(vm, " ++ creg x ++ ")"
331doOp v LB8S32 [x] = v ++ "idris_b8S32(vm, " ++ creg x ++ ")"
332doOp v LB8S64 [x] = v ++ "idris_b8S64(vm, " ++ creg x ++ ")"
334doOp v LB16Lt [x, y] = v ++ "idris_b16Lt(vm, " ++ creg x ++ "," ++ creg y ++ ")"
335doOp v LB16Lte [x, y] = v ++ "idris_b16Lte(vm, " ++ creg x ++ "," ++ creg y ++ ")"
336doOp v LB16Eq [x, y] = v ++ "idris_b16Eq(vm, " ++ creg x ++ "," ++ creg y ++ ")"
337doOp v LB16Gte [x, y] = v ++ "idris_b16Gte(vm, " ++ creg x ++ "," ++ creg y ++ ")"
338doOp v LB16Gt [x, y] = v ++ "idris_b16Gt(vm, " ++ creg x ++ "," ++ creg y ++ ")"
340doOp v LB16Shl [x, y] = v ++ "idris_b16Shl(vm, " ++ creg x ++ "," ++ creg y ++ ")"
341doOp v LB16LShr [x, y] = v ++ "idris_b16Shr(vm, " ++ creg x ++ "," ++ creg y ++ ")"
342doOp v LB16AShr [x, y] = v ++ "idris_b16AShr(vm, " ++ creg x ++ "," ++ creg y ++ ")"
343doOp v LB16And [x, y] = v ++ "idris_b16And(vm, " ++ creg x ++ "," ++ creg y ++ ")"
344doOp v LB16Or [x, y] = v ++ "idris_b16Or(vm, " ++ creg x ++ "," ++ creg y ++ ")"
345doOp v LB16Xor [x, y] = v ++ "idris_b16Xor(vm, " ++ creg x ++ "," ++ creg y ++ ")"
346doOp v LB16Compl [x, y] = v ++ "idris_b16Compl(vm, " ++ creg x ++ "," ++ creg y ++ ")"
348doOp v LB16Plus [x, y] =
349 v ++ "idris_b16Plus(vm, " ++ creg x ++ "," ++ creg y ++ ")"
350doOp v LB16Minus [x, y] =
351 v ++ "idris_b16Minus(vm, " ++ creg x ++ "," ++ creg y ++ ")"
352doOp v LB16Times [x, y] =
353 v ++ "idris_b16Times(vm, " ++ creg x ++ "," ++ creg y ++ ")"
354doOp v LB16UDiv [x, y] =
355 v ++ "idris_b16UDiv(vm, " ++ creg x ++ "," ++ creg y ++ ")"
356doOp v LB16SDiv [x, y] =
357 v ++ "idris_b16SDiv(vm, " ++ creg x ++ "," ++ creg y ++ ")"
359doOp v LB16Z32 [x] = v ++ "idris_b16Z32(vm, " ++ creg x ++ ")"
360doOp v LB16Z64 [x] = v ++ "idris_b16Z64(vm, " ++ creg x ++ ")"
361doOp v LB16S32 [x] = v ++ "idris_b16S32(vm, " ++ creg x ++ ")"
362doOp v LB16S64 [x] = v ++ "idris_b16S64(vm, " ++ creg x ++ ")"
363doOp v LB16T8 [x] = v ++ "idris_b16T8(vm, " ++ creg x ++ ")"
365doOp v LB32Lt [x, y] = v ++ "idris_b32Lt(vm, " ++ creg x ++ "," ++ creg y ++ ")"
366doOp v LB32Lte [x, y] = v ++ "idris_b32Lte(vm, " ++ creg x ++ "," ++ creg y ++ ")"
367doOp v LB32Eq [x, y] = v ++ "idris_b32Eq(vm, " ++ creg x ++ "," ++ creg y ++ ")"
368doOp v LB32Gte [x, y] = v ++ "idris_b32Gte(vm, " ++ creg x ++ "," ++ creg y ++ ")"
369doOp v LB32Gt [x, y] = v ++ "idris_b32Gt(vm, " ++ creg x ++ "," ++ creg y ++ ")"
371doOp v LB32Shl [x, y] = v ++ "idris_b32Shl(vm, " ++ creg x ++ "," ++ creg y ++ ")"
372doOp v LB32LShr [x, y] = v ++ "idris_b32Shr(vm, " ++ creg x ++ "," ++ creg y ++ ")"
373doOp v LB32AShr [x, y] = v ++ "idris_b32AShr(vm, " ++ creg x ++ "," ++ creg y ++ ")"
374doOp v LB32And [x, y] = v ++ "idris_b32And(vm, " ++ creg x ++ "," ++ creg y ++ ")"
375doOp v LB32Or [x, y] = v ++ "idris_b32Or(vm, " ++ creg x ++ "," ++ creg y ++ ")"
376doOp v LB32Xor [x, y] = v ++ "idris_b32Xor(vm, " ++ creg x ++ "," ++ creg y ++ ")"
377doOp v LB32Compl [x, y] = v ++ "idris_b32Compl(vm, " ++ creg x ++ "," ++ creg y ++ ")"
379doOp v LB32Plus [x, y] =
380 v ++ "idris_b32Plus(vm, " ++ creg x ++ "," ++ creg y ++ ")"
381doOp v LB32Minus [x, y] =
382 v ++ "idris_b32Minus(vm, " ++ creg x ++ "," ++ creg y ++ ")"
383doOp v LB32Times [x, y] =
384 v ++ "idris_b32Times(vm, " ++ creg x ++ "," ++ creg y ++ ")"
385doOp v LB32UDiv [x, y] =
386 v ++ "idris_b32UDiv(vm, " ++ creg x ++ "," ++ creg y ++ ")"
387doOp v LB32SDiv [x, y] =
388 v ++ "idris_b32SDiv(vm, " ++ creg x ++ "," ++ creg y ++ ")"
390doOp v LB32Z64 [x] = v ++ "idris_b32Z64(vm, " ++ creg x ++ ")"
391doOp v LB32S64 [x] = v ++ "idris_b32S64(vm, " ++ creg x ++ ")"
392doOp v LB32T8 [x] = v ++ "idris_b32T8(vm, " ++ creg x ++ ")"
393doOp v LB32T16 [x] = v ++ "idris_b32T16(vm, " ++ creg x ++ ")"
395doOp v LB64Lt [x, y] = v ++ "idris_b64Lt(vm, " ++ creg x ++ "," ++ creg y ++ ")"
396doOp v LB64Lte [x, y] = v ++ "idris_b64Lte(vm, " ++ creg x ++ "," ++ creg y ++ ")"
397doOp v LB64Eq [x, y] = v ++ "idris_b64Eq(vm, " ++ creg x ++ "," ++ creg y ++ ")"
398doOp v LB64Gte [x, y] = v ++ "idris_b64Gte(vm, " ++ creg x ++ "," ++ creg y ++ ")"
399doOp v LB64Gt [x, y] = v ++ "idris_b64Gt(vm, " ++ creg x ++ "," ++ creg y ++ ")"
401doOp v LB64Shl [x, y] = v ++ "idris_b64Shl(vm, " ++ creg x ++ "," ++ creg y ++ ")"
402doOp v LB64LShr [x, y] = v ++ "idris_b64Shr(vm, " ++ creg x ++ "," ++ creg y ++ ")"
403doOp v LB64AShr [x, y] = v ++ "idris_b64AShr(vm, " ++ creg x ++ "," ++ creg y ++ ")"
404doOp v LB64And [x, y] = v ++ "idris_b64And(vm, " ++ creg x ++ "," ++ creg y ++ ")"
405doOp v LB64Or [x, y] = v ++ "idris_b64Or(vm, " ++ creg x ++ "," ++ creg y ++ ")"
406doOp v LB64Xor [x, y] = v ++ "idris_b64Xor(vm, " ++ creg x ++ "," ++ creg y ++ ")"
407doOp v LB64Compl [x, y] = v ++ "idris_b64Compl(vm, " ++ creg x ++ "," ++ creg y ++ ")"
409doOp v LB64Plus [x, y] =
410 v ++ "idris_b64Plus(vm, " ++ creg x ++ "," ++ creg y ++ ")"
411doOp v LB64Minus [x, y] =
412 v ++ "idris_b64Minus(vm, " ++ creg x ++ "," ++ creg y ++ ")"
413doOp v LB64Times [x, y] =
414 v ++ "idris_b64Times(vm, " ++ creg x ++ "," ++ creg y ++ ")"
415doOp v LB64UDiv [x, y] =
416 v ++ "idris_b64UDiv(vm, " ++ creg x ++ "," ++ creg y ++ ")"
417doOp v LB64SDiv [x, y] =
418 v ++ "idris_b64SDiv(vm, " ++ creg x ++ "," ++ creg y ++ ")"
420doOp v LB64T8 [x] = v ++ "idris_b64T8(vm, " ++ creg x ++ ")"
421doOp v LB64T16 [x] = v ++ "idris_b64T16(vm, " ++ creg x ++ ")"
422doOp v LB64T32 [x] = v ++ "idris_b64T32(vm, " ++ creg x ++ ")"
424doOp v LFExp [x] = v ++ "MKFLOAT(exp(GETFLOAT(" ++ creg x ++ ")))"
425doOp v LFLog [x] = v ++ "MKFLOAT(log(GETFLOAT(" ++ creg x ++ ")))"
426doOp v LFSin [x] = v ++ "MKFLOAT(sin(GETFLOAT(" ++ creg x ++ ")))"
427doOp v LFCos [x] = v ++ "MKFLOAT(cos(GETFLOAT(" ++ creg x ++ ")))"
428doOp v LFTan [x] = v ++ "MKFLOAT(tan(GETFLOAT(" ++ creg x ++ ")))"
429doOp v LFASin [x] = v ++ "MKFLOAT(asin(GETFLOAT(" ++ creg x ++ ")))"
430doOp v LFACos [x] = v ++ "MKFLOAT(acos(GETFLOAT(" ++ creg x ++ ")))"
431doOp v LFATan [x] = v ++ "MKFLOAT(atan(GETFLOAT(" ++ creg x ++ ")))"
432doOp v LFSqrt [x] = v ++ "MKFLOAT(floor(GETFLOAT(" ++ creg x ++ ")))"
433doOp v LFFloor [x] = v ++ "MKFLOAT(ceil(GETFLOAT(" ++ creg x ++ ")))"
434doOp v LFCeil [x] = v ++ "MKFLOAT(sqrt(GETFLOAT(" ++ creg x ++ ")))"
436doOp v LStrHead [x] = v ++ "idris_strHead(vm, " ++ creg x ++ ")"
437doOp v LStrTail [x] = v ++ "idris_strTail(vm, " ++ creg x ++ ")"
438doOp v LStrCons [x, y] = v ++ "idris_strCons(vm, " ++ creg x ++ "," ++ creg y ++ ")"
439doOp v LStrIndex [x, y] = v ++ "idris_strIndex(vm, " ++ creg x ++ "," ++ creg y ++ ")"
440doOp v LStrRev [x] = v ++ "idris_strRev(vm, " ++ creg x ++ ")"
442doOp v LStdIn [] = v ++ "MKPTR(vm, stdin)"
443doOp v LStdOut [] = v ++ "MKPTR(vm, stdout)"
444doOp v LStdErr [] = v ++ "MKPTR(vm, stderr)"
446doOp v LFork [x] = v ++ "MKPTR(vm, vmThread(vm, " ++ cname (MN 0 "EVAL") ++ ", " ++ creg x ++ "))"
447doOp v LPar [x] = v ++ creg x -- "MKPTR(vm, vmThread(vm, " ++ cname (MN 0 "EVAL") ++ ", " ++ creg x ++ "))"
448doOp v LVMPtr [] = v ++ "MKPTR(vm, vm)"
449doOp v LNoOp args = v ++ creg (last args)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list