| Chris Lattner | db2049f | 2007-02-27 05:57:32 +0000 | [diff] [blame] | 1 | //===- 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 |  | 
|  | 15 | class CCAction; | 
|  | 16 | class CallingConv; | 
|  | 17 |  | 
|  | 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; | 
|  | 22 | } | 
|  | 23 |  | 
| Chris Lattner | 6f287c6 | 2007-02-28 05:29:33 +0000 | [diff] [blame^] | 24 | /// CCIfType - If the current argument is one of the specified types, apply | 
| Chris Lattner | db2049f | 2007-02-27 05:57:32 +0000 | [diff] [blame] | 25 | /// Action A. | 
| Chris Lattner | 6f287c6 | 2007-02-28 05:29:33 +0000 | [diff] [blame^] | 26 | class CCIfType<list<ValueType> vts, CCAction A> : CCPredicateAction<A> { | 
| Chris Lattner | aeb9ebe | 2007-02-27 20:45:02 +0000 | [diff] [blame] | 27 | list<ValueType> VTs = vts; | 
| Chris Lattner | db2049f | 2007-02-27 05:57:32 +0000 | [diff] [blame] | 28 | } | 
|  | 29 |  | 
| Chris Lattner | 6f287c6 | 2007-02-28 05:29:33 +0000 | [diff] [blame^] | 30 | /// CCIf - If the predicate matches, apply A. | 
|  | 31 | class CCIf<string predicate, CCAction A> : CCPredicateAction<A> { | 
| Chris Lattner | db2049f | 2007-02-27 05:57:32 +0000 | [diff] [blame] | 32 | string Predicate = predicate; | 
|  | 33 | } | 
|  | 34 |  | 
| Chris Lattner | 6f287c6 | 2007-02-28 05:29:33 +0000 | [diff] [blame^] | 35 | /// CCIfCC - Match of the current calling convention is 'CC'. | 
|  | 36 | class 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. | 
|  | 41 | class CCIfInReg<CCAction A> : CCIf<"ArgFlags & 2", A> {} | 
|  | 42 |  | 
| Chris Lattner | db2049f | 2007-02-27 05:57:32 +0000 | [diff] [blame] | 43 |  | 
|  | 44 | /// CCAssignToReg - This action matches if there is a register in the specified | 
|  | 45 | /// list that is still available.  If so, it assigns the value to the first | 
|  | 46 | /// available register and succeeds. | 
|  | 47 | class CCAssignToReg<list<Register> regList> : CCAction { | 
|  | 48 | list<Register> RegList = regList; | 
|  | 49 | } | 
|  | 50 |  | 
|  | 51 | /// CCAssignToStack - This action always matches: it assigns the value to a | 
|  | 52 | /// stack slot of the specified size and alignment on the stack. | 
|  | 53 | class CCAssignToStack<int size, int align> : CCAction { | 
|  | 54 | int Size = size; | 
|  | 55 | int Align = align; | 
|  | 56 | } | 
|  | 57 |  | 
|  | 58 |  | 
|  | 59 | /// CCPromoteToType - If applied, this promotes the specified current value to | 
|  | 60 | /// the specified type. | 
|  | 61 | class CCPromoteToType<ValueType destTy> : CCAction { | 
|  | 62 | ValueType DestTy = destTy; | 
|  | 63 | } | 
|  | 64 |  | 
|  | 65 | /// CCDelegateTo - This action invokes the specified sub-calling-convention.  It | 
|  | 66 | /// is successful if the specified CC matches. | 
|  | 67 | class CCDelegateTo<CallingConv cc> : CCAction { | 
|  | 68 | CallingConv CC = cc; | 
|  | 69 | } | 
|  | 70 |  | 
|  | 71 | /// CallingConv - An instance of this is used to define each calling convention | 
|  | 72 | /// that the target supports. | 
|  | 73 | class CallingConv<list<CCAction> actions> { | 
|  | 74 | list<CCAction> Actions = actions; | 
|  | 75 | } | 
|  | 76 |  |