2013-05-20 20:13:32 +08:00
|
|
|
//===-- GenericToNVVM.cpp - Convert generic module to NVVM module - C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Convert generic global variables into either .global or .const access based
|
|
|
|
// on the variable's "constant" qualifier.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "NVPTX.h"
|
|
|
|
#include "MCTargetDesc/NVPTXBaseInfo.h"
|
2014-01-07 19:48:04 +08:00
|
|
|
#include "NVPTXUtilities.h"
|
|
|
|
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
|
|
|
|
#include "llvm/CodeGen/ValueTypes.h"
|
2013-05-20 20:13:32 +08:00
|
|
|
#include "llvm/IR/Constants.h"
|
|
|
|
#include "llvm/IR/DerivedTypes.h"
|
2014-01-07 19:48:04 +08:00
|
|
|
#include "llvm/IR/IRBuilder.h"
|
2013-05-20 20:13:32 +08:00
|
|
|
#include "llvm/IR/Instructions.h"
|
|
|
|
#include "llvm/IR/Intrinsics.h"
|
2015-02-13 18:01:29 +08:00
|
|
|
#include "llvm/IR/LegacyPassManager.h"
|
2013-05-20 20:13:32 +08:00
|
|
|
#include "llvm/IR/Module.h"
|
|
|
|
#include "llvm/IR/Operator.h"
|
2014-03-04 19:26:31 +08:00
|
|
|
#include "llvm/IR/ValueMap.h"
|
2015-01-14 13:14:30 +08:00
|
|
|
#include "llvm/Transforms/Utils/ValueMapper.h"
|
2013-05-20 20:13:32 +08:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
void initializeGenericToNVVMPass(PassRegistry &);
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
class GenericToNVVM : public ModulePass {
|
|
|
|
public:
|
|
|
|
static char ID;
|
|
|
|
|
|
|
|
GenericToNVVM() : ModulePass(ID) {}
|
|
|
|
|
2014-04-29 15:57:44 +08:00
|
|
|
bool runOnModule(Module &M) override;
|
2013-05-20 20:13:32 +08:00
|
|
|
|
2014-04-29 15:57:44 +08:00
|
|
|
void getAnalysisUsage(AnalysisUsage &AU) const override {}
|
2013-05-20 20:13:32 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
Value *getOrInsertCVTA(Module *M, Function *F, GlobalVariable *GV,
|
|
|
|
IRBuilder<> &Builder);
|
|
|
|
Value *remapConstant(Module *M, Function *F, Constant *C,
|
|
|
|
IRBuilder<> &Builder);
|
|
|
|
Value *remapConstantVectorOrConstantAggregate(Module *M, Function *F,
|
|
|
|
Constant *C,
|
|
|
|
IRBuilder<> &Builder);
|
|
|
|
Value *remapConstantExpr(Module *M, Function *F, ConstantExpr *C,
|
|
|
|
IRBuilder<> &Builder);
|
2015-01-14 13:14:30 +08:00
|
|
|
void remapNamedMDNode(ValueToValueMapTy &VM, NamedMDNode *N);
|
2013-05-20 20:13:32 +08:00
|
|
|
|
|
|
|
typedef ValueMap<GlobalVariable *, GlobalVariable *> GVMapTy;
|
|
|
|
typedef ValueMap<Constant *, Value *> ConstantToValueMapTy;
|
|
|
|
GVMapTy GVMap;
|
|
|
|
ConstantToValueMapTy ConstantToValueMap;
|
|
|
|
};
|
2014-01-28 04:03:35 +08:00
|
|
|
} // end namespace
|
2013-05-20 20:13:32 +08:00
|
|
|
|
|
|
|
char GenericToNVVM::ID = 0;
|
|
|
|
|
|
|
|
ModulePass *llvm::createGenericToNVVMPass() { return new GenericToNVVM(); }
|
|
|
|
|
|
|
|
INITIALIZE_PASS(
|
|
|
|
GenericToNVVM, "generic-to-nvvm",
|
|
|
|
"Ensure that the global variables are in the global address space", false,
|
|
|
|
false)
|
|
|
|
|
|
|
|
bool GenericToNVVM::runOnModule(Module &M) {
|
|
|
|
// Create a clone of each global variable that has the default address space.
|
|
|
|
// The clone is created with the global address space specifier, and the pair
|
|
|
|
// of original global variable and its clone is placed in the GVMap for later
|
|
|
|
// use.
|
|
|
|
|
|
|
|
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
|
|
|
|
I != E;) {
|
2015-10-20 08:54:09 +08:00
|
|
|
GlobalVariable *GV = &*I++;
|
2013-05-20 20:13:32 +08:00
|
|
|
if (GV->getType()->getAddressSpace() == llvm::ADDRESS_SPACE_GENERIC &&
|
|
|
|
!llvm::isTexture(*GV) && !llvm::isSurface(*GV) &&
|
2014-06-28 02:36:02 +08:00
|
|
|
!llvm::isSampler(*GV) && !GV->getName().startswith("llvm.")) {
|
2013-05-20 20:13:32 +08:00
|
|
|
GlobalVariable *NewGV = new GlobalVariable(
|
|
|
|
M, GV->getType()->getElementType(), GV->isConstant(),
|
2014-04-25 13:30:21 +08:00
|
|
|
GV->getLinkage(),
|
|
|
|
GV->hasInitializer() ? GV->getInitializer() : nullptr,
|
2013-05-20 20:13:32 +08:00
|
|
|
"", GV, GV->getThreadLocalMode(), llvm::ADDRESS_SPACE_GLOBAL);
|
|
|
|
NewGV->copyAttributesFrom(GV);
|
|
|
|
GVMap[GV] = NewGV;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return immediately, if every global variable has a specific address space
|
|
|
|
// specifier.
|
|
|
|
if (GVMap.empty()) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Walk through the instructions in function defitinions, and replace any use
|
|
|
|
// of original global variables in GVMap with a use of the corresponding
|
|
|
|
// copies in GVMap. If necessary, promote constants to instructions.
|
|
|
|
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
|
|
|
|
if (I->isDeclaration()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
IRBuilder<> Builder(I->getEntryBlock().getFirstNonPHIOrDbg());
|
|
|
|
for (Function::iterator BBI = I->begin(), BBE = I->end(); BBI != BBE;
|
|
|
|
++BBI) {
|
|
|
|
for (BasicBlock::iterator II = BBI->begin(), IE = BBI->end(); II != IE;
|
|
|
|
++II) {
|
|
|
|
for (unsigned i = 0, e = II->getNumOperands(); i < e; ++i) {
|
|
|
|
Value *Operand = II->getOperand(i);
|
|
|
|
if (isa<Constant>(Operand)) {
|
|
|
|
II->setOperand(
|
2015-10-20 08:54:09 +08:00
|
|
|
i, remapConstant(&M, &*I, cast<Constant>(Operand), Builder));
|
2013-05-20 20:13:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ConstantToValueMap.clear();
|
|
|
|
}
|
|
|
|
|
2015-01-14 13:14:30 +08:00
|
|
|
// Copy GVMap over to a standard value map.
|
|
|
|
ValueToValueMapTy VM;
|
|
|
|
for (auto I = GVMap.begin(), E = GVMap.end(); I != E; ++I)
|
|
|
|
VM[I->first] = I->second;
|
|
|
|
|
2013-05-20 20:13:32 +08:00
|
|
|
// Walk through the metadata section and update the debug information
|
|
|
|
// associated with the global variables in the default address space.
|
2015-10-20 08:54:09 +08:00
|
|
|
for (NamedMDNode &I : M.named_metadata()) {
|
|
|
|
remapNamedMDNode(VM, &I);
|
2013-05-20 20:13:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Walk through the global variable initializers, and replace any use of
|
|
|
|
// original global variables in GVMap with a use of the corresponding copies
|
|
|
|
// in GVMap. The copies need to be bitcast to the original global variable
|
|
|
|
// types, as we cannot use cvta in global variable initializers.
|
|
|
|
for (GVMapTy::iterator I = GVMap.begin(), E = GVMap.end(); I != E;) {
|
|
|
|
GlobalVariable *GV = I->first;
|
|
|
|
GlobalVariable *NewGV = I->second;
|
2014-08-19 08:20:02 +08:00
|
|
|
|
|
|
|
// Remove GV from the map so that it can be RAUWed. Note that
|
|
|
|
// DenseMap::erase() won't invalidate any iterators but this one.
|
|
|
|
auto Next = std::next(I);
|
|
|
|
GVMap.erase(I);
|
|
|
|
I = Next;
|
|
|
|
|
2013-11-15 09:34:59 +08:00
|
|
|
Constant *BitCastNewGV = ConstantExpr::getPointerCast(NewGV, GV->getType());
|
2013-05-20 20:13:32 +08:00
|
|
|
// At this point, the remaining uses of GV should be found only in global
|
|
|
|
// variable initializers, as other uses have been already been removed
|
|
|
|
// while walking through the instructions in function definitions.
|
2014-08-19 08:20:02 +08:00
|
|
|
GV->replaceAllUsesWith(BitCastNewGV);
|
2013-05-20 20:13:32 +08:00
|
|
|
std::string Name = GV->getName();
|
|
|
|
GV->eraseFromParent();
|
|
|
|
NewGV->setName(Name);
|
|
|
|
}
|
2014-08-19 08:20:02 +08:00
|
|
|
assert(GVMap.empty() && "Expected it to be empty by now");
|
2013-05-20 20:13:32 +08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Value *GenericToNVVM::getOrInsertCVTA(Module *M, Function *F,
|
|
|
|
GlobalVariable *GV,
|
|
|
|
IRBuilder<> &Builder) {
|
|
|
|
PointerType *GVType = GV->getType();
|
2014-04-25 13:30:21 +08:00
|
|
|
Value *CVTA = nullptr;
|
2013-05-20 20:13:32 +08:00
|
|
|
|
|
|
|
// See if the address space conversion requires the operand to be bitcast
|
|
|
|
// to i8 addrspace(n)* first.
|
|
|
|
EVT ExtendedGVType = EVT::getEVT(GVType->getElementType(), true);
|
|
|
|
if (!ExtendedGVType.isInteger() && !ExtendedGVType.isFloatingPoint()) {
|
|
|
|
// A bitcast to i8 addrspace(n)* on the operand is needed.
|
|
|
|
LLVMContext &Context = M->getContext();
|
|
|
|
unsigned int AddrSpace = GVType->getAddressSpace();
|
|
|
|
Type *DestTy = PointerType::get(Type::getInt8Ty(Context), AddrSpace);
|
|
|
|
CVTA = Builder.CreateBitCast(GV, DestTy, "cvta");
|
|
|
|
// Insert the address space conversion.
|
|
|
|
Type *ResultType =
|
|
|
|
PointerType::get(Type::getInt8Ty(Context), llvm::ADDRESS_SPACE_GENERIC);
|
|
|
|
SmallVector<Type *, 2> ParamTypes;
|
|
|
|
ParamTypes.push_back(ResultType);
|
|
|
|
ParamTypes.push_back(DestTy);
|
|
|
|
Function *CVTAFunction = Intrinsic::getDeclaration(
|
|
|
|
M, Intrinsic::nvvm_ptr_global_to_gen, ParamTypes);
|
|
|
|
CVTA = Builder.CreateCall(CVTAFunction, CVTA, "cvta");
|
|
|
|
// Another bitcast from i8 * to <the element type of GVType> * is
|
|
|
|
// required.
|
|
|
|
DestTy =
|
|
|
|
PointerType::get(GVType->getElementType(), llvm::ADDRESS_SPACE_GENERIC);
|
|
|
|
CVTA = Builder.CreateBitCast(CVTA, DestTy, "cvta");
|
|
|
|
} else {
|
|
|
|
// A simple CVTA is enough.
|
|
|
|
SmallVector<Type *, 2> ParamTypes;
|
|
|
|
ParamTypes.push_back(PointerType::get(GVType->getElementType(),
|
|
|
|
llvm::ADDRESS_SPACE_GENERIC));
|
|
|
|
ParamTypes.push_back(GVType);
|
|
|
|
Function *CVTAFunction = Intrinsic::getDeclaration(
|
|
|
|
M, Intrinsic::nvvm_ptr_global_to_gen, ParamTypes);
|
|
|
|
CVTA = Builder.CreateCall(CVTAFunction, GV, "cvta");
|
|
|
|
}
|
|
|
|
|
|
|
|
return CVTA;
|
|
|
|
}
|
|
|
|
|
|
|
|
Value *GenericToNVVM::remapConstant(Module *M, Function *F, Constant *C,
|
|
|
|
IRBuilder<> &Builder) {
|
|
|
|
// If the constant C has been converted already in the given function F, just
|
|
|
|
// return the converted value.
|
|
|
|
ConstantToValueMapTy::iterator CTII = ConstantToValueMap.find(C);
|
|
|
|
if (CTII != ConstantToValueMap.end()) {
|
|
|
|
return CTII->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
Value *NewValue = C;
|
|
|
|
if (isa<GlobalVariable>(C)) {
|
|
|
|
// If the constant C is a global variable and is found in GVMap, generate a
|
|
|
|
// set set of instructions that convert the clone of C with the global
|
|
|
|
// address space specifier to a generic pointer.
|
|
|
|
// The constant C cannot be used here, as it will be erased from the
|
|
|
|
// module eventually. And the clone of C with the global address space
|
|
|
|
// specifier cannot be used here either, as it will affect the types of
|
|
|
|
// other instructions in the function. Hence, this address space conversion
|
|
|
|
// is required.
|
|
|
|
GVMapTy::iterator I = GVMap.find(cast<GlobalVariable>(C));
|
|
|
|
if (I != GVMap.end()) {
|
|
|
|
NewValue = getOrInsertCVTA(M, F, I->second, Builder);
|
|
|
|
}
|
|
|
|
} else if (isa<ConstantVector>(C) || isa<ConstantArray>(C) ||
|
|
|
|
isa<ConstantStruct>(C)) {
|
|
|
|
// If any element in the constant vector or aggregate C is or uses a global
|
|
|
|
// variable in GVMap, the constant C needs to be reconstructed, using a set
|
|
|
|
// of instructions.
|
|
|
|
NewValue = remapConstantVectorOrConstantAggregate(M, F, C, Builder);
|
|
|
|
} else if (isa<ConstantExpr>(C)) {
|
|
|
|
// If any operand in the constant expression C is or uses a global variable
|
|
|
|
// in GVMap, the constant expression C needs to be reconstructed, using a
|
|
|
|
// set of instructions.
|
|
|
|
NewValue = remapConstantExpr(M, F, cast<ConstantExpr>(C), Builder);
|
|
|
|
}
|
|
|
|
|
|
|
|
ConstantToValueMap[C] = NewValue;
|
|
|
|
return NewValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
Value *GenericToNVVM::remapConstantVectorOrConstantAggregate(
|
|
|
|
Module *M, Function *F, Constant *C, IRBuilder<> &Builder) {
|
|
|
|
bool OperandChanged = false;
|
|
|
|
SmallVector<Value *, 4> NewOperands;
|
|
|
|
unsigned NumOperands = C->getNumOperands();
|
|
|
|
|
|
|
|
// Check if any element is or uses a global variable in GVMap, and thus
|
|
|
|
// converted to another value.
|
|
|
|
for (unsigned i = 0; i < NumOperands; ++i) {
|
|
|
|
Value *Operand = C->getOperand(i);
|
|
|
|
Value *NewOperand = remapConstant(M, F, cast<Constant>(Operand), Builder);
|
|
|
|
OperandChanged |= Operand != NewOperand;
|
|
|
|
NewOperands.push_back(NewOperand);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If none of the elements has been modified, return C as it is.
|
|
|
|
if (!OperandChanged) {
|
|
|
|
return C;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If any of the elements has been modified, construct the equivalent
|
|
|
|
// vector or aggregate value with a set instructions and the converted
|
|
|
|
// elements.
|
|
|
|
Value *NewValue = UndefValue::get(C->getType());
|
|
|
|
if (isa<ConstantVector>(C)) {
|
|
|
|
for (unsigned i = 0; i < NumOperands; ++i) {
|
|
|
|
Value *Idx = ConstantInt::get(Type::getInt32Ty(M->getContext()), i);
|
|
|
|
NewValue = Builder.CreateInsertElement(NewValue, NewOperands[i], Idx);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (unsigned i = 0; i < NumOperands; ++i) {
|
|
|
|
NewValue =
|
|
|
|
Builder.CreateInsertValue(NewValue, NewOperands[i], makeArrayRef(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NewValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
Value *GenericToNVVM::remapConstantExpr(Module *M, Function *F, ConstantExpr *C,
|
|
|
|
IRBuilder<> &Builder) {
|
|
|
|
bool OperandChanged = false;
|
|
|
|
SmallVector<Value *, 4> NewOperands;
|
|
|
|
unsigned NumOperands = C->getNumOperands();
|
|
|
|
|
|
|
|
// Check if any operand is or uses a global variable in GVMap, and thus
|
|
|
|
// converted to another value.
|
|
|
|
for (unsigned i = 0; i < NumOperands; ++i) {
|
|
|
|
Value *Operand = C->getOperand(i);
|
|
|
|
Value *NewOperand = remapConstant(M, F, cast<Constant>(Operand), Builder);
|
|
|
|
OperandChanged |= Operand != NewOperand;
|
|
|
|
NewOperands.push_back(NewOperand);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If none of the operands has been modified, return C as it is.
|
|
|
|
if (!OperandChanged) {
|
|
|
|
return C;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If any of the operands has been modified, construct the instruction with
|
|
|
|
// the converted operands.
|
|
|
|
unsigned Opcode = C->getOpcode();
|
|
|
|
switch (Opcode) {
|
|
|
|
case Instruction::ICmp:
|
|
|
|
// CompareConstantExpr (icmp)
|
|
|
|
return Builder.CreateICmp(CmpInst::Predicate(C->getPredicate()),
|
|
|
|
NewOperands[0], NewOperands[1]);
|
|
|
|
case Instruction::FCmp:
|
|
|
|
// CompareConstantExpr (fcmp)
|
2015-10-26 06:28:27 +08:00
|
|
|
llvm_unreachable("Address space conversion should have no effect "
|
|
|
|
"on float point CompareConstantExpr (fcmp)!");
|
2013-05-20 20:13:32 +08:00
|
|
|
case Instruction::ExtractElement:
|
|
|
|
// ExtractElementConstantExpr
|
|
|
|
return Builder.CreateExtractElement(NewOperands[0], NewOperands[1]);
|
|
|
|
case Instruction::InsertElement:
|
|
|
|
// InsertElementConstantExpr
|
|
|
|
return Builder.CreateInsertElement(NewOperands[0], NewOperands[1],
|
|
|
|
NewOperands[2]);
|
|
|
|
case Instruction::ShuffleVector:
|
|
|
|
// ShuffleVector
|
|
|
|
return Builder.CreateShuffleVector(NewOperands[0], NewOperands[1],
|
|
|
|
NewOperands[2]);
|
|
|
|
case Instruction::ExtractValue:
|
|
|
|
// ExtractValueConstantExpr
|
|
|
|
return Builder.CreateExtractValue(NewOperands[0], C->getIndices());
|
|
|
|
case Instruction::InsertValue:
|
|
|
|
// InsertValueConstantExpr
|
|
|
|
return Builder.CreateInsertValue(NewOperands[0], NewOperands[1],
|
|
|
|
C->getIndices());
|
|
|
|
case Instruction::GetElementPtr:
|
|
|
|
// GetElementPtrConstantExpr
|
|
|
|
return cast<GEPOperator>(C)->isInBounds()
|
|
|
|
? Builder.CreateGEP(
|
2015-03-25 07:34:31 +08:00
|
|
|
cast<GEPOperator>(C)->getSourceElementType(),
|
2013-05-20 20:13:32 +08:00
|
|
|
NewOperands[0],
|
|
|
|
makeArrayRef(&NewOperands[1], NumOperands - 1))
|
|
|
|
: Builder.CreateInBoundsGEP(
|
2015-04-04 05:33:42 +08:00
|
|
|
cast<GEPOperator>(C)->getSourceElementType(),
|
2013-05-20 20:13:32 +08:00
|
|
|
NewOperands[0],
|
|
|
|
makeArrayRef(&NewOperands[1], NumOperands - 1));
|
|
|
|
case Instruction::Select:
|
|
|
|
// SelectConstantExpr
|
|
|
|
return Builder.CreateSelect(NewOperands[0], NewOperands[1], NewOperands[2]);
|
|
|
|
default:
|
|
|
|
// BinaryConstantExpr
|
|
|
|
if (Instruction::isBinaryOp(Opcode)) {
|
|
|
|
return Builder.CreateBinOp(Instruction::BinaryOps(C->getOpcode()),
|
|
|
|
NewOperands[0], NewOperands[1]);
|
|
|
|
}
|
|
|
|
// UnaryConstantExpr
|
|
|
|
if (Instruction::isCast(Opcode)) {
|
|
|
|
return Builder.CreateCast(Instruction::CastOps(C->getOpcode()),
|
|
|
|
NewOperands[0], C->getType());
|
|
|
|
}
|
2015-10-26 06:28:27 +08:00
|
|
|
llvm_unreachable("GenericToNVVM encountered an unsupported ConstantExpr");
|
2013-05-20 20:13:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-14 13:14:30 +08:00
|
|
|
void GenericToNVVM::remapNamedMDNode(ValueToValueMapTy &VM, NamedMDNode *N) {
|
2013-05-20 20:13:32 +08:00
|
|
|
|
|
|
|
bool OperandChanged = false;
|
|
|
|
SmallVector<MDNode *, 16> NewOperands;
|
|
|
|
unsigned NumOperands = N->getNumOperands();
|
|
|
|
|
|
|
|
// Check if any operand is or contains a global variable in GVMap, and thus
|
|
|
|
// converted to another value.
|
|
|
|
for (unsigned i = 0; i < NumOperands; ++i) {
|
2014-11-12 05:30:22 +08:00
|
|
|
MDNode *Operand = N->getOperand(i);
|
2015-01-14 13:14:30 +08:00
|
|
|
MDNode *NewOperand = MapMetadata(Operand, VM);
|
2013-05-20 20:13:32 +08:00
|
|
|
OperandChanged |= Operand != NewOperand;
|
|
|
|
NewOperands.push_back(NewOperand);
|
|
|
|
}
|
|
|
|
|
|
|
|
// If none of the operands has been modified, return immediately.
|
|
|
|
if (!OperandChanged) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Replace the old operands with the new operands.
|
|
|
|
N->dropAllReferences();
|
2013-07-04 09:31:24 +08:00
|
|
|
for (SmallVectorImpl<MDNode *>::iterator I = NewOperands.begin(),
|
2013-05-20 20:13:32 +08:00
|
|
|
E = NewOperands.end();
|
|
|
|
I != E; ++I) {
|
|
|
|
N->addOperand(*I);
|
|
|
|
}
|
|
|
|
}
|