Lines Matching refs:StructTy
176 bool shouldIgnoreStructType(StructType *StructTy);
178 StructType *StructTy, SmallString<MaxStructCounterNameSize> &NameStr);
180 Module &M, const DataLayout &DL, StructType *StructTy,
190 bool insertCounterUpdate(Instruction *I, StructType *StructTy,
192 unsigned getFieldCounterIdx(StructType *StructTy) {
195 unsigned getArrayCounterIdx(StructType *StructTy) {
196 return StructTy->getNumElements();
198 unsigned getStructCounterSize(StructType *StructTy) {
202 return (StructTy->getNumElements()/*field*/ + 1/*array*/);
301 bool EfficiencySanitizer::shouldIgnoreStructType(StructType *StructTy) {
302 if (StructTy == nullptr || StructTy->isOpaque() /* no struct body */)
308 StructType *StructTy, SmallString<MaxStructCounterNameSize> &NameStr) {
311 if (StructTy->hasName())
312 NameStr += StructTy->getName();
320 Twine(StructTy->getNumElements()).toVector(NameStr);
322 for (int i = StructTy->getNumElements() - 1; i >= 0; --i) {
324 Twine(StructTy->getElementType(i)->getTypeID()).toVector(NameStr);
328 if (StructTy->isLiteral()) {
337 Module &M, const DataLayout &DL, StructType *StructTy,
343 auto *TypeNameArrayTy = ArrayType::get(Int8PtrTy, StructTy->getNumElements());
348 auto *OffsetArrayTy = ArrayType::get(Int32Ty, StructTy->getNumElements());
353 auto *SizeArrayTy = ArrayType::get(Int32Ty, StructTy->getNumElements());
357 for (unsigned i = 0; i < StructTy->getNumElements(); ++i) {
358 Type *Ty = StructTy->getElementType(i);
368 DL.getStructLayout(StructTy)->getElementOffset(i)));
417 for (auto &StructTy : Vec) {
418 if (shouldIgnoreStructType(StructTy)) {
426 createStructCounterName(StructTy, CounterNameStr);
435 getStructCounterSize(StructTy));
443 StructTyMap.insert(std::pair<Type *, GlobalVariable *>(StructTy, Counters));
449 createCacheFragAuxGV(M, DL, StructTy, TypeName, Offset, Size);
454 getFieldCounterIdx(StructTy));
458 getArrayCounterIdx(StructTy));
463 DL.getStructLayout(StructTy)->getSizeInBytes()),
464 ConstantInt::get(Int32Ty, StructTy->getNumElements()),
755 StructType *StructTy = nullptr;
759 StructTy = cast<StructType>(SourceTy);
762 !shouldIgnoreStructType(StructTy) && StructTyMap.count(StructTy) != 0)
763 Res |= insertCounterUpdate(I, StructTy, getArrayCounterIdx(StructTy));
774 StructTy = dyn_cast<StructType>(ArrayTy->getElementType());
775 if (shouldIgnoreStructType(StructTy) || StructTyMap.count(StructTy) == 0)
778 CounterIdx = getArrayCounterIdx(StructTy);
780 StructTy = cast<StructType>(Ty);
781 if (shouldIgnoreStructType(StructTy) || StructTyMap.count(StructTy) == 0)
783 // Get the StructTy's subfield index.
786 Idx->getSExtValue() < StructTy->getNumElements());
787 CounterIdx = getFieldCounterIdx(StructTy
789 Res |= insertCounterUpdate(I, StructTy, CounterIdx);
799 StructType *StructTy,
801 GlobalVariable *CounterArray = StructTyMap[StructTy];
815 ArrayType::get(IRB.getInt64Ty(), getStructCounterSize(StructTy)),