From: Alkis Evlogimenos Date: Wed, 4 Aug 2004 08:08:13 +0000 (+0000) Subject: Stop using getValues(). X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cc7ba49d85b66955516ff0d9574a70e1637dea36;p=oota-llvm.git Stop using getValues(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15485 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 5fa52b60389..5eadc388b6d 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -292,18 +292,16 @@ static Value *RemapOperand(const Value *In, Constant *Result = 0; if (const ConstantArray *CPA = dyn_cast(CPV)) { - const std::vector &Ops = CPA->getValues(); - std::vector Operands(Ops.size()); - for (unsigned i = 0, e = Ops.size(); i != e; ++i) - Operands[i] = - cast(RemapOperand(Ops[i], LocalMap, GlobalMap)); + std::vector Operands(CPA->getNumOperands()); + for (unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i) + Operands[i] = + cast(RemapOperand(CPA->getOperand(i), LocalMap, GlobalMap)); Result = ConstantArray::get(cast(CPA->getType()), Operands); } else if (const ConstantStruct *CPS = dyn_cast(CPV)) { - const std::vector &Ops = CPS->getValues(); - std::vector Operands(Ops.size()); - for (unsigned i = 0; i < Ops.size(); ++i) - Operands[i] = - cast(RemapOperand(Ops[i], LocalMap, GlobalMap)); + std::vector Operands(CPS->getNumOperands()); + for (unsigned i = 0, e = CPS->getNumOperands(); i != e; ++i) + Operands[i] = + cast(RemapOperand(CPS->getOperand(i), LocalMap, GlobalMap)); Result = ConstantStruct::get(cast(CPS->getType()), Operands); } else if (isa(CPV)) { Result = const_cast(CPV); @@ -774,7 +772,7 @@ static bool LinkAppendingVars(Module *M, Inits.reserve(NewSize); if (ConstantArray *I = dyn_cast(G1->getInitializer())) { for (unsigned i = 0, e = T1->getNumElements(); i != e; ++i) - Inits.push_back(cast(I->getValues()[i])); + Inits.push_back(I->getOperand(i)); } else { assert(isa(G1->getInitializer())); Constant *CV = Constant::getNullValue(T1->getElementType()); @@ -783,7 +781,7 @@ static bool LinkAppendingVars(Module *M, } if (ConstantArray *I = dyn_cast(G2->getInitializer())) { for (unsigned i = 0, e = T2->getNumElements(); i != e; ++i) - Inits.push_back(cast(I->getValues()[i])); + Inits.push_back(I->getOperand(i)); } else { assert(isa(G2->getInitializer())); Constant *CV = Constant::getNullValue(T2->getElementType()); diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp index 5fa52b60389..5eadc388b6d 100644 --- a/lib/VMCore/Linker.cpp +++ b/lib/VMCore/Linker.cpp @@ -292,18 +292,16 @@ static Value *RemapOperand(const Value *In, Constant *Result = 0; if (const ConstantArray *CPA = dyn_cast(CPV)) { - const std::vector &Ops = CPA->getValues(); - std::vector Operands(Ops.size()); - for (unsigned i = 0, e = Ops.size(); i != e; ++i) - Operands[i] = - cast(RemapOperand(Ops[i], LocalMap, GlobalMap)); + std::vector Operands(CPA->getNumOperands()); + for (unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i) + Operands[i] = + cast(RemapOperand(CPA->getOperand(i), LocalMap, GlobalMap)); Result = ConstantArray::get(cast(CPA->getType()), Operands); } else if (const ConstantStruct *CPS = dyn_cast(CPV)) { - const std::vector &Ops = CPS->getValues(); - std::vector Operands(Ops.size()); - for (unsigned i = 0; i < Ops.size(); ++i) - Operands[i] = - cast(RemapOperand(Ops[i], LocalMap, GlobalMap)); + std::vector Operands(CPS->getNumOperands()); + for (unsigned i = 0, e = CPS->getNumOperands(); i != e; ++i) + Operands[i] = + cast(RemapOperand(CPS->getOperand(i), LocalMap, GlobalMap)); Result = ConstantStruct::get(cast(CPS->getType()), Operands); } else if (isa(CPV)) { Result = const_cast(CPV); @@ -774,7 +772,7 @@ static bool LinkAppendingVars(Module *M, Inits.reserve(NewSize); if (ConstantArray *I = dyn_cast(G1->getInitializer())) { for (unsigned i = 0, e = T1->getNumElements(); i != e; ++i) - Inits.push_back(cast(I->getValues()[i])); + Inits.push_back(I->getOperand(i)); } else { assert(isa(G1->getInitializer())); Constant *CV = Constant::getNullValue(T1->getElementType()); @@ -783,7 +781,7 @@ static bool LinkAppendingVars(Module *M, } if (ConstantArray *I = dyn_cast(G2->getInitializer())) { for (unsigned i = 0, e = T2->getNumElements(); i != e; ++i) - Inits.push_back(cast(I->getValues()[i])); + Inits.push_back(I->getOperand(i)); } else { assert(isa(G2->getInitializer())); Constant *CV = Constant::getNullValue(T2->getElementType());