private void GenCall(IL.CallInstruction instr)
        {
            GenPreStore(instr.Destination);
            GenLoadEntity(instr.Function);
            Gen(new I.LoadInt {
                Value = instr.Parameters.Count
            });
            Gen(new I.NewArray {
                Type = "[Runtime]Runtime.IType"
            });
            Gen(new I.Store {
                Loc = 1
            });
            int no = 0;

            foreach (IL.IEntity e in instr.Parameters)
            {
                Gen(new I.Load {
                    Loc = 1
                });
                Gen(new I.LoadInt {
                    Value = no++
                });
                GenLoadEntity(e);
                Gen(new I.StoreElement {
                });
            }
            Gen(new I.Load {
                Loc = 1
            });
            Gen(new I.CallVirtual {
            });
            GenPostStore(instr.Destination);
        }
        public void Call(IL.IEntity f, params IL.IEntity[] args)
        {
            var ins = new IL.CallInstruction(f, Env.rax);

            ins.Parameters.AddRange(args);
            Add(ins);
        }
 private static bool IsRecursiveCall(IL.CallInstruction call, Function func)
 {
     // Check if the call is recursive.
     // (Need a better method.)
     if (call.Function is IL.Variable varFunc)
     {
         if (FuncMap.GetValueOrDefault(varFunc) == func.ILFunction)
         {
             return(true);
         }
     }
     return(false);
 }
 private static IL.Instruction GenTailRecursiveCall(IL.CallInstruction call)
 {
     return(new TailCallInstruction(call.Parameters));
 }