-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
abi_win64.cpp
55 lines (47 loc) · 1.61 KB
/
abi_win64.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//===-- abi_win64.cpp - Windows x86_64 ABI description ----------*- C++ -*-===https://
//
// LDC – the LLVM D compiler
//
// This file is distributed under the BSD-style LDC license. See the LICENSE
// file for details.
//
//===----------------------------------------------------------------------===https://
//
// The ABI implementation used for 64 bit x86 (i.e. x86_64/AMD64/x64) targets
// on Windows.
//
//===----------------------------------------------------------------------===https://
struct AbiState {
};
const AbiState default_abi_state = {};
bool use_sret(AbiState *state, jl_value_t *ty)
{
if(!jl_is_datatype(ty) || jl_is_abstracttype(ty) || jl_is_cpointer_type(ty) || jl_is_array_type(ty))
return false;
size_t size = jl_datatype_size(ty);
if (size <= 8)
return false;
return true;
}
void needPassByRef(AbiState *state, jl_value_t *ty, bool *byRef, bool *inReg, bool *byRefAttr)
{
if(!jl_is_datatype(ty) || jl_is_abstracttype(ty) || jl_is_cpointer_type(ty) || jl_is_array_type(ty))
return;
size_t size = jl_datatype_size(ty);
if (size > 8)
*byRefAttr = *byRef = true;
}
Type *preferred_llvm_type(jl_value_t *ty, bool isret)
{
if (!jl_is_datatype(ty) || jl_is_abstracttype(ty) || jl_is_cpointer_type(ty) || jl_is_array_type(ty))
return NULL;
size_t size = jl_datatype_size(ty);
if (size > 0 && size <= 8)
return Type::getIntNTy(getGlobalContext(), size*8);
return NULL;
}
// Windows needs all types pased byRef to be passed in caller allocated memory
bool need_private_copy(jl_value_t *ty, bool byRef)
{
return byRef;
}