MCPcopy Create free account
hub / github.com/Samsung/UTopia / isBufferAllocSize

Method isBufferAllocSize

lib/inputanalysis/DefMapGenerator.cpp:118–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118bool DefMapGenerator::isBufferAllocSize(
119 const ASTIRNode &Node,
120 const AllocSizeAnalysisReport &AllocSizeReport) const {
121 const auto *AN = Node.AST.getNodeForType();
122 if (!AN)
123 return false;
124
125 const auto *T = AN->getType().getTypePtrOrNull();
126 if (!T || !T->isIntegerType())
127 return false;
128
129 auto &TNode = *const_cast<RDNode *>(&Node.IR);
130 if (auto *CB = llvm::dyn_cast<llvm::CallBase>(&TNode.getLocation())) {
131 if (auto *F = CB->getCalledFunction()) {
132 auto FuncName = F->getName().str();
133 if (TNode.getIdx() >= 0 &&
134 AllocSizeReport.has(FuncName, TNode.getIdx()) &&
135 AllocSizeReport.get(FuncName, TNode.getIdx()))
136 return true;
137 }
138 }
139
140 for (auto &FirstUse : TNode.getFirstUses()) {
141 auto FuncName = FirstUse.getFunctionName();
142 if (AllocSizeReport.has(FuncName, FirstUse.ArgNo) &&
143 AllocSizeReport.get(FuncName, FirstUse.ArgNo))
144 return true;
145 }
146
147 return false;
148}
149
150bool DefMapGenerator::isLoopExit(const RDNode &Node,
151 const LoopAnalysisReport &LoopReport) const {

Callers

nothing calls this directly

Calls 9

getNodeForTypeMethod · 0.80
isIntegerTypeMethod · 0.80
getCalledFunctionMethod · 0.80
getIdxMethod · 0.80
getTypeMethod · 0.45
getNameMethod · 0.45
hasMethod · 0.45
getMethod · 0.45
getFunctionNameMethod · 0.45

Tested by

no test coverage detected