blob: 9f9692bf67feaa4442115a7a0005cd6369d29412 [file] [log] [blame]
Chris Lattner23e70eb2010-08-17 16:20:04 +00001//===- SPUCallingConv.td - Calling Conventions for CellSPU -*- tablegen -*-===//
Jia Liu31d157a2012-02-18 12:03:15 +00002//
Scott Michel266bc8f2007-12-04 22:23:35 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jia Liu31d157a2012-02-18 12:03:15 +00007//
Scott Michel266bc8f2007-12-04 22:23:35 +00008//===----------------------------------------------------------------------===//
9//
10// This describes the calling conventions for the STI Cell SPU architecture.
11//
12//===----------------------------------------------------------------------===//
13
14/// CCIfSubtarget - Match if the current subtarget has a feature F.
15class CCIfSubtarget<string F, CCAction A>
16 : CCIf<!strconcat("State.getTarget().getSubtarget<PPCSubtarget>().", F), A>;
17
18//===----------------------------------------------------------------------===//
19// Return Value Calling Convention
20//===----------------------------------------------------------------------===//
21
Kalle Raiskila44ff5f52010-08-18 09:50:30 +000022// Return-value convention for Cell SPU: return value to be passed in reg 3-74
Scott Michel266bc8f2007-12-04 22:23:35 +000023def RetCC_SPU : CallingConv<[
Kalle Raiskila86a79122010-08-18 10:04:39 +000024 CCIfType<[i8,i16,i32,i64,i128,f32,f64,v16i8,v8i16,v4i32,v2i64,v4f32,v2f64],
Kalle Raiskila44ff5f52010-08-18 09:50:30 +000025 CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10, R11,
26 R12, R13, R14, R15, R16, R17, R18, R19, R20,
27 R21, R22, R23, R24, R25, R26, R27, R28, R29,
28 R30, R31, R32, R33, R34, R35, R36, R37, R38,
29 R39, R40, R41, R42, R43, R44, R45, R46, R47,
30 R48, R49, R50, R51, R52, R53, R54, R55, R56,
31 R57, R58, R59, R60, R61, R62, R63, R64, R65,
32 R66, R67, R68, R69, R70, R71, R72, R73, R74]>>
Scott Michel266bc8f2007-12-04 22:23:35 +000033]>;
34
35
36//===----------------------------------------------------------------------===//
37// CellSPU Argument Calling Conventions
Scott Michel266bc8f2007-12-04 22:23:35 +000038//===----------------------------------------------------------------------===//
Kalle Raiskilad258c492010-07-08 21:15:22 +000039def CCC_SPU : CallingConv<[
40 CCIfType<[i8, i16, i32, i64, i128, f32, f64,
Kalle Raiskila86a79122010-08-18 10:04:39 +000041 v16i8, v8i16, v4i32, v4f32, v2i64, v2f64],
Kalle Raiskilad258c492010-07-08 21:15:22 +000042 CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10, R11,
43 R12, R13, R14, R15, R16, R17, R18, R19, R20,
44 R21, R22, R23, R24, R25, R26, R27, R28, R29,
45 R30, R31, R32, R33, R34, R35, R36, R37, R38,
46 R39, R40, R41, R42, R43, R44, R45, R46, R47,
47 R48, R49, R50, R51, R52, R53, R54, R55, R56,
48 R57, R58, R59, R60, R61, R62, R63, R64, R65,
Kalle Raiskila44ff5f52010-08-18 09:50:30 +000049 R66, R67, R68, R69, R70, R71, R72, R73, R74]>>,
Scott Michel266bc8f2007-12-04 22:23:35 +000050 // Integer/FP values get stored in stack slots that are 8 bytes in size and
51 // 8-byte aligned if there are no more registers to hold them.
52 CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>,
53
54 // Vectors get 16-byte stack slots that are 16-byte aligned.
55 CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
Scott Michelb30e8f62008-12-02 19:53:53 +000056 CCAssignToStack<16, 16>>
Scott Michel266bc8f2007-12-04 22:23:35 +000057]>;