blob: e710ad08e7746de5a36186096e2fe2492ee73b35 [file] [log] [blame]
Chris Lattner00836642007-02-27 05:57:32 +00001//===- TargetCallingConv.td - Target Calling Conventions ---*- tablegen -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
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.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the target-independent interfaces with which targets
11// describe their calling conventions.
12//
13//===----------------------------------------------------------------------===//
14
15class CCAction;
16class CallingConv;
17
18/// CCPredicateAction - Instances of this class check some predicate, then
19/// delegate to another action if the predicate is true.
20class CCPredicateAction<CCAction A> : CCAction {
21 CCAction SubAction = A;
22}
23
Chris Lattner62247f62007-02-28 05:29:33 +000024/// CCIfType - If the current argument is one of the specified types, apply
Chris Lattner00836642007-02-27 05:57:32 +000025/// Action A.
Chris Lattner62247f62007-02-28 05:29:33 +000026class CCIfType<list<ValueType> vts, CCAction A> : CCPredicateAction<A> {
Chris Lattnerf4580302007-02-27 20:45:02 +000027 list<ValueType> VTs = vts;
Chris Lattner00836642007-02-27 05:57:32 +000028}
29
Chris Lattner62247f62007-02-28 05:29:33 +000030/// CCIf - If the predicate matches, apply A.
31class CCIf<string predicate, CCAction A> : CCPredicateAction<A> {
Chris Lattner00836642007-02-27 05:57:32 +000032 string Predicate = predicate;
33}
34
Chris Lattner62247f62007-02-28 05:29:33 +000035/// CCIfCC - Match of the current calling convention is 'CC'.
36class CCIfCC<string CC, CCAction A>
37 : CCIf<!strconcat("State.getCallingConv() == ", CC), A> {}
38
39/// CCIfInReg - If this argument is marked with the 'inreg' attribute, apply
40/// the specified action.
Anton Korobeynikovd0b82b32007-03-07 16:25:09 +000041class CCIfInReg<CCAction A> : CCIf<"ArgFlags & ISD::ParamFlags::InReg", A> {}
Chris Lattner62247f62007-02-28 05:29:33 +000042
Chris Lattner52387be2007-06-19 00:13:10 +000043/// CCIfNotVarArg - If the current function is not vararg - apply the action
44class CCIfNotVarArg<CCAction A> : CCIf<"!State.isVarArg()", A> {}
Chris Lattner00836642007-02-27 05:57:32 +000045
46/// CCAssignToReg - This action matches if there is a register in the specified
47/// list that is still available. If so, it assigns the value to the first
48/// available register and succeeds.
49class CCAssignToReg<list<Register> regList> : CCAction {
50 list<Register> RegList = regList;
51}
52
53/// CCAssignToStack - This action always matches: it assigns the value to a
54/// stack slot of the specified size and alignment on the stack.
55class CCAssignToStack<int size, int align> : CCAction {
56 int Size = size;
57 int Align = align;
58}
59
60
61/// CCPromoteToType - If applied, this promotes the specified current value to
62/// the specified type.
63class CCPromoteToType<ValueType destTy> : CCAction {
64 ValueType DestTy = destTy;
65}
66
67/// CCDelegateTo - This action invokes the specified sub-calling-convention. It
68/// is successful if the specified CC matches.
69class CCDelegateTo<CallingConv cc> : CCAction {
70 CallingConv CC = cc;
71}
72
73/// CallingConv - An instance of this is used to define each calling convention
74/// that the target supports.
75class CallingConv<list<CCAction> actions> {
76 list<CCAction> Actions = actions;
77}
78