Exemplo n.º 1
0
        public GamaGlobalContext(string name)
        {
            ModuleName = $"{ name }.mod";

            ErrorList = new GamaErrorCollection();

            Module  = LLVMModuleRef.CreateWithName(ModuleName);
            Context = Module.Context;

            Root       = new GamaNamespace("[root]", this);
            Namespaces = new List <GamaNamespace>();

            ImportedFiles = new List <string>();

            // I know this is 'unsafe', but these methods are not implemeted to their OOP counterparts yet
            // So I am stuck with this for now
            unsafe
            {
                LLVM.SetDataLayout(Module, "e-m:w-i64:64-f80:128-n8:16:32:64-S128".GetSbytePtr());
                if (Environment.OSVersion.Platform == PlatformID.Unix)
                {
                    LLVM.SetTarget(Module, "x86_64-pc-linux-gnu".GetSbytePtr());
                }
                else
                {
                    LLVM.SetTarget(Module, "x86_64-pc-windows".GetSbytePtr());
                }
            }
        }
Exemplo n.º 2
0
        public GamaNamespace GetOrCreateNamespace(string name)
        {
            foreach (var n in Namespaces)
            {
                if (n.Name == name)
                {
                    return(n);
                }
            }
            var ns = new GamaNamespace(name, this);

            Namespaces.Add(ns);
            return(ns);
        }
Exemplo n.º 3
0
 public GamaNamespace(string name, GamaNamespace parent, GamaGlobalContext ctx) : this(name, ctx)
 {
     Parent = parent;
 }