27 #define DEBUG_TYPE "hexagon-cext-opt" 33 cl::desc(
"Minimum number of extenders to trigger replacement"));
43 static int32_t
adjustUp(int32_t V, uint8_t A, uint8_t
O) {
45 int32_t U = (V & -A) + O;
46 return U >= V ? U : U+A;
51 int32_t U = (V & -A) + O;
52 return U <= V ? U : U-A;
60 int32_t Min = INT_MIN, Max = INT_MAX;
64 OffsetRange() =
default;
65 OffsetRange(int32_t L, int32_t
H, uint8_t A, uint8_t
O = 0)
72 if (Offset >= A.Offset && (Offset - A.Offset) % A.Align == 0) {
74 Max =
adjustDown(std::min(Max, A.Max), Align, Offset);
82 std::tie(Min, Max, Align) = std::make_tuple(0, -1, 1);
85 OffsetRange &shift(int32_t S) {
88 Offset = (Offset+S) % Align;
91 OffsetRange &extendBy(int32_t
D) {
95 Min = (INT_MIN-D < Min) ? Min+D : INT_MIN;
97 Max = (INT_MAX-D > Max) ? Max+D : INT_MAX;
104 return Min <= V && V <= Max && (V-
Offset) % Align == 0;
107 return Min == R.Min && Max == R.Max && Align == R.Align;
112 bool operator<(
const OffsetRange &R)
const {
117 return Align < R.Align;
119 static OffsetRange
zero() {
return {0, 0, 1}; }
124 Node(
const OffsetRange &R) : MaxEnd(R.Max), Range(R) {}
128 const OffsetRange &Range;
132 Node *Root =
nullptr;
134 void add(
const OffsetRange &R) {
137 void erase(
const Node *
N) {
138 Root =
remove(Root,
N);
146 nodesWith(Root, P, CheckAlign, Nodes);
153 for (Node *N : Nodes)
158 void dump(
const Node *N)
const;
160 void nodesWith(Node *N, int32_t P,
bool CheckA,
163 Node *
add(Node *N,
const OffsetRange &R);
164 Node *
remove(Node *
N,
const Node *
D);
166 Node *rotateRight(Node *Lower, Node *Higher);
167 unsigned height(Node *N) {
168 return N !=
nullptr ? N->Height : 0;
170 Node *update(Node *N) {
172 N->Height = 1 +
std::max(height(N->Left), height(N->Right));
174 N->MaxEnd =
std::max(N->MaxEnd, N->Left->MaxEnd);
176 N->MaxEnd =
std::max(N->MaxEnd, N->Right->MaxEnd);
179 Node *rebalance(Node *N) {
181 int32_t Balance = height(N->Right) - height(N->Left);
183 return rotateRight(N->Left, N);
185 return rotateLeft(N->Right, N);
196 if (B->
end() == It) {
200 Pos = std::distance(B->
begin(), It);
204 if (Block != A.Block)
205 return Block->
getNumber() < A.Block->getNumber();
208 return Pos != -1 && Pos < A.Pos;
225 return "Hexagon constant-extender optimization";
232 Register(
unsigned R,
unsigned S) :
Reg(R), Sub(S) {}
239 }
else if (Op.
isFI()) {
244 bool isVReg()
const {
248 bool isSlot()
const {
266 return Reg < R.Reg || (
Reg == R.Reg && Sub < R.Sub);
268 unsigned Reg = 0, Sub = 0;
298 ExtExpr(
Register RS,
bool NG,
unsigned SH) : Rs(RS), S(SH), Neg(NG) {}
300 bool trivial()
const {
304 return Rs == Ex.Rs && S == Ex.S && Neg == Ex.Neg;
309 bool operator<(
const ExtExpr &Ex)
const {
314 return !Neg && Ex.Neg;
320 unsigned OpNum = -1u;
353 return Kind == ER.Kind && V.ImmVal == ER.V.ImmVal;
361 struct ExtValue :
public ExtRoot {
365 ExtValue(
const ExtDesc &ED) : ExtValue(ED.getOp()) {}
366 ExtValue(
const ExtRoot &ER, int32_t Off) : ExtRoot(ER),
Offset(Off) {}
367 bool operator<(
const ExtValue &EV)
const;
369 return ExtRoot(*
this) == ExtRoot(EV) && Offset == EV.Offset;
378 using ExtenderInit = std::pair<ExtValue, ExtExpr>;
379 using AssignmentMap = std::map<ExtenderInit, IndexList>;
380 using LocDefList = std::vector<std::pair<Loc, IndexList>>;
386 std::vector<ExtDesc> Extenders;
387 std::vector<unsigned> NewRegs;
389 bool isStoreImmediate(
unsigned Opc)
const;
390 bool isRegOffOpcode(
unsigned ExtOpc)
const ;
391 unsigned getRegOffOpcode(
unsigned ExtOpc)
const;
392 unsigned getDirectRegReplacement(
unsigned ExtOpc)
const;
394 OffsetRange getOffsetRange(
const ExtDesc &ED)
const;
395 OffsetRange getOffsetRange(
Register Rd)
const;
400 void assignInits(
const ExtRoot &ER,
unsigned Begin,
unsigned End,
401 AssignmentMap &IMap);
402 void calculatePlacement(
const ExtenderInit &ExtI,
const IndexList &Refs,
404 Register insertInitializer(Loc DefL,
const ExtenderInit &ExtI);
405 bool replaceInstrExact(
const ExtDesc &ED,
Register ExtR);
406 bool replaceInstrExpr(
const ExtDesc &ED,
const ExtenderInit &ExtI,
408 bool replaceInstr(
unsigned Idx,
Register ExtR,
const ExtenderInit &ExtI);
409 bool replaceExtenders(
const AssignmentMap &IMap);
417 friend struct PrintRegister;
418 friend struct PrintExpr;
419 friend struct PrintInit;
420 friend struct PrintIMap;
422 const struct PrintRegister &
P);
432 using HCE = HexagonConstExtenders;
438 OS <<
'[' << OR.Min <<
',' << OR.Max <<
"]a" <<
unsigned(OR.Align)
443 struct PrintRegister {
453 OS <<
printReg(P.Rs.Reg, &P.HRI, P.Rs.Sub);
462 const HCE::ExtExpr &Ex;
468 OS <<
"## " << (P.Ex.Neg ?
"- " :
"+ ");
469 if (P.Ex.Rs.Reg != 0)
470 OS <<
printReg(P.Ex.Rs.Reg, &P.HRI, P.Ex.Rs.Sub);
473 OS <<
" << " << P.Ex.S;
479 : ExtI(EI), HRI(I) {}
480 const HCE::ExtenderInit &ExtI;
486 OS <<
'[' << P.ExtI.first <<
", " 487 << PrintExpr(P.ExtI.second, P.HRI) <<
']';
499 OS <<
printReg(ED.Rd.Reg, &HRI, ED.Rd.Sub);
502 OS <<
" = " << PrintExpr(ED.Expr, HRI);
512 OS <<
"imm:" << ER.V.ImmVal;
515 OS <<
"fpi:" << *ER.V.CFP;
518 OS <<
"sym:" << *ER.V.SymbolName;
521 OS <<
"gad:" << ER.V.GV->getName();
524 OS <<
"blk:" << *ER.V.BA;
527 OS <<
"tgi:" << ER.V.ImmVal;
530 OS <<
"cpi:" << ER.V.ImmVal;
533 OS <<
"jti:" << ER.V.ImmVal;
536 OS <<
"???:" << ER.V.ImmVal;
544 OS << HCE::ExtRoot(EV) <<
" off:" << EV.Offset;
551 const HCE::AssignmentMap &IMap;
558 for (
const std::pair<const HCE::ExtenderInit, HCE::IndexList> &Q : P.IMap) {
559 OS <<
" " << PrintInit(Q.first, P.HRI) <<
" -> {";
560 for (
unsigned I : Q.second)
570 "Hexagon constant-extender optimization",
false,
false)
581 dbgs() <<
"Root: " << Root <<
'\n';
587 dbgs() <<
"Node: " << N <<
'\n';
588 dbgs() <<
" Height: " << N->Height <<
'\n';
589 dbgs() <<
" Count: " << N->Count <<
'\n';
590 dbgs() <<
" MaxEnd: " << N->MaxEnd <<
'\n';
591 dbgs() <<
" Range: " << N->Range <<
'\n';
592 dbgs() <<
" Left: " << N->Left <<
'\n';
593 dbgs() <<
" Right: " << N->Right <<
"\n\n";
607 order(N->Right, Seq);
610 void RangeTree::nodesWith(Node *N, int32_t
P,
bool CheckA,
612 if (N ==
nullptr || N->MaxEnd < P)
614 nodesWith(N->Left, P, CheckA, Seq);
615 if (N->Range.Min <= P) {
616 if ((CheckA && N->Range.contains(P)) || (!CheckA && P <= N->Range.Max))
618 nodesWith(N->Right, P, CheckA, Seq);
632 N->Left =
add(N->Left, R);
634 N->Right =
add(N->Right, R);
635 return rebalance(update(N));
642 assert(N->Range != D->Range &&
"N and D should not be equal");
643 if (D->Range < N->Range)
644 N->Left =
remove(N->Left,
D);
646 N->Right =
remove(N->Right,
D);
647 return rebalance(update(N));
652 if (N->Left ==
nullptr || N->Right ==
nullptr)
653 return (N->Left ==
nullptr) ? N->Right : N->Left;
660 M->Left =
remove(N->Left, M);
662 return rebalance(update(M));
665 RangeTree::Node *RangeTree::rotateLeft(Node *
Lower, Node *
Higher) {
666 assert(Higher->Right == Lower);
670 if (height(Lower->Left) > height(Lower->Right))
671 Lower = rotateRight(Lower->Left, Lower);
672 assert(height(Lower->Left) <= height(Lower->Right));
673 Higher->Right = Lower->Left;
680 RangeTree::Node *RangeTree::rotateRight(Node *Lower, Node *Higher) {
681 assert(Higher->Left == Lower);
685 if (height(Lower->Left) < height(Lower->Right))
686 Lower = rotateLeft(Lower->Right, Lower);
687 assert(height(Lower->Left) >= height(Lower->Right));
688 Higher->Left = Lower->Right;
720 return Kind < ER.Kind;
726 return V.ImmVal < ER.V.ImmVal;
728 const APFloat &ThisF = V.CFP->getValueAPF();
729 const APFloat &OtherF = ER.V.CFP->getValueAPF();
739 assert(!V.GV->getName().empty() && !ER.V.GV->getName().empty());
740 return V.GV->getName() < ER.V.GV->getName();
742 const BasicBlock *ThisB = V.BA->getBasicBlock();
743 const BasicBlock *OtherB = ER.V.BA->getBasicBlock();
746 return std::distance(F.begin(), ThisB->
getIterator()) <
750 return V.ImmVal < ER.V.ImmVal;
766 const ExtRoot &ER = *
this;
767 if (!(ER == ExtRoot(EV)))
769 return Offset < EV.Offset;
798 bool HCE::isStoreImmediate(
unsigned Opc)
const {
800 case Hexagon::S4_storeirbt_io:
801 case Hexagon::S4_storeirbf_io:
802 case Hexagon::S4_storeirht_io:
803 case Hexagon::S4_storeirhf_io:
804 case Hexagon::S4_storeirit_io:
805 case Hexagon::S4_storeirif_io:
806 case Hexagon::S4_storeirb_io:
807 case Hexagon::S4_storeirh_io:
808 case Hexagon::S4_storeiri_io:
816 bool HCE::isRegOffOpcode(
unsigned Opc)
const {
818 case Hexagon::L2_loadrub_io:
819 case Hexagon::L2_loadrb_io:
820 case Hexagon::L2_loadruh_io:
821 case Hexagon::L2_loadrh_io:
822 case Hexagon::L2_loadri_io:
823 case Hexagon::L2_loadrd_io:
824 case Hexagon::L2_loadbzw2_io:
825 case Hexagon::L2_loadbzw4_io:
826 case Hexagon::L2_loadbsw2_io:
827 case Hexagon::L2_loadbsw4_io:
828 case Hexagon::L2_loadalignh_io:
829 case Hexagon::L2_loadalignb_io:
830 case Hexagon::L2_ploadrubt_io:
831 case Hexagon::L2_ploadrubf_io:
832 case Hexagon::L2_ploadrbt_io:
833 case Hexagon::L2_ploadrbf_io:
834 case Hexagon::L2_ploadruht_io:
835 case Hexagon::L2_ploadruhf_io:
836 case Hexagon::L2_ploadrht_io:
837 case Hexagon::L2_ploadrhf_io:
838 case Hexagon::L2_ploadrit_io:
839 case Hexagon::L2_ploadrif_io:
840 case Hexagon::L2_ploadrdt_io:
841 case Hexagon::L2_ploadrdf_io:
842 case Hexagon::S2_storerb_io:
843 case Hexagon::S2_storerh_io:
844 case Hexagon::S2_storerf_io:
845 case Hexagon::S2_storeri_io:
846 case Hexagon::S2_storerd_io:
847 case Hexagon::S2_pstorerbt_io:
848 case Hexagon::S2_pstorerbf_io:
849 case Hexagon::S2_pstorerht_io:
850 case Hexagon::S2_pstorerhf_io:
851 case Hexagon::S2_pstorerft_io:
852 case Hexagon::S2_pstorerff_io:
853 case Hexagon::S2_pstorerit_io:
854 case Hexagon::S2_pstorerif_io:
855 case Hexagon::S2_pstorerdt_io:
856 case Hexagon::S2_pstorerdf_io:
857 case Hexagon::A2_addi:
865 unsigned HCE::getRegOffOpcode(
unsigned ExtOpc)
const {
868 using namespace Hexagon;
870 case A2_tfrsi:
return A2_addi;
885 case L4_loadrub_ur:
return L2_loadrub_io;
888 case L4_loadrb_ur:
return L2_loadrb_io;
891 case L4_loadruh_ur:
return L2_loadruh_io;
894 case L4_loadrh_ur:
return L2_loadrh_io;
897 case L4_loadri_ur:
return L2_loadri_io;
900 case L4_loadrd_ur:
return L2_loadrd_io;
902 case L4_loadbzw2_ur:
return L2_loadbzw2_io;
904 case L4_loadbzw4_ur:
return L2_loadbzw4_io;
906 case L4_loadbsw2_ur:
return L2_loadbsw2_io;
908 case L4_loadbsw4_ur:
return L2_loadbsw4_io;
909 case L4_loadalignh_ap:
910 case L4_loadalignh_ur:
return L2_loadalignh_io;
911 case L4_loadalignb_ap:
912 case L4_loadalignb_ur:
return L2_loadalignb_io;
913 case L4_ploadrubt_abs:
return L2_ploadrubt_io;
914 case L4_ploadrubf_abs:
return L2_ploadrubf_io;
915 case L4_ploadrbt_abs:
return L2_ploadrbt_io;
916 case L4_ploadrbf_abs:
return L2_ploadrbf_io;
917 case L4_ploadruht_abs:
return L2_ploadruht_io;
918 case L4_ploadruhf_abs:
return L2_ploadruhf_io;
919 case L4_ploadrht_abs:
return L2_ploadrht_io;
920 case L4_ploadrhf_abs:
return L2_ploadrhf_io;
921 case L4_ploadrit_abs:
return L2_ploadrit_io;
922 case L4_ploadrif_abs:
return L2_ploadrif_io;
923 case L4_ploadrdt_abs:
return L2_ploadrdt_io;
924 case L4_ploadrdf_abs:
return L2_ploadrdf_io;
927 case S4_storerb_ur:
return S2_storerb_io;
930 case S4_storerh_ur:
return S2_storerh_io;
933 case S4_storerf_ur:
return S2_storerf_io;
936 case S4_storeri_ur:
return S2_storeri_io;
939 case S4_storerd_ur:
return S2_storerd_io;
940 case S4_pstorerbt_abs:
return S2_pstorerbt_io;
941 case S4_pstorerbf_abs:
return S2_pstorerbf_io;
942 case S4_pstorerht_abs:
return S2_pstorerht_io;
943 case S4_pstorerhf_abs:
return S2_pstorerhf_io;
944 case S4_pstorerft_abs:
return S2_pstorerft_io;
945 case S4_pstorerff_abs:
return S2_pstorerff_io;
946 case S4_pstorerit_abs:
return S2_pstorerit_io;
947 case S4_pstorerif_abs:
return S2_pstorerif_io;
948 case S4_pstorerdt_abs:
return S2_pstorerdt_io;
949 case S4_pstorerdf_abs:
return S2_pstorerdf_io;
955 if (!isStoreImmediate(ExtOpc))
965 unsigned HCE::getDirectRegReplacement(
unsigned ExtOpc)
const {
967 case Hexagon::A2_addi:
return Hexagon::A2_add;
968 case Hexagon::A2_andir:
return Hexagon::A2_and;
969 case Hexagon::A2_combineii:
return Hexagon::A4_combineri;
970 case Hexagon::A2_orir:
return Hexagon::A2_or;
971 case Hexagon::A2_paddif:
return Hexagon::A2_paddf;
972 case Hexagon::A2_paddit:
return Hexagon::A2_paddt;
973 case Hexagon::A2_subri:
return Hexagon::A2_sub;
974 case Hexagon::A2_tfrsi:
return TargetOpcode::COPY;
975 case Hexagon::A4_cmpbeqi:
return Hexagon::A4_cmpbeq;
976 case Hexagon::A4_cmpbgti:
return Hexagon::A4_cmpbgt;
977 case Hexagon::A4_cmpbgtui:
return Hexagon::A4_cmpbgtu;
978 case Hexagon::A4_cmpheqi:
return Hexagon::A4_cmpheq;
979 case Hexagon::A4_cmphgti:
return Hexagon::A4_cmphgt;
980 case Hexagon::A4_cmphgtui:
return Hexagon::A4_cmphgtu;
981 case Hexagon::A4_combineii:
return Hexagon::A4_combineir;
982 case Hexagon::A4_combineir:
return TargetOpcode::REG_SEQUENCE;
983 case Hexagon::A4_combineri:
return TargetOpcode::REG_SEQUENCE;
984 case Hexagon::A4_rcmpeqi:
return Hexagon::A4_rcmpeq;
985 case Hexagon::A4_rcmpneqi:
return Hexagon::A4_rcmpneq;
986 case Hexagon::C2_cmoveif:
return Hexagon::A2_tfrpf;
987 case Hexagon::C2_cmoveit:
return Hexagon::A2_tfrpt;
988 case Hexagon::C2_cmpeqi:
return Hexagon::C2_cmpeq;
989 case Hexagon::C2_cmpgti:
return Hexagon::C2_cmpgt;
990 case Hexagon::C2_cmpgtui:
return Hexagon::C2_cmpgtu;
991 case Hexagon::C2_muxii:
return Hexagon::C2_muxir;
992 case Hexagon::C2_muxir:
return Hexagon::C2_mux;
993 case Hexagon::C2_muxri:
return Hexagon::C2_mux;
994 case Hexagon::C4_cmpltei:
return Hexagon::C4_cmplte;
995 case Hexagon::C4_cmplteui:
return Hexagon::C4_cmplteu;
996 case Hexagon::C4_cmpneqi:
return Hexagon::C4_cmpneq;
997 case Hexagon::M2_accii:
return Hexagon::M2_acci;
999 case Hexagon::M2_macsip:
return Hexagon::M2_maci;
1000 case Hexagon::M2_mpysin:
return Hexagon::M2_mpyi;
1001 case Hexagon::M2_mpysip:
return Hexagon::M2_mpyi;
1002 case Hexagon::M2_mpysmi:
return Hexagon::M2_mpyi;
1003 case Hexagon::M2_naccii:
return Hexagon::M2_nacci;
1004 case Hexagon::M4_mpyri_addi:
return Hexagon::M4_mpyri_addr;
1005 case Hexagon::M4_mpyri_addr:
return Hexagon::M4_mpyrr_addr;
1006 case Hexagon::M4_mpyrr_addi:
return Hexagon::M4_mpyrr_addr;
1007 case Hexagon::S4_addaddi:
return Hexagon::M2_acci;
1008 case Hexagon::S4_addi_asl_ri:
return Hexagon::S2_asl_i_r_acc;
1009 case Hexagon::S4_addi_lsr_ri:
return Hexagon::S2_lsr_i_r_acc;
1010 case Hexagon::S4_andi_asl_ri:
return Hexagon::S2_asl_i_r_and;
1011 case Hexagon::S4_andi_lsr_ri:
return Hexagon::S2_lsr_i_r_and;
1012 case Hexagon::S4_ori_asl_ri:
return Hexagon::S2_asl_i_r_or;
1013 case Hexagon::S4_ori_lsr_ri:
return Hexagon::S2_lsr_i_r_or;
1014 case Hexagon::S4_subaddi:
return Hexagon::M2_subacc;
1015 case Hexagon::S4_subi_asl_ri:
return Hexagon::S2_asl_i_r_nac;
1016 case Hexagon::S4_subi_lsr_ri:
return Hexagon::S2_lsr_i_r_nac;
1019 case Hexagon::S4_storeirbf_io:
return Hexagon::S2_pstorerbf_io;
1020 case Hexagon::S4_storeirb_io:
return Hexagon::S2_storerb_io;
1021 case Hexagon::S4_storeirbt_io:
return Hexagon::S2_pstorerbt_io;
1022 case Hexagon::S4_storeirhf_io:
return Hexagon::S2_pstorerhf_io;
1023 case Hexagon::S4_storeirh_io:
return Hexagon::S2_storerh_io;
1024 case Hexagon::S4_storeirht_io:
return Hexagon::S2_pstorerht_io;
1025 case Hexagon::S4_storeirif_io:
return Hexagon::S2_pstorerif_io;
1026 case Hexagon::S4_storeiri_io:
return Hexagon::S2_storeri_io;
1027 case Hexagon::S4_storeirit_io:
return Hexagon::S2_pstorerit_io;
1052 if (!isRegOffOpcode(Opc) || HII->isConstExtended(MI))
1055 if (Opc == Hexagon::A2_addi) {
1057 if (Rb !=
Register(Op1) || !Op2.isImm())
1059 OffsetRange R = { -(1<<15)+1, (1<<15)-1, 1 };
1060 return R.shift(Op2.getImm());
1064 if (HII->isPostIncrement(MI))
1070 unsigned BaseP, OffP;
1071 if (!HII->getBaseAndOffsetPosition(MI, BaseP, OffP) ||
1086 int32_t Max = Off >= 0 ? 0 : -Off;
1088 OffsetRange R = { Min, Max, A };
1089 return R.shift(Off);
1099 OffsetRange HCE::getOffsetRange(
const ExtDesc &ED)
const {
1103 unsigned IdxOpc = getRegOffOpcode(ED.UseMI->getOpcode());
1107 case Hexagon::A2_addi:
1108 return { -32767, 32767, 1 };
1109 case Hexagon::A2_subri:
1110 return { -511, 511, 1 };
1113 if (!ED.UseMI->mayLoad() && !ED.UseMI->mayStore())
1123 return { Min, Max, A };
1128 OffsetRange HCE::getOffsetRange(
Register Rd)
const {
1136 Range.intersect(getOffsetRange(Rd, *Op.
getParent()));
1141 void HCE::recordExtender(
MachineInstr &MI,
unsigned OpNum) {
1156 if (IsLoad || IsStore) {
1157 unsigned AM = HII->getAddrMode(MI);
1170 if (!isStoreImmediate(Opc))
1182 case Hexagon::A2_tfrsi:
1186 case Hexagon::A2_combineii:
1187 case Hexagon::A4_combineir:
1191 case Hexagon::A4_combineri:
1195 case Hexagon::A2_addi:
1199 case Hexagon::M2_accii:
1200 case Hexagon::M2_naccii:
1201 case Hexagon::S4_addaddi:
1204 case Hexagon::A2_subri:
1209 case Hexagon::S4_subaddi:
1221 ExtRoot ER(ED.getOp());
1223 if (ER.V.GV->getName().empty())
1225 Extenders.push_back(ED);
1229 if (!HII->isConstExtended(MI))
1235 case Hexagon::M2_macsin:
1236 case Hexagon::C4_addipc:
1237 case Hexagon::S4_or_andi:
1238 case Hexagon::S4_or_andix:
1239 case Hexagon::S4_or_ori:
1242 recordExtender(MI, HII->getCExtOpNum(MI));
1249 if (MBB.getNumber() == -1)
1256 void HCE::assignInits(
const ExtRoot &ER,
unsigned Begin,
unsigned End,
1257 AssignmentMap &IMap) {
1260 for (
unsigned I = Begin;
I != End; ++
I)
1261 assert(ER == ExtRoot(Extenders[
I].getOp()));
1267 std::vector<OffsetRange> Ranges(End-Begin);
1273 for (
unsigned I = Begin;
I != End; ++
I) {
1274 const ExtDesc &ED = Extenders[
I];
1280 Ranges[
I-Begin] = getOffsetRange(ED.Rd).shift(EV.Offset);
1285 if (ED.UseMI->getOpcode() == Hexagon::A2_tfrsi) {
1287 Ranges[
I-Begin].extendBy(-D).extendBy(D);
1293 for (
unsigned I = Begin;
I != End; ++
I) {
1294 const ExtDesc &ED = Extenders[
I];
1299 OffsetRange Dev = getOffsetRange(ED);
1300 Ranges[
I-Begin].intersect(Dev.shift(EV.Offset));
1306 std::map<OffsetRange, IndexList> RangeMap;
1307 for (
unsigned I = Begin;
I != End; ++
I)
1308 RangeMap[Ranges[
I-Begin]].insert(
I);
1311 dbgs() <<
"Ranges\n";
1312 for (
unsigned I = Begin;
I != End; ++
I)
1313 dbgs() <<
" " <<
I <<
". " << Ranges[
I-Begin] <<
'\n';
1314 dbgs() <<
"RangeMap\n";
1315 for (
auto &P : RangeMap) {
1316 dbgs() <<
" " << P.first <<
" ->";
1317 for (
unsigned I : P.second)
1329 using CandData = std::pair<unsigned, SmallVector<RangeTree::Node*,8>>;
1330 std::map<int32_t, CandData> CandMap;
1333 for (
const OffsetRange &R : Ranges)
1340 for (RangeTree::Node *N : Nodes) {
1341 if (N->Range.Align <= Align || N->Range.Offset <
Offset)
1343 if ((N->Range.Offset -
Offset) % Align != 0)
1345 Align = N->Range.Align;
1346 Offset = N->Range.Offset;
1348 return std::make_pair(Align,
Offset);
1355 std::set<int32_t> CandSet;
1356 for (RangeTree::Node *N : Nodes) {
1357 const OffsetRange &R = N->Range;
1358 auto P0 = MaxAlign(Tree.nodesWith(R.Min,
false), R.Align, R.Offset);
1359 CandSet.insert(R.Min);
1360 if (R.Align < P0.first)
1361 CandSet.insert(
adjustUp(R.Min, P0.first, P0.second));
1362 auto P1 = MaxAlign(Tree.nodesWith(R.Max,
false), R.Align, R.Offset);
1363 CandSet.insert(R.Max);
1364 if (R.Align < P1.first)
1365 CandSet.insert(
adjustDown(R.Max, P1.first, P1.second));
1374 using CMap = std::map<int32_t,unsigned>;
1376 for (
auto It = CandSet.begin(), Et = CandSet.end(); It != Et; ) {
1377 auto &&V = Tree.nodesWith(*It);
1378 unsigned N = std::accumulate(V.begin(), V.end(), 0u,
1379 [](
unsigned Acc,
const RangeTree::Node *
N) {
1380 return Acc + N->Count;
1383 Counts.insert({*It, N});
1384 It = (N != 0) ? std::next(It) : CandSet.erase(It);
1390 auto BestIt = std::max_element(Counts.begin(), Counts.end(),
1391 [](
const CMap::value_type &A,
const CMap::value_type &
B) {
1392 return A.second <
B.second ||
1393 (A.second ==
B.second && A <
B);
1395 int32_t Best = BestIt->first;
1396 ExtValue BestV(ER, Best);
1397 for (RangeTree::Node *N : Tree.nodesWith(Best)) {
1398 for (
unsigned I : RangeMap[N->Range])
1399 IMap[{BestV,Extenders[
I].Expr}].insert(
I);
1404 LLVM_DEBUG(
dbgs() <<
"IMap (before fixup) = " << PrintIMap(IMap, *HRI));
1413 for (std::pair<const ExtenderInit,IndexList> &P : IMap) {
1415 if (P.first.second.trivial())
1419 const ExtValue &EV = P.first.first;
1420 AssignmentMap::iterator
F = IMap.find({EV, ExtExpr()});
1421 if (F == IMap.end())
1460 bool IsStack =
any_of(F->second, [
this](
unsigned I) {
1461 return Extenders[I].Expr.Rs.isSlot();
1463 auto SameValue = [&EV,
this,IsStack](
unsigned I) {
1464 const ExtDesc &ED = Extenders[
I];
1465 return ED.Expr.Rs.isSlot() == IsStack &&
1466 ExtValue(ED).Offset == EV.Offset;
1468 if (
all_of(P.second, SameValue)) {
1469 F->second.insert(P.second.begin(), P.second.end());
1474 LLVM_DEBUG(
dbgs() <<
"IMap (after fixup) = " << PrintIMap(IMap, *HRI));
1477 void HCE::calculatePlacement(
const ExtenderInit &ExtI,
const IndexList &Refs,
1489 const ExtDesc &ED0 = Extenders[Refs[0]];
1491 RefMIs.
insert(ED0.UseMI);
1493 for (
unsigned i = 1,
e = Refs.size(); i !=
e; ++i) {
1494 const ExtDesc &ED = Extenders[Refs[i]];
1497 DomB = MDT->findNearestCommonDominator(DomB, MBB);
1505 const MachineInstr *DefI = Rs.isVReg() ?
MRI->getVRegDef(Rs.Reg) :
nullptr;
1513 if (Blocks.
count(DomB)) {
1516 for (It = DomB->
begin(); It != End; ++It)
1517 if (RefMIs.
count(&*It))
1519 assert(It != End &&
"Should have found a ref in DomB");
1524 Loc DefLoc(DomB, It);
1525 Defs.emplace_back(DefLoc, Refs);
1528 HCE::Register HCE::insertInitializer(Loc DefL,
const ExtenderInit &ExtI) {
1532 DebugLoc dl = DefL.Block->findDebugLoc(DefL.At);
1533 const ExtValue &EV = ExtI.first;
1536 const ExtExpr &Ex = ExtI.second;
1539 if (Ex.Rs.isSlot()) {
1540 assert(Ex.S == 0 &&
"Cannot have a shift of a stack slot");
1541 assert(!Ex.Neg &&
"Cannot subtract a stack slot");
1543 InitI =
BuildMI(MBB, At, dl, HII->
get(Hexagon::PS_fi), DefR)
1547 assert((Ex.Rs.Reg == 0 || Ex.Rs.isVReg()) &&
"Expecting virtual register");
1550 InitI =
BuildMI(MBB, At, dl, HII->
get(Hexagon::A2_tfrsi), DefR)
1552 }
else if (Ex.S == 0) {
1555 InitI =
BuildMI(MBB, At, dl, HII->
get(Hexagon::A2_subri), DefR)
1560 InitI =
BuildMI(MBB, At, dl, HII->
get(Hexagon::A2_addi), DefR)
1565 unsigned NewOpc = Ex.Neg ? Hexagon::S4_subi_asl_ri
1566 : Hexagon::S4_addi_asl_ri;
1568 InitI =
BuildMI(MBB, At, dl, HII->
get(NewOpc), DefR)
1578 <<
" for initializer: " << PrintInit(ExtI, *HRI) <<
"\n " 1584 bool HCE::replaceInstrExact(
const ExtDesc &ED,
Register ExtR) {
1594 unsigned RegOpc = getDirectRegReplacement(ExtOpc);
1596 if (RegOpc == TargetOpcode::REG_SEQUENCE) {
1597 if (ExtOpc == Hexagon::A4_combineri)
1601 .addImm(Hexagon::isub_hi)
1603 .addImm(Hexagon::isub_lo);
1604 else if (ExtOpc == Hexagon::A4_combineir)
1608 .addImm(Hexagon::isub_hi)
1610 .addImm(Hexagon::isub_lo);
1616 if (ExtOpc == Hexagon::C2_cmpgei || ExtOpc == Hexagon::C2_cmpgeui) {
1617 unsigned NewOpc = ExtOpc == Hexagon::C2_cmpgei ? Hexagon::C2_cmplt
1618 : Hexagon::C2_cmpltu;
1629 unsigned RegN = ED.OpNum;
1650 unsigned RegOpc, Shift;
1651 unsigned AM = HII->getAddrMode(MI);
1653 RegOpc = HII->changeAddrMode_io_rr(ExtOpc);
1658 RegOpc = HII->changeAddrMode_ur_rr(ExtOpc);
1664 if (RegOpc == -1u) {
1665 dbgs() <<
"\nExtOpc: " << HII->getName(ExtOpc) <<
" has no rr version\n";
1670 unsigned BaseP, OffP;
1671 HII->getBaseAndOffsetPosition(MI, BaseP, OffP);
1677 MIB.
add(getLoadResultOp(MI));
1679 if (HII->isPredicated(MI))
1680 MIB.
add(getPredicateOp(MI));
1687 MIB.
add(getStoredValueOp(MI));
1701 bool HCE::replaceInstrExpr(
const ExtDesc &ED,
const ExtenderInit &ExtI,
1709 if (ExtOpc == Hexagon::A2_tfrsi) {
1718 unsigned IdxOpc = getRegOffOpcode(ExtOpc);
1719 assert(IdxOpc == Hexagon::A2_addi);
1722 int32_t D =
isInt<16>(Diff) ? Diff : (Diff > 0 ? 32767 : -32768);
1728 OffsetRange R = getOffsetRange(MI.
getOperand(0));
1741 OffsetRange Uses = getOffsetRange(MI.
getOperand(0));
1742 if (!Uses.contains(-Diff))
1743 dbgs() <<
"Diff: " << -Diff <<
" out of range " << Uses
1745 assert(Uses.contains(-Diff));
1751 const ExtValue &EV = ExtI.first; (void)EV;
1752 const ExtExpr &Ex = ExtI.second; (void)Ex;
1754 if (ExtOpc == Hexagon::A2_addi || ExtOpc == Hexagon::A2_subri) {
1759 bool IsAddi = ExtOpc == Hexagon::A2_addi;
1762 assert(Ex.Rs == RegOp && EV == ImmOp && Ex.Neg != IsAddi &&
1763 "Initializer mismatch");
1765 BuildMI(MBB, At, dl, HII->
get(TargetOpcode::COPY))
1772 if (ExtOpc == Hexagon::M2_accii || ExtOpc == Hexagon::M2_naccii ||
1773 ExtOpc == Hexagon::S4_addaddi || ExtOpc == Hexagon::S4_subaddi) {
1782 bool IsSub = ExtOpc == Hexagon::S4_subaddi;
1785 assert(EV == V && Rs == Ex.Rs && IsSub == Ex.Neg &&
"Initializer mismatch");
1787 unsigned NewOpc = ExtOpc == Hexagon::M2_naccii ? Hexagon::A2_sub
1798 unsigned IdxOpc = getRegOffOpcode(ExtOpc);
1799 assert(IdxOpc &&
"Expecting indexed opcode");
1804 MIB.
add(getLoadResultOp(MI));
1806 if (HII->isPredicated(MI))
1807 MIB.
add(getPredicateOp(MI));
1813 MIB.
add(getStoredValueOp(MI));
1820 dbgs() <<
'\n' << PrintInit(ExtI, *HRI) <<
" " <<
MI;
1826 bool HCE::replaceInstr(
unsigned Idx,
Register ExtR,
const ExtenderInit &ExtI) {
1832 const ExtDesc &ED = Extenders[Idx];
1833 assert((!ED.IsDef || ED.Rd.Reg != 0) &&
"Missing Rd for def");
1834 const ExtValue &DefV = ExtI.first;
1835 assert(ExtRoot(ExtValue(ED)) == ExtRoot(DefV) &&
"Extender root mismatch");
1836 const ExtExpr &DefEx = ExtI.second;
1839 int32_t Diff = EV.Offset - DefV.Offset;
1842 << PrintRegister(ExtR, *HRI) <<
" Diff:" << Diff <<
'\n');
1846 bool IsAbs =
false, IsAbsSet =
false;
1848 unsigned AM = HII->getAddrMode(MI);
1857 std::vector<std::pair<MachineInstr*,unsigned>> RegOps;
1858 if (ED.IsDef && Diff != 0) {
1861 RegOps.push_back({&UI, getOperandIndex(UI, Op)});
1866 bool Replaced =
false;
1867 if (Diff == 0 && DefEx.trivial() && !IsAbs && !IsAbsSet)
1868 Replaced = replaceInstrExact(ED, ExtR);
1870 Replaced = replaceInstrExpr(ED, ExtI, ExtR, Diff);
1872 if (Diff != 0 && Replaced && ED.IsDef) {
1874 for (std::pair<MachineInstr*,unsigned> P : RegOps) {
1875 unsigned J = P.second;
1876 assert(P.first->getNumOperands() > J+1 &&
1877 P.first->getOperand(J+1).isImm());
1879 ImmOp.
setImm(ImmOp.getImm() + Diff);
1886 assert(ED.Rd.Sub == 0 && ExtR.Sub == 0);
1887 MRI->replaceRegWith(ED.Rd.Reg, ExtR.Reg);
1894 bool HCE::replaceExtenders(
const AssignmentMap &IMap) {
1896 bool Changed =
false;
1898 for (
const std::pair<const ExtenderInit, IndexList> &P : IMap) {
1899 const IndexList &Idxs = P.second;
1904 calculatePlacement(P.first, Idxs, Defs);
1905 for (
const std::pair<Loc,IndexList> &Q : Defs) {
1906 Register DefR = insertInitializer(Q.first, P.first);
1907 NewRegs.push_back(DefR.Reg);
1908 for (
unsigned I : Q.second)
1909 Changed |= replaceInstr(I, DefR, P.first);
1924 assert(HII->isPredicated(MI));
1927 MRI->getRegClass(Op.
getReg()) != &Hexagon::PredRegsRegClass)
1929 assert(Op.
getSubReg() == 0 &&
"Predicate register with a subregister");
1950 <<
" due to exception handling\n");
1957 MDT = &getAnalysis<MachineDominatorTree>();
1962 llvm::sort(Extenders, [
this](
const ExtDesc &A,
const ExtDesc &
B) {
1963 ExtValue VA(A),
VB(B);
1970 return A.OpNum < B.OpNum;
1978 return MDT->dominates(MA, MB);
1981 bool Changed =
false;
1982 LLVM_DEBUG(
dbgs() <<
"Collected " << Extenders.size() <<
" extenders\n");
1983 for (
unsigned I = 0,
E = Extenders.size();
I !=
E; ) {
1985 const ExtRoot &
T = Extenders[
B].getOp();
1986 while (
I !=
E && ExtRoot(Extenders[
I].getOp()) == T)
1990 assignInits(T, B,
I, IMap);
1991 Changed |= replaceExtenders(IMap);
1996 MF.
print(
dbgs() <<
"After " << getPassName() <<
'\n',
nullptr);
1998 dbgs() <<
"No changes\n";
2004 return new HexagonConstExtenders();
unsigned getTargetFlags() const
const MachineInstrBuilder & add(const MachineOperand &MO) const
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
MachineInstr * getParent()
getParent - Return the instruction that this operand belongs to.
This class represents lattice values for constants.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
bool isTargetIndex() const
isTargetIndex - Tests if this is a MO_TargetIndex operand.
Implements a dense probed hash-table based set.
void push_back(const T &Elt)
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
iterator getFirstTerminator()
Returns an iterator to the first terminator instruction of this basic block.
Describe properties that are true of each instruction in the target description file.
static bool isStackSlot(unsigned Reg)
isStackSlot - Sometimes it is useful the be able to store a non-negative frame index in a variable th...
Address of indexed Jump Table for switch.
unsigned getSubReg() const
bool mayLoadOrStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read or modify memory.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly...
static void dump(StringRef Title, SpillInfo const &Spills)
constexpr bool isInt< 16 >(int64_t x)
bool isCPI() const
isCPI - Tests if this is a MO_ConstantPoolIndex operand.
Node(Kind K_, Cache RHSComponentCache_=Cache::No, Cache ArrayCache_=Cache::No, Cache FunctionCache_=Cache::No)
Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
bool mayLoad() const
Return true if this instruction could possibly read memory.
iterator_range< mop_iterator > operands()
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
return AArch64::GPR64RegClass contains(Reg)
unsigned countTrailingZeros(T Val, ZeroBehavior ZB=ZB_Width)
Count number of 0's from the least significant bit to the most stopping at the first 1...
The address of a basic block.
uint64_t alignDown(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the largest uint64_t less than or equal to Value and is Skew mod Align.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
constexpr char SymbolName[]
Key for Kernel::Metadata::mSymbolName.
instr_iterator erase(instr_iterator I)
Remove an instruction from the instruction list and delete it.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
static MachineOperand CreateGA(const GlobalValue *GV, int64_t Offset, unsigned TargetFlags=0)
const ConstantFP * getFPImm() const
unsigned getNumOperands() const
Retuns the total number of operands.
Target-dependent index+offset operand.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Name of external global symbol.
static int32_t adjustUp(int32_t V, uint8_t A, uint8_t O)
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const char * getSymbolName() const
static MachineOperand CreateTargetIndex(unsigned Idx, int64_t Offset, unsigned TargetFlags=0)
void initializeHexagonConstExtendersPass(PassRegistry &)
static cl::opt< unsigned > CountThreshold("hexagon-cext-threshold", cl::init(3), cl::Hidden, cl::ZeroOrMore, cl::desc("Minimum number of extenders to trigger replacement"))
FunctionPass * createHexagonConstExtenders()
bool isFPImm() const
isFPImm - Tests if this is a MO_FPImmediate operand.
bool hasPersonalityFn() const
Check whether this function has a personality function.
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
static unsigned index2StackSlot(int FI)
Convert a non-negative frame index to a stack slot register value.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
Address of a global value.
initializer< Ty > init(const Ty &Val)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
unsigned const MachineRegisterInfo * MRI
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
LLVM Basic Block Representation.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
static int stackSlot2Index(unsigned Reg)
Compute the frame index from a register value representing a stack slot.
static MachineOperand CreateJTI(unsigned Idx, unsigned TargetFlags=0)
static MachineOperand CreateFPImm(const ConstantFP *CFP)
bool ult(const APInt &RHS) const
Unsigned less than comparison.
MachineInstrBuilder & UseMI
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const GlobalValue * getGlobal() const
std::pair< iterator, bool > insert(const ValueT &V)
ConstantFP - Floating Point Values [float, double].
static MachineOperand CreateCPI(unsigned Idx, int Offset, unsigned TargetFlags=0)
Represent the analysis usage information of a pass.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
Address of a basic block.
#define LLVM_ATTRIBUTE_UNUSED
void setImm(int64_t immVal)
FunctionPass class - This class is used to implement most global optimizations.
self_iterator getIterator()
static MachineOperand CreateReg(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isEarlyClobber=false, unsigned SubReg=0, bool isDebug=false, bool isInternalRead=false, bool isRenamable=false)
void print(raw_ostream &OS, const SlotIndexes *=nullptr) const
print - Print out the MachineFunction in a format suitable for debugging to the specified stream...
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned getNumExplicitOperands() const
Returns the number of non-implicit operands.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static MachineOperand CreateES(const char *SymName, unsigned TargetFlags=0)
void sort(IteratorTy Start, IteratorTy End)
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
Align max(MaybeAlign Lhs, Align Rhs)
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
static uint64_t add(uint64_t LeftOp, uint64_t RightOp)
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
hexagon cext Hexagon constant extender optimization
Promote Memory to Register
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
bool isBlockAddress() const
isBlockAddress - Tests if this is a MO_BlockAddress operand.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
static int32_t adjustDown(int32_t V, uint8_t A, uint8_t O)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static LLVM_ATTRIBUTE_UNUSED unsigned getMemAccessSizeInBytes(MemAccessSize S)
bool mayStore() const
Return true if this instruction could possibly modify memory.
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
bool operator!=(uint64_t V1, const APInt &V2)
Representation of each machine instruction.
const MachineFunction * getParent() const
Return the MachineFunction containing this basic block.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
static ValueLatticeElement intersect(const ValueLatticeElement &A, const ValueLatticeElement &B)
Combine two sets of facts about the same value into a single set of facts.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
int64_t getOffset() const
Return the offset from the symbol in this operand.
const Function * getParent() const
Return the enclosing method, or null if none.
const BlockAddress * getBlockAddress() const
static MachineOperand CreateImm(int64_t Val)
const MachineInstrBuilder & cloneMemRefs(const MachineInstr &OtherMI) const
hexagon cext Hexagon constant extender static false unsigned ReplaceCounter
bool isFI() const
isFI - Tests if this is a MO_FrameIndex operand.
static cl::opt< unsigned > ReplaceLimit("hexagon-cext-limit", cl::init(0), cl::Hidden, cl::ZeroOrMore, cl::desc("Maximum number of replacements"))
size_type count(const_arg_type_t< ValueT > V) const
Return 1 if the specified key is in the set, 0 otherwise.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool operator<(int64_t V1, const APSInt &V2)
INITIALIZE_PASS_BEGIN(HexagonConstExtenders, "hexagon-cext-opt", "Hexagon constant-extender optimization", false, false) INITIALIZE_PASS_END(HexagonConstExtenders
Floating-point immediate operand.
A vector that has set insertion semantics.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
This class implements an extremely fast bulk output stream that can only output to a stream...
static MachineOperand CreateBA(const BlockAddress *BA, int64_t Offset, unsigned TargetFlags=0)
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
APInt bitcastToAPInt() const
Address of indexed Constant in Constant Pool.
bool operator<(const DeltaInfo &LHS, int64_t Delta)
bool operator==(uint64_t V1, const APInt &V2)
Register getReg() const
getReg - Returns the register number.
const MachineOperand & getOperand(unsigned i) const
MachineOperandType getType() const
getType - Returns the MachineOperandType for this operand.
static MachineOperand CreateFI(int Idx)
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Wrapper class representing virtual and physical registers.