1 //===---- MipsCCState.h - CCState with Mips specific extensions -----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/CodeGen/CallingConvLower.h"
15 #include "MipsISelLowering.h"
21 class MipsCCState : public CCState {
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);
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 TargetLowering::CallLoweringInfo &CLI);
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
43 PreAnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
44 std::vector<TargetLowering::ArgListEntry> &FuncArgs,
45 const SDNode *CallNode);
47 /// Identify lowered values that originated from f128 arguments and record
50 PreAnalyzeFormalArgumentsForF128(const SmallVectorImpl<ISD::InputArg> &Ins);
52 /// Records whether the value has been lowered from an f128.
53 SmallVector<bool, 4> OriginalArgWasF128;
55 /// Records whether the value was a fixed argument.
56 /// See ISD::OutputArg::IsFixed,
57 SmallVector<bool, 4> CallOperandIsFixed;
59 // Used to handle MIPS16-specific calling convention tweaks.
60 // FIXME: This should probably be a fully fledged calling convention.
61 SpecialCallingConvType SpecialCallingConv;
64 MipsCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
65 SmallVectorImpl<CCValAssign> &locs, LLVMContext &C,
66 SpecialCallingConvType SpecialCC = NoSpecialCallingConv)
67 : CCState(CC, isVarArg, MF, locs, C), SpecialCallingConv(SpecialCC) {}
70 AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
72 std::vector<TargetLowering::ArgListEntry> &FuncArgs,
73 const SDNode *CallNode) {
74 PreAnalyzeCallOperands(Outs, FuncArgs, CallNode);
75 CCState::AnalyzeCallOperands(Outs, Fn);
76 OriginalArgWasF128.clear();
77 CallOperandIsFixed.clear();
80 // The AnalyzeCallOperands in the base class is not usable since we must
81 // provide a means of accessing ArgListEntry::IsFixed. Delete them from this
82 // class. This doesn't stop them being used via the base class though.
83 void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
84 CCAssignFn Fn) LLVM_DELETED_FUNCTION;
85 void AnalyzeCallOperands(const SmallVectorImpl<MVT> &Outs,
86 SmallVectorImpl<ISD::ArgFlagsTy> &Flags,
87 CCAssignFn Fn) LLVM_DELETED_FUNCTION;
89 void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
91 PreAnalyzeFormalArgumentsForF128(Ins);
92 CCState::AnalyzeFormalArguments(Ins, Fn);
93 OriginalArgWasF128.clear();
96 void AnalyzeCallResult(const SmallVectorImpl<ISD::InputArg> &Ins,
98 const TargetLowering::CallLoweringInfo &CLI) {
99 PreAnalyzeCallResultForF128(Ins, CLI);
100 CCState::AnalyzeCallResult(Ins, Fn);
101 OriginalArgWasF128.clear();
104 void AnalyzeReturn(const SmallVectorImpl<ISD::OutputArg> &Outs,
106 PreAnalyzeReturnForF128(Outs);
107 CCState::AnalyzeReturn(Outs, Fn);
108 OriginalArgWasF128.clear();
111 bool CheckReturn(const SmallVectorImpl<ISD::OutputArg> &ArgsFlags,
113 PreAnalyzeReturnForF128(ArgsFlags);
114 bool Return = CCState::CheckReturn(ArgsFlags, Fn);
115 OriginalArgWasF128.clear();
119 bool WasOriginalArgF128(unsigned ValNo) { return OriginalArgWasF128[ValNo]; }
120 bool IsCallOperandFixed(unsigned ValNo) { return CallOperandIsFixed[ValNo]; }
121 SpecialCallingConvType getSpecialCallingConv() { return SpecialCallingConv; }