mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Add a way to replace a field inside a metadata node. This can be
used to incrementally update a created node without needing a temporary node and RAUW. llvm-svn: 150571
This commit is contained in:
parent
643575d4a9
commit
6be42e9898
@ -135,6 +135,9 @@ public:
|
||||
/// deleteTemporary - Deallocate a node created by getTemporary. The
|
||||
/// node must not have any users.
|
||||
static void deleteTemporary(MDNode *N);
|
||||
|
||||
/// replaceOperandWith - Replace a specific operand.
|
||||
void replaceOperandWith(unsigned i, Value *NewVal);
|
||||
|
||||
/// getOperand - Return specified operand.
|
||||
Value *getOperand(unsigned i) const;
|
||||
|
@ -87,6 +87,11 @@ static MDNodeOperand *getOperandPtr(MDNode *N, unsigned Op) {
|
||||
return reinterpret_cast<MDNodeOperand*>(N+1)+Op;
|
||||
}
|
||||
|
||||
void MDNode::replaceOperandWith(unsigned i, Value *Val) {
|
||||
MDNodeOperand *Op = getOperandPtr(this, i);
|
||||
replaceOperand(Op, Val);
|
||||
}
|
||||
|
||||
MDNode::MDNode(LLVMContext &C, ArrayRef<Value*> Vals, bool isFunctionLocal)
|
||||
: Value(Type::getMetadataTy(C), Value::MDNodeVal) {
|
||||
NumOperands = Vals.size();
|
||||
|
Loading…
Reference in New Issue
Block a user