mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-29 06:10:48 +00:00
add support for GlobalAlias to ObjectSizeOffsetVisitor
llvm-svn: 171303
This commit is contained in:
parent
812bc66ae6
commit
be740c67e2
@ -191,6 +191,7 @@ public:
|
||||
SizeOffsetType visitExtractElementInst(ExtractElementInst &I);
|
||||
SizeOffsetType visitExtractValueInst(ExtractValueInst &I);
|
||||
SizeOffsetType visitGEPOperator(GEPOperator &GEP);
|
||||
SizeOffsetType visitGlobalAlias(GlobalAlias &GA);
|
||||
SizeOffsetType visitGlobalVariable(GlobalVariable &GV);
|
||||
SizeOffsetType visitIntToPtrInst(IntToPtrInst&);
|
||||
SizeOffsetType visitLoadInst(LoadInst &I);
|
||||
|
@ -399,6 +399,8 @@ SizeOffsetType ObjectSizeOffsetVisitor::compute(Value *V) {
|
||||
return visitArgument(*A);
|
||||
if (ConstantPointerNull *P = dyn_cast<ConstantPointerNull>(V))
|
||||
return visitConstantPointerNull(*P);
|
||||
if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V))
|
||||
return visitGlobalAlias(*GA);
|
||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
|
||||
return visitGlobalVariable(*GV);
|
||||
if (UndefValue *UV = dyn_cast<UndefValue>(V))
|
||||
@ -517,6 +519,12 @@ SizeOffsetType ObjectSizeOffsetVisitor::visitGEPOperator(GEPOperator &GEP) {
|
||||
return std::make_pair(PtrData.first, PtrData.second + Offset);
|
||||
}
|
||||
|
||||
SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalAlias(GlobalAlias &GA) {
|
||||
if (GA.mayBeOverridden())
|
||||
return unknown();
|
||||
return compute(GA.getAliasee());
|
||||
}
|
||||
|
||||
SizeOffsetType ObjectSizeOffsetVisitor::visitGlobalVariable(GlobalVariable &GV){
|
||||
if (!GV.hasDefinitiveInitializer())
|
||||
return unknown();
|
||||
@ -629,6 +637,7 @@ SizeOffsetEvalType ObjectSizeOffsetEvaluator::compute_(Value *V) {
|
||||
} else if (isa<Argument>(V) ||
|
||||
(isa<ConstantExpr>(V) &&
|
||||
cast<ConstantExpr>(V)->getOpcode() == Instruction::IntToPtr) ||
|
||||
isa<GlobalAlias>(V) ||
|
||||
isa<GlobalVariable>(V)) {
|
||||
// ignore values where we cannot do more than what ObjectSizeVisitor can
|
||||
Result = unknown();
|
||||
|
Loading…
Reference in New Issue
Block a user