74 #define DEBUG_TYPE "mips-fastisel" 80 class MipsFastISel final :
public FastISel {
85 using BaseKind =
enum { RegBase, FrameIndexBase };
88 BaseKind
Kind = RegBase;
102 void setKind(BaseKind K) { Kind = K; }
103 BaseKind getKind()
const {
return Kind; }
104 bool isRegBase()
const {
return Kind == RegBase; }
105 bool isFIBase()
const {
return Kind == FrameIndexBase; }
107 void setReg(
unsigned Reg) {
108 assert(isRegBase() &&
"Invalid base register access!");
113 assert(isRegBase() &&
"Invalid base register access!");
117 void setFI(
unsigned FI) {
118 assert(isFIBase() &&
"Invalid base frame index access!");
122 unsigned getFI()
const {
123 assert(isFIBase() &&
"Invalid base frame index access!");
127 void setOffset(int64_t Offset_) { Offset = Offset_; }
144 bool fastLowerArguments()
override;
145 bool fastLowerCall(CallLoweringInfo &CLI)
override;
146 bool fastLowerIntrinsicCall(
const IntrinsicInst *II)
override;
148 bool UnsupportedFPMode;
162 bool selectFPToInt(
const Instruction *I,
bool IsSigned);
167 bool selectDivRem(
const Instruction *I,
unsigned ISDOpcode);
170 bool isTypeLegal(
Type *Ty,
MVT &VT);
171 bool isTypeSupported(
Type *Ty,
MVT &VT);
172 bool isLoadTypeLegal(
Type *Ty,
MVT &VT);
175 void simplifyAddress(
Address &Addr);
179 bool emitLoad(
MVT VT,
unsigned &ResultReg,
Address &Addr,
180 unsigned Alignment = 0);
181 bool emitStore(
MVT VT,
unsigned SrcReg,
Address Addr,
183 bool emitStore(
MVT VT,
unsigned SrcReg,
Address &Addr,
184 unsigned Alignment = 0);
185 unsigned emitIntExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
bool isZExt);
186 bool emitIntExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
unsigned DestReg,
189 bool emitIntZExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
unsigned DestReg);
191 bool emitIntSExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
unsigned DestReg);
192 bool emitIntSExt32r1(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
194 bool emitIntSExt32r2(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
197 unsigned getRegEnsuringSimpleIntegerWidening(
const Value *,
bool IsUnsigned);
199 unsigned emitLogicalOp(
unsigned ISDOpc,
MVT RetVT,
const Value *LHS,
206 unsigned materializeExternalCallSym(
MCSymbol *Syn);
209 return BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.
get(Opc));
213 return BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, TII.
get(Opc),
218 unsigned MemReg, int64_t MemOffset) {
223 unsigned MemReg, int64_t MemOffset) {
224 return emitInst(Opc, DstReg).
addReg(MemReg).
addImm(MemOffset);
227 unsigned fastEmitInst_rr(
unsigned MachineInstOpcode,
229 unsigned Op0,
bool Op0IsKill,
230 unsigned Op1,
bool Op1IsKill);
235 unsigned Op0,
bool Op0IsKill, uint64_t imm1,
236 uint64_t imm2,
unsigned Op3,
bool Op3IsKill) {
245 bool finishCall(CallLoweringInfo &CLI,
MVT RetVT,
unsigned NumBytes);
263 unsigned fastMaterializeAlloca(
const AllocaInst *AI)
override;
264 unsigned fastMaterializeConstant(
const Constant *C)
override;
265 bool fastSelectInstruction(
const Instruction *I)
override;
267 #include "MipsGenFastISel.inc" 288 #include "MipsGenCallingConv.inc" 294 unsigned MipsFastISel::emitLogicalOp(
unsigned ISDOpc,
MVT RetVT,
297 if (isa<ConstantInt>(LHS) && !isa<ConstantInt>(RHS))
315 unsigned LHSReg = getRegForValue(LHS);
320 if (
const auto *
C = dyn_cast<ConstantInt>(RHS))
323 RHSReg = getRegForValue(RHS);
327 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
331 emitInst(Opc, ResultReg).addReg(LHSReg).addReg(RHSReg);
335 unsigned MipsFastISel::fastMaterializeAlloca(
const AllocaInst *AI) {
337 "Alloca should always return a pointer.");
340 FuncInfo.StaticAllocaMap.find(AI);
342 if (SI != FuncInfo.StaticAllocaMap.
end()) {
343 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
344 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
TII.get(Mips::LEA_ADDiu),
346 .addFrameIndex(SI->second)
354 unsigned MipsFastISel::materializeInt(
const Constant *
C,
MVT VT) {
362 unsigned MipsFastISel::materialize32BitInt(int64_t Imm,
364 unsigned ResultReg = createResultReg(RC);
367 unsigned Opc = Mips::ADDiu;
368 emitInst(Opc, ResultReg).addReg(Mips::ZERO).addImm(Imm);
371 emitInst(Mips::ORi, ResultReg).addReg(Mips::ZERO).addImm(Imm);
374 unsigned Lo = Imm & 0xFFFF;
375 unsigned Hi = (Imm >> 16) & 0xFFFF;
378 unsigned TmpReg = createResultReg(RC);
379 emitInst(Mips::LUi, TmpReg).addImm(Hi);
380 emitInst(Mips::ORi, ResultReg).addReg(TmpReg).addImm(Lo);
382 emitInst(Mips::LUi, ResultReg).addImm(Hi);
387 unsigned MipsFastISel::materializeFP(
const ConstantFP *CFP,
MVT VT) {
388 if (UnsupportedFPMode)
393 unsigned DestReg = createResultReg(RC);
394 unsigned TempReg = materialize32BitInt(Imm, &Mips::GPR32RegClass);
395 emitInst(Mips::MTC1, DestReg).addReg(TempReg);
399 unsigned DestReg = createResultReg(RC);
400 unsigned TempReg1 = materialize32BitInt(Imm >> 32, &Mips::GPR32RegClass);
402 materialize32BitInt(Imm & 0xFFFFFFFF, &Mips::GPR32RegClass);
409 unsigned MipsFastISel::materializeGV(
const GlobalValue *GV,
MVT VT) {
414 unsigned DestReg = createResultReg(RC);
420 emitInst(Mips::LW, DestReg)
421 .addReg(MFI->getGlobalBaseReg())
425 unsigned TempReg = createResultReg(RC);
426 emitInst(Mips::ADDiu, TempReg)
434 unsigned MipsFastISel::materializeExternalCallSym(
MCSymbol *Sym) {
436 unsigned DestReg = createResultReg(RC);
437 emitInst(Mips::LW, DestReg)
438 .addReg(MFI->getGlobalBaseReg())
445 unsigned MipsFastISel::fastMaterializeConstant(
const Constant *C) {
446 EVT CEVT = TLI.getValueType(DL, C->
getType(),
true);
453 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(C))
454 return (UnsupportedFPMode) ? 0 : materializeFP(CFP, VT);
455 else if (
const GlobalValue *GV = dyn_cast<GlobalValue>(C))
456 return materializeGV(GV, VT);
457 else if (isa<ConstantInt>(C))
458 return materializeInt(C, VT);
463 bool MipsFastISel::computeAddress(
const Value *Obj,
Address &Addr) {
464 const User *U =
nullptr;
465 unsigned Opcode = Instruction::UserOp1;
466 if (
const Instruction *
I = dyn_cast<Instruction>(Obj)) {
469 if (FuncInfo.StaticAllocaMap.count(static_cast<const AllocaInst *>(Obj)) ||
470 FuncInfo.MBBMap[
I->getParent()] == FuncInfo.MBB) {
471 Opcode =
I->getOpcode();
474 }
else if (
const ConstantExpr *C = dyn_cast<ConstantExpr>(Obj)) {
475 Opcode = C->getOpcode();
481 case Instruction::BitCast:
483 return computeAddress(U->
getOperand(0), Addr);
484 case Instruction::GetElementPtr: {
486 int64_t TmpOffset = Addr.getOffset();
495 unsigned Idx = cast<ConstantInt>(
Op)->getZExtValue();
500 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(Op)) {
502 TmpOffset += CI->getSExtValue() * S;
505 if (canFoldAddIntoGEP(U, Op)) {
508 cast<ConstantInt>(cast<AddOperator>(
Op)->getOperand(1));
511 Op = cast<AddOperator>(
Op)->getOperand(0);
515 goto unsupported_gep;
520 Addr.setOffset(TmpOffset);
528 case Instruction::Alloca: {
531 FuncInfo.StaticAllocaMap.find(AI);
532 if (SI != FuncInfo.StaticAllocaMap.end()) {
533 Addr.setKind(Address::FrameIndexBase);
534 Addr.setFI(SI->second);
540 Addr.setReg(getRegForValue(Obj));
541 return Addr.getReg() != 0;
544 bool MipsFastISel::computeCallAddress(
const Value *V,
Address &Addr) {
545 const User *U =
nullptr;
546 unsigned Opcode = Instruction::UserOp1;
548 if (
const auto *
I = dyn_cast<Instruction>(V)) {
551 if (
I->getParent() == FuncInfo.MBB->getBasicBlock()) {
552 Opcode =
I->getOpcode();
555 }
else if (
const auto *C = dyn_cast<ConstantExpr>(V)) {
556 Opcode = C->getOpcode();
563 case Instruction::BitCast:
565 return computeCallAddress(U->
getOperand(0), Addr);
567 case Instruction::IntToPtr:
570 TLI.getPointerTy(DL))
571 return computeCallAddress(U->
getOperand(0), Addr);
573 case Instruction::PtrToInt:
575 if (TLI.getValueType(DL, U->
getType()) == TLI.getPointerTy(DL))
576 return computeCallAddress(U->
getOperand(0), Addr);
580 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
581 Addr.setGlobalValue(GV);
586 if (!Addr.getGlobalValue()) {
587 Addr.setReg(getRegForValue(V));
588 return Addr.getReg() != 0;
594 bool MipsFastISel::isTypeLegal(
Type *Ty,
MVT &VT) {
595 EVT evt = TLI.getValueType(DL, Ty,
true);
603 return TLI.isTypeLegal(VT);
606 bool MipsFastISel::isTypeSupported(
Type *Ty,
MVT &VT) {
610 if (isTypeLegal(Ty, VT))
621 bool MipsFastISel::isLoadTypeLegal(
Type *Ty,
MVT &VT) {
622 if (isTypeLegal(Ty, VT))
639 unsigned LeftReg = getRegEnsuringSimpleIntegerWidening(Left, IsUnsigned);
642 unsigned RightReg = getRegEnsuringSimpleIntegerWidening(
Right, IsUnsigned);
651 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
652 emitInst(
Mips::XOR, TempReg).addReg(LeftReg).addReg(RightReg);
653 emitInst(Mips::SLTiu, ResultReg).addReg(TempReg).addImm(1);
657 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
658 emitInst(
Mips::XOR, TempReg).addReg(LeftReg).addReg(RightReg);
659 emitInst(Mips::SLTu, ResultReg).addReg(Mips::ZERO).addReg(TempReg);
663 emitInst(Mips::SLTu, ResultReg).addReg(RightReg).addReg(LeftReg);
666 emitInst(Mips::SLTu, ResultReg).addReg(LeftReg).addReg(RightReg);
669 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
670 emitInst(Mips::SLTu, TempReg).addReg(LeftReg).addReg(RightReg);
671 emitInst(Mips::XORi, ResultReg).addReg(TempReg).addImm(1);
675 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
676 emitInst(Mips::SLTu, TempReg).addReg(RightReg).addReg(LeftReg);
677 emitInst(Mips::XORi, ResultReg).addReg(TempReg).addImm(1);
681 emitInst(Mips::SLT, ResultReg).addReg(RightReg).addReg(LeftReg);
684 emitInst(Mips::SLT, ResultReg).addReg(LeftReg).addReg(RightReg);
687 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
688 emitInst(Mips::SLT, TempReg).addReg(LeftReg).addReg(RightReg);
689 emitInst(Mips::XORi, ResultReg).addReg(TempReg).addImm(1);
693 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
694 emitInst(Mips::SLT, TempReg).addReg(RightReg).addReg(LeftReg);
695 emitInst(Mips::XORi, ResultReg).addReg(TempReg).addImm(1);
704 if (UnsupportedFPMode)
708 if (!IsFloat && !IsDouble)
710 unsigned Opc, CondMovOpc;
713 Opc = IsFloat ? Mips::C_EQ_S : Mips::C_EQ_D32;
714 CondMovOpc = Mips::MOVT_I;
717 Opc = IsFloat ? Mips::C_EQ_S : Mips::C_EQ_D32;
718 CondMovOpc = Mips::MOVF_I;
721 Opc = IsFloat ? Mips::C_OLT_S : Mips::C_OLT_D32;
722 CondMovOpc = Mips::MOVT_I;
725 Opc = IsFloat ? Mips::C_OLE_S : Mips::C_OLE_D32;
726 CondMovOpc = Mips::MOVT_I;
729 Opc = IsFloat ? Mips::C_ULE_S : Mips::C_ULE_D32;
730 CondMovOpc = Mips::MOVF_I;
733 Opc = IsFloat ? Mips::C_ULT_S : Mips::C_ULT_D32;
734 CondMovOpc = Mips::MOVF_I;
739 unsigned RegWithZero = createResultReg(&Mips::GPR32RegClass);
740 unsigned RegWithOne = createResultReg(&Mips::GPR32RegClass);
741 emitInst(Mips::ADDiu, RegWithZero).addReg(Mips::ZERO).addImm(0);
742 emitInst(Mips::ADDiu, RegWithOne).addReg(Mips::ZERO).addImm(1);
745 emitInst(CondMovOpc, ResultReg)
748 .addReg(RegWithZero);
755 bool MipsFastISel::emitLoad(
MVT VT,
unsigned &ResultReg,
Address &Addr,
756 unsigned Alignment) {
763 ResultReg = createResultReg(&Mips::GPR32RegClass);
767 ResultReg = createResultReg(&Mips::GPR32RegClass);
771 ResultReg = createResultReg(&Mips::GPR32RegClass);
775 if (UnsupportedFPMode)
777 ResultReg = createResultReg(&Mips::FGR32RegClass);
781 if (UnsupportedFPMode)
783 ResultReg = createResultReg(&Mips::AFGR64RegClass);
789 if (Addr.isRegBase()) {
790 simplifyAddress(Addr);
791 emitInstLoad(Opc, ResultReg, Addr.getReg(), Addr.getOffset());
794 if (Addr.isFIBase()) {
795 unsigned FI = Addr.getFI();
797 int64_t
Offset = Addr.getOffset();
802 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
TII.get(Opc), ResultReg)
811 bool MipsFastISel::emitStore(
MVT VT,
unsigned SrcReg,
Address &Addr,
812 unsigned Alignment) {
828 if (UnsupportedFPMode)
833 if (UnsupportedFPMode)
840 if (Addr.isRegBase()) {
841 simplifyAddress(Addr);
842 emitInstStore(Opc, SrcReg, Addr.getReg(), Addr.getOffset());
845 if (Addr.isFIBase()) {
846 unsigned FI = Addr.getFI();
848 int64_t
Offset = Addr.getOffset();
853 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
TII.get(Opc))
863 bool MipsFastISel::selectLogicalOp(
const Instruction *
I) {
865 if (!isTypeSupported(I->
getType(), VT))
872 case Instruction::And:
875 case Instruction::Or:
878 case Instruction::Xor:
886 updateValueMap(I, ResultReg);
890 bool MipsFastISel::selectLoad(
const Instruction *I) {
897 if (!isLoadTypeLegal(I->
getType(), VT))
906 if (!emitLoad(VT, ResultReg, Addr, cast<LoadInst>(I)->getAlignment()))
908 updateValueMap(I, ResultReg);
912 bool MipsFastISel::selectStore(
const Instruction *I) {
926 SrcReg = getRegForValue(Op0);
935 if (!emitStore(VT, SrcReg, Addr, cast<StoreInst>(I)->getAlignment()))
942 bool MipsFastISel::selectBranch(
const Instruction *I) {
956 unsigned CondReg = getRegForValue(CI);
957 BuildMI(*BrBB, FuncInfo.InsertPt, DbgLoc,
TII.get(Mips::BGTZ))
960 finishCondBranch(BI->
getParent(), TBB, FBB);
966 bool MipsFastISel::selectCmp(
const Instruction *I) {
967 const CmpInst *CI = cast<CmpInst>(
I);
968 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
971 updateValueMap(I, ResultReg);
976 bool MipsFastISel::selectFPExt(
const Instruction *I) {
977 if (UnsupportedFPMode)
980 EVT SrcVT = TLI.getValueType(DL, Src->
getType(),
true);
981 EVT DestVT = TLI.getValueType(DL, I->
getType(),
true);
992 unsigned DestReg = createResultReg(&Mips::AFGR64RegClass);
993 emitInst(Mips::CVT_D32_S, DestReg).addReg(SrcReg);
994 updateValueMap(I, DestReg);
998 bool MipsFastISel::selectSelect(
const Instruction *I) {
999 assert(isa<SelectInst>(I) &&
"Expected a select instruction.");
1004 if (!isTypeSupported(I->
getType(), VT) || UnsupportedFPMode) {
1006 dbgs() <<
".. .. gave up (!isTypeSupported || UnsupportedFPMode)\n");
1010 unsigned CondMovOpc;
1014 CondMovOpc = Mips::MOVN_I_I;
1015 RC = &Mips::GPR32RegClass;
1017 CondMovOpc = Mips::MOVN_I_S;
1018 RC = &Mips::FGR32RegClass;
1020 CondMovOpc = Mips::MOVN_I_D32;
1021 RC = &Mips::AFGR64RegClass;
1029 unsigned CondReg = getRegForValue(Cond);
1031 if (!Src1Reg || !Src2Reg || !CondReg)
1034 unsigned ZExtCondReg = createResultReg(&Mips::GPR32RegClass);
1041 unsigned ResultReg = createResultReg(RC);
1042 unsigned TempReg = createResultReg(RC);
1044 if (!ResultReg || !TempReg)
1047 emitInst(TargetOpcode::COPY, TempReg).addReg(Src2Reg);
1048 emitInst(CondMovOpc, ResultReg)
1049 .addReg(Src1Reg).addReg(ZExtCondReg).addReg(TempReg);
1050 updateValueMap(I, ResultReg);
1055 bool MipsFastISel::selectFPTrunc(
const Instruction *I) {
1056 if (UnsupportedFPMode)
1059 EVT SrcVT = TLI.getValueType(DL, Src->
getType(),
true);
1060 EVT DestVT = TLI.getValueType(DL, I->
getType(),
true);
1065 unsigned SrcReg = getRegForValue(Src);
1069 unsigned DestReg = createResultReg(&Mips::FGR32RegClass);
1073 emitInst(Mips::CVT_S_D32, DestReg).addReg(SrcReg);
1074 updateValueMap(I, DestReg);
1079 bool MipsFastISel::selectFPToInt(
const Instruction *I,
bool IsSigned) {
1080 if (UnsupportedFPMode)
1087 if (!isTypeLegal(DstTy, DstVT))
1095 if (!isTypeLegal(SrcTy, SrcVT))
1101 unsigned SrcReg = getRegForValue(Src);
1107 unsigned DestReg = createResultReg(&Mips::GPR32RegClass);
1108 unsigned TempReg = createResultReg(&Mips::FGR32RegClass);
1109 unsigned Opc = (SrcVT ==
MVT::f32) ? Mips::TRUNC_W_S : Mips::TRUNC_W_D32;
1112 emitInst(Opc, TempReg).addReg(SrcReg);
1113 emitInst(Mips::MFC1, DestReg).addReg(TempReg);
1115 updateValueMap(I, DestReg);
1119 bool MipsFastISel::processCallArgs(CallLoweringInfo &CLI,
1121 unsigned &NumBytes) {
1132 emitInst(Mips::ADJCALLSTACKDOWN).addImm(16).addImm(0);
1135 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
1147 }
else if (i == 1) {
1176 unsigned ArgReg = getRegForValue(ArgVal);
1188 ArgReg = emitIntExt(SrcVT, ArgReg, DestVT,
false);
1196 ArgReg = emitIntExt(SrcVT, ArgReg, DestVT,
true);
1207 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
1208 TII.get(TargetOpcode::COPY), VA.
getLocReg()).addReg(ArgReg);
1221 if (isa<UndefValue>(ArgVal))
1231 unsigned BEAlign = 0;
1232 if (ArgSize < 8 && !Subtarget->isLittle())
1233 BEAlign = 8 - ArgSize;
1236 Addr.setKind(Address::RegBase);
1237 Addr.setReg(Mips::SP);
1240 unsigned Alignment = DL.getABITypeAlignment(ArgVal->
getType());
1253 bool MipsFastISel::finishCall(CallLoweringInfo &CLI,
MVT RetVT,
1254 unsigned NumBytes) {
1256 emitInst(Mips::ADJCALLSTACKUP).addImm(16).addImm(0);
1262 CLI.Symbol ? CLI.Symbol->getName().data()
1266 if (RVLocs.
size() != 1)
1269 MVT CopyVT = RVLocs[0].getValVT();
1274 unsigned ResultReg = createResultReg(TLI.getRegClassFor(CopyVT));
1277 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
1278 TII.get(TargetOpcode::COPY),
1279 ResultReg).addReg(RVLocs[0].getLocReg());
1280 CLI.InRegs.push_back(RVLocs[0].getLocReg());
1282 CLI.ResultReg = ResultReg;
1283 CLI.NumResultRegs = 1;
1288 bool MipsFastISel::fastLowerArguments() {
1291 if (!FuncInfo.CanLowerReturn) {
1304 LLVM_DEBUG(
dbgs() <<
".. gave up (calling convention is not C)\n");
1308 std::array<MCPhysReg, 4> GPR32ArgRegs = {{Mips::A0, Mips::A1, Mips::A2,
1310 std::array<MCPhysReg, 2> FGR32ArgRegs = {{Mips::F12, Mips::F14}};
1311 std::array<MCPhysReg, 2> AFGR64ArgRegs = {{Mips::D6, Mips::D7}};
1312 auto NextGPR32 = GPR32ArgRegs.begin();
1313 auto NextFGR32 = FGR32ArgRegs.begin();
1314 auto NextAFGR64 = AFGR64ArgRegs.begin();
1316 struct AllocatedReg {
1320 : RC(RC),
Reg(Reg) {}
1326 for (
const auto &FormalArg : F->
args()) {
1327 if (FormalArg.hasAttribute(Attribute::InReg) ||
1328 FormalArg.hasAttribute(Attribute::StructRet) ||
1329 FormalArg.hasAttribute(Attribute::ByVal)) {
1334 Type *ArgTy = FormalArg.getType();
1340 EVT ArgVT = TLI.getValueType(DL, ArgTy);
1352 if (!FormalArg.hasAttribute(Attribute::SExt) &&
1353 !FormalArg.hasAttribute(Attribute::ZExt)) {
1356 LLVM_DEBUG(
dbgs() <<
".. .. gave up (i8/i16 arg is not extended)\n");
1360 if (NextGPR32 == GPR32ArgRegs.end()) {
1361 LLVM_DEBUG(
dbgs() <<
".. .. gave up (ran out of GPR32 arguments)\n");
1366 Allocation.
emplace_back(&Mips::GPR32RegClass, *NextGPR32++);
1369 NextFGR32 = FGR32ArgRegs.end();
1370 NextAFGR64 = AFGR64ArgRegs.end();
1374 if (FormalArg.hasAttribute(Attribute::ZExt)) {
1376 LLVM_DEBUG(
dbgs() <<
".. .. gave up (i32 arg is zero extended)\n");
1380 if (NextGPR32 == GPR32ArgRegs.end()) {
1381 LLVM_DEBUG(
dbgs() <<
".. .. gave up (ran out of GPR32 arguments)\n");
1386 Allocation.
emplace_back(&Mips::GPR32RegClass, *NextGPR32++);
1389 NextFGR32 = FGR32ArgRegs.end();
1390 NextAFGR64 = AFGR64ArgRegs.end();
1394 if (UnsupportedFPMode) {
1398 if (NextFGR32 == FGR32ArgRegs.end()) {
1399 LLVM_DEBUG(
dbgs() <<
".. .. gave up (ran out of FGR32 arguments)\n");
1403 Allocation.
emplace_back(&Mips::FGR32RegClass, *NextFGR32++);
1406 if (NextGPR32 != GPR32ArgRegs.end())
1408 if (NextAFGR64 != AFGR64ArgRegs.end())
1413 if (UnsupportedFPMode) {
1417 if (NextAFGR64 == AFGR64ArgRegs.end()) {
1418 LLVM_DEBUG(
dbgs() <<
".. .. gave up (ran out of AFGR64 arguments)\n");
1422 Allocation.
emplace_back(&Mips::AFGR64RegClass, *NextAFGR64++);
1425 if (NextGPR32 != GPR32ArgRegs.end())
1427 if (NextGPR32 != GPR32ArgRegs.end())
1429 if (NextFGR32 != FGR32ArgRegs.end())
1439 for (
const auto &FormalArg : F->
args()) {
1440 unsigned ArgNo = FormalArg.getArgNo();
1441 unsigned SrcReg = Allocation[ArgNo].Reg;
1442 unsigned DstReg = FuncInfo.MF->addLiveIn(SrcReg, Allocation[ArgNo].RC);
1446 unsigned ResultReg = createResultReg(Allocation[ArgNo].RC);
1447 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
1448 TII.get(TargetOpcode::COPY), ResultReg)
1450 updateValueMap(&FormalArg, ResultReg);
1455 unsigned IncomingArgSizeInBytes = 0;
1460 IncomingArgSizeInBytes = std::min(getABI().GetCalleeAllocdArgSizeInBytes(CC),
1461 IncomingArgSizeInBytes);
1469 bool MipsFastISel::fastLowerCall(CallLoweringInfo &CLI) {
1471 bool IsTailCall = CLI.IsTailCall;
1472 bool IsVarArg = CLI.IsVarArg;
1490 if (CLI.RetTy->isVoidTy())
1492 else if (!isTypeSupported(CLI.RetTy, RetVT))
1495 for (
auto Flag : CLI.OutFlags)
1501 OutVTs.
reserve(CLI.OutVals.size());
1503 for (
auto *Val : CLI.OutVals) {
1505 if (!isTypeLegal(Val->getType(), VT) &&
1517 if (!computeCallAddress(Callee, Addr))
1522 if (!processCallArgs(CLI, OutVTs, NumBytes))
1525 if (!Addr.getGlobalValue())
1529 unsigned DestAddress;
1531 DestAddress = materializeExternalCallSym(Symbol);
1533 DestAddress = materializeGV(Addr.getGlobalValue(),
MVT::i32);
1534 emitInst(TargetOpcode::COPY, Mips::T9).addReg(DestAddress);
1536 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
TII.get(Mips::JALR),
1540 for (
auto Reg : CLI.OutRegs)
1550 return finishCall(CLI, RetVT, NumBytes);
1553 bool MipsFastISel::fastLowerIntrinsicCall(
const IntrinsicInst *II) {
1557 case Intrinsic::bswap: {
1561 if (!isTypeSupported(RetTy, VT))
1564 unsigned SrcReg = getRegForValue(II->
getOperand(0));
1567 unsigned DestReg = createResultReg(&Mips::GPR32RegClass);
1571 if (Subtarget->hasMips32r2()) {
1572 emitInst(Mips::WSBH, DestReg).addReg(SrcReg);
1573 updateValueMap(II, DestReg);
1576 unsigned TempReg[3];
1577 for (
int i = 0; i < 3; i++) {
1578 TempReg[i] = createResultReg(&Mips::GPR32RegClass);
1579 if (TempReg[i] == 0)
1582 emitInst(Mips::SLL, TempReg[0]).addReg(SrcReg).addImm(8);
1583 emitInst(
Mips::SRL, TempReg[1]).addReg(SrcReg).addImm(8);
1584 emitInst(
Mips::OR, TempReg[2]).addReg(TempReg[0]).addReg(TempReg[1]);
1585 emitInst(Mips::ANDi, DestReg).addReg(TempReg[2]).addImm(0xFFFF);
1586 updateValueMap(II, DestReg);
1590 if (Subtarget->hasMips32r2()) {
1591 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
1592 emitInst(Mips::WSBH, TempReg).addReg(SrcReg);
1593 emitInst(
Mips::ROTR, DestReg).addReg(TempReg).addImm(16);
1594 updateValueMap(II, DestReg);
1597 unsigned TempReg[8];
1598 for (
int i = 0; i < 8; i++) {
1599 TempReg[i] = createResultReg(&Mips::GPR32RegClass);
1600 if (TempReg[i] == 0)
1604 emitInst(
Mips::SRL, TempReg[0]).addReg(SrcReg).addImm(8);
1605 emitInst(
Mips::SRL, TempReg[1]).addReg(SrcReg).addImm(24);
1606 emitInst(Mips::ANDi, TempReg[2]).addReg(TempReg[0]).addImm(0xFF00);
1607 emitInst(
Mips::OR, TempReg[3]).addReg(TempReg[1]).addReg(TempReg[2]);
1609 emitInst(Mips::ANDi, TempReg[4]).addReg(SrcReg).addImm(0xFF00);
1610 emitInst(Mips::SLL, TempReg[5]).addReg(TempReg[4]).addImm(8);
1612 emitInst(Mips::SLL, TempReg[6]).addReg(SrcReg).addImm(24);
1613 emitInst(
Mips::OR, TempReg[7]).addReg(TempReg[3]).addReg(TempReg[5]);
1614 emitInst(
Mips::OR, DestReg).addReg(TempReg[6]).addReg(TempReg[7]);
1615 updateValueMap(II, DestReg);
1621 case Intrinsic::memcpy:
1622 case Intrinsic::memmove: {
1623 const auto *MTI = cast<MemTransferInst>(II);
1625 if (MTI->isVolatile())
1627 if (!MTI->getLength()->getType()->isIntegerTy(32))
1629 const char *IntrMemName = isa<MemCpyInst>(II) ?
"memcpy" :
"memmove";
1632 case Intrinsic::memset: {
1633 const MemSetInst *MSI = cast<MemSetInst>(II);
1645 bool MipsFastISel::selectRet(
const Instruction *I) {
1651 if (!FuncInfo.CanLowerReturn)
1672 CCInfo.AnalyzeReturn(Outs, RetCC);
1675 if (ValLocs.size() != 1)
1690 unsigned Reg = getRegForValue(RV);
1694 unsigned SrcReg = Reg + VA.
getValNo();
1697 if (!
MRI.getRegClass(SrcReg)->contains(DestReg))
1700 EVT RVEVT = TLI.getValueType(DL, RV->
getType());
1712 if (RVVT ==
MVT::f64 && UnsupportedFPMode) {
1719 if (RVVT != DestVT) {
1723 if (Outs[0].Flags.isZExt() || Outs[0].Flags.isSExt()) {
1724 bool IsZExt = Outs[0].Flags.isZExt();
1725 SrcReg = emitIntExt(RVVT, SrcReg, DestVT, IsZExt);
1732 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
1733 TII.get(TargetOpcode::COPY), DestReg).addReg(SrcReg);
1739 for (
unsigned i = 0, e = RetRegs.
size(); i != e; ++i)
1744 bool MipsFastISel::selectTrunc(
const Instruction *I) {
1750 SrcVT = TLI.getValueType(DL, Op->
getType(),
true);
1751 DestVT = TLI.getValueType(DL, I->
getType(),
true);
1758 unsigned SrcReg = getRegForValue(Op);
1764 updateValueMap(I, SrcReg);
1768 bool MipsFastISel::selectIntExt(
const Instruction *I) {
1773 bool isZExt = isa<ZExtInst>(
I);
1774 unsigned SrcReg = getRegForValue(Src);
1778 EVT SrcEVT, DestEVT;
1779 SrcEVT = TLI.getValueType(DL, SrcTy,
true);
1780 DestEVT = TLI.getValueType(DL, DestTy,
true);
1788 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
1790 if (!emitIntExt(SrcVT, SrcReg, DestVT, ResultReg, isZExt))
1792 updateValueMap(I, ResultReg);
1796 bool MipsFastISel::emitIntSExt32r1(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1809 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
1810 emitInst(Mips::SLL, TempReg).addReg(SrcReg).addImm(ShiftAmt);
1811 emitInst(
Mips::SRA, DestReg).addReg(TempReg).addImm(ShiftAmt);
1815 bool MipsFastISel::emitIntSExt32r2(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1821 emitInst(Mips::SEB, DestReg).addReg(SrcReg);
1824 emitInst(Mips::SEH, DestReg).addReg(SrcReg);
1830 bool MipsFastISel::emitIntSExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1834 if (Subtarget->hasMips32r2())
1835 return emitIntSExt32r2(SrcVT, SrcReg, DestVT, DestReg);
1836 return emitIntSExt32r1(SrcVT, SrcReg, DestVT, DestReg);
1839 bool MipsFastISel::emitIntZExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1857 emitInst(Mips::ANDi, DestReg).addReg(SrcReg).addImm(Imm);
1861 bool MipsFastISel::emitIntExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1862 unsigned DestReg,
bool IsZExt) {
1871 return emitIntZExt(SrcVT, SrcReg, DestVT, DestReg);
1872 return emitIntSExt(SrcVT, SrcReg, DestVT, DestReg);
1875 unsigned MipsFastISel::emitIntExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1877 unsigned DestReg = createResultReg(&Mips::GPR32RegClass);
1878 bool Success = emitIntExt(SrcVT, SrcReg, DestVT, DestReg, isZExt);
1879 return Success ? DestReg : 0;
1882 bool MipsFastISel::selectDivRem(
const Instruction *I,
unsigned ISDOpcode) {
1883 EVT DestEVT = TLI.getValueType(DL, I->
getType(),
true);
1892 switch (ISDOpcode) {
1905 unsigned Src0Reg = getRegForValue(I->
getOperand(0));
1906 unsigned Src1Reg = getRegForValue(I->
getOperand(1));
1907 if (!Src0Reg || !Src1Reg)
1910 emitInst(DivOpc).addReg(Src0Reg).addReg(Src1Reg);
1911 emitInst(Mips::TEQ).addReg(Src1Reg).addReg(Mips::ZERO).addImm(7);
1913 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
1920 emitInst(MFOpc, ResultReg);
1922 updateValueMap(I, ResultReg);
1926 bool MipsFastISel::selectShift(
const Instruction *I) {
1929 if (!isTypeSupported(I->
getType(), RetVT))
1932 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
1938 unsigned Op0Reg = getRegForValue(Op0);
1943 if (Opcode == Instruction::AShr || Opcode == Instruction::LShr) {
1944 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
1948 MVT Op0MVT = TLI.getValueType(DL, Op0->
getType(),
true).getSimpleVT();
1949 bool IsZExt = Opcode == Instruction::LShr;
1950 if (!emitIntExt(Op0MVT, Op0Reg,
MVT::i32, TempReg, IsZExt))
1956 if (
const auto *C = dyn_cast<ConstantInt>(I->
getOperand(1))) {
1957 uint64_t ShiftVal = C->getZExtValue();
1962 case Instruction::Shl:
1965 case Instruction::AShr:
1968 case Instruction::LShr:
1973 emitInst(Opcode, ResultReg).addReg(Op0Reg).addImm(ShiftVal);
1974 updateValueMap(I, ResultReg);
1978 unsigned Op1Reg = getRegForValue(I->
getOperand(1));
1985 case Instruction::Shl:
1986 Opcode = Mips::SLLV;
1988 case Instruction::AShr:
1989 Opcode = Mips::SRAV;
1991 case Instruction::LShr:
1992 Opcode = Mips::SRLV;
1996 emitInst(Opcode, ResultReg).addReg(Op0Reg).addReg(Op1Reg);
1997 updateValueMap(I, ResultReg);
2001 bool MipsFastISel::fastSelectInstruction(
const Instruction *I) {
2006 return selectLoad(I);
2008 return selectStore(I);
2009 case Instruction::SDiv:
2013 case Instruction::UDiv:
2017 case Instruction::SRem:
2021 case Instruction::URem:
2025 case Instruction::Shl:
2026 case Instruction::LShr:
2027 case Instruction::AShr:
2028 return selectShift(I);
2029 case Instruction::And:
2030 case Instruction::Or:
2031 case Instruction::Xor:
2032 return selectLogicalOp(I);
2033 case Instruction::Br:
2034 return selectBranch(I);
2036 return selectRet(I);
2037 case Instruction::Trunc:
2038 return selectTrunc(I);
2039 case Instruction::ZExt:
2040 case Instruction::SExt:
2041 return selectIntExt(I);
2042 case Instruction::FPTrunc:
2043 return selectFPTrunc(I);
2044 case Instruction::FPExt:
2045 return selectFPExt(I);
2046 case Instruction::FPToSI:
2047 return selectFPToInt(I,
true);
2048 case Instruction::FPToUI:
2049 return selectFPToInt(I,
false);
2050 case Instruction::ICmp:
2051 case Instruction::FCmp:
2052 return selectCmp(I);
2054 return selectSelect(I);
2059 unsigned MipsFastISel::getRegEnsuringSimpleIntegerWidening(
const Value *V,
2061 unsigned VReg = getRegForValue(V);
2064 MVT VMVT = TLI.getValueType(DL, V->
getType(),
true).getSimpleVT();
2070 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
2071 if (!emitIntExt(VMVT, VReg,
MVT::i32, TempReg, IsUnsigned))
2078 void MipsFastISel::simplifyAddress(
Address &Addr) {
2081 materialize32BitInt(Addr.getOffset(), &Mips::GPR32RegClass);
2082 unsigned DestReg = createResultReg(&Mips::GPR32RegClass);
2083 emitInst(Mips::ADDu, DestReg).addReg(TempReg).addReg(Addr.getReg());
2084 Addr.setReg(DestReg);
2089 unsigned MipsFastISel::fastEmitInst_rr(
unsigned MachineInstOpcode,
2091 unsigned Op0,
bool Op0IsKill,
2092 unsigned Op1,
bool Op1IsKill) {
2100 unsigned ResultReg = createResultReg(RC);
2104 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc, II, ResultReg)
2120 return new MipsFastISel(funcInfo, libInfo);
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
Return a value (possibly void), from a function.
void push_back(const T &Elt)
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
bool isInteger() const
Return true if this is an integer or a vector integer type.
This class is the base class for the comparison instructions.
bool hasLocalLinkage() const
uint64_t getZExtValue() const
Get zero extended value.
C - The default llvm calling convention, compatible with C.
Compute iterated dominance frontiers using a linear time algorithm.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
bool isVector() const
Return true if this is a vector value type.
Describe properties that are true of each instruction in the target description file.
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
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...
const MipsInstrInfo * getInstrInfo() const override
const Value * getTrueValue() const
0 1 0 0 True if ordered and less than
unsigned getValNo() const
LLVMContext & getContext() const
All values hold a context through their type.
1 1 1 0 True if unordered or not equal
This class wraps the llvm.memset intrinsic.
BasicBlock * getSuccessor(unsigned i) const
constexpr bool isInt< 16 >(int64_t x)
unsigned const TargetRegisterInfo * TRI
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
Value * getCondition() const
bool isVectorTy() const
True if this is an instance of VectorType.
void reserve(size_type N)
Value * getLength() const
SI optimize exec mask operations pre RA
Used to lazily calculate structure layout information for a target machine, based on the DataLayout s...
A description of a memory reference used in the backend.
This class represents the LLVM 'select' instruction.
const HexagonInstrInfo * TII
PointerType * getType() const
Overload to return most specific pointer type.
Class to represent struct types.
A Use represents the edge between a Value definition and its users.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
bool isIntegerTy() const
True if this is an instance of IntegerType.
0 1 0 1 True if ordered and less than or equal
This file contains the simple types necessary to represent the attributes associated with functions a...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted...
static bool CC_MipsO32_FP32(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
unsigned getStoreSize() const
Return the number of bytes overwritten by a store of the specified value type.
LocInfo getLocInfo() const
This class defines information used to lower LLVM code to legal SelectionDAG operators that the targe...
This file implements a class to represent arbitrary precision integral constant values and operations...
unsigned getSizeInBits() const
This is a fast-path instruction selection class that generates poor code and doesn't support illegal ...
A constant value that is initialized with an expression using other constant values.
unsigned getNextStackOffset() const
getNextStackOffset - Return the next stack offset such that all stack slots satisfy their alignment r...
Type * getType() const
All values are typed, get the type of this value.
void AnalyzeCallResult(const SmallVectorImpl< ISD::InputArg > &Ins, CCAssignFn Fn, const Type *RetTy, const char *Func)
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
AttributeList getAttributes() const
Return the attribute list for this Function.
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
amdgpu Simplify well known AMD library false Value * Callee
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
Value * getOperand(unsigned i) const
unsigned getKillRegState(bool B)
Flag
These should be considered private to the implementation of the MCInstrDesc class.
TargetInstrInfo - Interface to description of machine instruction set.
Value * getOperand(unsigned i_nocapture) const
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
static unsigned selectBinaryOp(unsigned GenericOpc, unsigned RegBankID, unsigned OpSize)
Select the AArch64 opcode for the basic binary operation GenericOpc (such as G_OR or G_SDIV)...
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
Type * getReturnType() const
Returns the type of the ret val.
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
Conditional or Unconditional Branch instruction.
This is an important base class in LLVM.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static ManagedStatic< OptionRegistry > OR
ConstantFP - Floating Point Values [float, double].
bool hasInternalLinkage() const
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
const MachineInstrBuilder & addFrameIndex(int Idx) const
const Value * getCondition() const
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
Type * getIndexedType() const
static bool isAtomic(Instruction *I)
Fast - This calling convention attempts to make calls as fast as possible (e.g.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
The memory access writes data.
const APFloat & getValueAPF() const
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
void GetReturnInfo(CallingConv::ID CC, Type *ReturnType, AttributeList attr, SmallVectorImpl< ISD::OutputArg > &Outs, const TargetLowering &TLI, const DataLayout &DL)
Given an LLVM IR type and return type attributes, compute the return value EVTs and flags...
0 0 1 0 True if ordered and greater than
MO_GOT - Represents the offset into the global offset table at which the address the relocation entry...
unsigned getNumOperands() const
StructType * getStructTypeOrNull() const
CCState - This class holds information needed while lowering arguments and return values...
This is the shared class of boolean and integer constants.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Provides information about what library functions are available for the current target.
static bool CC_MipsO32(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State, ArrayRef< MCPhysReg > F64Regs)
CCValAssign - Represent assignment of one arg/retval to a location.
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
unsigned fastEmitInst_rr(unsigned MachineInstOpcode, const TargetRegisterClass *RC, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill)
Emit a MachineInstr with two register operands and a result register in the given register class...
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static bool CC_Mips(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State) LLVM_ATTRIBUTE_UNUSED
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static unsigned getReg(const void *D, unsigned RC, unsigned RegNo)
This file defines the FastISel class.
const MipsTargetLowering * getTargetLowering() const override
void AnalyzeCallOperands(const SmallVectorImpl< ISD::OutputArg > &Outs, CCAssignFn Fn)
AnalyzeCallOperands - Analyze the outgoing arguments to a call, incorporating info about the passed v...
const Value * getFalseValue() const
#define LLVM_ATTRIBUTE_UNUSED
The memory access reads data.
static MachinePointerInfo getFixedStack(MachineFunction &MF, int FI, int64_t Offset=0)
Return a MachinePointerInfo record that refers to the specified FrameIndex.
Predicate getPredicate() const
Return the predicate for this instruction.
bool isVector() const
Return true if this is a vector value type.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Bitwise operators - logical and, logical or, logical xor.
uint64_t getElementOffset(unsigned Idx) const
void emplace_back(ArgTypes &&... Args)
unsigned getLocMemOffset() const
unsigned getNumArgOperands() const
Return the number of call arguments.
unsigned greater or equal
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode...
const Function * getParent() const
Return the enclosing method, or null if none.
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
constexpr bool isUInt< 16 >(uint64_t x)
static SDValue emitCmp(SelectionDAG &DAG, const SDLoc &DL, Comparison &C)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
0 0 0 1 True if ordered and equal
LLVM Value Representation.
bool useSoftFloat() const
Primary interface to the complete machine description for the target machine.
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset, uint8_t ID=0)
Stack pointer relative access.
unsigned constrainOperandRegClass(const MachineFunction &MF, const TargetRegisterInfo &TRI, MachineRegisterInfo &MRI, const TargetInstrInfo &TII, const RegisterBankInfo &RBI, MachineInstr &InsertPt, const MCInstrDesc &II, const MachineOperand &RegMO, unsigned OpIdx)
Try to constrain Reg so that it is usable by argument OpIdx of the provided MCInstrDesc II...
APInt bitcastToAPInt() const
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
unsigned getLocReg() const
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
0 0 1 1 True if ordered and greater than or equal
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
static bool CC_MipsO32_FP64(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
void convertToReg(unsigned RegNo)
iterator_range< arg_iterator > args()
bool isStructTy() const
True if this is an instance of StructType.
bool isArrayTy() const
True if this is an instance of ArrayType.
A wrapper class for inspecting calls to intrinsic functions.
This file describes how to lower LLVM code to machine code.
const BasicBlock * getParent() const
an instruction to allocate memory on the stack
gep_type_iterator gep_type_begin(const User *GEP)