internal void generate() { ast.translate(directTranslation); directTranslation.ResolveLabel(); // directTranslation.ConstructFlowGraph(); // directTranslation.CalculateLiveSpan(); List <FunctionTranslation> list = new List <FunctionTranslation>(); Dictionary <string, (SortedSet <int> s, SortedSet <int> v)> rlist = new Dictionary <string, (SortedSet <int> s, SortedSet <int> v)>(); for (int i = 0; i < directTranslation.ListOfList.Count; i++) { var item = directTranslation.ListOfList[i]; var f = new FunctionTranslation(item, directTranslation.LabelReferences, directTranslation.Functions[i]); list.Add(f); rlist.Add(item[0].Label, RegisterAllocator.fk(f)); } foreach (var item in list) { item.CalculateLiveSpan2(); item.ResolveCallerSave(rlist); } foreach (var item in directTranslation.FunctionStackWaiting) { int size = item.Key.StackSize; if (size % 4 != 0) { size = size - (size % 4) + 4; } item.Value.Operands[2] = size.ToString(); } list[0].List.AddFirst(new Assembly("s_mov", new List <string> { "RS2", "RS28" })); list[0].List.AddFirst(new Assembly("s_mov", new List <string> { "RS28", "RS29" })); foreach (var item in list) { item.ResolvePhysicalRegister(); item.Output(Console.Out); } // directTranslation.Print(); }
public void Init() { if (Directory.Exists(path + "/" + application)) { string[] files = Directory.GetFiles(path + "/" + application); if (files.Length > 0) { foreach (string file in files) { File.Delete(file); } } } if (!Directory.Exists("Content")) { Directory.CreateDirectory("Content"); } this._graphics = new GraphicsConfiguration(); this._graphics.BitsPerPixel = 32; this._graphics.IsMouseVisible = true; this._graphics.IsVerticalSync = false; this._graphics.Resolution = new Resolution(800, 600); this._graphics.Styles = Styles.Default; this._graphics.IsLightEngineActive = false; this._graphics.IsParticuleEngineActive = false; this._audio = new AudioConfiguration(); this._audio.FadeMusic = false; this._audio.FxVolume = 0f; this._audio.MasterVolume = 0f; this._audio.MaxSounds = 0; this._audio.MusicVolume = 0f; this._audio.Mute = true; this._game = new GameConfiguration(); this._game.Culture = CultureInfo.CurrentCulture.Name; this._game.Skin = string.Empty; this._hotKeys = new HotKeyConfiguration(); this._language = new Language(); this._language.Key = CultureInfo.CurrentCulture.Name; this._language.Name = CultureInfo.CurrentCulture.NativeName; FunctionTranslation func = new FunctionTranslation(); func.Key = "DEFAULT"; Translation trans = new Translation(); trans.Key = "HELLO_WORLD"; trans.Value = "Bonjour le monde !"; func.Translations.Add(trans); this._language.Functions.Add(func); SerializerHelper.Save("Content/graphics.xml", this._graphics); SerializerHelper.Save("Content/audio.xml", this._audio); SerializerHelper.Save("Content/game.xml", this._game); SerializerHelper.Save("Content/keys.xml", this._hotKeys); SerializerHelper.Save("Content/" + this._language.Key + ".xml", this._language); }