llvm.org GIT mirror llvm / d1474d0
Thread LLVMContext through MVT and related parts of SDISel. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75153 91177308-0d34-0410-b5e6-96231b3b80d8 Owen Anderson 11 years ago
25 changed file(s) with 131 addition(s) and 101 deletion(s). Raw diff Collapse all Expand all
141141 const TargetMachine &TM;
142142 const TargetRegisterInfo &TRI;
143143 SmallVector &Locs;
144 LLVMContext *Context;
144145
145146 unsigned StackOffset;
146147 SmallVector UsedRegs;
147148 public:
148149 CCState(unsigned CC, bool isVarArg, const TargetMachine &TM,
149 SmallVector &locs);
150 SmallVector &locs, LLVMContext *C);
150151
151152 void addLoc(const CCValAssign &V) {
152153 Locs.push_back(V);
153154 }
154155
156 LLVMContext *getContext() const { return Context; }
155157 const TargetMachine &getTarget() const { return TM; }
156158 unsigned getCallingConv() const { return CallingConv; }
157159 bool isVarArg() const { return IsVarArg; }
7777 FunctionLoweringInfo &FLI;
7878 MachineModuleInfo *MMI;
7979 DwarfWriter *DW;
80 LLVMContext* Context;
8081
8182 /// EntryNode - The starting token.
8283 SDNode EntryNode;
124125 /// init - Prepare this SelectionDAG to process code in the given
125126 /// MachineFunction.
126127 ///
127 void init(MachineFunction &mf, MachineModuleInfo *mmi, DwarfWriter *dw);
128 void init(MachineFunction &mf, MachineModuleInfo *mmi, DwarfWriter *dw,
129 LLVMContext* C);
128130
129131 /// clear - Clear state and free memory necessary to make this
130132 /// SelectionDAG ready to process a new block.
137139 FunctionLoweringInfo &getFunctionLoweringInfo() const { return FLI; }
138140 MachineModuleInfo *getMachineModuleInfo() const { return MMI; }
139141 DwarfWriter *getDwarfWriter() const { return DW; }
142 LLVMContext *getContext() const {return Context; }
140143
141144 /// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
142145 ///
2222
2323 namespace llvm {
2424 class Type;
25 class LLVMContext;
2526
2627 struct MVT { // MVT = Machine Value Type
2728 public:
486487 /// getTypeForMVT - This method returns an LLVM type corresponding to the
487488 /// specified MVT. For integer types, this returns an unsigned type. Note
488489 /// that this will abort for types that cannot be represented.
489 const Type *getTypeForMVT() const;
490 const Type *getTypeForMVT(LLVMContext &Context) const;
490491
491492 /// getMVT - Return the value type corresponding to the specified type.
492493 /// This returns all pointers as iPTR. If HandleUnknown is true, unknown
1818 using namespace llvm;
1919
2020 CCState::CCState(unsigned CC, bool isVarArg, const TargetMachine &tm,
21 SmallVector &locs)
21 SmallVector &locs, LLVMContext *C)
2222 : CallingConv(CC), IsVarArg(isVarArg), TM(tm),
23 TRI(*TM.getRegisterInfo()), Locs(locs) {
23 TRI(*TM.getRegisterInfo()), Locs(locs), Context(C) {
2424 // No stack is used.
2525 StackOffset = 0;
2626
36593659 TLI.isConsecutiveLoad(LD2, LD1, LD1VT.getSizeInBits()/8, 1, MFI)) {
36603660 unsigned Align = LD1->getAlignment();
36613661 unsigned NewAlign = TLI.getTargetData()->
3662 getABITypeAlignment(VT.getTypeForMVT());
3662 getABITypeAlignment(VT.getTypeForMVT(*DAG.getContext()));
36633663
36643664 if (NewAlign <= Align &&
36653665 (!LegalOperations || TLI.isOperationLegal(ISD::LOAD, VT)))
37173717 (!LegalOperations || TLI.isOperationLegal(ISD::LOAD, VT))) {
37183718 LoadSDNode *LN0 = cast(N0);
37193719 unsigned Align = TLI.getTargetData()->
3720 getABITypeAlignment(VT.getTypeForMVT());
3720 getABITypeAlignment(VT.getTypeForMVT(*DAG.getContext()));
37213721 unsigned OrigAlign = LN0->getAlignment();
37223722
37233723 if (Align <= OrigAlign) {
49884988
49894989 unsigned NewAlign = MinAlign(LD->getAlignment(), PtrOff);
49904990 if (NewAlign <
4991 TLI.getTargetData()->getABITypeAlignment(NewVT.getTypeForMVT()))
4991 TLI.getTargetData()->getABITypeAlignment(NewVT.getTypeForMVT(
4992 *DAG.getContext())))
49924993 return SDValue();
49934994
49944995 SDValue NewPtr = DAG.getNode(ISD::ADD, LD->getDebugLoc(),
50435044 unsigned OrigAlign = ST->getAlignment();
50445045 MVT SVT = Value.getOperand(0).getValueType();
50455046 unsigned Align = TLI.getTargetData()->
5046 getABITypeAlignment(SVT.getTypeForMVT());
5047 getABITypeAlignment(SVT.getTypeForMVT(*DAG.getContext()));
50475048 if (Align <= OrigAlign &&
50485049 ((!LegalOperations && !ST->isVolatile()) ||
50495050 TLI.isOperationLegalOrCustom(ISD::STORE, SVT)))
53235324 // Check the resultant load doesn't need a higher alignment than the
53245325 // original load.
53255326 unsigned NewAlign =
5326 TLI.getTargetData()->getABITypeAlignment(LVT.getTypeForMVT());
5327 TLI.getTargetData()->getABITypeAlignment(LVT.getTypeForMVT(
5328 *DAG.getContext()));
53275329
53285330 if (NewAlign > Align || !TLI.isOperationLegalOrCustom(ISD::LOAD, LVT))
53295331 return SDValue();
358358 // smaller type.
359359 TLI.isLoadExtLegal(ISD::EXTLOAD, SVT) &&
360360 TLI.ShouldShrinkFPConstant(OrigVT)) {
361 const Type *SType = SVT.getTypeForMVT();
361 const Type *SType = SVT.getTypeForMVT(*DAG.getContext());
362362 LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC, SType));
363363 VT = SVT;
364364 Extend = true;
11051105 // expand it.
11061106 if (!TLI.allowsUnalignedMemoryAccesses()) {
11071107 unsigned ABIAlignment = TLI.getTargetData()->
1108 getABITypeAlignment(LD->getMemoryVT().getTypeForMVT());
1108 getABITypeAlignment(LD->getMemoryVT().getTypeForMVT(
1109 *DAG.getContext()));
11091110 if (LD->getAlignment() < ABIAlignment){
11101111 Result = ExpandUnalignedLoad(cast(Result.getNode()), DAG,
11111112 TLI);
12881289 // expand it.
12891290 if (!TLI.allowsUnalignedMemoryAccesses()) {
12901291 unsigned ABIAlignment = TLI.getTargetData()->
1291 getABITypeAlignment(LD->getMemoryVT().getTypeForMVT());
1292 getABITypeAlignment(LD->getMemoryVT().getTypeForMVT(
1293 *DAG.getContext()));
12921294 if (LD->getAlignment() < ABIAlignment){
12931295 Result = ExpandUnalignedLoad(cast(Result.getNode()), DAG,
12941296 TLI);
13661368 // expand it.
13671369 if (!TLI.allowsUnalignedMemoryAccesses()) {
13681370 unsigned ABIAlignment = TLI.getTargetData()->
1369 getABITypeAlignment(ST->getMemoryVT().getTypeForMVT());
1371 getABITypeAlignment(ST->getMemoryVT().getTypeForMVT(
1372 *DAG.getContext()));
13701373 if (ST->getAlignment() < ABIAlignment)
13711374 Result = ExpandUnalignedStore(cast(Result.getNode()), DAG,
13721375 TLI);
14651468 // expand it.
14661469 if (!TLI.allowsUnalignedMemoryAccesses()) {
14671470 unsigned ABIAlignment = TLI.getTargetData()->
1468 getABITypeAlignment(ST->getMemoryVT().getTypeForMVT());
1471 getABITypeAlignment(ST->getMemoryVT().getTypeForMVT(
1472 *DAG.getContext()));
14691473 if (ST->getAlignment() < ABIAlignment)
14701474 Result = ExpandUnalignedStore(cast(Result.getNode()), DAG,
14711475 TLI);
17271731 // Create the stack frame object.
17281732 unsigned SrcAlign =
17291733 TLI.getTargetData()->getPrefTypeAlignment(SrcOp.getValueType().
1730 getTypeForMVT());
1734 getTypeForMVT(*DAG.getContext()));
17311735 SDValue FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign);
17321736
17331737 FrameIndexSDNode *StackPtrFI = cast(FIPtr);
17381742 unsigned SlotSize = SlotVT.getSizeInBits();
17391743 unsigned DestSize = DestVT.getSizeInBits();
17401744 unsigned DestAlign =
1741 TLI.getTargetData()->getPrefTypeAlignment(DestVT.getTypeForMVT());
1745 TLI.getTargetData()->getPrefTypeAlignment(DestVT.getTypeForMVT(
1746 *DAG.getContext()));
17421747
17431748 // Emit a store to the stack slot. Use a truncstore if the input value is
17441749 // later than DestVT.
18321837 CV.push_back(const_cast(V->getConstantIntValue()));
18331838 } else {
18341839 assert(Node->getOperand(i).getOpcode() == ISD::UNDEF);
1835 const Type *OpNTy = OpVT.getTypeForMVT();
1840 const Type *OpNTy = OpVT.getTypeForMVT(*DAG.getContext());
18361841 CV.push_back(UndefValue::get(OpNTy));
18371842 }
18381843 }
18861891 TargetLowering::ArgListEntry Entry;
18871892 for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
18881893 MVT ArgVT = Node->getOperand(i).getValueType();
1889 const Type *ArgTy = ArgVT.getTypeForMVT();
1894 const Type *ArgTy = ArgVT.getTypeForMVT(*DAG.getContext());
18901895 Entry.Node = Node->getOperand(i); Entry.Ty = ArgTy;
18911896 Entry.isSExt = isSigned;
18921897 Entry.isZExt = !isSigned;
18961901 TLI.getPointerTy());
18971902
18981903 // Splice the libcall in wherever FindInputOutputChains tells us to.
1899 const Type *RetTy = Node->getValueType(0).getTypeForMVT();
1904 const Type *RetTy = Node->getValueType(0).getTypeForMVT(*DAG.getContext());
19001905 std::pair CallInfo =
19011906 TLI.LowerCallTo(InChain, RetTy, isSigned, !isSigned, false, false,
19021907 0, CallingConv::C, false, Callee, Args, DAG,
23852390 // Increment the pointer, VAList, to the next vaarg
23862391 Tmp3 = DAG.getNode(ISD::ADD, dl, TLI.getPointerTy(), VAList,
23872392 DAG.getConstant(TLI.getTargetData()->
2388 getTypeAllocSize(VT.getTypeForMVT()),
2393 getTypeAllocSize(VT.getTypeForMVT(
2394 *DAG.getContext())),
23892395 TLI.getPointerTy()));
23902396 // Store the incremented VAList to the legalized pointer
23912397 Tmp3 = DAG.getStore(VAList.getValue(1), dl, Tmp3, Tmp2, V, 0);
10071007 TargetLowering::ArgListEntry Entry;
10081008 for (unsigned i = 0; i != NumOps; ++i) {
10091009 Entry.Node = Ops[i];
1010 Entry.Ty = Entry.Node.getValueType().getTypeForMVT();
1010 Entry.Ty = Entry.Node.getValueType().getTypeForMVT(*DAG.getContext());
10111011 Entry.isSExt = isSigned;
10121012 Entry.isZExt = !isSigned;
10131013 Args.push_back(Entry);
10151015 SDValue Callee = DAG.getExternalSymbol(TLI.getLibcallName(LC),
10161016 TLI.getPointerTy());
10171017
1018 const Type *RetTy = RetVT.getTypeForMVT();
1018 const Type *RetTy = RetVT.getTypeForMVT(*DAG.getContext());
10191019 std::pair CallInfo =
10201020 TLI.LowerCallTo(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false,
10211021 false, 0, CallingConv::C, false, Callee, Args, DAG, dl);
114114 // Create the stack frame object. Make sure it is aligned for both
115115 // the source and expanded destination types.
116116 unsigned Alignment =
117 TLI.getTargetData()->getPrefTypeAlignment(NOutVT.getTypeForMVT());
117 TLI.getTargetData()->getPrefTypeAlignment(NOutVT.getTypeForMVT(
118 *DAG.getContext()));
118119 SDValue StackPtr = DAG.CreateStackTemporary(InVT, Alignment);
119120 int SPFI = cast(StackPtr.getNode())->getIndex();
120121 const Value *SV = PseudoSourceValue::getFixedStack(SPFI);
663663 // so use a truncating store.
664664 SDValue EltPtr = GetVectorElementPointer(StackPtr, EltVT, Idx);
665665 unsigned Alignment =
666 TLI.getTargetData()->getPrefTypeAlignment(VecVT.getTypeForMVT());
666 TLI.getTargetData()->getPrefTypeAlignment(VecVT.getTypeForMVT(
667 *DAG.getContext()));
667668 Store = DAG.getTruncStore(Store, dl, Elt, EltPtr, NULL, 0, EltVT);
668669
669670 // Load the Lo part from the stack slot.
796796 unsigned SelectionDAG::getMVTAlignment(MVT VT) const {
797797 const Type *Ty = VT == MVT::iPTR ?
798798 PointerType::get(Type::Int8Ty, 0) :
799 VT.getTypeForMVT();
799 VT.getTypeForMVT(*Context);
800800
801801 return TLI.getTargetData()->getABITypeAlignment(Ty);
802802 }
810810 }
811811
812812 void SelectionDAG::init(MachineFunction &mf, MachineModuleInfo *mmi,
813 DwarfWriter *dw) {
813 DwarfWriter *dw, LLVMContext* C) {
814814 MF = &mf;
815815 MMI = mmi;
816816 DW = dw;
817 Context = C;
817818 }
818819
819820 SelectionDAG::~SelectionDAG() {
13861387 SDValue SelectionDAG::CreateStackTemporary(MVT VT, unsigned minAlign) {
13871388 MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo();
13881389 unsigned ByteSize = VT.getStoreSizeInBits()/8;
1389 const Type *Ty = VT.getTypeForMVT();
1390 const Type *Ty = VT.getTypeForMVT(*Context);
13901391 unsigned StackAlign =
13911392 std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), minAlign);
13921393
13991400 SDValue SelectionDAG::CreateStackTemporary(MVT VT1, MVT VT2) {
14001401 unsigned Bytes = std::max(VT1.getStoreSizeInBits(),
14011402 VT2.getStoreSizeInBits())/8;
1402 const Type *Ty1 = VT1.getTypeForMVT();
1403 const Type *Ty2 = VT2.getTypeForMVT();
1403 const Type *Ty1 = VT1.getTypeForMVT(*Context);
1404 const Type *Ty2 = VT2.getTypeForMVT(*Context);
14041405 const TargetData *TD = TLI.getTargetData();
14051406 unsigned Align = std::max(TD->getPrefTypeAlignment(Ty1),
14061407 TD->getPrefTypeAlignment(Ty2));
30983099 MVT VT = TLI.getOptimalMemOpType(Size, Align, isSrcConst, isSrcStr, DAG);
30993100 if (VT != MVT::iAny) {
31003101 unsigned NewAlign = (unsigned)
3101 TLI.getTargetData()->getABITypeAlignment(VT.getTypeForMVT());
3102 TLI.getTargetData()->getABITypeAlignment(VT.getTypeForMVT(
3103 *DAG.getContext()));
31023104 // If source is a string constant, this will require an unaligned load.
31033105 if (NewAlign > Align && (isSrcConst || AllowUnalign)) {
31043106 if (Dst.getOpcode() != ISD::FrameIndex) {
55195519 for (unsigned Value = 0, NumValues = ValueVTs.size();
55205520 Value != NumValues; ++Value) {
55215521 MVT VT = ValueVTs[Value];
5522 const Type *ArgTy = VT.getTypeForMVT();
5522 const Type *ArgTy = VT.getTypeForMVT(*DAG.getContext());
55235523 ISD::ArgFlagsTy Flags;
55245524 unsigned OriginalAlignment =
55255525 getTargetData()->getABITypeAlignment(ArgTy);
56505650 for (unsigned Value = 0, NumValues = ValueVTs.size();
56515651 Value != NumValues; ++Value) {
56525652 MVT VT = ValueVTs[Value];
5653 const Type *ArgTy = VT.getTypeForMVT();
5653 const Type *ArgTy = VT.getTypeForMVT(*DAG.getContext());
56545654 SDValue Op = SDValue(Args[i].Node.getNode(),
56555655 Args[i].Node.getResNo() + Value);
56565656 ISD::ArgFlagsTy Flags;
318318
319319 MachineModuleInfo *MMI = getAnalysisIfAvailable();
320320 DwarfWriter *DW = getAnalysisIfAvailable();
321 CurDAG->init(*MF, MMI, DW);
321 CurDAG->init(*MF, MMI, DW, Context);
322322 FuncInfo->set(Fn, *MF, *CurDAG, EnableFastISel);
323323 SDL->init(GFI, *AA);
324324
694694 // Assign locations to each value returned by this call.
695695 SmallVector RVLocs;
696696 bool isVarArg = TheCall->isVarArg();
697 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs);
697 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(),
698 RVLocs, DAG.getContext());
698699 CCInfo.AnalyzeCallResult(TheCall,
699700 CCAssignFnForNode(CallingConv, /* Return*/ true));
700701
830831
831832 // Analyze operands of the call, assigning locations to each operand.
832833 SmallVector ArgLocs;
833 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
834 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
834835 CCInfo.AnalyzeCallOperands(TheCall, CCAssignFnForNode(CC, /* Return*/ false));
835836
836837 // Get a count of how many bytes are to be pushed on the stack.
10311032 bool isVarArg = DAG.getMachineFunction().getFunction()->isVarArg();
10321033
10331034 // CCState - Info about the registers and stack slots.
1034 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs);
1035 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs, DAG.getContext());
10351036
10361037 // Analyze return values of ISD::RET.
10371038 CCInfo.AnalyzeReturn(Op.getNode(), CCAssignFnForNode(CC, /* Return */ true));
13831384
13841385 // Assign locations to all of the incoming arguments.
13851386 SmallVector ArgLocs;
1386 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
1387 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
13871388 CCInfo.AnalyzeFormalArguments(Op.getNode(),
13881389 CCAssignFnForNode(CC, /* Return*/ false));
13891390
101101 TargetLowering::ArgListEntry Entry;
102102 for (unsigned i = 0, e = Op.getNumOperands(); i != e; ++i) {
103103 MVT ArgVT = Op.getOperand(i).getValueType();
104 const Type *ArgTy = ArgVT.getTypeForMVT();
104 const Type *ArgTy = ArgVT.getTypeForMVT(*DAG.getContext());
105105 Entry.Node = Op.getOperand(i);
106106 Entry.Ty = ArgTy;
107107 Entry.isSExt = isSigned;
112112 TLI.getPointerTy());
113113
114114 // Splice the libcall in wherever FindInputOutputChains tells us to.
115 const Type *RetTy = Op.getNode()->getValueType(0).getTypeForMVT();
115 const Type *RetTy =
116 Op.getNode()->getValueType(0).getTypeForMVT(*DAG.getContext());
116117 std::pair CallInfo =
117118 TLI.LowerCallTo(InChain, RetTy, isSigned, !isSigned, false, false,
118119 0, CallingConv::C, false, Callee, Args, DAG,
13351336 unsigned CC = DAG.getMachineFunction().getFunction()->getCallingConv();
13361337 bool isVarArg = DAG.getMachineFunction().getFunction()->isVarArg();
13371338 DebugLoc dl = Op.getDebugLoc();
1338 CCState CCInfo(CC, isVarArg, TM, RVLocs);
1339 CCState CCInfo(CC, isVarArg, TM, RVLocs, DAG.getContext());
13391340 CCInfo.AnalyzeReturn(Op.getNode(), RetCC_SPU);
13401341
13411342 // If this is the first return lowered for this function, add the regs to the
178178
179179 // Assign locations to all of the incoming arguments.
180180 SmallVector ArgLocs;
181 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
181 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
182182 CCInfo.AnalyzeFormalArguments(Op.getNode(), CC_MSP430);
183183
184184 assert(!isVarArg && "Varargs not supported yet");
255255 DebugLoc dl = Op.getDebugLoc();
256256
257257 // CCState - Info about the registers and stack slot.
258 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs);
258 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs, DAG.getContext());
259259
260260 // Analize return values of ISD::RET
261261 CCInfo.AnalyzeReturn(Op.getNode(), RetCC_MSP430);
307307
308308 // Analyze operands of the call, assigning locations to each operand.
309309 SmallVector ArgLocs;
310 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
310 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
311311
312312 CCInfo.AnalyzeCallOperands(TheCall, CC_MSP430);
313313
434434
435435 // Assign locations to each value returned by this call.
436436 SmallVector RVLocs;
437 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs);
437 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(),
438 RVLocs, DAG.getContext());
438439
439440 CCInfo.AnalyzeCallResult(TheCall, RetCC_MSP430);
440441 SmallVector ResultVals;
720720
721721 // Analyze operands of the call, assigning locations to each operand.
722722 SmallVector ArgLocs;
723 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
723 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
724724
725725 // To meet O32 ABI, Mips must always allocate 16 bytes on
726726 // the stack (even if less than 4 are used as arguments)
903903
904904 // Assign locations to each value returned by this call.
905905 SmallVector RVLocs;
906 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs);
906 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(),
907 RVLocs, DAG.getContext());
907908
908909 CCInfo.AnalyzeCallResult(TheCall, RetCC_Mips);
909910 SmallVector ResultVals;
947948
948949 // Assign locations to all of the incoming arguments.
949950 SmallVector ArgLocs;
950 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
951 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
951952
952953 if (Subtarget->isABI_O32())
953954 CCInfo.AnalyzeFormalArguments(Op.getNode(), CC_MipsO32);
10951096 DebugLoc dl = Op.getDebugLoc();
10961097
10971098 // CCState - Info about the registers and stack slot.
1098 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs);
1099 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs, DAG.getContext());
10991100
11001101 // Analize return values of ISD::RET
11011102 CCInfo.AnalyzeReturn(Op.getNode(), RetCC_Mips);
389389 TargetLowering::ArgListEntry Entry;
390390 for (unsigned i = 0; i != NumOps; ++i) {
391391 Entry.Node = Ops[i];
392 Entry.Ty = Entry.Node.getValueType().getTypeForMVT();
392 Entry.Ty = Entry.Node.getValueType().getTypeForMVT(*DAG.getContext());
393393 Entry.isSExt = isSigned;
394394 Entry.isZExt = !isSigned;
395395 Args.push_back(Entry);
396396 }
397397 SDValue Callee = DAG.getExternalSymbol(getPIC16LibcallName(Call), MVT::i8);
398398
399 const Type *RetTy = RetVT.getTypeForMVT();
399 const Type *RetTy = RetVT.getTypeForMVT(*DAG.getContext());
400400 std::pair CallInfo =
401401 LowerCallTo(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false,
402402 false, 0, CallingConv::C, false, Callee, Args, DAG, dl);
12821282
12831283 // Lower to a call to __trampoline_setup(Trmp, TrampSize, FPtr, ctx_reg)
12841284 std::pair CallResult =
1285 LowerCallTo(Chain, Op.getValueType().getTypeForMVT(), false, false,
1286 false, false, 0, CallingConv::C, false,
1285 LowerCallTo(Chain, Op.getValueType().getTypeForMVT(*DAG.getContext()),
1286 false, false, false, false, 0, CallingConv::C, false,
12871287 DAG.getExternalSymbol("__trampoline_setup", PtrVT),
12881288 Args, DAG, dl);
12891289
15261526
15271527 // Assign locations to all of the incoming arguments.
15281528 SmallVector ArgLocs;
1529 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
1529 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
15301530
15311531 // Reserve space for the linkage area on the stack.
15321532 CCInfo.AllocateStack(PPCFrameInfo::getLinkageSize(false, false), PtrByteSize);
15841584 // Aggregates passed by value are stored in the local variable space of the
15851585 // caller's stack frame, right above the parameter list area.
15861586 SmallVector ByValArgLocs;
1587 CCState CCByValInfo(CC, isVarArg, getTargetMachine(), ByValArgLocs);
1587 CCState CCByValInfo(CC, isVarArg, getTargetMachine(),
1588 ByValArgLocs, DAG.getContext());
15881589
15891590 // Reserve stack space for the allocations in CCInfo.
15901591 CCByValInfo.AllocateStack(CCInfo.getNextStackOffset(), PtrByteSize);
24532454 SmallVector ResultVals;
24542455 SmallVector RVLocs;
24552456 unsigned CallerCC = DAG.getMachineFunction().getFunction()->getCallingConv();
2456 CCState CCRetInfo(CallerCC, isVarArg, TM, RVLocs);
2457 CCState CCRetInfo(CallerCC, isVarArg, TM, RVLocs, DAG.getContext());
24572458 CCRetInfo.AnalyzeCallResult(TheCall, RetCC_PPC);
24582459
24592460 // Copy all of the result registers out of their specified physreg.
25592560
25602561 // Assign locations to all of the outgoing arguments.
25612562 SmallVector ArgLocs;
2562 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
2563 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
25632564
25642565 // Reserve space for the linkage area on the stack.
25652566 CCInfo.AllocateStack(PPCFrameInfo::getLinkageSize(false, false), PtrByteSize);
25992600
26002601 // Assign locations to all of the outgoing aggregate by value arguments.
26012602 SmallVector ByValArgLocs;
2602 CCState CCByValInfo(CC, isVarArg, getTargetMachine(), ByValArgLocs);
2603 CCState CCByValInfo(CC, isVarArg, getTargetMachine(), ByValArgLocs,
2604 DAG.getContext());
26032605
26042606 // Reserve stack space for the allocations in CCInfo.
26052607 CCByValInfo.AllocateStack(CCInfo.getNextStackOffset(), PtrByteSize);
30643066 unsigned CC = DAG.getMachineFunction().getFunction()->getCallingConv();
30653067 bool isVarArg = DAG.getMachineFunction().getFunction()->isVarArg();
30663068 DebugLoc dl = Op.getDebugLoc();
3067 CCState CCInfo(CC, isVarArg, TM, RVLocs);
3069 CCState CCInfo(CC, isVarArg, TM, RVLocs, DAG.getContext());
30683070 CCInfo.AnalyzeReturn(Op.getNode(), RetCC_PPC);
30693071
30703072 // If this is the first return lowered for this function, add the regs to the
3838 DebugLoc dl = Op.getDebugLoc();
3939
4040 // CCState - Info about the registers and stack slot.
41 CCState CCInfo(CC, isVarArg, DAG.getTarget(), RVLocs);
41 CCState CCInfo(CC, isVarArg, DAG.getTarget(), RVLocs, DAG.getContext());
4242
4343 // Analize return values of ISD::RET
4444 CCInfo.AnalyzeReturn(Op.getNode(), RetCC_Sparc32);
458458
459459 // Assign locations to each value returned by this call.
460460 SmallVector RVLocs;
461 CCState RVInfo(CallingConv, isVarArg, DAG.getTarget(), RVLocs);
461 CCState RVInfo(CallingConv, isVarArg, DAG.getTarget(),
462 RVLocs, DAG.getContext());
462463
463464 RVInfo.AnalyzeCallResult(TheCall, RetCC_Sparc32);
464465 SmallVector ResultVals;
12411241
12421242 // Analyze operands of the call, assigning locations to each operand.
12431243 SmallVector ArgLocs;
1244 CCState CCInfo(CC, false, TM, ArgLocs);
1244 CCState CCInfo(CC, false, TM, ArgLocs, I->getParent()->getContext());
12451245 CCInfo.AnalyzeCallOperands(ArgVTs, ArgFlags, CCAssignFnForCall(CC));
12461246
12471247 // Get a count of how many bytes are to be pushed on the stack.
13811381 // Now handle call return value (if any).
13821382 if (RetVT.getSimpleVT() != MVT::isVoid) {
13831383 SmallVector RVLocs;
1384 CCState CCInfo(CC, false, TM, RVLocs);
1384 CCState CCInfo(CC, false, TM, RVLocs, I->getParent()->getContext());
13851385 CCInfo.AnalyzeCallResult(RetVT, RetCC_X86);
13861386
13871387 // Copy all of the result registers out of their specified physreg.
10471047 SmallVector RVLocs;
10481048 unsigned CC = DAG.getMachineFunction().getFunction()->getCallingConv();
10491049 bool isVarArg = DAG.getMachineFunction().getFunction()->isVarArg();
1050 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs);
1050 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs, DAG.getContext());
10511051 CCInfo.AnalyzeReturn(Op.getNode(), RetCC_X86);
10521052
10531053 // If this is the first return lowered for this function, add the regs to the
11731173 SmallVector RVLocs;
11741174 bool isVarArg = TheCall->isVarArg();
11751175 bool Is64Bit = Subtarget->is64Bit();
1176 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs);
1176 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(),
1177 RVLocs, DAG.getContext());
11771178 CCInfo.AnalyzeCallResult(TheCall, RetCC_X86);
11781179
11791180 SmallVector ResultVals;
13821383
13831384 // Assign locations to all of the incoming arguments.
13841385 SmallVector ArgLocs;
1385 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
1386 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
13861387 CCInfo.AnalyzeFormalArguments(Op.getNode(), CCAssignFnForNode(CC));
13871388
13881389 SmallVector ArgValues;
16771678
16781679 // Analyze operands of the call, assigning locations to each operand.
16791680 SmallVector ArgLocs;
1680 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
1681 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
16811682 CCInfo.AnalyzeCallOperands(TheCall, CCAssignFnForNode(CC));
16821683
16831684 // Get a count of how many bytes are to be pushed on the stack.
447447
448448 // Analyze operands of the call, assigning locations to each operand.
449449 SmallVector ArgLocs;
450 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
450 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
451451
452452 // The ABI dictates there should be one stack slot available to the callee
453453 // on function entry (for saving lr).
573573
574574 // Assign locations to each value returned by this call.
575575 SmallVector RVLocs;
576 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs);
576 CCState CCInfo(CallingConv, isVarArg, getTargetMachine(),
577 RVLocs, DAG.getContext());
577578
578579 CCInfo.AnalyzeCallResult(TheCall, RetCC_XCore);
579580 SmallVector ResultVals;
629630
630631 // Assign locations to all of the incoming arguments.
631632 SmallVector ArgLocs;
632 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs);
633 CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs, DAG.getContext());
633634
634635 CCInfo.AnalyzeFormalArguments(Op.getNode(), CC_XCore);
635636
746747 DebugLoc dl = Op.getDebugLoc();
747748
748749 // CCState - Info about the registers and stack slot.
749 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs);
750 CCState CCInfo(CC, isVarArg, getTargetMachine(), RVLocs, DAG.getContext());
750751
751752 // Analize return values of ISD::RET
752753 CCInfo.AnalyzeReturn(Op.getNode(), RetCC_XCore);
1212
1313 #include "llvm/ADT/StringExtras.h"
1414 #include "llvm/CodeGen/ValueTypes.h"
15 #include "llvm/LLVMContext.h"
1516 #include "llvm/Type.h"
1617 #include "llvm/DerivedTypes.h"
1718 using namespace llvm;
1819
1920 MVT MVT::getExtendedIntegerVT(unsigned BitWidth) {
2021 MVT VT;
21 VT.LLVMTy = IntegerType::get(BitWidth);
22 VT.LLVMTy = getGlobalContext().getIntegerType(BitWidth);
2223 assert(VT.isExtended() && "Type is not extended!");
2324 return VT;
2425 }
2526
2627 MVT MVT::getExtendedVectorVT(MVT VT, unsigned NumElements) {
2728 MVT ResultVT;
28 ResultVT.LLVMTy = VectorType::get(VT.getTypeForMVT(), NumElements);
29 ResultVT.LLVMTy = getGlobalContext().getVectorType(
30 VT.getTypeForMVT(getGlobalContext()),
31 NumElements);
2932 assert(ResultVT.isExtended() && "Type is not extended!");
3033 return ResultVT;
3134 }
130133 /// getTypeForMVT - This method returns an LLVM type corresponding to the
131134 /// specified MVT. For integer types, this returns an unsigned type. Note
132135 /// that this will abort for types that cannot be represented.
133 const Type *MVT::getTypeForMVT() const {
136 const Type *MVT::getTypeForMVT(LLVMContext &Context) const {
134137 switch (V) {
135138 default:
136139 assert(isExtended() && "Type is not extended!");
141144 case MVT::i16: return Type::Int16Ty;
142145 case MVT::i32: return Type::Int32Ty;
143146 case MVT::i64: return Type::Int64Ty;
144 case MVT::i128: return IntegerType::get(128);
147 case MVT::i128: return Context.getIntegerType(128);
145148 case MVT::f32: return Type::FloatTy;
146149 case MVT::f64: return Type::DoubleTy;
147150 case MVT::f80: return Type::X86_FP80Ty;
148151 case MVT::f128: return Type::FP128Ty;
149152 case MVT::ppcf128: return Type::PPC_FP128Ty;
150 case MVT::v2i8: return VectorType::get(Type::Int8Ty, 2);
151 case MVT::v4i8: return VectorType::get(Type::Int8Ty, 4);
152 case MVT::v8i8: return VectorType::get(Type::Int8Ty, 8);
153 case MVT::v16i8: return VectorType::get(Type::Int8Ty, 16);
154 case MVT::v32i8: return VectorType::get(Type::Int8Ty, 32);
155 case MVT::v2i16: return VectorType::get(Type::Int16Ty, 2);
156 case MVT::v4i16: return VectorType::get(Type::Int16Ty, 4);
157 case MVT::v8i16: return VectorType::get(Type::Int16Ty, 16);
158 case MVT::v16i16: return VectorType::get(Type::Int16Ty, 8);
159 case MVT::v2i32: return VectorType::get(Type::Int32Ty, 2);
160 case MVT::v3i32: return VectorType::get(Type::Int32Ty, 3);
161 case MVT::v4i32: return VectorType::get(Type::Int32Ty, 4);
162 case MVT::v8i32: return VectorType::get(Type::Int32Ty, 8);
163 case MVT::v1i64: return VectorType::get(Type::Int64Ty, 1);
164 case MVT::v2i64: return VectorType::get(Type::Int64Ty, 2);
165 case MVT::v4i64: return VectorType::get(Type::Int64Ty, 4);
166 case MVT::v2f32: return VectorType::get(Type::FloatTy, 2);
167 case MVT::v3f32: return VectorType::get(Type::FloatTy, 3);
168 case MVT::v4f32: return VectorType::get(Type::FloatTy, 4);
169 case MVT::v8f32: return VectorType::get(Type::FloatTy, 8);
170 case MVT::v2f64: return VectorType::get(Type::DoubleTy, 2);
171 case MVT::v4f64: return VectorType::get(Type::DoubleTy, 4);
153 case MVT::v2i8: return Context.getVectorType(Type::Int8Ty, 2);
154 case MVT::v4i8: return Context.getVectorType(Type::Int8Ty, 4);
155 case MVT::v8i8: return Context.getVectorType(Type::Int8Ty, 8);
156 case MVT::v16i8: return Context.getVectorType(Type::Int8Ty, 16);
157 case MVT::v32i8: return Context.getVectorType(Type::Int8Ty, 32);
158 case MVT::v2i16: return Context.getVectorType(Type::Int16Ty, 2);
159 case MVT::v4i16: return Context.getVectorType(Type::Int16Ty, 4);
160 case MVT::v8i16: return Context.getVectorType(Type::Int16Ty, 16);
161 case MVT::v16i16: return Context.getVectorType(Type::Int16Ty, 8);
162 case MVT::v2i32: return Context.getVectorType(Type::Int32Ty, 2);
163 case MVT::v3i32: return Context.getVectorType(Type::Int32Ty, 3);
164 case MVT::v4i32: return Context.getVectorType(Type::Int32Ty, 4);
165 case MVT::v8i32: return Context.getVectorType(Type::Int32Ty, 8);
166 case MVT::v1i64: return Context.getVectorType(Type::Int64Ty, 1);
167 case MVT::v2i64: return Context.getVectorType(Type::Int64Ty, 2);
168 case MVT::v4i64: return Context.getVectorType(Type::Int64Ty, 4);
169 case MVT::v2f32: return Context.getVectorType(Type::FloatTy, 2);
170 case MVT::v3f32: return Context.getVectorType(Type::FloatTy, 3);
171 case MVT::v4f32: return Context.getVectorType(Type::FloatTy, 4);
172 case MVT::v8f32: return Context.getVectorType(Type::FloatTy, 8);
173 case MVT::v2f64: return Context.getVectorType(Type::DoubleTy, 2);
174 case MVT::v4f64: return Context.getVectorType(Type::DoubleTy, 4);
172175 }
173176 }
174177
197200 VTy->getNumElements());
198201 }
199202 }
200 }
203 }
16181618 "vector elements!", F);
16191619 return false;
16201620 }
1621 } else if (MVT((MVT::SimpleValueType)VT).getTypeForMVT() != EltTy) {
1621 } else if (MVT((MVT::SimpleValueType)VT).getTypeForMVT(*Context) != EltTy) {
16221622 CheckFailed(IntrinsicParam(ArgNo, NumRets) + " is wrong!", F);
16231623 return false;
16241624 } else if (EltTy != Ty) {
162162 O << Size << ", ";
163163 else
164164 O << "\n" << IndentStr << " State.getTarget().getTargetData()"
165 "->getTypeAllocSize(LocVT.getTypeForMVT()), ";
165 "->getTypeAllocSize(LocVT.getTypeForMVT(*State.getContext())), ";
166166 if (Align)
167167 O << Align;
168168 else
169169 O << "\n" << IndentStr << " State.getTarget().getTargetData()"
170 "->getABITypeAlignment(LocVT.getTypeForMVT())";
170 "->getABITypeAlignment(LocVT.getTypeForMVT(*State.getContext()))";
171171 O << ");\n" << IndentStr
172172 << "State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset"
173173 << Counter << ", LocVT, LocInfo));\n";