hyc

Hydrogen Compiler written in C
git clone git://git.kocotian.pl/hyc.git
Log | Files | Refs | README | LICENSE

commit 740c7afb30a5eca969f36762dad1b7c97d6766ba
parent 62a50c84d4153e98935e907117f2d699b4ebae82
Author: kocotian <kocotian@kocotian.pl>
Date:   Mon, 26 Jul 2021 19:00:24 +0000

Inline assembly compilation

Diffstat:
Mtarget/x86_64-linux.c | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/target/x86_64-linux.c b/target/x86_64-linux.c @@ -43,6 +43,7 @@ static void compileStatementCompound(Compiler *compiler, ASTStatementCompound st static void compileStatementConditional(Compiler *compiler, ASTStatementConditional stat); static void compileStatementReturn(Compiler *compiler, ASTStatementReturn stat); static void compileStatementExpression(Compiler *compiler, ASTStatementExpression stat); +static void compileStatementInlineAssembly(Compiler *compiler, ASTStatementInlineAssembly stat); static void compileStatement(Compiler *compiler, union ASTStatement *statement); static void compileGlobalFunction(Compiler *compiler, ASTGlobalFunction func); @@ -190,6 +191,12 @@ compileStatementExpression(Compiler *compiler, ASTStatementExpression stat) } static void +compileStatementInlineAssembly(Compiler *compiler, ASTStatementInlineAssembly stat) +{ + asmTextAppend(compiler, "\t%s", stat.expr.value); +} + +static void compileStatement(Compiler *compiler, union ASTStatement *statement) { switch (statement->type) { @@ -207,6 +214,9 @@ compileStatement(Compiler *compiler, union ASTStatement *statement) case ASTStatementExpression_T: compileStatementExpression(compiler, statement->Expression); break; + case ASTStatementInlineAssembly_T: + compileStatementInlineAssembly(compiler, statement->InlineAssembly); + break; default: break; } }