forked from Hoernchen/Epiphany
-
Notifications
You must be signed in to change notification settings - Fork 2
/
EpiphanyCallingConv.td
54 lines (44 loc) · 2.11 KB
/
EpiphanyCallingConv.td
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
//==-- EpiphanyCallingConv.td - Calling Conventions for ARM ----*- tblgen -*-==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// This describes the calling conventions for Epiphany architecture.
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
// Epiphany Argument Calling Conventions
//===----------------------------------------------------------------------===//
def CC_Epiphany_Assign : CallingConv<[
// Put ByVal arguments directly on the stack.
CCIfByVal<CCPassByVal<4, 4>>,
// Promote all ints to natural i32
CCIfType<[i1, i8, i16], CCPromoteToType<i32>>,
CCIfType<[f16], CCPromoteToType<f32>>,
// First try to assign to the first 8 regs so that we will be able to use 16-bit instr
CCIfType<[i32,f32], CCAssignToReg<[R0, R1, R2, R3]>>,
// If still no luck - save to stack
CCIfType<[i32,f32], CCAssignToStack<4, 4>>,
// Pass 64-bit within 2 first regs or in the stack
CCIfType<[i64,f64], CCAssignToReg<[D0, D1]>>,
CCIfType<[i64,f64], CCAssignToStack<8, 8>>,
CCAssignToStack<8, 8>
]>;
//===----------------------------------------------------------------------===//
// Epiphany Return Value Calling Convention
//===----------------------------------------------------------------------===//
def RetCC_Epiphany : CallingConv<[
CCIfType<[i1, i8, i16], CCPromoteToType<i32>>,
CCIfType<[f16], CCPromoteToType<f32>>,
// Result to be returned in first 4 regs
CCIfType<[i32,f32], CCAssignToReg<[R0, R1, R2, R3]>>,
// Alternatively, they are assigned to the stack in 4-byte aligned units.
CCIfType<[i32,f32], CCAssignToStack<4, 4>>,
// Pass 64-bit within 2 first regs or in the stack
CCIfType<[i64,f64], CCAssignToReg<[D0, D1]>>,
CCIfType<[i64,f64], CCAssignToStack<8, 8>>,
CCAssignToStack<8, 8>
]>;
def CSR32 : CalleeSavedRegs<(add R4, R5, R6, R7, R8, SB, SL, FP, LR, R15)>;