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 {...}`
This commit is contained in:
gingerBill
2020-10-24 16:32:37 +01:00
parent 0061e63db0
commit 4629754f7c
8 changed files with 271 additions and 14 deletions
+7 -2
View File
@@ -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;
}