From 4629754f7ced5df477eb017872ef65539db64a27 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 24 Oct 2020 16:32:37 +0100 Subject: 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 {...}` --- src/check_type.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/check_type.cpp') diff --git a/src/check_type.cpp b/src/check_type.cpp index 4d1359848..93040e493 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -2209,7 +2209,7 @@ Type *type_to_abi_compat_param_type(gbAllocator a, Type *original_type, ProcCall return new_type; } - if (cc == ProcCC_None || cc == ProcCC_PureNone) { + if (cc == ProcCC_None || cc == ProcCC_PureNone || cc == ProcCC_InlineAsm) { return new_type; } @@ -2328,10 +2328,15 @@ Type *type_to_abi_compat_result_type(gbAllocator a, Type *original_type, ProcCal Type *single_type = reduce_tuple_to_single_type(original_type); + if (cc == ProcCC_InlineAsm) { + return new_type; + } + if (is_type_simd_vector(single_type)) { return new_type; } + if (build_context.ODIN_OS == "windows") { if (build_context.ODIN_ARCH == "amd64") { if (is_type_integer_128bit(single_type)) { @@ -2401,7 +2406,7 @@ bool abi_compat_return_by_pointer(gbAllocator a, ProcCallingConvention cc, Type if (abi_return_type == nullptr) { return false; } - if (cc == ProcCC_None || cc == ProcCC_PureNone) { + if (cc == ProcCC_None || cc == ProcCC_PureNone || cc == ProcCC_InlineAsm) { return false; } -- cgit v1.2.3