aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-10-24 16:32:37 +0100
committergingerBill <bill@gingerbill.org>2020-10-24 16:32:37 +0100
commit4629754f7ced5df477eb017872ef65539db64a27 (patch)
treefc2fc4b7a493c58adeb10bf54254fbbad66f2f67 /src/check_type.cpp
parent0061e63db010cdb2043af63527b4c25f45652a51 (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_type.cpp')
-rw-r--r--src/check_type.cpp9
1 files changed, 7 insertions, 2 deletions
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;
}