mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-20 10:30:03 +00:00
Calling memmove on a MachineOperand is totally safe.
While it's not POD due to the user-defined constructor, it's still a trivially copyable type. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230141 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2b17108064
commit
7efcb3338c
@ -674,14 +674,8 @@ static void moveOperands(MachineOperand *Dst, MachineOperand *Src,
|
|||||||
if (MRI)
|
if (MRI)
|
||||||
return MRI->moveOperands(Dst, Src, NumOps);
|
return MRI->moveOperands(Dst, Src, NumOps);
|
||||||
|
|
||||||
// Here it would be convenient to call memmove, so that isn't allowed because
|
// MachineOperand is a trivially copyable type so we can just use memmove.
|
||||||
// MachineOperand has a constructor and so isn't a POD type.
|
std::memmove(Dst, Src, NumOps * sizeof(MachineOperand));
|
||||||
if (Dst < Src)
|
|
||||||
for (unsigned i = 0; i != NumOps; ++i)
|
|
||||||
new (Dst + i) MachineOperand(Src[i]);
|
|
||||||
else
|
|
||||||
for (unsigned i = NumOps; i ; --i)
|
|
||||||
new (Dst + i - 1) MachineOperand(Src[i - 1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// addOperand - Add the specified operand to the instruction. If it is an
|
/// addOperand - Add the specified operand to the instruction. If it is an
|
||||||
|
Loading…
Reference in New Issue
Block a user