1 //===- TargetCallingConv.td - Target Calling Conventions ---*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Chris Lattner and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the target-independent interfaces with which targets
11 // describe their calling conventions.
13 //===----------------------------------------------------------------------===//
18 /// CCPredicateAction - Instances of this class check some predicate, then
19 /// delegate to another action if the predicate is true.
20 class CCPredicateAction<CCAction A> : CCAction {
21 CCAction SubAction = A;
24 /// CCMatchType - If the current argument is one of the specified types, apply
26 class CCMatchType<list<ValueType> vts, CCAction A> : CCPredicateAction<A> {
27 list<ValueType> VTs = vts;
30 /// CCMatchIf - If the predicate matches, apply A.
31 class CCMatchIf<string predicate, CCAction A> : CCPredicateAction<A> {
32 string Predicate = predicate;
35 /// CCMatchIfCC - Match of the current calling convention is 'CC'.
36 class CCMatchIfCC<string CC, CCAction A>
37 : CCMatchIf<!strconcat("State.getCallingConv() == ", CC), A> {}
39 /// CCAssignToReg - This action matches if there is a register in the specified
40 /// list that is still available. If so, it assigns the value to the first
41 /// available register and succeeds.
42 class CCAssignToReg<list<Register> regList> : CCAction {
43 list<Register> RegList = regList;
46 /// CCAssignToStack - This action always matches: it assigns the value to a
47 /// stack slot of the specified size and alignment on the stack.
48 class CCAssignToStack<int size, int align> : CCAction {
54 /// CCPromoteToType - If applied, this promotes the specified current value to
55 /// the specified type.
56 class CCPromoteToType<ValueType destTy> : CCAction {
57 ValueType DestTy = destTy;
60 /// CCDelegateTo - This action invokes the specified sub-calling-convention. It
61 /// is successful if the specified CC matches.
62 class CCDelegateTo<CallingConv cc> : CCAction {
66 /// CallingConv - An instance of this is used to define each calling convention
67 /// that the target supports.
68 class CallingConv<list<CCAction> actions> {
69 list<CCAction> Actions = actions;