本文整理汇总了C++中LSLocationList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ LSLocationList::push_back方法的具体用法?C++ LSLocationList::push_back怎么用?C++ LSLocationList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LSLocationList
的用法示例。
在下文中一共展示了LSLocationList::push_back方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
LSLocation::expand(LSLocation Base, SILModule *M, LSLocationList &Locs,
TypeExpansionAnalysis *TE) {
const ProjectionPath &BasePath = Base.getPath().getValue();
for (const auto &P : TE->getTypeExpansion(Base.getType(M), M)) {
Locs.push_back(LSLocation(Base.getBase(), BasePath, P.getValue()));
}
}
示例2: getFirstLevelLSLocations
void LSLocation::getFirstLevelLSLocations(LSLocationList &Locs,
SILModule *Mod) {
SILType Ty = getType();
llvm::SmallVector<Projection, 8> Out;
Projection::getFirstLevelAddrProjections(Ty, *Mod, Out);
for (auto &X : Out) {
ProjectionPath P;
P.append(X);
P.append(Path.getValue());
Locs.push_back(LSLocation(Base, P));
}
}
示例3: expand
void LSLocation::expand(LSLocation Base, SILModule *M, LSLocationList &Locs,
TypeExpansionAnalysis *TE) {
// To expand a memory location to its indivisible parts, we first get the
// address projection paths from the accessed type to each indivisible field,
// i.e. leaf nodes, then we append these projection paths to the Base.
//
// Construct the LSLocation by appending the projection path from the
// accessed node to the leaf nodes.
const NewProjectionPath &BasePath = Base.getPath().getValue();
for (const auto &P : TE->getTypeExpansion(Base.getType(M), M, TEKind::TELeaf)) {
Locs.push_back(LSLocation(Base.getBase(), BasePath, P.getValue()));
}
}
示例4: reduce
void LSLocation::reduce(LSLocation &Base, SILModule *M, LSLocationSet &Locs,
TypeExpansionAnalysis *TE) {
// First, construct the LSLocation by appending the projection path from the
// accessed node to the leaf nodes.
LSLocationList Nodes;
ProjectionPath &BasePath = Base.getPath().getValue();
for (const auto &P :
TE->getTypeExpansionProjectionPaths(Base.getType(), M, TEKind::TENode)) {
Nodes.push_back(LSLocation(Base.getBase(), P.getValue(), BasePath));
}
// Second, go from leaf nodes to their parents. This guarantees that at the
// point the parent is processed, its children have been processed already.
for (auto I = Nodes.rbegin(), E = Nodes.rend(); I != E; ++I) {
LSLocationList FirstLevel;
I->getFirstLevelLSLocations(FirstLevel, M);
// Reached the end of the projection tree, this is a leaf node.
if (FirstLevel.empty())
continue;
// If this is a class reference type, we have reached end of the type tree.
if (I->getType().getClassOrBoundGenericClass())
continue;
// This is NOT a leaf node, check whether all its first level children are
// alive.
bool Alive = true;
for (auto &X : FirstLevel) {
Alive &= Locs.find(X) != Locs.end();
}
// All first level locations are alive, create the new aggregated location.
if (Alive) {
for (auto &X : FirstLevel)
Locs.erase(X);
Locs.insert(*I);
}
}
}
示例5: processWrite
void DSEContext::processWrite(SILInstruction *I, SILValue Val, SILValue Mem,
DSEKind Kind) {
auto *S = getBlockState(I);
// Construct a LSLocation to represent the memory read by this instruction.
// NOTE: The base will point to the actual object this inst is accessing,
// not this particular field.
//
// e.g. %1 = alloc_stack $S
// %2 = struct_element_addr %1, #a
// store %3 to %2 : $*Int
//
// Base will point to %1, but not %2. Projection path will indicate which
// field is accessed.
//
// This will make comparison between locations easier. This eases the
// implementation of intersection operator in the data flow.
LSLocation L;
if (BaseToLocIndex.find(Mem) != BaseToLocIndex.end()) {
L = BaseToLocIndex[Mem];
} else {
SILValue UO = getUnderlyingObject(Mem);
L = LSLocation(UO, ProjectionPath::getProjectionPath(UO, Mem));
}
// If we can't figure out the Base or Projection Path for the store
// instruction, simply ignore it.
if (!L.isValid())
return;
// Expand the given Mem into individual fields and process them as separate
// writes.
bool Dead = true;
LSLocationList Locs;
LSLocation::expand(L, Mod, Locs, TE);
SmallBitVector V(Locs.size());
// Are we computing max store set.
if (isComputeMaxStoreSet(Kind)) {
for (auto &E : Locs) {
// Update the max store set for the basic block.
processWriteForMaxStoreSet(S, getLocationBit(E));
}
return;
}
// Are we computing genset and killset.
if (isBuildingGenKillSet(Kind)) {
for (auto &E : Locs) {
// Only building the gen and kill sets here.
processWriteForGenKillSet(S, getLocationBit(E));
}
// Data flow has not stabilized, do not perform the DSE just yet.
return;
}
// We are doing the actual DSE.
assert(isPerformingDSE(Kind) && "Invalid computation kind");
unsigned idx = 0;
for (auto &E : Locs) {
// This is the last iteration, compute BBWriteSetOut and perform the dead
// store elimination.
if (processWriteForDSE(S, getLocationBit(E)))
V.set(idx);
Dead &= V.test(idx);
++idx;
}
// Fully dead store - stores to all the components are dead, therefore this
// instruction is dead.
if (Dead) {
LLVM_DEBUG(llvm::dbgs() << "Instruction Dead: " << *I << "\n");
S->DeadStores.push_back(I);
++NumDeadStores;
return;
}
// Partial dead store - stores to some locations are dead, but not all. This
// is a partially dead store. Also at this point we know what locations are
// dead.
LSLocationList Alives;
if (V.any()) {
// Take out locations that are dead.
for (unsigned i = 0; i < V.size(); ++i) {
if (V.test(i))
continue;
// This location is alive.
Alives.push_back(Locs[i]);
}
// Try to create as few aggregated stores as possible out of the locations.
LSLocation::reduce(L, Mod, Alives);
// Oops, we have too many smaller stores generated, bail out.
if (Alives.size() > MaxPartialStoreCount)
return;
// At this point, we are performing a partial dead store elimination.
//
// Locations here have a projection path from their Base, but this
// particular instruction may not be accessing the base, so we need to
//.........这里部分代码省略.........