Don't allocate the SmallVector of Registers. It gets messy figuring out who

should delete what when the object gets copied around. It's also making valgrind
upset.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119747 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2010-11-18 21:50:54 +00:00
parent 8ee9779658
commit 24d22d2764

View File

@ -113,6 +113,7 @@ class ARMOperand : public MCParsedAsmOperand {
} Kind; } Kind;
SMLoc StartLoc, EndLoc; SMLoc StartLoc, EndLoc;
SmallVector<unsigned, 8> Registers;
union { union {
struct { struct {
@ -129,10 +130,6 @@ class ARMOperand : public MCParsedAsmOperand {
bool Writeback; bool Writeback;
} Reg; } Reg;
struct {
SmallVector<unsigned, 32> *Registers;
} RegList;
struct { struct {
const MCExpr *Val; const MCExpr *Val;
} Imm; } Imm;
@ -172,7 +169,7 @@ public:
case RegisterList: case RegisterList:
case DPRRegisterList: case DPRRegisterList:
case SPRRegisterList: case SPRRegisterList:
RegList = o.RegList; Registers = o.Registers;
break; break;
case Immediate: case Immediate:
Imm = o.Imm; Imm = o.Imm;
@ -182,10 +179,6 @@ public:
break; break;
} }
} }
~ARMOperand() {
if (isRegList())
delete RegList.Registers;
}
/// getStartLoc - Get the location of the first token of this operand. /// getStartLoc - Get the location of the first token of this operand.
SMLoc getStartLoc() const { return StartLoc; } SMLoc getStartLoc() const { return StartLoc; }
@ -210,7 +203,7 @@ public:
const SmallVectorImpl<unsigned> &getRegList() const { const SmallVectorImpl<unsigned> &getRegList() const {
assert((Kind == RegisterList || Kind == DPRRegisterList || assert((Kind == RegisterList || Kind == DPRRegisterList ||
Kind == SPRRegisterList) && "Invalid access!"); Kind == SPRRegisterList) && "Invalid access!");
return *RegList.Registers; return Registers;
} }
const MCExpr *getImm() const { const MCExpr *getImm() const {
@ -350,11 +343,10 @@ public:
Kind = SPRRegisterList; Kind = SPRRegisterList;
ARMOperand *Op = new ARMOperand(Kind); ARMOperand *Op = new ARMOperand(Kind);
Op->RegList.Registers = new SmallVector<unsigned, 32>();
for (SmallVectorImpl<std::pair<unsigned, SMLoc> >::const_iterator for (SmallVectorImpl<std::pair<unsigned, SMLoc> >::const_iterator
I = Regs.begin(), E = Regs.end(); I != E; ++I) I = Regs.begin(), E = Regs.end(); I != E; ++I)
Op->RegList.Registers->push_back(I->first); Op->Registers.push_back(I->first);
std::sort(Op->RegList.Registers->begin(), Op->RegList.Registers->end()); std::sort(Op->Registers.begin(), Op->Registers.end());
Op->StartLoc = StartLoc; Op->StartLoc = StartLoc;
Op->EndLoc = EndLoc; Op->EndLoc = EndLoc;
return Op; return Op;