c generator
This commit is contained in:
@@ -116,28 +116,38 @@ if (diagnostics.Any(diagnostic => diagnostic.Severity == DiagnosticSeverity.Erro
|
||||
|
||||
Directory.CreateDirectory(".build");
|
||||
|
||||
sw.Restart();
|
||||
var generator = new CGenerator(definitions, referencedStructTypes);
|
||||
var c = generator.Emit();
|
||||
var cFilePath = Path.Combine(".build", "out.c");
|
||||
|
||||
var generator = new QBEGenerator(definitions, referencedStructTypes);
|
||||
var ssa = generator.Emit();
|
||||
var ssaFilePath = Path.Combine(".build", "out.ssa");
|
||||
File.WriteAllText(ssaFilePath, ssa);
|
||||
|
||||
Console.WriteLine($"Emit ssa: {sw.ElapsedMilliseconds}ms");
|
||||
sw.Restart();
|
||||
|
||||
var asmFilePath = Path.Combine(".build", "out.asm");
|
||||
var qbeSuccess = await QBE.Invoke(ssaFilePath, asmFilePath);
|
||||
if (!qbeSuccess) return 1;
|
||||
|
||||
Console.WriteLine($"Emit asm: {sw.ElapsedMilliseconds}ms");
|
||||
sw.Restart();
|
||||
File.WriteAllText(cFilePath, c);
|
||||
|
||||
var objFilePath = Path.Combine(".build", "out.o");
|
||||
var asmSuccess = await GCC.Assemble(asmFilePath, objFilePath);
|
||||
var asmSuccess = await GCC.Compile(cFilePath, objFilePath);
|
||||
if (!asmSuccess) return 1;
|
||||
|
||||
Console.WriteLine($"Assemble: {sw.ElapsedMilliseconds}ms");
|
||||
// sw.Restart();
|
||||
//
|
||||
// var generator = new QBEGenerator(definitions, referencedStructTypes);
|
||||
// var ssa = generator.Emit();
|
||||
// var ssaFilePath = Path.Combine(".build", "out.ssa");
|
||||
// File.WriteAllText(ssaFilePath, ssa);
|
||||
//
|
||||
// Console.WriteLine($"Emit ssa: {sw.ElapsedMilliseconds}ms");
|
||||
// sw.Restart();
|
||||
//
|
||||
// var asmFilePath = Path.Combine(".build", "out.asm");
|
||||
// var qbeSuccess = await QBE.Invoke(ssaFilePath, asmFilePath);
|
||||
// if (!qbeSuccess) return 1;
|
||||
//
|
||||
// Console.WriteLine($"Emit asm: {sw.ElapsedMilliseconds}ms");
|
||||
// sw.Restart();
|
||||
//
|
||||
// var objFilePath = Path.Combine(".build", "out.o");
|
||||
// var asmSuccess = await GCC.Assemble(asmFilePath, objFilePath);
|
||||
// if (!asmSuccess) return 1;
|
||||
//
|
||||
// Console.WriteLine($"Assemble: {sw.ElapsedMilliseconds}ms");
|
||||
sw.Restart();
|
||||
|
||||
return 0;
|
||||
Reference in New Issue
Block a user