summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineModuleInfo.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-01-30 19:00:21 +0000
committerDale Johannesen <dalej@apple.com>2008-01-30 19:00:21 +0000
commit56d4903db563982956d9de3f477cdf4dcec0d506 (patch)
tree39ba18ffe4cdbd191c7444aa55bf35ac603d9be5 /llvm/lib/CodeGen/MachineModuleInfo.cpp
parent90962af0e84654442b1862955cf2800c8683e78e (diff)
downloadbcm5719-llvm-56d4903db563982956d9de3f477cdf4dcec0d506.tar.gz
bcm5719-llvm-56d4903db563982956d9de3f477cdf4dcec0d506.zip
Accept getelementptr starting at GV with all 0 indices as a
legitimate way of representing global variable GV in debug info. llvm-svn: 46565
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineModuleInfo.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index 8aa4c4456ac..c1823947b1d 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -104,6 +104,13 @@ static GlobalVariable *getGlobalVariable(Value *V) {
} else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
if (CE->getOpcode() == Instruction::BitCast) {
return dyn_cast<GlobalVariable>(CE->getOperand(0));
+ } else if (CE->getOpcode() == Instruction::GetElementPtr) {
+ for (unsigned int i=1; i<CE->getNumOperands(); i++) {
+ Constant* CI = cast<Constant>(CE->getOperand(i));
+ if (!CI || !CI->isNullValue())
+ return NULL;
+ }
+ return dyn_cast<GlobalVariable>(CE->getOperand(0));
}
}
return NULL;
@@ -117,6 +124,13 @@ static bool isGlobalVariable(Value *V) {
} else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
if (CE->getOpcode() == Instruction::BitCast) {
return isa<GlobalVariable>(CE->getOperand(0));
+ } else if (CE->getOpcode() == Instruction::GetElementPtr) {
+ for (unsigned int i=1; i<CE->getNumOperands(); i++) {
+ Constant* CI = cast<Constant>(CE->getOperand(i));
+ if (!CI || !CI->isNullValue())
+ return false;
+ }
+ return isa<GlobalVariable>(CE->getOperand(0));
}
}
return false;
OpenPOWER on IntegriCloud