LLVM  4.0.0
MipsCCState.h
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
9 
10 #ifndef MIPSCCSTATE_H
11 #define MIPSCCSTATE_H
12 
13 #include "MipsISelLowering.h"
14 #include "llvm/ADT/SmallVector.h"
16 
17 namespace llvm {
18 class SDNode;
19 class MipsSubtarget;
20 
21 class MipsCCState : public CCState {
22 public:
24 
25  /// Determine the SpecialCallingConvType for the given callee
28  const MipsSubtarget &Subtarget);
29 
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,
35 
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);
39 
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 SDNode *CallNode);
46 
47  /// Identify lowered values that originated from f128 arguments and record
48  /// this.
49  void
50  PreAnalyzeFormalArgumentsForF128(const SmallVectorImpl<ISD::InputArg> &Ins);
51 
52  /// Records whether the value has been lowered from an f128.
53  SmallVector<bool, 4> OriginalArgWasF128;
54 
55  /// Records whether the value has been lowered from float.
56  SmallVector<bool, 4> OriginalArgWasFloat;
57 
58  /// Records whether the value was a fixed argument.
59  /// See ISD::OutputArg::IsFixed,
60  SmallVector<bool, 4> CallOperandIsFixed;
61 
62  // Used to handle MIPS16-specific calling convention tweaks.
63  // FIXME: This should probably be a fully fledged calling convention.
64  SpecialCallingConvType SpecialCallingConv;
65 
66 public:
70  : CCState(CC, isVarArg, MF, locs, C), SpecialCallingConv(SpecialCC) {}
71 
72  void
74  CCAssignFn Fn,
75  std::vector<TargetLowering::ArgListEntry> &FuncArgs,
76  const SDNode *CallNode) {
77  PreAnalyzeCallOperands(Outs, FuncArgs, CallNode);
79  OriginalArgWasF128.clear();
80  OriginalArgWasFloat.clear();
81  CallOperandIsFixed.clear();
82  }
83 
84  // The AnalyzeCallOperands in the base class is not usable since we must
85  // provide a means of accessing ArgListEntry::IsFixed. Delete them from this
86  // class. This doesn't stop them being used via the base class though.
88  CCAssignFn Fn) = delete;
91  CCAssignFn Fn) = delete;
92 
94  CCAssignFn Fn) {
95  PreAnalyzeFormalArgumentsForF128(Ins);
97  OriginalArgWasFloat.clear();
98  OriginalArgWasF128.clear();
99  }
100 
102  CCAssignFn Fn,
104  PreAnalyzeCallResultForF128(Ins, CLI);
106  OriginalArgWasFloat.clear();
107  OriginalArgWasF128.clear();
108  }
109 
111  CCAssignFn Fn) {
112  PreAnalyzeReturnForF128(Outs);
113  CCState::AnalyzeReturn(Outs, Fn);
114  OriginalArgWasFloat.clear();
115  OriginalArgWasF128.clear();
116  }
117 
119  CCAssignFn Fn) {
120  PreAnalyzeReturnForF128(ArgsFlags);
121  bool Return = CCState::CheckReturn(ArgsFlags, Fn);
122  OriginalArgWasFloat.clear();
123  OriginalArgWasF128.clear();
124  return Return;
125  }
126 
127  bool WasOriginalArgF128(unsigned ValNo) { return OriginalArgWasF128[ValNo]; }
128  bool WasOriginalArgFloat(unsigned ValNo) {
129  return OriginalArgWasFloat[ValNo];
130  }
131  bool IsCallOperandFixed(unsigned ValNo) { return CallOperandIsFixed[ValNo]; }
132  SpecialCallingConvType getSpecialCallingConv() { return SpecialCallingConv; }
133 };
134 }
135 
136 #endif
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeCallResult - Analyze the return values of a call, incorporating info about the passed values i...
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
Definition: MipsCCState.h:93
void AnalyzeFormalArguments(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn)
AnalyzeFormalArguments - Analyze an array of argument values, incorporating info about the formals in...
bool CCAssignFn(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
CCAssignFn - This function assigns a location for Val, updating State to reflect the change...
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &ArgsFlags, CCAssignFn Fn)
CheckReturn - Analyze the return values of a function, returning true if the return can be performed ...
bool WasOriginalArgFloat(unsigned ValNo)
Definition: MipsCCState.h:128
struct fuzzer::@269 Flags
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn, const TargetLowering::CallLoweringInfo &CLI)
Definition: MipsCCState.h:101
static SpecialCallingConvType getSpecialCallingConvForCallee(const SDNode *Callee, const MipsSubtarget &Subtarget)
Determine the SpecialCallingConvType for the given callee.
Definition: MipsCCState.cpp:58
bool WasOriginalArgF128(unsigned ValNo)
Definition: MipsCCState.h:127
MipsCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF, SmallVectorImpl< CCValAssign > &locs, LLVMContext &C, SpecialCallingConvType SpecialCC=NoSpecialCallingConv)
Definition: MipsCCState.h:67
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:48
SpecialCallingConvType getSpecialCallingConv()
Definition: MipsCCState.h:132
bool isVarArg() const
This structure contains all information that is necessary for lowering calls.
CCState - This class holds information needed while lowering arguments and return values...
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn, std::vector< TargetLowering::ArgListEntry > &FuncArgs, const SDNode *CallNode)
Definition: MipsCCState.h:73
Represents one node in the SelectionDAG.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
bool IsCallOperandFixed(unsigned ValNo)
Definition: MipsCCState.h:131
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
Definition: MipsCCState.h:110
void AnalyzeReturn(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeReturn - Analyze the returned values of a return, incorporating info about the result values i...
bool CheckReturn(const SmallVectorImpl< ISD::OutputArg > &ArgsFlags, CCAssignFn Fn)
Definition: MipsCCState.h:118