26 #define DEBUG_TYPE "hexagon-cext-opt" 32 cl::desc(
"Minimum number of extenders to trigger replacement"));
42 static int32_t
adjustUp(int32_t V, uint8_t A, uint8_t
O) {
44 int32_t U = (V & -A) + O;
45 return U >= V ? U : U+A;
50 int32_t U = (V & -A) + O;
51 return U <= V ? U : U-A;
59 int32_t Min = INT_MIN, Max = INT_MAX;
63 OffsetRange() =
default;
64 OffsetRange(int32_t L, int32_t
H, uint8_t A, uint8_t
O = 0)
71 if (Offset >= A.Offset && (Offset - A.Offset) % A.Align == 0) {
73 Max =
adjustDown(std::min(Max, A.Max), Align, Offset);
81 std::tie(Min, Max, Align) = std::make_tuple(0, -1, 1);
84 OffsetRange &shift(int32_t S) {
87 Offset = (Offset+S) % Align;
90 OffsetRange &extendBy(int32_t
D) {
94 Min = (INT_MIN-D < Min) ? Min+D : INT_MIN;
96 Max = (INT_MAX-D > Max) ? Max+D : INT_MAX;
103 return Min <= V && V <= Max && (V-
Offset) % Align == 0;
106 return Min == R.Min && Max == R.Max && Align == R.Align;
111 bool operator<(
const OffsetRange &R)
const {
116 return Align < R.Align;
118 static OffsetRange zero() {
return {0, 0, 1}; }
123 Node(
const OffsetRange &R) : MaxEnd(R.Max), Range(R) {}
127 const OffsetRange &Range;
131 Node *Root =
nullptr;
133 void add(
const OffsetRange &R) {
136 void erase(
const Node *
N) {
137 Root =
remove(Root,
N);
145 nodesWith(Root, P, CheckAlign, Nodes);
152 for (Node *N : Nodes)
157 void dump(
const Node *N)
const;
159 void nodesWith(Node *N, int32_t P,
bool CheckA,
162 Node *
add(Node *N,
const OffsetRange &R);
163 Node *
remove(Node *
N,
const Node *
D);
165 Node *rotateRight(Node *Lower, Node *Higher);
166 unsigned height(Node *N) {
167 return N !=
nullptr ? N->Height : 0;
169 Node *update(Node *N) {
171 N->Height = 1 +
std::max(height(N->Left), height(N->Right));
173 N->MaxEnd =
std::max(N->MaxEnd, N->Left->MaxEnd);
175 N->MaxEnd =
std::max(N->MaxEnd, N->Right->MaxEnd);
178 Node *rebalance(Node *N) {
180 int32_t Balance = height(N->Right) - height(N->Left);
182 return rotateRight(N->Left, N);
184 return rotateLeft(N->Right, N);
195 if (B->
end() == It) {
199 Pos = std::distance(B->
begin(), It);
203 if (Block != A.Block)
204 return Block->
getNumber() < A.Block->getNumber();
207 return Pos != -1 && Pos < A.Pos;
224 return "Hexagon constant-extender optimization";
231 Register(
unsigned R,
unsigned S) :
Reg(R), Sub(S) {}
238 }
else if (Op.
isFI()) {
243 bool isVReg()
const {
247 bool isSlot()
const {
265 return Reg < R.Reg || (
Reg == R.Reg && Sub < R.Sub);
267 unsigned Reg = 0, Sub = 0;
297 ExtExpr(
Register RS,
bool NG,
unsigned SH) : Rs(RS), S(SH), Neg(NG) {}
299 bool trivial()
const {
303 return Rs == Ex.Rs && S == Ex.S && Neg == Ex.Neg;
308 bool operator<(
const ExtExpr &Ex)
const {
313 return !Neg && Ex.Neg;
319 unsigned OpNum = -1u;
352 return Kind == ER.Kind && V.ImmVal == ER.V.ImmVal;
360 struct ExtValue :
public ExtRoot {
364 ExtValue(
const ExtDesc &ED) : ExtValue(ED.getOp()) {}
365 ExtValue(
const ExtRoot &ER, int32_t Off) : ExtRoot(ER),
Offset(Off) {}
366 bool operator<(
const ExtValue &EV)
const;
368 return ExtRoot(*
this) == ExtRoot(EV) && Offset == EV.Offset;
377 using ExtenderInit = std::pair<ExtValue, ExtExpr>;
378 using AssignmentMap = std::map<ExtenderInit, IndexList>;
379 using LocDefMap = std::map<Loc, IndexList>;
385 std::vector<ExtDesc> Extenders;
386 std::vector<unsigned> NewRegs;
388 bool isStoreImmediate(
unsigned Opc)
const;
389 bool isRegOffOpcode(
unsigned ExtOpc)
const ;
390 unsigned getRegOffOpcode(
unsigned ExtOpc)
const;
391 unsigned getDirectRegReplacement(
unsigned ExtOpc)
const;
393 OffsetRange getOffsetRange(
const ExtDesc &ED)
const;
394 OffsetRange getOffsetRange(
Register Rd)
const;
399 void assignInits(
const ExtRoot &ER,
unsigned Begin,
unsigned End,
400 AssignmentMap &IMap);
401 void calculatePlacement(
const ExtenderInit &ExtI,
const IndexList &Refs,
403 Register insertInitializer(Loc DefL,
const ExtenderInit &ExtI);
404 bool replaceInstrExact(
const ExtDesc &ED,
Register ExtR);
405 bool replaceInstrExpr(
const ExtDesc &ED,
const ExtenderInit &ExtI,
407 bool replaceInstr(
unsigned Idx,
Register ExtR,
const ExtenderInit &ExtI);
408 bool replaceExtenders(
const AssignmentMap &IMap);
416 friend struct PrintRegister;
417 friend struct PrintExpr;
418 friend struct PrintInit;
419 friend struct PrintIMap;
421 const struct PrintRegister &
P);
431 using HCE = HexagonConstExtenders;
437 OS <<
'[' << OR.Min <<
',' << OR.Max <<
"]a" <<
unsigned(OR.Align)
442 struct PrintRegister {
452 OS <<
printReg(P.Rs.Reg, &P.HRI, P.Rs.Sub);
461 const HCE::ExtExpr &Ex;
467 OS <<
"## " << (P.Ex.Neg ?
"- " :
"+ ");
468 if (P.Ex.Rs.Reg != 0)
469 OS <<
printReg(P.Ex.Rs.Reg, &P.HRI, P.Ex.Rs.Sub);
472 OS <<
" << " << P.Ex.S;
478 : ExtI(EI), HRI(I) {}
479 const HCE::ExtenderInit &ExtI;
485 OS <<
'[' << P.ExtI.first <<
", " 486 << PrintExpr(P.ExtI.second, P.HRI) <<
']';
498 OS <<
printReg(ED.Rd.Reg, &HRI, ED.Rd.Sub);
501 OS <<
" = " << PrintExpr(ED.Expr, HRI);
511 OS <<
"imm:" << ER.V.ImmVal;
514 OS <<
"fpi:" << *ER.V.CFP;
517 OS <<
"sym:" << *ER.V.SymbolName;
520 OS <<
"gad:" << ER.V.GV->getName();
523 OS <<
"blk:" << *ER.V.BA;
526 OS <<
"tgi:" << ER.V.ImmVal;
529 OS <<
"cpi:" << ER.V.ImmVal;
532 OS <<
"jti:" << ER.V.ImmVal;
535 OS <<
"???:" << ER.V.ImmVal;
543 OS << HCE::ExtRoot(EV) <<
" off:" << EV.Offset;
550 const HCE::AssignmentMap &IMap;
557 for (
const std::pair<HCE::ExtenderInit,HCE::IndexList> &Q : P.IMap) {
558 OS <<
" " << PrintInit(Q.first, P.HRI) <<
" -> {";
559 for (
unsigned I : Q.second)
569 "Hexagon constant-extender optimization",
false,
false)
580 dbgs() <<
"Root: " << Root <<
'\n';
586 dbgs() <<
"Node: " << N <<
'\n';
587 dbgs() <<
" Height: " << N->Height <<
'\n';
588 dbgs() <<
" Count: " << N->Count <<
'\n';
589 dbgs() <<
" MaxEnd: " << N->MaxEnd <<
'\n';
590 dbgs() <<
" Range: " << N->Range <<
'\n';
591 dbgs() <<
" Left: " << N->Left <<
'\n';
592 dbgs() <<
" Right: " << N->Right <<
"\n\n";
606 order(N->Right, Seq);
609 void RangeTree::nodesWith(Node *N, int32_t
P,
bool CheckA,
611 if (N ==
nullptr || N->MaxEnd < P)
613 nodesWith(N->Left, P, CheckA, Seq);
614 if (N->Range.Min <= P) {
615 if ((CheckA && N->Range.contains(P)) || (!CheckA && P <= N->Range.Max))
617 nodesWith(N->Right, P, CheckA, Seq);
631 N->Left =
add(N->Left, R);
633 N->Right =
add(N->Right, R);
634 return rebalance(update(N));
641 assert(N->Range != D->Range &&
"N and D should not be equal");
642 if (D->Range < N->Range)
643 N->Left =
remove(N->Left,
D);
645 N->Right =
remove(N->Right,
D);
646 return rebalance(update(N));
651 if (N->Left ==
nullptr || N->Right ==
nullptr)
652 return (N->Left ==
nullptr) ? N->Right : N->Left;
659 M->Left =
remove(N->Left, M);
661 return rebalance(update(M));
664 RangeTree::Node *RangeTree::rotateLeft(Node *
Lower, Node *
Higher) {
665 assert(Higher->Right == Lower);
669 if (height(Lower->Left) > height(Lower->Right))
670 Lower = rotateRight(Lower->Left, Lower);
671 assert(height(Lower->Left) <= height(Lower->Right));
672 Higher->Right = Lower->Left;
679 RangeTree::Node *RangeTree::rotateRight(Node *Lower, Node *Higher) {
680 assert(Higher->Left == Lower);
684 if (height(Lower->Left) < height(Lower->Right))
685 Lower = rotateLeft(Lower->Right, Lower);
686 assert(height(Lower->Left) >= height(Lower->Right));
687 Higher->Left = Lower->Right;
719 return Kind < ER.Kind;
725 return V.ImmVal < ER.V.ImmVal;
727 const APFloat &ThisF = V.CFP->getValueAPF();
728 const APFloat &OtherF = ER.V.CFP->getValueAPF();
736 const Module &M = *V.GV->getParent();
746 return FindPos(*V.GV) < FindPos(*ER.V.GV);
749 const BasicBlock *ThisB = V.BA->getBasicBlock();
750 const BasicBlock *OtherB = ER.V.BA->getBasicBlock();
753 return std::distance(F.begin(), ThisB->
getIterator()) <
757 return V.ImmVal < ER.V.ImmVal;
773 const ExtRoot &ER = *
this;
774 if (!(ER == ExtRoot(EV)))
776 return Offset < EV.Offset;
804 bool HCE::isStoreImmediate(
unsigned Opc)
const {
806 case Hexagon::S4_storeirbt_io:
807 case Hexagon::S4_storeirbf_io:
808 case Hexagon::S4_storeirht_io:
809 case Hexagon::S4_storeirhf_io:
810 case Hexagon::S4_storeirit_io:
811 case Hexagon::S4_storeirif_io:
812 case Hexagon::S4_storeirb_io:
813 case Hexagon::S4_storeirh_io:
814 case Hexagon::S4_storeiri_io:
822 bool HCE::isRegOffOpcode(
unsigned Opc)
const {
824 case Hexagon::L2_loadrub_io:
825 case Hexagon::L2_loadrb_io:
826 case Hexagon::L2_loadruh_io:
827 case Hexagon::L2_loadrh_io:
828 case Hexagon::L2_loadri_io:
829 case Hexagon::L2_loadrd_io:
830 case Hexagon::L2_loadbzw2_io:
831 case Hexagon::L2_loadbzw4_io:
832 case Hexagon::L2_loadbsw2_io:
833 case Hexagon::L2_loadbsw4_io:
834 case Hexagon::L2_loadalignh_io:
835 case Hexagon::L2_loadalignb_io:
836 case Hexagon::L2_ploadrubt_io:
837 case Hexagon::L2_ploadrubf_io:
838 case Hexagon::L2_ploadrbt_io:
839 case Hexagon::L2_ploadrbf_io:
840 case Hexagon::L2_ploadruht_io:
841 case Hexagon::L2_ploadruhf_io:
842 case Hexagon::L2_ploadrht_io:
843 case Hexagon::L2_ploadrhf_io:
844 case Hexagon::L2_ploadrit_io:
845 case Hexagon::L2_ploadrif_io:
846 case Hexagon::L2_ploadrdt_io:
847 case Hexagon::L2_ploadrdf_io:
848 case Hexagon::S2_storerb_io:
849 case Hexagon::S2_storerh_io:
850 case Hexagon::S2_storerf_io:
851 case Hexagon::S2_storeri_io:
852 case Hexagon::S2_storerd_io:
853 case Hexagon::S2_pstorerbt_io:
854 case Hexagon::S2_pstorerbf_io:
855 case Hexagon::S2_pstorerht_io:
856 case Hexagon::S2_pstorerhf_io:
857 case Hexagon::S2_pstorerft_io:
858 case Hexagon::S2_pstorerff_io:
859 case Hexagon::S2_pstorerit_io:
860 case Hexagon::S2_pstorerif_io:
861 case Hexagon::S2_pstorerdt_io:
862 case Hexagon::S2_pstorerdf_io:
863 case Hexagon::A2_addi:
871 unsigned HCE::getRegOffOpcode(
unsigned ExtOpc)
const {
874 using namespace Hexagon;
876 case A2_tfrsi:
return A2_addi;
891 case L4_loadrub_ur:
return L2_loadrub_io;
894 case L4_loadrb_ur:
return L2_loadrb_io;
897 case L4_loadruh_ur:
return L2_loadruh_io;
900 case L4_loadrh_ur:
return L2_loadrh_io;
903 case L4_loadri_ur:
return L2_loadri_io;
906 case L4_loadrd_ur:
return L2_loadrd_io;
908 case L4_loadbzw2_ur:
return L2_loadbzw2_io;
910 case L4_loadbzw4_ur:
return L2_loadbzw4_io;
912 case L4_loadbsw2_ur:
return L2_loadbsw2_io;
914 case L4_loadbsw4_ur:
return L2_loadbsw4_io;
915 case L4_loadalignh_ap:
916 case L4_loadalignh_ur:
return L2_loadalignh_io;
917 case L4_loadalignb_ap:
918 case L4_loadalignb_ur:
return L2_loadalignb_io;
919 case L4_ploadrubt_abs:
return L2_ploadrubt_io;
920 case L4_ploadrubf_abs:
return L2_ploadrubf_io;
921 case L4_ploadrbt_abs:
return L2_ploadrbt_io;
922 case L4_ploadrbf_abs:
return L2_ploadrbf_io;
923 case L4_ploadruht_abs:
return L2_ploadruht_io;
924 case L4_ploadruhf_abs:
return L2_ploadruhf_io;
925 case L4_ploadrht_abs:
return L2_ploadrht_io;
926 case L4_ploadrhf_abs:
return L2_ploadrhf_io;
927 case L4_ploadrit_abs:
return L2_ploadrit_io;
928 case L4_ploadrif_abs:
return L2_ploadrif_io;
929 case L4_ploadrdt_abs:
return L2_ploadrdt_io;
930 case L4_ploadrdf_abs:
return L2_ploadrdf_io;
933 case S4_storerb_ur:
return S2_storerb_io;
936 case S4_storerh_ur:
return S2_storerh_io;
939 case S4_storerf_ur:
return S2_storerf_io;
942 case S4_storeri_ur:
return S2_storeri_io;
945 case S4_storerd_ur:
return S2_storerd_io;
946 case S4_pstorerbt_abs:
return S2_pstorerbt_io;
947 case S4_pstorerbf_abs:
return S2_pstorerbf_io;
948 case S4_pstorerht_abs:
return S2_pstorerht_io;
949 case S4_pstorerhf_abs:
return S2_pstorerhf_io;
950 case S4_pstorerft_abs:
return S2_pstorerft_io;
951 case S4_pstorerff_abs:
return S2_pstorerff_io;
952 case S4_pstorerit_abs:
return S2_pstorerit_io;
953 case S4_pstorerif_abs:
return S2_pstorerif_io;
954 case S4_pstorerdt_abs:
return S2_pstorerdt_io;
955 case S4_pstorerdf_abs:
return S2_pstorerdf_io;
961 if (!isStoreImmediate(ExtOpc))
971 unsigned HCE::getDirectRegReplacement(
unsigned ExtOpc)
const {
973 case Hexagon::A2_addi:
return Hexagon::A2_add;
974 case Hexagon::A2_andir:
return Hexagon::A2_and;
975 case Hexagon::A2_combineii:
return Hexagon::A4_combineri;
976 case Hexagon::A2_orir:
return Hexagon::A2_or;
977 case Hexagon::A2_paddif:
return Hexagon::A2_paddf;
978 case Hexagon::A2_paddit:
return Hexagon::A2_paddt;
979 case Hexagon::A2_subri:
return Hexagon::A2_sub;
980 case Hexagon::A2_tfrsi:
return TargetOpcode::COPY;
981 case Hexagon::A4_cmpbeqi:
return Hexagon::A4_cmpbeq;
982 case Hexagon::A4_cmpbgti:
return Hexagon::A4_cmpbgt;
983 case Hexagon::A4_cmpbgtui:
return Hexagon::A4_cmpbgtu;
984 case Hexagon::A4_cmpheqi:
return Hexagon::A4_cmpheq;
985 case Hexagon::A4_cmphgti:
return Hexagon::A4_cmphgt;
986 case Hexagon::A4_cmphgtui:
return Hexagon::A4_cmphgtu;
987 case Hexagon::A4_combineii:
return Hexagon::A4_combineir;
988 case Hexagon::A4_combineir:
return TargetOpcode::REG_SEQUENCE;
989 case Hexagon::A4_combineri:
return TargetOpcode::REG_SEQUENCE;
990 case Hexagon::A4_rcmpeqi:
return Hexagon::A4_rcmpeq;
991 case Hexagon::A4_rcmpneqi:
return Hexagon::A4_rcmpneq;
992 case Hexagon::C2_cmoveif:
return Hexagon::A2_tfrpf;
993 case Hexagon::C2_cmoveit:
return Hexagon::A2_tfrpt;
994 case Hexagon::C2_cmpeqi:
return Hexagon::C2_cmpeq;
995 case Hexagon::C2_cmpgti:
return Hexagon::C2_cmpgt;
996 case Hexagon::C2_cmpgtui:
return Hexagon::C2_cmpgtu;
997 case Hexagon::C2_muxii:
return Hexagon::C2_muxir;
998 case Hexagon::C2_muxir:
return Hexagon::C2_mux;
999 case Hexagon::C2_muxri:
return Hexagon::C2_mux;
1000 case Hexagon::C4_cmpltei:
return Hexagon::C4_cmplte;
1001 case Hexagon::C4_cmplteui:
return Hexagon::C4_cmplteu;
1002 case Hexagon::C4_cmpneqi:
return Hexagon::C4_cmpneq;
1003 case Hexagon::M2_accii:
return Hexagon::M2_acci;
1005 case Hexagon::M2_macsip:
return Hexagon::M2_maci;
1006 case Hexagon::M2_mpysin:
return Hexagon::M2_mpyi;
1007 case Hexagon::M2_mpysip:
return Hexagon::M2_mpyi;
1008 case Hexagon::M2_mpysmi:
return Hexagon::M2_mpyi;
1009 case Hexagon::M2_naccii:
return Hexagon::M2_nacci;
1010 case Hexagon::M4_mpyri_addi:
return Hexagon::M4_mpyri_addr;
1011 case Hexagon::M4_mpyri_addr:
return Hexagon::M4_mpyrr_addr;
1012 case Hexagon::M4_mpyrr_addi:
return Hexagon::M4_mpyrr_addr;
1013 case Hexagon::S4_addaddi:
return Hexagon::M2_acci;
1014 case Hexagon::S4_addi_asl_ri:
return Hexagon::S2_asl_i_r_acc;
1015 case Hexagon::S4_addi_lsr_ri:
return Hexagon::S2_lsr_i_r_acc;
1016 case Hexagon::S4_andi_asl_ri:
return Hexagon::S2_asl_i_r_and;
1017 case Hexagon::S4_andi_lsr_ri:
return Hexagon::S2_lsr_i_r_and;
1018 case Hexagon::S4_ori_asl_ri:
return Hexagon::S2_asl_i_r_or;
1019 case Hexagon::S4_ori_lsr_ri:
return Hexagon::S2_lsr_i_r_or;
1020 case Hexagon::S4_subaddi:
return Hexagon::M2_subacc;
1021 case Hexagon::S4_subi_asl_ri:
return Hexagon::S2_asl_i_r_nac;
1022 case Hexagon::S4_subi_lsr_ri:
return Hexagon::S2_lsr_i_r_nac;
1025 case Hexagon::S4_storeirbf_io:
return Hexagon::S2_pstorerbf_io;
1026 case Hexagon::S4_storeirb_io:
return Hexagon::S2_storerb_io;
1027 case Hexagon::S4_storeirbt_io:
return Hexagon::S2_pstorerbt_io;
1028 case Hexagon::S4_storeirhf_io:
return Hexagon::S2_pstorerhf_io;
1029 case Hexagon::S4_storeirh_io:
return Hexagon::S2_storerh_io;
1030 case Hexagon::S4_storeirht_io:
return Hexagon::S2_pstorerht_io;
1031 case Hexagon::S4_storeirif_io:
return Hexagon::S2_pstorerif_io;
1032 case Hexagon::S4_storeiri_io:
return Hexagon::S2_storeri_io;
1033 case Hexagon::S4_storeirit_io:
return Hexagon::S2_pstorerit_io;
1058 if (!isRegOffOpcode(Opc) || HII->isConstExtended(MI))
1059 return OffsetRange::zero();
1061 if (Opc == Hexagon::A2_addi) {
1063 if (Rb !=
Register(Op1) || !Op2.isImm())
1064 return OffsetRange::zero();
1065 OffsetRange R = { -(1<<15)+1, (1<<15)-1, 1 };
1066 return R.shift(Op2.getImm());
1070 if (HII->isPostIncrement(MI))
1071 return OffsetRange::zero();
1076 unsigned BaseP, OffP;
1077 if (!HII->getBaseAndOffsetPosition(MI, BaseP, OffP) ||
1080 return OffsetRange::zero();
1092 int32_t Max = Off >= 0 ? 0 : -Off;
1094 OffsetRange R = { Min, Max, A };
1095 return R.shift(Off);
1105 OffsetRange HCE::getOffsetRange(
const ExtDesc &ED)
const {
1109 unsigned IdxOpc = getRegOffOpcode(ED.UseMI->getOpcode());
1112 return OffsetRange::zero();
1113 case Hexagon::A2_addi:
1114 return { -32767, 32767, 1 };
1115 case Hexagon::A2_subri:
1116 return { -511, 511, 1 };
1119 if (!ED.UseMI->mayLoad() && !ED.UseMI->mayStore())
1120 return OffsetRange::zero();
1129 return { Min, Max, A };
1134 OffsetRange HCE::getOffsetRange(
Register Rd)
const {
1141 return OffsetRange::zero();
1142 Range.intersect(getOffsetRange(Rd, *Op.
getParent()));
1147 void HCE::recordExtender(
MachineInstr &MI,
unsigned OpNum) {
1162 if (IsLoad || IsStore) {
1163 unsigned AM = HII->getAddrMode(MI);
1176 if (!isStoreImmediate(Opc))
1188 case Hexagon::A2_tfrsi:
1192 case Hexagon::A2_combineii:
1193 case Hexagon::A4_combineir:
1197 case Hexagon::A4_combineri:
1201 case Hexagon::A2_addi:
1205 case Hexagon::M2_accii:
1206 case Hexagon::M2_naccii:
1207 case Hexagon::S4_addaddi:
1210 case Hexagon::A2_subri:
1215 case Hexagon::S4_subaddi:
1224 Extenders.push_back(ED);
1228 if (!HII->isConstExtended(MI))
1234 case Hexagon::M2_macsin:
1235 case Hexagon::C4_addipc:
1236 case Hexagon::S4_or_andi:
1237 case Hexagon::S4_or_andix:
1238 case Hexagon::S4_or_ori:
1241 recordExtender(MI, HII->getCExtOpNum(MI));
1251 void HCE::assignInits(
const ExtRoot &ER,
unsigned Begin,
unsigned End,
1252 AssignmentMap &IMap) {
1255 for (
unsigned I = Begin;
I != End; ++
I)
1256 assert(ER == ExtRoot(Extenders[
I].getOp()));
1262 std::vector<OffsetRange> Ranges(End-Begin);
1268 for (
unsigned I = Begin;
I != End; ++
I) {
1269 const ExtDesc &ED = Extenders[
I];
1275 Ranges[
I-Begin] = getOffsetRange(ED.Rd).shift(EV.Offset);
1280 if (ED.UseMI->getOpcode() == Hexagon::A2_tfrsi) {
1282 Ranges[
I-Begin].extendBy(-D).extendBy(D);
1288 for (
unsigned I = Begin;
I != End; ++
I) {
1289 const ExtDesc &ED = Extenders[
I];
1294 OffsetRange Dev = getOffsetRange(ED);
1295 Ranges[
I-Begin].intersect(Dev.shift(EV.Offset));
1301 std::map<OffsetRange, IndexList> RangeMap;
1302 for (
unsigned I = Begin;
I != End; ++
I)
1303 RangeMap[Ranges[
I-Begin]].insert(
I);
1306 dbgs() <<
"Ranges\n";
1307 for (
unsigned I = Begin;
I != End; ++
I)
1308 dbgs() <<
" " <<
I <<
". " << Ranges[
I-Begin] <<
'\n';
1309 dbgs() <<
"RangeMap\n";
1310 for (
auto &P : RangeMap) {
1311 dbgs() <<
" " << P.first <<
" ->";
1312 for (
unsigned I : P.second)
1324 using CandData = std::pair<unsigned, SmallVector<RangeTree::Node*,8>>;
1325 std::map<int32_t, CandData> CandMap;
1328 for (
const OffsetRange &R : Ranges)
1335 for (RangeTree::Node *N : Nodes) {
1336 if (N->Range.Align <= Align || N->Range.Offset <
Offset)
1338 if ((N->Range.Offset -
Offset) % Align != 0)
1340 Align = N->Range.Align;
1341 Offset = N->Range.Offset;
1343 return std::make_pair(Align,
Offset);
1350 std::set<int32_t> CandSet;
1351 for (RangeTree::Node *N : Nodes) {
1352 const OffsetRange &R = N->Range;
1353 auto P0 = MaxAlign(Tree.nodesWith(R.Min,
false), R.Align, R.Offset);
1354 CandSet.insert(R.Min);
1355 if (R.Align < P0.first)
1356 CandSet.insert(
adjustUp(R.Min, P0.first, P0.second));
1357 auto P1 = MaxAlign(Tree.nodesWith(R.Max,
false), R.Align, R.Offset);
1358 CandSet.insert(R.Max);
1359 if (R.Align < P1.first)
1360 CandSet.insert(
adjustDown(R.Max, P1.first, P1.second));
1369 using CMap = std::map<int32_t,unsigned>;
1371 for (
auto It = CandSet.begin(), Et = CandSet.end(); It != Et; ) {
1372 auto &&V = Tree.nodesWith(*It);
1373 unsigned N = std::accumulate(V.begin(), V.end(), 0u,
1374 [](
unsigned Acc,
const RangeTree::Node *
N) {
1375 return Acc + N->Count;
1378 Counts.insert({*It, N});
1379 It = (N != 0) ? std::next(It) : CandSet.erase(It);
1385 auto BestIt = std::max_element(Counts.begin(), Counts.end(),
1386 [](
const CMap::value_type &A,
const CMap::value_type &
B) {
1387 return A.second <
B.second ||
1388 (A.second ==
B.second && A <
B);
1390 int32_t Best = BestIt->first;
1391 ExtValue BestV(ER, Best);
1392 for (RangeTree::Node *N : Tree.nodesWith(Best)) {
1393 for (
unsigned I : RangeMap[N->Range])
1394 IMap[{BestV,Extenders[
I].Expr}].insert(
I);
1399 LLVM_DEBUG(
dbgs() <<
"IMap (before fixup) = " << PrintIMap(IMap, *HRI));
1408 for (std::pair<const ExtenderInit,IndexList> &P : IMap) {
1410 if (P.first.second.trivial())
1414 const ExtValue &EV = P.first.first;
1415 AssignmentMap::iterator
F = IMap.find({EV, ExtExpr()});
1416 if (F == IMap.end())
1455 bool IsStack =
any_of(F->second, [
this](
unsigned I) {
1456 return Extenders[I].Expr.Rs.isSlot();
1458 auto SameValue = [&EV,
this,IsStack](
unsigned I) {
1459 const ExtDesc &ED = Extenders[
I];
1460 return ED.Expr.Rs.isSlot() == IsStack &&
1461 ExtValue(ED).Offset == EV.Offset;
1463 if (
all_of(P.second, SameValue)) {
1464 F->second.insert(P.second.begin(), P.second.end());
1469 LLVM_DEBUG(
dbgs() <<
"IMap (after fixup) = " << PrintIMap(IMap, *HRI));
1472 void HCE::calculatePlacement(
const ExtenderInit &ExtI,
const IndexList &Refs,
1484 const ExtDesc &ED0 = Extenders[Refs[0]];
1486 RefMIs.
insert(ED0.UseMI);
1488 for (
unsigned i = 1, e = Refs.size(); i != e; ++i) {
1489 const ExtDesc &ED = Extenders[Refs[i]];
1492 DomB = MDT->findNearestCommonDominator(DomB, MBB);
1500 const MachineInstr *DefI = Rs.isVReg() ?
MRI->getVRegDef(Rs.Reg) :
nullptr;
1508 if (Blocks.
count(DomB)) {
1511 for (It = DomB->
begin(); It != End; ++It)
1512 if (RefMIs.
count(&*It))
1514 assert(It != End &&
"Should have found a ref in DomB");
1519 Loc DefLoc(DomB, It);
1520 Defs.emplace(DefLoc, Refs);
1523 HCE::Register HCE::insertInitializer(Loc DefL,
const ExtenderInit &ExtI) {
1524 unsigned DefR =
MRI->createVirtualRegister(&Hexagon::IntRegsRegClass);
1527 DebugLoc dl = DefL.Block->findDebugLoc(DefL.At);
1528 const ExtValue &EV = ExtI.first;
1531 const ExtExpr &Ex = ExtI.second;
1534 if (Ex.Rs.isSlot()) {
1535 assert(Ex.S == 0 &&
"Cannot have a shift of a stack slot");
1536 assert(!Ex.Neg &&
"Cannot subtract a stack slot");
1538 InitI =
BuildMI(MBB, At, dl, HII->
get(Hexagon::PS_fi), DefR)
1542 assert((Ex.Rs.Reg == 0 || Ex.Rs.isVReg()) &&
"Expecting virtual register");
1545 InitI =
BuildMI(MBB, At, dl, HII->
get(Hexagon::A2_tfrsi), DefR)
1547 }
else if (Ex.S == 0) {
1550 InitI =
BuildMI(MBB, At, dl, HII->
get(Hexagon::A2_subri), DefR)
1555 InitI =
BuildMI(MBB, At, dl, HII->
get(Hexagon::A2_addi), DefR)
1560 unsigned NewOpc = Ex.Neg ? Hexagon::S4_subi_asl_ri
1561 : Hexagon::S4_addi_asl_ri;
1563 InitI =
BuildMI(MBB, At, dl, HII->
get(NewOpc), DefR)
1573 <<
" for initializer: " << PrintInit(ExtI, *HRI) <<
"\n " 1579 bool HCE::replaceInstrExact(
const ExtDesc &ED,
Register ExtR) {
1589 unsigned RegOpc = getDirectRegReplacement(ExtOpc);
1591 if (RegOpc == TargetOpcode::REG_SEQUENCE) {
1592 if (ExtOpc == Hexagon::A4_combineri)
1596 .addImm(Hexagon::isub_hi)
1598 .addImm(Hexagon::isub_lo);
1599 else if (ExtOpc == Hexagon::A4_combineir)
1603 .addImm(Hexagon::isub_hi)
1605 .addImm(Hexagon::isub_lo);
1611 if (ExtOpc == Hexagon::C2_cmpgei || ExtOpc == Hexagon::C2_cmpgeui) {
1612 unsigned NewOpc = ExtOpc == Hexagon::C2_cmpgei ? Hexagon::C2_cmplt
1613 : Hexagon::C2_cmpltu;
1624 unsigned RegN = ED.OpNum;
1645 unsigned RegOpc, Shift;
1646 unsigned AM = HII->getAddrMode(MI);
1648 RegOpc = HII->changeAddrMode_io_rr(ExtOpc);
1653 RegOpc = HII->changeAddrMode_ur_rr(ExtOpc);
1659 if (RegOpc == -1u) {
1660 dbgs() <<
"\nExtOpc: " << HII->getName(ExtOpc) <<
" has no rr version\n";
1665 unsigned BaseP, OffP;
1666 HII->getBaseAndOffsetPosition(MI, BaseP, OffP);
1672 MIB.
add(getLoadResultOp(MI));
1674 if (HII->isPredicated(MI))
1675 MIB.
add(getPredicateOp(MI));
1682 MIB.
add(getStoredValueOp(MI));
1696 bool HCE::replaceInstrExpr(
const ExtDesc &ED,
const ExtenderInit &ExtI,
1704 if (ExtOpc == Hexagon::A2_tfrsi) {
1713 unsigned IdxOpc = getRegOffOpcode(ExtOpc);
1714 assert(IdxOpc == Hexagon::A2_addi);
1717 int32_t D =
isInt<16>(Diff) ? Diff : (Diff > 0 ? 32767 : -32768);
1727 OffsetRange Uses = getOffsetRange(MI.
getOperand(0));
1728 if (!Uses.contains(-Diff))
1729 dbgs() <<
"Diff: " << -Diff <<
" out of range " << Uses
1731 assert(Uses.contains(-Diff));
1737 const ExtValue &EV = ExtI.first; (void)EV;
1738 const ExtExpr &Ex = ExtI.second; (void)Ex;
1740 if (ExtOpc == Hexagon::A2_addi || ExtOpc == Hexagon::A2_subri) {
1745 bool IsAddi = ExtOpc == Hexagon::A2_addi;
1748 assert(Ex.Rs == RegOp && EV == ImmOp && Ex.Neg != IsAddi &&
1749 "Initializer mismatch");
1751 BuildMI(MBB, At, dl, HII->
get(TargetOpcode::COPY))
1758 if (ExtOpc == Hexagon::M2_accii || ExtOpc == Hexagon::M2_naccii ||
1759 ExtOpc == Hexagon::S4_addaddi || ExtOpc == Hexagon::S4_subaddi) {
1768 bool IsSub = ExtOpc == Hexagon::S4_subaddi;
1771 assert(EV == V && Rs == Ex.Rs && IsSub == Ex.Neg &&
"Initializer mismatch");
1773 unsigned NewOpc = ExtOpc == Hexagon::M2_naccii ? Hexagon::A2_sub
1784 unsigned IdxOpc = getRegOffOpcode(ExtOpc);
1785 assert(IdxOpc &&
"Expecting indexed opcode");
1790 MIB.
add(getLoadResultOp(MI));
1792 if (HII->isPredicated(MI))
1793 MIB.
add(getPredicateOp(MI));
1799 MIB.
add(getStoredValueOp(MI));
1806 dbgs() <<
'\n' << PrintInit(ExtI, *HRI) <<
" " <<
MI;
1812 bool HCE::replaceInstr(
unsigned Idx,
Register ExtR,
const ExtenderInit &ExtI) {
1818 const ExtDesc &ED = Extenders[Idx];
1819 assert((!ED.IsDef || ED.Rd.Reg != 0) &&
"Missing Rd for def");
1820 const ExtValue &DefV = ExtI.first;
1821 assert(ExtRoot(ExtValue(ED)) == ExtRoot(DefV) &&
"Extender root mismatch");
1822 const ExtExpr &DefEx = ExtI.second;
1825 int32_t Diff = EV.Offset - DefV.Offset;
1828 << PrintRegister(ExtR, *HRI) <<
" Diff:" << Diff <<
'\n');
1832 bool IsAbs =
false, IsAbsSet =
false;
1834 unsigned AM = HII->getAddrMode(MI);
1843 std::vector<std::pair<MachineInstr*,unsigned>> RegOps;
1844 if (ED.IsDef && Diff != 0) {
1847 RegOps.push_back({&UI, getOperandIndex(UI, Op)});
1852 bool Replaced =
false;
1853 if (Diff == 0 && DefEx.trivial() && !IsAbs && !IsAbsSet)
1854 Replaced = replaceInstrExact(ED, ExtR);
1856 Replaced = replaceInstrExpr(ED, ExtI, ExtR, Diff);
1858 if (Diff != 0 && Replaced && ED.IsDef) {
1860 for (std::pair<MachineInstr*,unsigned> P : RegOps) {
1861 unsigned J = P.second;
1862 assert(P.first->getNumOperands() > J+1 &&
1863 P.first->getOperand(J+1).isImm());
1865 ImmOp.
setImm(ImmOp.getImm() + Diff);
1872 assert(ED.Rd.Sub == 0 && ExtR.Sub == 0);
1873 MRI->replaceRegWith(ED.Rd.Reg, ExtR.Reg);
1880 bool HCE::replaceExtenders(
const AssignmentMap &IMap) {
1882 bool Changed =
false;
1884 for (
const std::pair<ExtenderInit,IndexList> &P : IMap) {
1885 const IndexList &Idxs = P.second;
1890 calculatePlacement(P.first, Idxs, Defs);
1891 for (
const std::pair<Loc,IndexList> &Q : Defs) {
1892 Register DefR = insertInitializer(Q.first, P.first);
1893 NewRegs.push_back(DefR.Reg);
1894 for (
unsigned I : Q.second)
1895 Changed |= replaceInstr(I, DefR, P.first);
1910 assert(HII->isPredicated(MI));
1913 MRI->getRegClass(Op.
getReg()) != &Hexagon::PredRegsRegClass)
1915 assert(Op.
getSubReg() == 0 &&
"Predicate register with a subregister");
1938 MDT = &getAnalysis<MachineDominatorTree>();
1943 llvm::sort(Extenders.begin(), Extenders.end(),
1944 [](
const ExtDesc &A,
const ExtDesc &
B) {
1945 return ExtValue(A) < ExtValue(
B);
1948 bool Changed =
false;
1949 LLVM_DEBUG(
dbgs() <<
"Collected " << Extenders.size() <<
" extenders\n");
1950 for (
unsigned I = 0,
E = Extenders.size();
I !=
E; ) {
1952 const ExtRoot &
T = Extenders[
B].getOp();
1953 while (
I !=
E && ExtRoot(Extenders[
I].getOp()) == T)
1957 assignInits(T, B,
I, IMap);
1958 Changed |= replaceExtenders(IMap);
1963 MF.
print(
dbgs() <<
"After " << getPassName() <<
'\n',
nullptr);
1965 dbgs() <<
"No changes\n";
1971 return new HexagonConstExtenders();
unsigned getTargetFlags() const
void push_back(const T &Elt)
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.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
Compute iterated dominance frontiers using a linear time algorithm.
A Module instance is used to store all the information related to an LLVM module. ...
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.
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.
unsigned getReg() const
getReg - Returns the register number.
static bool isVirtualRegister(unsigned Reg)
Return true if the specified register number is in the virtual register namespace.
Address of indexed Jump Table for switch.
unsigned getSubReg() const
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.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
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)
static MachineOperand CreateReg(unsigned 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)
static int stackSlot2Index(unsigned Reg)
Compute the frame index from a register value representing a stack slot.
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...
const ConstantFP * getFPImm() const
unsigned getNumOperands() const
Access to explicit operands of the instruction.
Printable printReg(unsigned Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
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
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.
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
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.
static MachineOperand CreateCPI(unsigned Idx, int Offset, unsigned char TargetFlags=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 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)
static ManagedStatic< OptionRegistry > OR
ConstantFP - Floating Point Values [float, double].
static MachineOperand CreateBA(const BlockAddress *BA, int64_t Offset, unsigned char 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.
void setImm(int64_t immVal)
static MachineOperand CreateGA(const GlobalValue *GV, int64_t Offset, unsigned char TargetFlags=0)
static MachineOperand CreateTargetIndex(unsigned Idx, int64_t Offset, unsigned char TargetFlags=0)
FunctionPass class - This class is used to implement most global optimizations.
self_iterator getIterator()
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.
void sort(IteratorTy Start, IteratorTy End)
static bool isStackSlot(unsigned Reg)
isStackSlot - Sometimes it is useful the be able to store a non-negative frame index in a variable th...
bool isJTI() const
isJTI - Tests if this is a MO_JumpTableIndex operand.
bool isGlobal() const
isGlobal - Tests if this is a MO_GlobalAddress operand.
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
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 MachineOperand CreateES(const char *SymName, unsigned char TargetFlags=0)
static LLVM_ATTRIBUTE_UNUSED unsigned getMemAccessSizeInBytes(MemAccessSize S)
bool mayStore() const
Return true if this instruction could possibly modify memory.
#define LLVM_ATTRIBUTE_UNUSED
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)
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.
This class implements an extremely fast bulk output stream that can only output to a stream...
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==(uint64_t V1, const APInt &V2)
const MachineInstrBuilder & setMemRefs(MachineInstr::mmo_iterator b, MachineInstr::mmo_iterator e) const
const MachineOperand & getOperand(unsigned i) const
iterator_range< global_value_iterator > global_values()
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...
static unsigned index2StackSlot(int FI)
Convert a non-negative frame index to a stack slot register value.
mmo_iterator memoperands_end() const