forked from OSchip/llvm-project
parent
847b54101b
commit
2f8e4ad870
|
@ -249,7 +249,8 @@ namespace {
|
||||||
++SS.Idx;
|
++SS.Idx;
|
||||||
if (SS.Idx != ST->getNumElements()) {
|
if (SS.Idx != ST->getNumElements()) {
|
||||||
const StructLayout *SL = TD.getStructLayout(ST);
|
const StructLayout *SL = TD.getStructLayout(ST);
|
||||||
SS.Offset += SL->MemberOffsets[SS.Idx]-SL->MemberOffsets[SS.Idx-1];
|
SS.Offset +=
|
||||||
|
unsigned(SL->MemberOffsets[SS.Idx]-SL->MemberOffsets[SS.Idx-1]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Stack.pop_back(); // At the end of the structure
|
Stack.pop_back(); // At the end of the structure
|
||||||
|
@ -257,7 +258,7 @@ namespace {
|
||||||
const ArrayType *AT = cast<ArrayType>(SS.Ty);
|
const ArrayType *AT = cast<ArrayType>(SS.Ty);
|
||||||
++SS.Idx;
|
++SS.Idx;
|
||||||
if (SS.Idx != AT->getNumElements()) {
|
if (SS.Idx != AT->getNumElements()) {
|
||||||
SS.Offset += TD.getTypeSize(AT->getElementType());
|
SS.Offset += unsigned(TD.getTypeSize(AT->getElementType()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Stack.pop_back(); // At the end of the array
|
Stack.pop_back(); // At the end of the array
|
||||||
|
@ -280,7 +281,7 @@ namespace {
|
||||||
assert(SS.Idx < ST->getNumElements());
|
assert(SS.Idx < ST->getNumElements());
|
||||||
const StructLayout *SL = TD.getStructLayout(ST);
|
const StructLayout *SL = TD.getStructLayout(ST);
|
||||||
Stack.push_back(StackState(ST->getElementType(SS.Idx),
|
Stack.push_back(StackState(ST->getElementType(SS.Idx),
|
||||||
SS.Offset+SL->MemberOffsets[SS.Idx]));
|
SS.Offset+unsigned(SL->MemberOffsets[SS.Idx])));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const ArrayType *AT = cast<ArrayType>(SS.Ty);
|
const ArrayType *AT = cast<ArrayType>(SS.Ty);
|
||||||
|
@ -292,7 +293,7 @@ namespace {
|
||||||
assert(SS.Idx < AT->getNumElements());
|
assert(SS.Idx < AT->getNumElements());
|
||||||
Stack.push_back(StackState(AT->getElementType(),
|
Stack.push_back(StackState(AT->getElementType(),
|
||||||
SS.Offset+SS.Idx*
|
SS.Offset+SS.Idx*
|
||||||
TD.getTypeSize(AT->getElementType())));
|
unsigned(TD.getTypeSize(AT->getElementType()))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,7 +372,7 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Figure out how big the new type we're merging in is...
|
// Figure out how big the new type we're merging in is...
|
||||||
unsigned NewTySize = NewTy->isSized() ? TD.getTypeSize(NewTy) : 0;
|
unsigned NewTySize = NewTy->isSized() ? (unsigned)TD.getTypeSize(NewTy) : 0;
|
||||||
|
|
||||||
// Otherwise check to see if we can fold this type into the current node. If
|
// Otherwise check to see if we can fold this type into the current node. If
|
||||||
// we can't, we fold the node completely, if we can, we potentially update our
|
// we can't, we fold the node completely, if we can, we potentially update our
|
||||||
|
@ -450,12 +451,12 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
|
||||||
|
|
||||||
// The offset we are looking for must be in the i'th element...
|
// The offset we are looking for must be in the i'th element...
|
||||||
SubType = STy->getElementType(i);
|
SubType = STy->getElementType(i);
|
||||||
O += SL.MemberOffsets[i];
|
O += (unsigned)SL.MemberOffsets[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type::ArrayTyID: {
|
case Type::ArrayTyID: {
|
||||||
SubType = cast<ArrayType>(SubType)->getElementType();
|
SubType = cast<ArrayType>(SubType)->getElementType();
|
||||||
unsigned ElSize = TD.getTypeSize(SubType);
|
unsigned ElSize = (unsigned)TD.getTypeSize(SubType);
|
||||||
unsigned Remainder = (Offset-O) % ElSize;
|
unsigned Remainder = (Offset-O) % ElSize;
|
||||||
O = Offset-Remainder;
|
O = Offset-Remainder;
|
||||||
break;
|
break;
|
||||||
|
@ -476,7 +477,8 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
|
||||||
if (isa<FunctionType>(SubType) &&
|
if (isa<FunctionType>(SubType) &&
|
||||||
isa<FunctionType>(NewTy)) return false;
|
isa<FunctionType>(NewTy)) return false;
|
||||||
|
|
||||||
unsigned SubTypeSize = SubType->isSized() ? TD.getTypeSize(SubType) : 0;
|
unsigned SubTypeSize = SubType->isSized() ?
|
||||||
|
(unsigned)TD.getTypeSize(SubType) : 0;
|
||||||
|
|
||||||
// Ok, we are getting desperate now. Check for physical subtyping, where we
|
// Ok, we are getting desperate now. Check for physical subtyping, where we
|
||||||
// just require each element in the node to be compatible.
|
// just require each element in the node to be compatible.
|
||||||
|
@ -500,16 +502,16 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
|
||||||
const StructType *STy = cast<StructType>(SubType);
|
const StructType *STy = cast<StructType>(SubType);
|
||||||
const StructLayout &SL = *TD.getStructLayout(STy);
|
const StructLayout &SL = *TD.getStructLayout(STy);
|
||||||
if (SL.MemberOffsets.size() > 1)
|
if (SL.MemberOffsets.size() > 1)
|
||||||
NextPadSize = SL.MemberOffsets[1];
|
NextPadSize = (unsigned)SL.MemberOffsets[1];
|
||||||
else
|
else
|
||||||
NextPadSize = SubTypeSize;
|
NextPadSize = SubTypeSize;
|
||||||
NextSubType = STy->getElementType(0);
|
NextSubType = STy->getElementType(0);
|
||||||
NextSubTypeSize = TD.getTypeSize(NextSubType);
|
NextSubTypeSize = (unsigned)TD.getTypeSize(NextSubType);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Type::ArrayTyID:
|
case Type::ArrayTyID:
|
||||||
NextSubType = cast<ArrayType>(SubType)->getElementType();
|
NextSubType = cast<ArrayType>(SubType)->getElementType();
|
||||||
NextSubTypeSize = TD.getTypeSize(NextSubType);
|
NextSubTypeSize = (unsigned)TD.getTypeSize(NextSubType);
|
||||||
NextPadSize = NextSubTypeSize;
|
NextPadSize = NextSubTypeSize;
|
||||||
break;
|
break;
|
||||||
default: ;
|
default: ;
|
||||||
|
|
|
@ -382,8 +382,9 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) {
|
||||||
for (gep_type_iterator I = gep_type_begin(GEP), E = gep_type_end(GEP);
|
for (gep_type_iterator I = gep_type_begin(GEP), E = gep_type_end(GEP);
|
||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
if (const StructType *STy = dyn_cast<StructType>(*I)) {
|
if (const StructType *STy = dyn_cast<StructType>(*I)) {
|
||||||
unsigned FieldNo = cast<ConstantUInt>(I.getOperand())->getValue();
|
unsigned FieldNo =
|
||||||
Offset += TD.getStructLayout(STy)->MemberOffsets[FieldNo];
|
(unsigned)cast<ConstantUInt>(I.getOperand())->getValue();
|
||||||
|
Offset += (unsigned)TD.getStructLayout(STy)->MemberOffsets[FieldNo];
|
||||||
} else if (const PointerType *PTy = dyn_cast<PointerType>(*I)) {
|
} else if (const PointerType *PTy = dyn_cast<PointerType>(*I)) {
|
||||||
if (!isa<Constant>(I.getOperand()) ||
|
if (!isa<Constant>(I.getOperand()) ||
|
||||||
!cast<Constant>(I.getOperand())->isNullValue())
|
!cast<Constant>(I.getOperand())->isNullValue())
|
||||||
|
@ -1030,7 +1031,7 @@ void GraphBuilder::MergeConstantInitIntoNode(DSNodeHandle &NH, Constant *C) {
|
||||||
const StructLayout *SL = TD.getStructLayout(CS->getType());
|
const StructLayout *SL = TD.getStructLayout(CS->getType());
|
||||||
for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) {
|
||||||
DSNode *NHN = NH.getNode();
|
DSNode *NHN = NH.getNode();
|
||||||
DSNodeHandle NewNH(NHN, NH.getOffset()+SL->MemberOffsets[i]);
|
DSNodeHandle NewNH(NHN, NH.getOffset()+(unsigned)SL->MemberOffsets[i]);
|
||||||
MergeConstantInitIntoNode(NewNH, cast<Constant>(CS->getOperand(i)));
|
MergeConstantInitIntoNode(NewNH, cast<Constant>(CS->getOperand(i)));
|
||||||
}
|
}
|
||||||
} else if (isa<ConstantAggregateZero>(C) || isa<UndefValue>(C)) {
|
} else if (isa<ConstantAggregateZero>(C) || isa<UndefValue>(C)) {
|
||||||
|
|
|
@ -124,7 +124,7 @@ public:
|
||||||
class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> {
|
class ModRefInfoBuilder : public InstVisitor<ModRefInfoBuilder> {
|
||||||
const DSGraph& funcGraph;
|
const DSGraph& funcGraph;
|
||||||
const FunctionModRefInfo& funcModRef;
|
const FunctionModRefInfo& funcModRef;
|
||||||
struct ModRefTable& modRefTable;
|
class ModRefTable& modRefTable;
|
||||||
|
|
||||||
ModRefInfoBuilder(); // DO NOT IMPLEMENT
|
ModRefInfoBuilder(); // DO NOT IMPLEMENT
|
||||||
ModRefInfoBuilder(const ModRefInfoBuilder&); // DO NOT IMPLEMENT
|
ModRefInfoBuilder(const ModRefInfoBuilder&); // DO NOT IMPLEMENT
|
||||||
|
@ -333,6 +333,7 @@ void MemoryDepAnalysis::ProcessSCC(std::vector<BasicBlock*> &S,
|
||||||
/// Add true-dep: U -> D
|
/// Add true-dep: U -> D
|
||||||
/// if (HasLoop(S))
|
/// if (HasLoop(S))
|
||||||
/// Add anti-dep: D -> U
|
/// Add anti-dep: D -> U
|
||||||
|
{
|
||||||
ModRefTable::ref_iterator JI=ModRefCurrent.usersBegin();
|
ModRefTable::ref_iterator JI=ModRefCurrent.usersBegin();
|
||||||
ModRefTable::ref_iterator JE = ModRefCurrent.usersBeforeDef_End(II);
|
ModRefTable::ref_iterator JE = ModRefCurrent.usersBeforeDef_End(II);
|
||||||
for ( ; JI != JE; ++JI)
|
for ( ; JI != JE; ++JI)
|
||||||
|
@ -361,6 +362,7 @@ void MemoryDepAnalysis::ProcessSCC(std::vector<BasicBlock*> &S,
|
||||||
if (hasLoop)
|
if (hasLoop)
|
||||||
funcDepGraph->AddSimpleDependence(**II, **JI, TrueDependence);
|
funcDepGraph->AddSimpleDependence(**II, **JI, TrueDependence);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// for every def Dnext in DefSetPrev
|
/// for every def Dnext in DefSetPrev
|
||||||
/// // NOTE: Dnext comes after D in execution order
|
/// // NOTE: Dnext comes after D in execution order
|
||||||
|
|
|
@ -176,7 +176,7 @@ void DepIterState::Next()
|
||||||
firstSsaDone = true; // flags if we just rolled over
|
firstSsaDone = true; // flags if we just rolled over
|
||||||
}
|
}
|
||||||
|
|
||||||
if (depFlags & ControlDeps != 0)
|
if ((depFlags & ControlDeps) != 0)
|
||||||
{
|
{
|
||||||
assert(0 && "Cannot handle control deps");
|
assert(0 && "Cannot handle control deps");
|
||||||
// iterFlags &= ~FirstTimeFlag; // clear "firstTime" flag
|
// iterFlags &= ~FirstTimeFlag; // clear "firstTime" flag
|
||||||
|
|
Loading…
Reference in New Issue