Lines Matching refs:ProfileData
71 static void extractFromBranchWeightMD(const MDNode *ProfileData, in extractFromBranchWeightMD() argument
73 assert(isBranchWeightMD(ProfileData) && "wrong metadata"); in extractFromBranchWeightMD()
75 unsigned NOps = ProfileData->getNumOperands(); in extractFromBranchWeightMD()
76 unsigned WeightsIdx = getBranchWeightOffset(ProfileData); in extractFromBranchWeightMD()
82 mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(Idx)); in extractFromBranchWeightMD()
98 bool isBranchWeightMD(const MDNode *ProfileData) { in isBranchWeightMD() argument
99 return isTargetMD(ProfileData, "branch_weights", MinBWOps); in isBranchWeightMD()
102 bool isValueProfileMD(const MDNode *ProfileData) { in isValueProfileMD() argument
103 return isTargetMD(ProfileData, "VP", MinVPOps); in isValueProfileMD()
107 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof); in hasBranchWeightMD() local
108 return isBranchWeightMD(ProfileData); in hasBranchWeightMD()
112 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof); in hasCountTypeMD() local
114 if (isValueProfileMD(ProfileData)) in hasCountTypeMD()
118 return isa<CallBase>(I) && !isBranchWeightMD(ProfileData); in hasCountTypeMD()
126 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof); in hasBranchWeightOrigin() local
127 return hasBranchWeightOrigin(ProfileData); in hasBranchWeightOrigin()
130 bool hasBranchWeightOrigin(const MDNode *ProfileData) { in hasBranchWeightOrigin() argument
131 if (!isBranchWeightMD(ProfileData)) in hasBranchWeightOrigin()
133 auto *ProfDataName = dyn_cast<MDString>(ProfileData->getOperand(1)); in hasBranchWeightOrigin()
141 unsigned getBranchWeightOffset(const MDNode *ProfileData) { in getBranchWeightOffset() argument
142 return hasBranchWeightOrigin(ProfileData) ? 2 : 1; in getBranchWeightOffset()
145 unsigned getNumBranchWeights(const MDNode &ProfileData) { in getNumBranchWeights() argument
146 return ProfileData.getNumOperands() - getBranchWeightOffset(&ProfileData); in getNumBranchWeights()
150 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof); in getBranchWeightMDNode() local
151 if (!isBranchWeightMD(ProfileData)) in getBranchWeightMDNode()
153 return ProfileData; in getBranchWeightMDNode()
157 auto *ProfileData = getBranchWeightMDNode(I); in getValidBranchWeightMDNode() local
158 if (ProfileData && getNumBranchWeights(*ProfileData) == I.getNumSuccessors()) in getValidBranchWeightMDNode()
159 return ProfileData; in getValidBranchWeightMDNode()
163 void extractFromBranchWeightMD32(const MDNode *ProfileData, in extractFromBranchWeightMD32() argument
165 extractFromBranchWeightMD(ProfileData, Weights); in extractFromBranchWeightMD32()
168 void extractFromBranchWeightMD64(const MDNode *ProfileData, in extractFromBranchWeightMD64() argument
170 extractFromBranchWeightMD(ProfileData, Weights); in extractFromBranchWeightMD64()
173 bool extractBranchWeights(const MDNode *ProfileData, in extractBranchWeights() argument
175 if (!isBranchWeightMD(ProfileData)) in extractBranchWeights()
177 extractFromBranchWeightMD(ProfileData, Weights); in extractBranchWeights()
183 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof); in extractBranchWeights() local
184 return extractBranchWeights(ProfileData, Weights); in extractBranchWeights()
195 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof); in extractBranchWeights() local
196 if (!extractBranchWeights(ProfileData, Weights)) in extractBranchWeights()
207 bool extractProfTotalWeight(const MDNode *ProfileData, uint64_t &TotalVal) { in extractProfTotalWeight() argument
209 if (!ProfileData) in extractProfTotalWeight()
212 auto *ProfDataName = dyn_cast<MDString>(ProfileData->getOperand(0)); in extractProfTotalWeight()
217 unsigned Offset = getBranchWeightOffset(ProfileData); in extractProfTotalWeight()
218 for (unsigned Idx = Offset; Idx < ProfileData->getNumOperands(); ++Idx) { in extractProfTotalWeight()
219 auto *V = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(Idx)); in extractProfTotalWeight()
226 if (ProfDataName->getString() == "VP" && ProfileData->getNumOperands() > 3) { in extractProfTotalWeight()
227 TotalVal = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(2)) in extractProfTotalWeight()
248 auto *ProfileData = I.getMetadata(LLVMContext::MD_prof); in scaleProfData() local
249 if (ProfileData == nullptr) in scaleProfData()
252 auto *ProfDataName = dyn_cast<MDString>(ProfileData->getOperand(0)); in scaleProfData()
264 Vals.push_back(ProfileData->getOperand(0)); in scaleProfData()
267 ProfileData->getNumOperands() > 0) { in scaleProfData()
271 ProfileData->getOperand(getBranchWeightOffset(ProfileData))) in scaleProfData()
278 for (unsigned i = 1; i < ProfileData->getNumOperands(); i += 2) { in scaleProfData()
280 Vals.push_back(ProfileData->getOperand(i)); in scaleProfData()
282 mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(i + 1)) in scaleProfData()
287 Vals.push_back(ProfileData->getOperand(i + 1)); in scaleProfData()