mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Update default asm dialect on asm strings. Fix naked function analysis.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## 0.5.0 Change List
|
||||
|
||||
### Changes / improvements
|
||||
- Asm string blocks use AT&T syntax for better reliability.
|
||||
- Distinct methods changed to separate syntax.
|
||||
- 'exec' directive to run scripts at compile time.
|
||||
- Project key descriptions in --list command.
|
||||
@@ -174,6 +175,7 @@
|
||||
- Added posix socket functions.
|
||||
|
||||
### Fixes
|
||||
- Naked functions now correctly handles `asm`.
|
||||
- Indexing into arrays would not always widen the index safely.
|
||||
- Macros with implicit return didn't correctly deduct the return type.
|
||||
- Reevaluating a bitstruct (due to checked) would break.
|
||||
|
||||
@@ -1222,7 +1222,7 @@ static inline void llvm_emit_asm_block_stmt(GenContext *c, Ast *ast)
|
||||
strlen(clobbers),
|
||||
ast->asm_block_stmt.is_volatile,
|
||||
true,
|
||||
ast->asm_block_stmt.is_string ? LLVMInlineAsmDialectIntel : LLVMInlineAsmDialectATT,
|
||||
LLVMInlineAsmDialectATT,
|
||||
/* can throw */ false
|
||||
);
|
||||
LLVMValueRef res = LLVMBuildCall2(c->builder, asm_fn_type, asm_fn, args, param_count, "");
|
||||
|
||||
@@ -3115,6 +3115,7 @@ bool sema_analyse_function_body(SemaContext *context, Decl *func)
|
||||
}
|
||||
}
|
||||
assert_first = 0;
|
||||
if (!sema_analyse_compound_statement_no_scope(context, body)) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define COMPILER_VERSION "0.4.681"
|
||||
#define COMPILER_VERSION "0.4.682"
|
||||
@@ -1,11 +1,19 @@
|
||||
// #target: macos-x64
|
||||
module testing;
|
||||
import std::io;
|
||||
|
||||
fn void test() @naked @export("hello")
|
||||
{
|
||||
asm("nop");
|
||||
fn void start() @export("_start") @naked @nostrip {
|
||||
asm {
|
||||
movq $rax, 0x3c;
|
||||
movq $rdi, 42;
|
||||
syscall;
|
||||
}
|
||||
}
|
||||
fn void main()
|
||||
{
|
||||
}
|
||||
|
||||
/* #expect: testing.ll
|
||||
|
||||
define void @_start() #0 {
|
||||
entry:
|
||||
call void asm alignstack "movq $$60, %rax\0Amovq $$42, %rdi\0Asyscall \0A", "~{cc},~{rax},~{rcx},~{r8},~{r11},~{flags},~{dirflag},~{fspr}"()
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user