mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Accept getelementptr starting at GV with all 0 indices as a
legitimate way of representing global variable GV in debug info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user