74 #define DEBUG_TYPE "mips-fastisel"
80 class MipsFastISel final :
public FastISel {
85 typedef enum { RegBase, FrameIndexBase } BaseKind;
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);
236 unsigned Op0,
bool Op0IsKill, uint64_t imm1,
237 uint64_t imm2,
unsigned Op3,
bool Op3IsKill) {
246 bool finishCall(CallLoweringInfo &CLI,
MVT RetVT,
unsigned NumBytes);
258 TII(*Subtarget->getInstrInfo()), TLI(*Subtarget->getTargetLowering()) {
261 UnsupportedFPMode = Subtarget->isFP64bit() || Subtarget->useSoftFloat();
264 unsigned fastMaterializeAlloca(
const AllocaInst *AI)
override;
265 unsigned fastMaterializeConstant(
const Constant *C)
override;
266 bool fastSelectInstruction(
const Instruction *I)
override;
268 #include "MipsGenFastISel.inc"
289 #include "MipsGenCallingConv.inc"
295 unsigned MipsFastISel::emitLogicalOp(
unsigned ISDOpc,
MVT RetVT,
298 if (isa<ConstantInt>(LHS) && !isa<ConstantInt>(RHS))
316 unsigned LHSReg = getRegForValue(LHS);
321 if (
const auto *
C = dyn_cast<ConstantInt>(RHS))
324 RHSReg = getRegForValue(RHS);
328 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
332 emitInst(Opc, ResultReg).addReg(LHSReg).addReg(RHSReg);
336 unsigned MipsFastISel::fastMaterializeAlloca(
const AllocaInst *AI) {
338 "Alloca should always return a pointer.");
341 FuncInfo.StaticAllocaMap.find(AI);
343 if (SI != FuncInfo.StaticAllocaMap.
end()) {
344 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
345 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
TII.get(Mips::LEA_ADDiu),
347 .addFrameIndex(SI->second)
355 unsigned MipsFastISel::materializeInt(
const Constant *
C,
MVT VT) {
363 unsigned MipsFastISel::materialize32BitInt(int64_t Imm,
365 unsigned ResultReg = createResultReg(RC);
368 unsigned Opc = Mips::ADDiu;
369 emitInst(Opc, ResultReg).addReg(Mips::ZERO).addImm(Imm);
372 emitInst(Mips::ORi, ResultReg).addReg(Mips::ZERO).addImm(Imm);
375 unsigned Lo = Imm & 0xFFFF;
376 unsigned Hi = (Imm >> 16) & 0xFFFF;
379 unsigned TmpReg = createResultReg(RC);
380 emitInst(Mips::LUi, TmpReg).addImm(Hi);
381 emitInst(Mips::ORi, ResultReg).addReg(TmpReg).addImm(Lo);
383 emitInst(Mips::LUi, ResultReg).addImm(Hi);
388 unsigned MipsFastISel::materializeFP(
const ConstantFP *CFP,
MVT VT) {
389 if (UnsupportedFPMode)
394 unsigned DestReg = createResultReg(RC);
395 unsigned TempReg = materialize32BitInt(Imm, &Mips::GPR32RegClass);
396 emitInst(Mips::MTC1, DestReg).addReg(TempReg);
400 unsigned DestReg = createResultReg(RC);
401 unsigned TempReg1 = materialize32BitInt(Imm >> 32, &Mips::GPR32RegClass);
403 materialize32BitInt(Imm & 0xFFFFFFFF, &Mips::GPR32RegClass);
410 unsigned MipsFastISel::materializeGV(
const GlobalValue *GV,
MVT VT) {
415 unsigned DestReg = createResultReg(RC);
421 emitInst(Mips::LW, DestReg)
422 .addReg(MFI->getGlobalBaseReg())
426 unsigned TempReg = createResultReg(RC);
427 emitInst(Mips::ADDiu, TempReg)
435 unsigned MipsFastISel::materializeExternalCallSym(
MCSymbol *Sym) {
437 unsigned DestReg = createResultReg(RC);
438 emitInst(Mips::LW, DestReg)
439 .addReg(MFI->getGlobalBaseReg())
446 unsigned MipsFastISel::fastMaterializeConstant(
const Constant *C) {
454 if (
const ConstantFP *CFP = dyn_cast<ConstantFP>(C))
455 return (UnsupportedFPMode) ? 0 : materializeFP(CFP, VT);
456 else if (
const GlobalValue *GV = dyn_cast<GlobalValue>(C))
457 return materializeGV(GV, VT);
458 else if (isa<ConstantInt>(C))
459 return materializeInt(C, VT);
464 bool MipsFastISel::computeAddress(
const Value *Obj,
Address &Addr) {
465 const User *U =
nullptr;
466 unsigned Opcode = Instruction::UserOp1;
467 if (
const Instruction *
I = dyn_cast<Instruction>(Obj)) {
470 if (FuncInfo.StaticAllocaMap.count(static_cast<const AllocaInst *>(Obj)) ||
471 FuncInfo.MBBMap[
I->getParent()] == FuncInfo.MBB) {
472 Opcode =
I->getOpcode();
475 }
else if (
const ConstantExpr *C = dyn_cast<ConstantExpr>(Obj)) {
476 Opcode = C->getOpcode();
482 case Instruction::BitCast:
484 return computeAddress(U->
getOperand(0), Addr);
485 case Instruction::GetElementPtr: {
487 int64_t TmpOffset = Addr.getOffset();
496 unsigned Idx = cast<ConstantInt>(
Op)->getZExtValue();
501 if (
const ConstantInt *CI = dyn_cast<ConstantInt>(Op)) {
506 if (canFoldAddIntoGEP(U, Op)) {
509 cast<ConstantInt>(cast<AddOperator>(
Op)->getOperand(1));
512 Op = cast<AddOperator>(
Op)->getOperand(0);
516 goto unsupported_gep;
521 Addr.setOffset(TmpOffset);
529 case Instruction::Alloca: {
532 FuncInfo.StaticAllocaMap.
find(AI);
533 if (SI != FuncInfo.StaticAllocaMap.end()) {
534 Addr.setKind(Address::FrameIndexBase);
535 Addr.setFI(SI->second);
541 Addr.setReg(getRegForValue(Obj));
542 return Addr.getReg() != 0;
545 bool MipsFastISel::computeCallAddress(
const Value *V,
Address &Addr) {
546 const User *U =
nullptr;
547 unsigned Opcode = Instruction::UserOp1;
549 if (
const auto *
I = dyn_cast<Instruction>(V)) {
552 if (
I->getParent() == FuncInfo.MBB->getBasicBlock()) {
553 Opcode =
I->getOpcode();
556 }
else if (
const auto *C = dyn_cast<ConstantExpr>(V)) {
557 Opcode = C->getOpcode();
564 case Instruction::BitCast:
566 return computeCallAddress(U->
getOperand(0), Addr);
568 case Instruction::IntToPtr:
571 TLI.getPointerTy(
DL))
572 return computeCallAddress(U->
getOperand(0), Addr);
574 case Instruction::PtrToInt:
576 if (TLI.getValueType(
DL, U->
getType()) == TLI.getPointerTy(
DL))
577 return computeCallAddress(U->
getOperand(0), Addr);
581 if (
const GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
582 Addr.setGlobalValue(GV);
587 if (!Addr.getGlobalValue()) {
588 Addr.setReg(getRegForValue(V));
589 return Addr.getReg() != 0;
595 bool MipsFastISel::isTypeLegal(
Type *Ty,
MVT &VT) {
596 EVT evt = TLI.getValueType(
DL, Ty,
true);
604 return TLI.isTypeLegal(VT);
607 bool MipsFastISel::isTypeSupported(
Type *Ty,
MVT &VT) {
611 if (isTypeLegal(Ty, VT))
622 bool MipsFastISel::isLoadTypeLegal(
Type *Ty,
MVT &VT) {
623 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()))
944 bool MipsFastISel::selectBranch(
const Instruction *I) {
959 unsigned CondReg = createResultReg(&Mips::GPR32RegClass);
962 BuildMI(*BrBB, FuncInfo.InsertPt, DbgLoc,
TII.get(Mips::BGTZ))
965 finishCondBranch(BI->
getParent(), TBB, FBB);
971 bool MipsFastISel::selectCmp(
const Instruction *I) {
972 const CmpInst *CI = cast<CmpInst>(
I);
973 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
976 updateValueMap(I, ResultReg);
981 bool MipsFastISel::selectFPExt(
const Instruction *I) {
982 if (UnsupportedFPMode)
997 unsigned DestReg = createResultReg(&Mips::AFGR64RegClass);
998 emitInst(Mips::CVT_D32_S, DestReg).addReg(SrcReg);
999 updateValueMap(I, DestReg);
1003 bool MipsFastISel::selectSelect(
const Instruction *I) {
1004 assert(isa<SelectInst>(I) &&
"Expected a select instruction.");
1009 if (!isTypeSupported(I->
getType(), VT) || UnsupportedFPMode) {
1010 DEBUG(
dbgs() <<
".. .. gave up (!isTypeSupported || UnsupportedFPMode)\n");
1014 unsigned CondMovOpc;
1018 CondMovOpc = Mips::MOVN_I_I;
1019 RC = &Mips::GPR32RegClass;
1021 CondMovOpc = Mips::MOVN_I_S;
1022 RC = &Mips::FGR32RegClass;
1024 CondMovOpc = Mips::MOVN_I_D32;
1025 RC = &Mips::AFGR64RegClass;
1033 unsigned CondReg = getRegForValue(Cond);
1035 if (!Src1Reg || !Src2Reg || !CondReg)
1038 unsigned ZExtCondReg = createResultReg(&Mips::GPR32RegClass);
1045 unsigned ResultReg = createResultReg(RC);
1046 unsigned TempReg = createResultReg(RC);
1048 if (!ResultReg || !TempReg)
1051 emitInst(TargetOpcode::COPY, TempReg).addReg(Src2Reg);
1052 emitInst(CondMovOpc, ResultReg)
1053 .addReg(Src1Reg).addReg(ZExtCondReg).addReg(TempReg);
1054 updateValueMap(I, ResultReg);
1059 bool MipsFastISel::selectFPTrunc(
const Instruction *I) {
1060 if (UnsupportedFPMode)
1063 EVT SrcVT = TLI.getValueType(
DL, Src->
getType(),
true);
1069 unsigned SrcReg = getRegForValue(Src);
1073 unsigned DestReg = createResultReg(&Mips::FGR32RegClass);
1077 emitInst(Mips::CVT_S_D32, DestReg).addReg(SrcReg);
1078 updateValueMap(I, DestReg);
1083 bool MipsFastISel::selectFPToInt(
const Instruction *I,
bool IsSigned) {
1084 if (UnsupportedFPMode)
1091 if (!isTypeLegal(DstTy, DstVT))
1099 if (!isTypeLegal(SrcTy, SrcVT))
1105 unsigned SrcReg = getRegForValue(Src);
1111 unsigned DestReg = createResultReg(&Mips::GPR32RegClass);
1112 unsigned TempReg = createResultReg(&Mips::FGR32RegClass);
1113 unsigned Opc = (SrcVT ==
MVT::f32) ? Mips::TRUNC_W_S : Mips::TRUNC_W_D32;
1116 emitInst(Opc, TempReg).addReg(SrcReg);
1117 emitInst(Mips::MFC1, DestReg).addReg(TempReg);
1119 updateValueMap(I, DestReg);
1123 bool MipsFastISel::processCallArgs(CallLoweringInfo &CLI,
1125 unsigned &NumBytes) {
1129 CCInfo.AnalyzeCallOperands(OutVTs, CLI.OutFlags, CCAssignFnForCall(CC));
1131 NumBytes = CCInfo.getNextStackOffset();
1136 emitInst(Mips::ADJCALLSTACKDOWN).addImm(16).addImm(0);
1139 for (
unsigned i = 0, e = ArgLocs.
size(); i != e; ++i) {
1151 }
else if (i == 1) {
1180 unsigned ArgReg = getRegForValue(ArgVal);
1192 ArgReg = emitIntExt(SrcVT, ArgReg, DestVT,
false);
1200 ArgReg = emitIntExt(SrcVT, ArgReg, DestVT,
true);
1211 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
1212 TII.get(TargetOpcode::COPY), VA.
getLocReg()).addReg(ArgReg);
1225 if (isa<UndefValue>(ArgVal))
1235 unsigned BEAlign = 0;
1236 if (ArgSize < 8 && !Subtarget->isLittle())
1237 BEAlign = 8 - ArgSize;
1240 Addr.setKind(Address::RegBase);
1241 Addr.setReg(Mips::SP);
1257 bool MipsFastISel::finishCall(CallLoweringInfo &CLI,
MVT RetVT,
1258 unsigned NumBytes) {
1260 emitInst(Mips::ADJCALLSTACKUP).addImm(16).addImm(0);
1265 CCInfo.AnalyzeCallResult(CLI.Ins, RetCC_Mips, CLI.RetTy,
1266 CLI.Symbol ? CLI.Symbol->getName().data()
1270 if (RVLocs.
size() != 1)
1273 MVT CopyVT = RVLocs[0].getValVT();
1278 unsigned ResultReg = createResultReg(TLI.getRegClassFor(CopyVT));
1281 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
1282 TII.get(TargetOpcode::COPY),
1283 ResultReg).addReg(RVLocs[0].getLocReg());
1284 CLI.InRegs.push_back(RVLocs[0].getLocReg());
1286 CLI.ResultReg = ResultReg;
1287 CLI.NumResultRegs = 1;
1292 bool MipsFastISel::fastLowerArguments() {
1293 DEBUG(
dbgs() <<
"fastLowerArguments\n");
1295 if (!FuncInfo.CanLowerReturn) {
1296 DEBUG(
dbgs() <<
".. gave up (!CanLowerReturn)\n");
1302 DEBUG(
dbgs() <<
".. gave up (varargs)\n");
1308 DEBUG(
dbgs() <<
".. gave up (calling convention is not C)\n");
1320 struct AllocatedReg {
1324 : RC(RC), Reg(Reg) {}
1330 for (
const auto &FormalArg : F->
args()) {
1331 if (FormalArg.hasAttribute(Attribute::InReg) ||
1332 FormalArg.hasAttribute(Attribute::StructRet) ||
1333 FormalArg.hasAttribute(Attribute::ByVal)) {
1334 DEBUG(
dbgs() <<
".. gave up (inreg, structret, byval)\n");
1338 Type *ArgTy = FormalArg.getType();
1340 DEBUG(
dbgs() <<
".. gave up (struct, array, or vector)\n");
1344 EVT ArgVT = TLI.getValueType(
DL, ArgTy);
1345 DEBUG(
dbgs() <<
".. " << FormalArg.getArgNo() <<
": "
1348 DEBUG(
dbgs() <<
".. .. gave up (not a simple type)\n");
1356 if (!FormalArg.hasAttribute(Attribute::SExt) &&
1357 !FormalArg.hasAttribute(Attribute::ZExt)) {
1360 DEBUG(
dbgs() <<
".. .. gave up (i8/i16 arg is not extended)\n");
1364 if (NextGPR32 == GPR32ArgRegs.
end()) {
1365 DEBUG(
dbgs() <<
".. .. gave up (ran out of GPR32 arguments)\n");
1369 DEBUG(
dbgs() <<
".. .. GPR32(" << *NextGPR32 <<
")\n");
1370 Allocation.
emplace_back(&Mips::GPR32RegClass, *NextGPR32++);
1373 NextFGR32 = FGR32ArgRegs.
end();
1374 NextAFGR64 = AFGR64ArgRegs.
end();
1378 if (FormalArg.hasAttribute(Attribute::ZExt)) {
1380 DEBUG(
dbgs() <<
".. .. gave up (i32 arg is zero extended)\n");
1384 if (NextGPR32 == GPR32ArgRegs.
end()) {
1385 DEBUG(
dbgs() <<
".. .. gave up (ran out of GPR32 arguments)\n");
1389 DEBUG(
dbgs() <<
".. .. GPR32(" << *NextGPR32 <<
")\n");
1390 Allocation.
emplace_back(&Mips::GPR32RegClass, *NextGPR32++);
1393 NextFGR32 = FGR32ArgRegs.
end();
1394 NextAFGR64 = AFGR64ArgRegs.
end();
1398 if (UnsupportedFPMode) {
1399 DEBUG(
dbgs() <<
".. .. gave up (UnsupportedFPMode)\n");
1402 if (NextFGR32 == FGR32ArgRegs.
end()) {
1403 DEBUG(
dbgs() <<
".. .. gave up (ran out of FGR32 arguments)\n");
1406 DEBUG(
dbgs() <<
".. .. FGR32(" << *NextFGR32 <<
")\n");
1407 Allocation.
emplace_back(&Mips::FGR32RegClass, *NextFGR32++);
1410 if (NextGPR32 != GPR32ArgRegs.
end())
1412 if (NextAFGR64 != AFGR64ArgRegs.
end())
1417 if (UnsupportedFPMode) {
1418 DEBUG(
dbgs() <<
".. .. gave up (UnsupportedFPMode)\n");
1421 if (NextAFGR64 == AFGR64ArgRegs.
end()) {
1422 DEBUG(
dbgs() <<
".. .. gave up (ran out of AFGR64 arguments)\n");
1425 DEBUG(
dbgs() <<
".. .. AFGR64(" << *NextAFGR64 <<
")\n");
1426 Allocation.
emplace_back(&Mips::AFGR64RegClass, *NextAFGR64++);
1429 if (NextGPR32 != GPR32ArgRegs.
end())
1431 if (NextGPR32 != GPR32ArgRegs.
end())
1433 if (NextFGR32 != FGR32ArgRegs.
end())
1438 DEBUG(
dbgs() <<
".. .. gave up (unknown type)\n");
1443 for (
const auto &FormalArg : F->
args()) {
1444 unsigned ArgNo = FormalArg.getArgNo();
1445 unsigned SrcReg = Allocation[ArgNo].Reg;
1446 unsigned DstReg = FuncInfo.MF->addLiveIn(SrcReg, Allocation[ArgNo].RC);
1450 unsigned ResultReg = createResultReg(Allocation[ArgNo].RC);
1451 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
1452 TII.get(TargetOpcode::COPY), ResultReg)
1454 updateValueMap(&FormalArg, ResultReg);
1459 unsigned IncomingArgSizeInBytes = 0;
1464 IncomingArgSizeInBytes =
std::min(getABI().GetCalleeAllocdArgSizeInBytes(CC),
1465 IncomingArgSizeInBytes);
1473 bool MipsFastISel::fastLowerCall(CallLoweringInfo &CLI) {
1475 bool IsTailCall = CLI.IsTailCall;
1476 bool IsVarArg = CLI.IsVarArg;
1477 const Value *Callee = CLI.Callee;
1494 if (CLI.RetTy->isVoidTy())
1496 else if (!isTypeSupported(CLI.RetTy, RetVT))
1499 for (
auto Flag : CLI.OutFlags)
1505 OutVTs.
reserve(CLI.OutVals.size());
1507 for (
auto *Val : CLI.OutVals) {
1509 if (!isTypeLegal(Val->getType(), VT) &&
1521 if (!computeCallAddress(Callee, Addr))
1526 if (!processCallArgs(CLI, OutVTs, NumBytes))
1529 if (!Addr.getGlobalValue())
1533 unsigned DestAddress;
1535 DestAddress = materializeExternalCallSym(Symbol);
1537 DestAddress = materializeGV(Addr.getGlobalValue(),
MVT::i32);
1538 emitInst(TargetOpcode::COPY, Mips::T9).addReg(DestAddress);
1540 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
TII.get(Mips::JALR),
1541 Mips::RA).addReg(Mips::T9);
1544 for (
auto Reg : CLI.OutRegs)
1549 MIB.
addRegMask(TRI.getCallPreservedMask(*FuncInfo.MF, CC));
1554 return finishCall(CLI, RetVT, NumBytes);
1557 bool MipsFastISel::fastLowerIntrinsicCall(
const IntrinsicInst *II) {
1561 case Intrinsic::bswap: {
1565 if (!isTypeSupported(RetTy, VT))
1568 unsigned SrcReg = getRegForValue(II->
getOperand(0));
1571 unsigned DestReg = createResultReg(&Mips::GPR32RegClass);
1575 if (Subtarget->hasMips32r2()) {
1576 emitInst(Mips::WSBH, DestReg).addReg(SrcReg);
1577 updateValueMap(II, DestReg);
1580 unsigned TempReg[3];
1581 for (
int i = 0; i < 3; i++) {
1582 TempReg[i] = createResultReg(&Mips::GPR32RegClass);
1583 if (TempReg[i] == 0)
1586 emitInst(Mips::SLL, TempReg[0]).addReg(SrcReg).addImm(8);
1587 emitInst(
Mips::SRL, TempReg[1]).addReg(SrcReg).addImm(8);
1588 emitInst(
Mips::OR, TempReg[2]).addReg(TempReg[0]).addReg(TempReg[1]);
1589 emitInst(Mips::ANDi, DestReg).addReg(TempReg[2]).addImm(0xFFFF);
1590 updateValueMap(II, DestReg);
1594 if (Subtarget->hasMips32r2()) {
1595 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
1596 emitInst(Mips::WSBH, TempReg).addReg(SrcReg);
1597 emitInst(
Mips::ROTR, DestReg).addReg(TempReg).addImm(16);
1598 updateValueMap(II, DestReg);
1601 unsigned TempReg[8];
1602 for (
int i = 0; i < 8; i++) {
1603 TempReg[i] = createResultReg(&Mips::GPR32RegClass);
1604 if (TempReg[i] == 0)
1608 emitInst(
Mips::SRL, TempReg[0]).addReg(SrcReg).addImm(8);
1609 emitInst(
Mips::SRL, TempReg[1]).addReg(SrcReg).addImm(24);
1610 emitInst(Mips::ANDi, TempReg[2]).addReg(TempReg[0]).addImm(0xFF00);
1611 emitInst(
Mips::OR, TempReg[3]).addReg(TempReg[1]).addReg(TempReg[2]);
1613 emitInst(Mips::ANDi, TempReg[4]).addReg(SrcReg).addImm(0xFF00);
1614 emitInst(Mips::SLL, TempReg[5]).addReg(TempReg[4]).addImm(8);
1616 emitInst(Mips::SLL, TempReg[6]).addReg(SrcReg).addImm(24);
1617 emitInst(
Mips::OR, TempReg[7]).addReg(TempReg[3]).addReg(TempReg[5]);
1618 emitInst(
Mips::OR, DestReg).addReg(TempReg[6]).addReg(TempReg[7]);
1619 updateValueMap(II, DestReg);
1625 case Intrinsic::memcpy:
1626 case Intrinsic::memmove: {
1627 const auto *MTI = cast<MemTransferInst>(II);
1629 if (MTI->isVolatile())
1631 if (!MTI->getLength()->getType()->isIntegerTy(32))
1633 const char *IntrMemName = isa<MemCpyInst>(II) ?
"memcpy" :
"memmove";
1636 case Intrinsic::memset: {
1637 const MemSetInst *MSI = cast<MemSetInst>(II);
1649 bool MipsFastISel::selectRet(
const Instruction *I) {
1655 if (!FuncInfo.CanLowerReturn)
1676 CCInfo.AnalyzeReturn(Outs, RetCC);
1679 if (ValLocs.size() != 1)
1694 unsigned Reg = getRegForValue(RV);
1698 unsigned SrcReg = Reg + VA.
getValNo();
1701 if (!
MRI.getRegClass(SrcReg)->contains(DestReg))
1716 if (RVVT ==
MVT::f64 && UnsupportedFPMode) {
1717 DEBUG(
dbgs() <<
".. .. gave up (UnsupportedFPMode\n");
1723 if (RVVT != DestVT) {
1727 if (Outs[0].
Flags.isZExt() || Outs[0].Flags.isSExt()) {
1728 bool IsZExt = Outs[0].Flags.isZExt();
1729 SrcReg = emitIntExt(RVVT, SrcReg, DestVT, IsZExt);
1736 BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
1737 TII.get(TargetOpcode::COPY), DestReg).addReg(SrcReg);
1743 for (
unsigned i = 0, e = RetRegs.
size(); i != e; ++i)
1748 bool MipsFastISel::selectTrunc(
const Instruction *I) {
1754 SrcVT = TLI.getValueType(
DL, Op->
getType(),
true);
1755 DestVT = TLI.getValueType(
DL, I->
getType(),
true);
1762 unsigned SrcReg = getRegForValue(Op);
1768 updateValueMap(I, SrcReg);
1772 bool MipsFastISel::selectIntExt(
const Instruction *I) {
1777 bool isZExt = isa<ZExtInst>(
I);
1778 unsigned SrcReg = getRegForValue(Src);
1782 EVT SrcEVT, DestEVT;
1783 SrcEVT = TLI.getValueType(
DL, SrcTy,
true);
1784 DestEVT = TLI.getValueType(
DL, DestTy,
true);
1792 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
1794 if (!emitIntExt(SrcVT, SrcReg, DestVT, ResultReg, isZExt))
1796 updateValueMap(I, ResultReg);
1800 bool MipsFastISel::emitIntSExt32r1(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1813 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
1814 emitInst(Mips::SLL, TempReg).addReg(SrcReg).addImm(ShiftAmt);
1815 emitInst(
Mips::SRA, DestReg).addReg(TempReg).addImm(ShiftAmt);
1819 bool MipsFastISel::emitIntSExt32r2(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1825 emitInst(Mips::SEB, DestReg).addReg(SrcReg);
1828 emitInst(Mips::SEH, DestReg).addReg(SrcReg);
1834 bool MipsFastISel::emitIntSExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1838 if (Subtarget->hasMips32r2())
1839 return emitIntSExt32r2(SrcVT, SrcReg, DestVT, DestReg);
1840 return emitIntSExt32r1(SrcVT, SrcReg, DestVT, DestReg);
1843 bool MipsFastISel::emitIntZExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1861 emitInst(Mips::ANDi, DestReg).addReg(SrcReg).addImm(Imm);
1865 bool MipsFastISel::emitIntExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1866 unsigned DestReg,
bool IsZExt) {
1875 return emitIntZExt(SrcVT, SrcReg, DestVT, DestReg);
1876 return emitIntSExt(SrcVT, SrcReg, DestVT, DestReg);
1879 unsigned MipsFastISel::emitIntExt(
MVT SrcVT,
unsigned SrcReg,
MVT DestVT,
1881 unsigned DestReg = createResultReg(&Mips::GPR32RegClass);
1882 bool Success = emitIntExt(SrcVT, SrcReg, DestVT, DestReg, isZExt);
1883 return Success ? DestReg : 0;
1886 bool MipsFastISel::selectDivRem(
const Instruction *I,
unsigned ISDOpcode) {
1887 EVT DestEVT = TLI.getValueType(
DL, I->
getType(),
true);
1896 switch (ISDOpcode) {
1909 unsigned Src0Reg = getRegForValue(I->
getOperand(0));
1910 unsigned Src1Reg = getRegForValue(I->
getOperand(1));
1911 if (!Src0Reg || !Src1Reg)
1914 emitInst(DivOpc).addReg(Src0Reg).addReg(Src1Reg);
1915 emitInst(Mips::TEQ).addReg(Src1Reg).addReg(Mips::ZERO).addImm(7);
1917 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
1924 emitInst(MFOpc, ResultReg);
1926 updateValueMap(I, ResultReg);
1930 bool MipsFastISel::selectShift(
const Instruction *I) {
1933 if (!isTypeSupported(I->
getType(), RetVT))
1936 unsigned ResultReg = createResultReg(&Mips::GPR32RegClass);
1942 unsigned Op0Reg = getRegForValue(Op0);
1947 if (Opcode == Instruction::AShr || Opcode == Instruction::LShr) {
1948 unsigned TempReg = createResultReg(&Mips::GPR32RegClass);
1952 MVT Op0MVT = TLI.getValueType(
DL, Op0->
getType(),
true).getSimpleVT();
1953 bool IsZExt = Opcode == Instruction::LShr;
1954 if (!emitIntExt(Op0MVT, Op0Reg,
MVT::i32, TempReg, IsZExt))
1960 if (
const auto *C = dyn_cast<ConstantInt>(I->
getOperand(1))) {
1961 uint64_t ShiftVal = C->getZExtValue();
1966 case Instruction::Shl:
1969 case Instruction::AShr:
1972 case Instruction::LShr:
1977 emitInst(Opcode, ResultReg).addReg(Op0Reg).addImm(ShiftVal);
1978 updateValueMap(I, ResultReg);
1982 unsigned Op1Reg = getRegForValue(I->
getOperand(1));
1989 case Instruction::Shl:
1990 Opcode = Mips::SLLV;
1992 case Instruction::AShr:
1993 Opcode = Mips::SRAV;
1995 case Instruction::LShr:
1996 Opcode = Mips::SRLV;
2000 emitInst(Opcode, ResultReg).addReg(Op0Reg).addReg(Op1Reg);
2001 updateValueMap(I, ResultReg);
2005 bool MipsFastISel::fastSelectInstruction(
const Instruction *I) {
2010 return selectLoad(I);
2012 return selectStore(I);
2013 case Instruction::SDiv:
2017 case Instruction::UDiv:
2021 case Instruction::SRem:
2025 case Instruction::URem:
2029 case Instruction::Shl:
2030 case Instruction::LShr:
2031 case Instruction::AShr:
2032 return selectShift(I);
2033 case Instruction::And:
2034 case Instruction::Or:
2035 case Instruction::Xor:
2036 return selectLogicalOp(I);
2037 case Instruction::Br:
2038 return selectBranch(I);
2040 return selectRet(I);
2041 case Instruction::Trunc:
2042 return selectTrunc(I);
2043 case Instruction::ZExt:
2044 case Instruction::SExt:
2045 return selectIntExt(I);
2046 case Instruction::FPTrunc:
2047 return selectFPTrunc(I);
2048 case Instruction::FPExt:
2049 return selectFPExt(I);
2050 case Instruction::FPToSI:
2051 return selectFPToInt(I,
true);
2052 case Instruction::FPToUI:
2053 return selectFPToInt(I,
false);
2054 case Instruction::ICmp:
2055 case Instruction::FCmp:
2056 return selectCmp(I);
2058 return selectSelect(I);
2063 unsigned MipsFastISel::getRegEnsuringSimpleIntegerWidening(
const Value *V,
2065 unsigned VReg = getRegForValue(V);
2068 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);
Return a value (possibly void), from a function.
void push_back(const T &Elt)
FastISel * createFastISel(FunctionLoweringInfo &funcInfo, const TargetLibraryInfo *libInfo)
Type * getIndexedType() const
This class is the base class for the comparison instructions.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
uint64_t getZExtValue() const
Get zero extended value.
LocInfo getLocInfo() const
unsigned constrainOperandRegClass(const MachineFunction &MF, const TargetRegisterInfo &TRI, MachineRegisterInfo &MRI, const TargetInstrInfo &TII, const RegisterBankInfo &RBI, MachineInstr &InsertPt, const MCInstrDesc &II, unsigned Reg, unsigned OpIdx)
Try to constrain Reg so that it is usable by argument OpIdx of the provided MCInstrDesc II...
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Intrinsic::ID getIntrinsicID() const
Return the intrinsic ID of this intrinsic.
unsigned getNumDefs() const
Return the number of MachineOperands that are register definitions.
Maximum length of the test input libFuzzer tries to guess a good value based on the corpus and reports it always prefer smaller inputs during the corpus shuffle When libFuzzer itself reports a bug this exit code will be used If indicates the maximal total time in seconds to run the fuzzer minimizes the provided crash input Use with tries to cleanse the provided crash input to make it contain fewer original bytes Use with exact_artifact_path to specify the output Experimental Use value profile to guide fuzzing Number of jobs to run If min(jobs, NumberOfCpuCores()/2)\" is used.") FUZZER_FLAG_INT(reload
unsigned getNumOperands() const
Describe properties that are true of each instruction in the target description file.
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...
0 1 0 0 True if ordered and less than
unsigned getSizeInBits() const
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
1 1 1 0 True if unordered or not equal
This class wraps the llvm.memset intrinsic.
const Function * getParent() const
Return the enclosing method, or null if none.
constexpr bool isInt< 16 >(int64_t x)
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...
void reserve(size_type N)
unsigned getValNo() const
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
AttributeList getAttributes() const
Return the attribute list for this Function.
bool isVector() const
Return true if this is a vector value type.
StructType * getStructTypeOrNull() const
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.
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
This class represents the LLVM 'select' instruction.
const HexagonInstrInfo * TII
const StructLayout * getStructLayout(StructType *Ty) const
Returns a StructLayout object, indicating the alignment of the struct, its size, and the offsets of i...
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
Class to represent struct types.
A Use represents the edge between a Value definition and its users.
bool hasInternalLinkage() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
unsigned getNumArgOperands() const
Return the number of call arguments.
Reg
All possible values of the reg field in the ModR/M byte.
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...
APInt bitcastToAPInt() const
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.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
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...
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
unsigned getLocReg() 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.
BasicBlock * getSuccessor(unsigned i) const
static Error getOffset(const SymbolRef &Sym, SectionRef Sec, uint64_t &Result)
bool isArrayTy() const
True if this is an instance of ArrayType.
static MachinePointerInfo getStack(MachineFunction &MF, int64_t Offset)
Stack pointer relative access.
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.
iterator find(const_arg_type_t< KeyT > Val)
uint64_t getElementOffset(unsigned Idx) const
Local Stack Slot Allocation
INITIALIZE_PASS(HexagonEarlyIfConversion,"hexagon-eif","Hexagon early if conversion", false, false) bool HexagonEarlyIfConversion MachineBasicBlock * SB
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.
bool isInteger() const
Return true if this is an integer or a vector integer type.
unsigned const MachineRegisterInfo * MRI
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.
bool isVectorTy() const
True if this is an instance of VectorType.
This is an important base class in LLVM.
PointerType * getType() const
Overload to return most specific pointer type.
bool isVector() const
Return true if this is a vector value type.
const Value * getCondition() const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
static ManagedStatic< OptionRegistry > OR
ConstantFP - Floating Point Values [float, double].
#define LLVM_ATTRIBUTE_UNUSED
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...
Value * getOperand(unsigned i) const
Predicate getPredicate() const
Return the predicate for this instruction.
bool isThreadLocal() const
If the value is "Thread Local", its value isn't shared by the threads.
LLVMContext & getContext() const
All values hold a context through their type.
static bool isAtomic(Instruction *I)
const Value * getTrueValue() const
The memory access writes data.
0 0 1 0 True if ordered and greater than
unsigned getABITypeAlignment(Type *Ty) const
Returns the minimum ABI-required alignment for the specified type.
MO_GOT - Represents the offset into the global offset table at which the address the relocation entry...
CCState - This class holds information needed while lowering arguments and return values...
This is the shared class of boolean and integer constants.
uint64_t getTypeAllocSize(Type *Ty) const
Returns the offset in bytes between successive objects of the specified type, including alignment pad...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Type * getType() const
All values are typed, get the type of this value.
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.
Value * getLength() 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...
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
const MachineInstrBuilder & addFrameIndex(int Idx) const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
C - The default llvm calling convention, compatible with C.
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)
bool isIntegerTy() const
True if this is an instance of IntegerType.
This file defines the FastISel class.
llvm_unreachable("Unknown RegBank!")
bool isStructTy() const
True if this is an instance of StructType.
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.
static std::vector< std::string > Flags
Value * getCondition() const
void emplace_back(ArgTypes &&...Args)
Bitwise operators - logical and, logical or, logical xor.
unsigned greater or equal
const MachineInstrBuilder & addMemOperand(MachineMemOperand *MMO) const
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
FunctionLoweringInfo - This contains information that is global to a function that is used when lower...
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
MipsFunctionInfo - This class is derived from MachineFunction private Mips target-specific informatio...
Fast - This calling convention attempts to make calls as fast as possible (e.g.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
constexpr bool isUInt< 16 >(uint64_t x)
bool hasLocalLinkage() const
const APFloat & getValueAPF() const
bool isUnsigned() const
Determine if this instruction is using an unsigned comparison.
static SDValue emitCmp(SelectionDAG &DAG, const SDLoc &DL, Comparison &C)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
void GetReturnInfo(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...
bool isSimple() const
Test if the given EVT is simple (as opposed to being extended).
0 0 0 1 True if ordered and equal
LLVM Value Representation.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
const MachineInstrBuilder & addMBB(MachineBasicBlock *MBB, unsigned char TargetFlags=0) const
Primary interface to the complete machine description for the target machine.
const Value * getFalseValue() const
unsigned getLocMemOffset() const
const MachineInstrBuilder & addRegMask(const uint32_t *Mask) const
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
0 0 1 1 True if ordered and greater than or equal
const MachineInstrBuilder & addReg(unsigned RegNo, unsigned flags=0, unsigned SubReg=0) const
Add a new virtual register operand.
static bool CC_MipsO32_FP64(unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, CCState &State)
const BasicBlock * getParent() const
int64_t getObjectSize(int ObjectIdx) const
Return the size of the specified object.
void convertToReg(unsigned RegNo)
MVT getSimpleVT() const
Return the SimpleValueType held in the specified simple EVT.
iterator_range< arg_iterator > args()
A wrapper class for inspecting calls to intrinsic functions.
This file describes how to lower LLVM code to machine code.
an instruction to allocate memory on the stack
gep_type_iterator gep_type_begin(const User *GEP)