comparison include/llvm/CodeGen/FastISel.h @ 95:afa8332a0e37 LLVM3.8

LLVM 3.8
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Tue, 13 Oct 2015 17:48:58 +0900
parents 60c9769439b8
children 7d135dc70f03
comparison
equal deleted inserted replaced
84:f3e34b893a5f 95:afa8332a0e37
67 bool IsTailCall; 67 bool IsTailCall;
68 68
69 unsigned NumFixedArgs; 69 unsigned NumFixedArgs;
70 CallingConv::ID CallConv; 70 CallingConv::ID CallConv;
71 const Value *Callee; 71 const Value *Callee;
72 const char *SymName; 72 MCSymbol *Symbol;
73 ArgListTy Args; 73 ArgListTy Args;
74 ImmutableCallSite *CS; 74 ImmutableCallSite *CS;
75 MachineInstr *Call; 75 MachineInstr *Call;
76 unsigned ResultReg; 76 unsigned ResultReg;
77 unsigned NumResultRegs; 77 unsigned NumResultRegs;
86 86
87 CallLoweringInfo() 87 CallLoweringInfo()
88 : RetTy(nullptr), RetSExt(false), RetZExt(false), IsVarArg(false), 88 : RetTy(nullptr), RetSExt(false), RetZExt(false), IsVarArg(false),
89 IsInReg(false), DoesNotReturn(false), IsReturnValueUsed(true), 89 IsInReg(false), DoesNotReturn(false), IsReturnValueUsed(true),
90 IsTailCall(false), NumFixedArgs(-1), CallConv(CallingConv::C), 90 IsTailCall(false), NumFixedArgs(-1), CallConv(CallingConv::C),
91 Callee(nullptr), SymName(nullptr), CS(nullptr), Call(nullptr), 91 Callee(nullptr), Symbol(nullptr), CS(nullptr), Call(nullptr),
92 ResultReg(0), NumResultRegs(0), IsPatchPoint(false) {} 92 ResultReg(0), NumResultRegs(0), IsPatchPoint(false) {}
93 93
94 CallLoweringInfo &setCallee(Type *ResultTy, FunctionType *FuncTy, 94 CallLoweringInfo &setCallee(Type *ResultTy, FunctionType *FuncTy,
95 const Value *Target, ArgListTy &&ArgsList, 95 const Value *Target, ArgListTy &&ArgsList,
96 ImmutableCallSite &Call) { 96 ImmutableCallSite &Call) {
112 112
113 return *this; 113 return *this;
114 } 114 }
115 115
116 CallLoweringInfo &setCallee(Type *ResultTy, FunctionType *FuncTy, 116 CallLoweringInfo &setCallee(Type *ResultTy, FunctionType *FuncTy,
117 const char *Target, ArgListTy &&ArgsList, 117 MCSymbol *Target, ArgListTy &&ArgsList,
118 ImmutableCallSite &Call, 118 ImmutableCallSite &Call,
119 unsigned FixedArgs = ~0U) { 119 unsigned FixedArgs = ~0U) {
120 RetTy = ResultTy; 120 RetTy = ResultTy;
121 Callee = Call.getCalledValue(); 121 Callee = Call.getCalledValue();
122 SymName = Target; 122 Symbol = Target;
123 123
124 IsInReg = Call.paramHasAttr(0, Attribute::InReg); 124 IsInReg = Call.paramHasAttr(0, Attribute::InReg);
125 DoesNotReturn = Call.doesNotReturn(); 125 DoesNotReturn = Call.doesNotReturn();
126 IsVarArg = FuncTy->isVarArg(); 126 IsVarArg = FuncTy->isVarArg();
127 IsReturnValueUsed = !Call.getInstruction()->use_empty(); 127 IsReturnValueUsed = !Call.getInstruction()->use_empty();
146 Args = std::move(ArgsList); 146 Args = std::move(ArgsList);
147 NumFixedArgs = (FixedArgs == ~0U) ? Args.size() : FixedArgs; 147 NumFixedArgs = (FixedArgs == ~0U) ? Args.size() : FixedArgs;
148 return *this; 148 return *this;
149 } 149 }
150 150
151 CallLoweringInfo &setCallee(const DataLayout &DL, MCContext &Ctx,
152 CallingConv::ID CC, Type *ResultTy,
153 const char *Target, ArgListTy &&ArgsList,
154 unsigned FixedArgs = ~0U);
155
151 CallLoweringInfo &setCallee(CallingConv::ID CC, Type *ResultTy, 156 CallLoweringInfo &setCallee(CallingConv::ID CC, Type *ResultTy,
152 const char *Target, ArgListTy &&ArgsList, 157 MCSymbol *Target, ArgListTy &&ArgsList,
153 unsigned FixedArgs = ~0U) { 158 unsigned FixedArgs = ~0U) {
154 RetTy = ResultTy; 159 RetTy = ResultTy;
155 SymName = Target; 160 Symbol = Target;
156 CallConv = CC; 161 CallConv = CC;
157 Args = std::move(ArgsList); 162 Args = std::move(ArgsList);
158 NumFixedArgs = (FixedArgs == ~0U) ? Args.size() : FixedArgs; 163 NumFixedArgs = (FixedArgs == ~0U) ? Args.size() : FixedArgs;
159 return *this; 164 return *this;
160 } 165 }
412 /// operands. 417 /// operands.
413 unsigned fastEmitInst_rii(unsigned MachineInstOpcode, 418 unsigned fastEmitInst_rii(unsigned MachineInstOpcode,
414 const TargetRegisterClass *RC, unsigned Op0, 419 const TargetRegisterClass *RC, unsigned Op0,
415 bool Op0IsKill, uint64_t Imm1, uint64_t Imm2); 420 bool Op0IsKill, uint64_t Imm1, uint64_t Imm2);
416 421
417 /// \brief Emit a MachineInstr with two register operands and a result 422 /// \brief Emit a MachineInstr with a floating point immediate, and a result
418 /// register in the given register class. 423 /// register in the given register class.
424 unsigned fastEmitInst_f(unsigned MachineInstOpcode,
425 const TargetRegisterClass *RC,
426 const ConstantFP *FPImm);
427
428 /// \brief Emit a MachineInstr with one register operand, a floating point
429 /// immediate, and a result register in the given register class.
419 unsigned fastEmitInst_rf(unsigned MachineInstOpcode, 430 unsigned fastEmitInst_rf(unsigned MachineInstOpcode,
420 const TargetRegisterClass *RC, unsigned Op0, 431 const TargetRegisterClass *RC, unsigned Op0,
421 bool Op0IsKill, const ConstantFP *FPImm); 432 bool Op0IsKill, const ConstantFP *FPImm);
422 433
423 /// \brief Emit a MachineInstr with two register operands, an immediate, and a 434 /// \brief Emit a MachineInstr with two register operands, an immediate, and a
455 466
456 /// \brief Emit an unconditional branch to the given block, unless it is the 467 /// \brief Emit an unconditional branch to the given block, unless it is the
457 /// immediate (fall-through) successor, and update the CFG. 468 /// immediate (fall-through) successor, and update the CFG.
458 void fastEmitBranch(MachineBasicBlock *MBB, DebugLoc DL); 469 void fastEmitBranch(MachineBasicBlock *MBB, DebugLoc DL);
459 470
471 /// Emit an unconditional branch to \p FalseMBB, obtains the branch weight
472 /// and adds TrueMBB and FalseMBB to the successor list.
473 void finishCondBranch(const BasicBlock *BranchBB, MachineBasicBlock *TrueMBB,
474 MachineBasicBlock *FalseMBB);
475
460 /// \brief Update the value map to include the new mapping for this 476 /// \brief Update the value map to include the new mapping for this
461 /// instruction, or insert an extra copy to get the result in a previous 477 /// instruction, or insert an extra copy to get the result in a previous
462 /// determined register. 478 /// determined register.
463 /// 479 ///
464 /// NOTE: This is only necessary because we might select a block that uses a 480 /// NOTE: This is only necessary because we might select a block that uses a
502 /// \brief Create a machine mem operand from the given instruction. 518 /// \brief Create a machine mem operand from the given instruction.
503 MachineMemOperand *createMachineMemOperandFor(const Instruction *I) const; 519 MachineMemOperand *createMachineMemOperandFor(const Instruction *I) const;
504 520
505 CmpInst::Predicate optimizeCmpPredicate(const CmpInst *CI) const; 521 CmpInst::Predicate optimizeCmpPredicate(const CmpInst *CI) const;
506 522
507 bool lowerCallTo(const CallInst *CI, const char *SymName, unsigned NumArgs); 523 bool lowerCallTo(const CallInst *CI, MCSymbol *Symbol, unsigned NumArgs);
524 bool lowerCallTo(const CallInst *CI, const char *SymbolName,
525 unsigned NumArgs);
508 bool lowerCallTo(CallLoweringInfo &CLI); 526 bool lowerCallTo(CallLoweringInfo &CLI);
509 527
510 bool isCommutativeIntrinsic(IntrinsicInst const *II) { 528 bool isCommutativeIntrinsic(IntrinsicInst const *II) {
511 switch (II->getIntrinsicID()) { 529 switch (II->getIntrinsicID()) {
512 case Intrinsic::sadd_with_overflow: 530 case Intrinsic::sadd_with_overflow: