...
This commit is contained in:
@@ -7,9 +7,8 @@ public static class QBE
|
||||
public static async Task<string?> Invoke(string ssa)
|
||||
{
|
||||
using var process = new Process();
|
||||
process.StartInfo = new ProcessStartInfo
|
||||
process.StartInfo = new ProcessStartInfo("qbe")
|
||||
{
|
||||
FileName = "qbe",
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
|
||||
@@ -200,16 +200,19 @@ public static class QBEGenerator
|
||||
{
|
||||
case BoundArrayInitializerNode arrayInitializer:
|
||||
{
|
||||
_writer.WriteDebugLocation(arrayInitializer);
|
||||
EmitStore(source.Type, EmitUnwrap(EmitArrayInitializer(arrayInitializer)), destinationPointer);
|
||||
return true;
|
||||
}
|
||||
case BoundStructInitializerNode structInitializer:
|
||||
{
|
||||
_writer.WriteDebugLocation(structInitializer);
|
||||
EmitStructInitializer(structInitializer, destinationPointer);
|
||||
return true;
|
||||
}
|
||||
case BoundLiteralNode { Kind: LiteralKind.String } literal:
|
||||
{
|
||||
_writer.WriteDebugLocation(literal);
|
||||
EmitStore(source.Type, EmitUnwrap(EmitLiteral(literal)), destinationPointer);
|
||||
return true;
|
||||
}
|
||||
@@ -521,6 +524,7 @@ public static class QBEGenerator
|
||||
builder.Append($"({string.Join(", ", parameterStrings)})");
|
||||
|
||||
_writer.StartFunction(builder.ToString());
|
||||
_writer.WriteDebugLocation(debugNode);
|
||||
|
||||
var parameterVars = parameters.Select(parameter => new Variable(parameter.Name, new Val("%" + parameter.Name, parameter.Type, ValKind.Direct))).ToList();
|
||||
|
||||
@@ -566,6 +570,8 @@ public static class QBEGenerator
|
||||
|
||||
private static void EmitStatement(BoundStatementNode statement)
|
||||
{
|
||||
_writer.WriteDebugLocation(statement);
|
||||
|
||||
switch (statement)
|
||||
{
|
||||
case BoundAssignmentNode assignment:
|
||||
@@ -714,6 +720,7 @@ public static class QBEGenerator
|
||||
|
||||
private static Val EmitExpression(BoundExpressionNode expression)
|
||||
{
|
||||
_writer.WriteDebugLocation(expression);
|
||||
return expression switch
|
||||
{
|
||||
BoundAddressOfNode addressOf => EmitAddressOf(addressOf),
|
||||
|
||||
@@ -40,7 +40,7 @@ internal class QBEWriter
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteDebugLocation(BoundNode node)
|
||||
public void WriteDebugLocation(BoundNode node)
|
||||
{
|
||||
var firstToken = node.Tokens.FirstOrDefault();
|
||||
if (firstToken != null)
|
||||
|
||||
Reference in New Issue
Block a user