1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/lib/Target/Nios2/Nios2CallingConv.td
Nikolai Bozhenov a1d10f171e [Nios2] final infrastructure to provide compilation of a return from a function
This patch includes all missing functionality needed to provide first
compilation of a simple program that just returns from a function.
I've added a test case that checks for "ret" instruction printed in assembly
output.

Patch by Andrei Grischenko (andrei.l.grischenko@intel.com)
Differential revision: https://reviews.llvm.org/D39688

llvm-svn: 320035
2017-12-07 12:35:02 +00:00

35 lines
1.4 KiB
TableGen

//===- Nios2CallingConv.td - Calling Conventions for Nios2 -*- tablegen -*-===//
//
// 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 Nios2 architecture.
//===----------------------------------------------------------------------===//
/// CCIfSubtarget - Match if the current subtarget has a feature F.
class CCIfSubtarget<string F, CCAction A>:
CCIf<!strconcat("State.getTarget().getSubtarget<Nios2Subtarget>().", F), A>;
def CC_Nios2 : CallingConv<[
// i32 f32 arguments get passed in integer registers if there is space.
CCIfType<[i32, f32], CCAssignToReg<[R4, R5, R6, R7]>>,
// Alternatively, they are assigned to the stack in 4-byte aligned units.
CCAssignToStack<4, 4>
]>;
def RetCC_Nios2EABI : CallingConv<[
// i32 are returned in registers R2, R3
CCIfType<[i32], CCAssignToReg<[R2, R3]>>,
// In case of floating point (FPH2 instr.) also use the same register set
CCIfType<[f32], CCAssignToReg<[R2, R3]>>,
CCIfByVal<CCPassByVal<4, 4>>,
// Stack parameter slots for i32 is 32-bit words and 4-byte aligned.
CCIfType<[i32], CCAssignToStack<4, 4>>
]>;
def CSR : CalleeSavedRegs<(add RA, FP, (sequence "R%u", 16, 23))>;