8b8146762b6a8080df834f00ffd1c5a2869dd344
[oota-llvm.git] / lib / Target / SystemZ / SystemZCallingConv.h
1 //===-- SystemZCallingConv.h - Calling conventions for SystemZ --*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCALLINGCONV_H
11 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCALLINGCONV_H
12
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/CodeGen/CallingConvLower.h"
15
16 namespace llvm {
17 namespace SystemZ {
18   const unsigned NumArgGPRs = 5;
19   extern const unsigned ArgGPRs[NumArgGPRs];
20
21   const unsigned NumArgFPRs = 4;
22   extern const unsigned ArgFPRs[NumArgFPRs];
23 } // end namespace SystemZ
24
25 class SystemZCCState : public CCState {
26 private:
27   /// Records whether the value was a fixed argument.
28   /// See ISD::OutputArg::IsFixed.
29   SmallVector<bool, 4> ArgIsFixed;
30
31 public:
32   SystemZCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
33                  SmallVectorImpl<CCValAssign> &locs, LLVMContext &C)
34       : CCState(CC, isVarArg, MF, locs, C) {}
35
36   void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
37                               CCAssignFn Fn) {
38     // Formal arguments are always fixed.
39     ArgIsFixed.clear();
40     for (unsigned i = 0; i < Ins.size(); ++i)
41       ArgIsFixed.push_back(true);
42
43     CCState::AnalyzeFormalArguments(Ins, Fn);
44   }
45
46   void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
47                            CCAssignFn Fn) {
48     // Record whether the call operand was a fixed argument.
49     ArgIsFixed.clear();
50     for (unsigned i = 0; i < Outs.size(); ++i)
51       ArgIsFixed.push_back(Outs[i].IsFixed);
52
53     CCState::AnalyzeCallOperands(Outs, Fn);
54   }
55
56   // This version of AnalyzeCallOperands in the base class is not usable
57   // since we must provide a means of accessing ISD::OutputArg::IsFixed.
58   void AnalyzeCallOperands(const SmallVectorImpl<MVT> &Outs,
59                            SmallVectorImpl<ISD::ArgFlagsTy> &Flags,
60                            CCAssignFn Fn) = delete;
61
62   bool IsFixed(unsigned ValNo) { return ArgIsFixed[ValNo]; }
63 };
64
65 } // end namespace llvm
66
67 #endif