diff options
| author | gingerBill <bill@gingerbill.org> | 2020-10-24 16:32:37 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-10-24 16:32:37 +0100 |
| commit | 4629754f7ced5df477eb017872ef65539db64a27 (patch) | |
| tree | fc2fc4b7a493c58adeb10bf54254fbbad66f2f67 /src/check_decl.cpp | |
| parent | 0061e63db010cdb2043af63527b4c25f45652a51 (diff) | |
Inline asm expression (-llvm-api)
See https://llvm.org/docs/LangRef.html#inline-assembler-expressions
Example:
```
x := asm(i32) -> i32 {
"bswap $0",
"=r,r",
}(123);
```
Allowed directives `#side_effect`, `#align_stack`, `#att`, `#intel` e.g. `asm() #side_effect #intel {...}`
Diffstat (limited to 'src/check_decl.cpp')
| -rw-r--r-- | src/check_decl.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/check_decl.cpp b/src/check_decl.cpp index 639bf7d4f..1aafa6e1c 100644 --- a/src/check_decl.cpp +++ b/src/check_decl.cpp @@ -79,7 +79,11 @@ Type *check_init_variable(CheckerContext *ctx, Entity *e, Operand *operand, Stri } t = default_type(t); } - if (is_type_polymorphic(t)) { + if (is_type_asm_proc(t)) { + error(e->token, "Invalid use of inline asm in %.*s", LIT(context_name)); + e->type = t_invalid; + return nullptr; + } else if (is_type_polymorphic(t)) { gbString str = type_to_string(t); defer (gb_string_free(str)); error(e->token, "Invalid use of a polymorphic type '%s' in %.*s", str, LIT(context_name)); |