mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Make the InsertBefore argument to FindInsertedValue optional, so you can find an inserted value without modifying the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52319 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0a7413dad8
commit
9772891219
@ -55,10 +55,13 @@ namespace llvm {
|
|||||||
/// FindScalarValue - Given an aggregrate and an sequence of indices, see if the
|
/// FindScalarValue - Given an aggregrate and an sequence of indices, see if the
|
||||||
/// scalar value indexed is already around as a register, for example if it were
|
/// scalar value indexed is already around as a register, for example if it were
|
||||||
/// inserted directly into the aggregrate.
|
/// inserted directly into the aggregrate.
|
||||||
|
///
|
||||||
|
/// If InsertBefore is not null, this function will duplicate (modified)
|
||||||
|
/// insertvalues when a part of a nested struct is extracted.
|
||||||
Value *FindInsertedValue(Value *V,
|
Value *FindInsertedValue(Value *V,
|
||||||
const unsigned *idx_begin,
|
const unsigned *idx_begin,
|
||||||
const unsigned *idx_end,
|
const unsigned *idx_end,
|
||||||
Instruction *InsertBefore);
|
Instruction *InsertBefore = 0);
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -805,6 +805,7 @@ Value *BuildSubAggregate(Value *From, Value* To, const Type *IndexedType,
|
|||||||
// Any inserted instructions are inserted before InsertBefore
|
// Any inserted instructions are inserted before InsertBefore
|
||||||
Value *BuildSubAggregate(Value *From, const unsigned *idx_begin,
|
Value *BuildSubAggregate(Value *From, const unsigned *idx_begin,
|
||||||
const unsigned *idx_end, Instruction *InsertBefore) {
|
const unsigned *idx_end, Instruction *InsertBefore) {
|
||||||
|
assert(InsertBefore && "Must have someplace to insert!");
|
||||||
const Type *IndexedType = ExtractValueInst::getIndexedType(From->getType(),
|
const Type *IndexedType = ExtractValueInst::getIndexedType(From->getType(),
|
||||||
idx_begin,
|
idx_begin,
|
||||||
idx_end);
|
idx_end);
|
||||||
@ -851,9 +852,13 @@ Value *llvm::FindInsertedValue(Value *V, const unsigned *idx_begin,
|
|||||||
for (const unsigned *i = I->idx_begin(), *e = I->idx_end();
|
for (const unsigned *i = I->idx_begin(), *e = I->idx_end();
|
||||||
i != e; ++i, ++req_idx) {
|
i != e; ++i, ++req_idx) {
|
||||||
if (req_idx == idx_end)
|
if (req_idx == idx_end)
|
||||||
// The requested index is a part of a nested aggregate. Handle this
|
if (InsertBefore)
|
||||||
// specially.
|
// The requested index is a part of a nested aggregate. Handle this
|
||||||
return BuildSubAggregate(V, idx_begin, req_idx, InsertBefore);
|
// specially.
|
||||||
|
return BuildSubAggregate(V, idx_begin, req_idx, InsertBefore);
|
||||||
|
else
|
||||||
|
// We can't handle this without inserting insertvalues
|
||||||
|
return 0;
|
||||||
|
|
||||||
// This insert value inserts something else than what we are looking for.
|
// This insert value inserts something else than what we are looking for.
|
||||||
// See if the (aggregrate) value inserted into has the value we are
|
// See if the (aggregrate) value inserted into has the value we are
|
||||||
|
Loading…
Reference in New Issue
Block a user