From 510e600542b731b950de77a53764f0ba0c555984 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 18 Nov 2010 21:50:54 +0000 Subject: [PATCH] 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. llvm-svn: 119747 --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index b07fb6410a0..b5f2e12e1c5 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -113,6 +113,7 @@ class ARMOperand : public MCParsedAsmOperand { } Kind; SMLoc StartLoc, EndLoc; + SmallVector Registers; union { struct { @@ -129,10 +130,6 @@ class ARMOperand : public MCParsedAsmOperand { bool Writeback; } Reg; - struct { - SmallVector *Registers; - } RegList; - struct { const MCExpr *Val; } Imm; @@ -172,7 +169,7 @@ public: case RegisterList: case DPRRegisterList: case SPRRegisterList: - RegList = o.RegList; + Registers = o.Registers; break; case Immediate: Imm = o.Imm; @@ -182,10 +179,6 @@ public: break; } } - ~ARMOperand() { - if (isRegList()) - delete RegList.Registers; - } /// getStartLoc - Get the location of the first token of this operand. SMLoc getStartLoc() const { return StartLoc; } @@ -210,7 +203,7 @@ public: const SmallVectorImpl &getRegList() const { assert((Kind == RegisterList || Kind == DPRRegisterList || Kind == SPRRegisterList) && "Invalid access!"); - return *RegList.Registers; + return Registers; } const MCExpr *getImm() const { @@ -350,11 +343,10 @@ public: Kind = SPRRegisterList; ARMOperand *Op = new ARMOperand(Kind); - Op->RegList.Registers = new SmallVector(); for (SmallVectorImpl >::const_iterator I = Regs.begin(), E = Regs.end(); I != E; ++I) - Op->RegList.Registers->push_back(I->first); - std::sort(Op->RegList.Registers->begin(), Op->RegList.Registers->end()); + Op->Registers.push_back(I->first); + std::sort(Op->Registers.begin(), Op->Registers.end()); Op->StartLoc = StartLoc; Op->EndLoc = EndLoc; return Op;