Fix uninitialized variable
[llvm-core.git] / lib / Target / Mips / MipsCCState.h
blob27901699480bfe194b930b03f4b9978f2b09354c
1 //===---- MipsCCState.h - CCState with Mips specific extensions -----------===//
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 //===----------------------------------------------------------------------===//
10 #ifndef MIPSCCSTATE_H
11 #define MIPSCCSTATE_H
13 #include "MipsISelLowering.h"
14 #include "llvm/ADT/SmallVector.h"
15 #include "llvm/CodeGen/CallingConvLower.h"
17 namespace llvm {
18 class SDNode;
19 class MipsSubtarget;
21 class MipsCCState : public CCState {
22 public:
23 enum SpecialCallingConvType { Mips16RetHelperConv, NoSpecialCallingConv };
25 /// Determine the SpecialCallingConvType for the given callee
26 static SpecialCallingConvType
27 getSpecialCallingConvForCallee(const SDNode *Callee,
28 const MipsSubtarget &Subtarget);
30 private:
31 /// Identify lowered values that originated from f128 arguments and record
32 /// this for use by RetCC_MipsN.
33 void PreAnalyzeCallResultForF128(const SmallVectorImpl<ISD::InputArg> &Ins,
34 const Type *RetTy, const char * Func);
36 /// Identify lowered values that originated from f128 arguments and record
37 /// this for use by RetCC_MipsN.
38 void PreAnalyzeReturnForF128(const SmallVectorImpl<ISD::OutputArg> &Outs);
40 /// Identify lowered values that originated from f128 arguments and record
41 /// this.
42 void
43 PreAnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
44 std::vector<TargetLowering::ArgListEntry> &FuncArgs,
45 const char *Func);
47 /// Identify lowered values that originated from f128 arguments and record
48 /// this for use by RetCC_MipsN.
49 void
50 PreAnalyzeFormalArgumentsForF128(const SmallVectorImpl<ISD::InputArg> &Ins);
52 void
53 PreAnalyzeCallResultForVectorFloat(const SmallVectorImpl<ISD::InputArg> &Ins,
54 const Type *RetTy);
56 void PreAnalyzeFormalArgumentsForVectorFloat(
57 const SmallVectorImpl<ISD::InputArg> &Ins);
59 void
60 PreAnalyzeReturnForVectorFloat(const SmallVectorImpl<ISD::OutputArg> &Outs);
62 /// Records whether the value has been lowered from an f128.
63 SmallVector<bool, 4> OriginalArgWasF128;
65 /// Records whether the value has been lowered from float.
66 SmallVector<bool, 4> OriginalArgWasFloat;
68 /// Records whether the value has been lowered from a floating point vector.
69 SmallVector<bool, 4> OriginalArgWasFloatVector;
71 /// Records whether the return value has been lowered from a floating point
72 /// vector.
73 SmallVector<bool, 4> OriginalRetWasFloatVector;
75 /// Records whether the value was a fixed argument.
76 /// See ISD::OutputArg::IsFixed,
77 SmallVector<bool, 4> CallOperandIsFixed;
79 // Used to handle MIPS16-specific calling convention tweaks.
80 // FIXME: This should probably be a fully fledged calling convention.
81 SpecialCallingConvType SpecialCallingConv;
83 public:
84 MipsCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
85 SmallVectorImpl<CCValAssign> &locs, LLVMContext &C,
86 SpecialCallingConvType SpecialCC = NoSpecialCallingConv)
87 : CCState(CC, isVarArg, MF, locs, C), SpecialCallingConv(SpecialCC) {}
89 void
90 AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
91 CCAssignFn Fn,
92 std::vector<TargetLowering::ArgListEntry> &FuncArgs,
93 const char *Func) {
94 PreAnalyzeCallOperands(Outs, FuncArgs, Func);
95 CCState::AnalyzeCallOperands(Outs, Fn);
96 OriginalArgWasF128.clear();
97 OriginalArgWasFloat.clear();
98 OriginalArgWasFloatVector.clear();
99 CallOperandIsFixed.clear();
102 // The AnalyzeCallOperands in the base class is not usable since we must
103 // provide a means of accessing ArgListEntry::IsFixed. Delete them from this
104 // class. This doesn't stop them being used via the base class though.
105 void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
106 CCAssignFn Fn) = delete;
107 void AnalyzeCallOperands(const SmallVectorImpl<MVT> &Outs,
108 SmallVectorImpl<ISD::ArgFlagsTy> &Flags,
109 CCAssignFn Fn) = delete;
111 void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
112 CCAssignFn Fn) {
113 PreAnalyzeFormalArgumentsForF128(Ins);
114 CCState::AnalyzeFormalArguments(Ins, Fn);
115 OriginalArgWasFloat.clear();
116 OriginalArgWasF128.clear();
117 OriginalArgWasFloatVector.clear();
120 void AnalyzeCallResult(const SmallVectorImpl<ISD::InputArg> &Ins,
121 CCAssignFn Fn, const Type *RetTy,
122 const char *Func) {
123 PreAnalyzeCallResultForF128(Ins, RetTy, Func);
124 PreAnalyzeCallResultForVectorFloat(Ins, RetTy);
125 CCState::AnalyzeCallResult(Ins, Fn);
126 OriginalArgWasFloat.clear();
127 OriginalArgWasF128.clear();
128 OriginalArgWasFloatVector.clear();
131 void AnalyzeReturn(const SmallVectorImpl<ISD::OutputArg> &Outs,
132 CCAssignFn Fn) {
133 PreAnalyzeReturnForF128(Outs);
134 PreAnalyzeReturnForVectorFloat(Outs);
135 CCState::AnalyzeReturn(Outs, Fn);
136 OriginalArgWasFloat.clear();
137 OriginalArgWasF128.clear();
138 OriginalArgWasFloatVector.clear();
141 bool CheckReturn(const SmallVectorImpl<ISD::OutputArg> &ArgsFlags,
142 CCAssignFn Fn) {
143 PreAnalyzeReturnForF128(ArgsFlags);
144 PreAnalyzeReturnForVectorFloat(ArgsFlags);
145 bool Return = CCState::CheckReturn(ArgsFlags, Fn);
146 OriginalArgWasFloat.clear();
147 OriginalArgWasF128.clear();
148 OriginalArgWasFloatVector.clear();
149 return Return;
152 bool WasOriginalArgF128(unsigned ValNo) { return OriginalArgWasF128[ValNo]; }
153 bool WasOriginalArgFloat(unsigned ValNo) {
154 return OriginalArgWasFloat[ValNo];
156 bool WasOriginalArgVectorFloat(unsigned ValNo) const {
157 return OriginalArgWasFloatVector[ValNo];
159 bool WasOriginalRetVectorFloat(unsigned ValNo) const {
160 return OriginalRetWasFloatVector[ValNo];
162 bool IsCallOperandFixed(unsigned ValNo) { return CallOperandIsFixed[ValNo]; }
163 SpecialCallingConvType getSpecialCallingConv() { return SpecialCallingConv; }
167 #endif