aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-17 22:00:23 +0000
committerChris Lattner <sabre@nondot.org>2009-07-17 22:00:23 +0000
commit3f621b34a4ad5326465a46ff73209384e0b0bd37 (patch)
tree2ba268e02318481adf4aaea21780bce122ee1309 /lib/CodeGen/AsmPrinter
parente9e4b5392584c0fceaf1450e982d77e47b97e6bc (diff)
downloadexternal_llvm-3f621b34a4ad5326465a46ff73209384e0b0bd37.zip
external_llvm-3f621b34a4ad5326465a46ff73209384e0b0bd37.tar.gz
external_llvm-3f621b34a4ad5326465a46ff73209384e0b0bd37.tar.bz2
remove AsmPrinter::findGlobalValue, just use Value::stripPointerCasts instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76246 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp31
1 files changed, 3 insertions, 28 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index e352922..a2d154f 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -500,35 +500,9 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
return false;
}
-/// findGlobalValue - if CV is an expression equivalent to a single
-/// global value, return that value.
-const GlobalValue * AsmPrinter::findGlobalValue(const Constant *CV) {
- if (const GlobalValue *GV = dyn_cast<GlobalValue>(CV))
- return GV;
- else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CV)) {
- const TargetData *TD = TM.getTargetData();
- unsigned Opcode = CE->getOpcode();
- switch (Opcode) {
- case Instruction::GetElementPtr: {
- const Constant *ptrVal = CE->getOperand(0);
- SmallVector<Value*, 8> idxVec(CE->op_begin()+1, CE->op_end());
- if (TD->getIndexedOffset(ptrVal->getType(), &idxVec[0], idxVec.size()))
- return 0;
- return findGlobalValue(ptrVal);
- }
- case Instruction::BitCast:
- return findGlobalValue(CE->getOperand(0));
- default:
- return 0;
- }
- }
- return 0;
-}
-
/// EmitLLVMUsedList - For targets that define a TAI::UsedDirective, mark each
/// global in the specified llvm.used list for which emitUsedDirectiveFor
/// is true, as being used with this directive.
-
void AsmPrinter::EmitLLVMUsedList(Constant *List) {
const char *Directive = TAI->getUsedDirective();
@@ -537,8 +511,9 @@ void AsmPrinter::EmitLLVMUsedList(Constant *List) {
if (InitList == 0) return;
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
- const GlobalValue *GV = findGlobalValue(InitList->getOperand(i));
- if (TAI->emitUsedDirectiveFor(GV, Mang)) {
+ const GlobalValue *GV =
+ dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
+ if (GV && TAI->emitUsedDirectiveFor(GV, Mang)) {
O << Directive;
EmitConstantValueOnly(InitList->getOperand(i));
O << '\n';