AvalonStudio.Toolchains.Llilum.LlilumToolchain.CompileLLVMIR C# (CSharp) Method

CompileLLVMIR() private method

private CompileLLVMIR ( IConsole console, IStandardProject superProject, IStandardProject project, ISourceFile file, string llvmBinary, string outputFile ) : void
console IConsole
superProject IStandardProject
project IStandardProject
file ISourceFile
llvmBinary string
outputFile string
return void
		private void CompileLLVMIR(IConsole console, IStandardProject superProject, IStandardProject project, ISourceFile file,
			string llvmBinary, string outputFile)
		{
			var startInfo = new ProcessStartInfo();

			startInfo.FileName = Path.Combine(BaseDirectory, "LLVM", "llc.exe");

			if (Path.IsPathRooted(startInfo.FileName) && !System.IO.File.Exists(startInfo.FileName))
			{
				console.WriteLine("Unable to find compiler (" + startInfo.FileName + ") Please check project compiler settings.");
			}
			else
			{
				startInfo.WorkingDirectory = Path.Combine(BaseDirectory, "Llilum\\ZeligBuild\\Host\\bin\\Debug");

				startInfo.Arguments =
					string.Format(
						"-O0 -code-model=small -data-sections -relocation-model=pic -march=thumb -mcpu=cortex-m4 -filetype=obj -mtriple=Thumb-NoSubArch-UnknownVendor-UnknownOS-GNUEABI-ELF -o={0} {1}",
						outputFile, llvmBinary);

				// Hide console window
				startInfo.UseShellExecute = false;
				startInfo.RedirectStandardOutput = true;
				startInfo.RedirectStandardError = true;
				startInfo.CreateNoWindow = true;

				//console.WriteLine (Path.GetFileNameWithoutExtension(startInfo.FileName) + " " + startInfo.Arguments);

				using (var process = Process.Start(startInfo))
				{
					process.OutputDataReceived += (sender, e) => { console.WriteLine(e.Data); };

					process.ErrorDataReceived += (sender, e) =>
					{
						if (e.Data != null)
						{
							console.WriteLine();
							console.WriteLine(e.Data);
						}
					};

					process.BeginOutputReadLine();

					process.BeginErrorReadLine();

					process.WaitForExit();
				}
			}
		}