From b849203c948a2aa36f7f8b7679cc9351c1a92706 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 4 Jun 2015 07:40:12 +0000 Subject: [PATCH] [TableGen] Merge single prefix bit in RecordVal into PointerIntPair with Name to reduce memory usage. llvm-svn: 239021 --- llvm/include/llvm/TableGen/Record.h | 11 +++++------ llvm/lib/TableGen/Record.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h index 43834cc3cc2d..d451a2a04f64 100644 --- a/llvm/include/llvm/TableGen/Record.h +++ b/llvm/include/llvm/TableGen/Record.h @@ -1113,22 +1113,21 @@ public: //===----------------------------------------------------------------------===// class RecordVal { - Init *Name; + PointerIntPair NameAndPrefix; RecTy *Ty; - unsigned Prefix; Init *Value; public: - RecordVal(Init *N, RecTy *T, unsigned P); - RecordVal(const std::string &N, RecTy *T, unsigned P); + RecordVal(Init *N, RecTy *T, bool P); + RecordVal(const std::string &N, RecTy *T, bool P); const std::string &getName() const; - const Init *getNameInit() const { return Name; } + const Init *getNameInit() const { return NameAndPrefix.getPointer(); } std::string getNameInitAsString() const { return getNameInit()->getAsUnquotedString(); } - unsigned getPrefix() const { return Prefix; } + bool getPrefix() const { return NameAndPrefix.getInt(); } RecTy *getType() const { return Ty; } Init *getValue() const { return Value; } diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp index 4ca3e8d34c9f..a0b48ff54021 100644 --- a/llvm/lib/TableGen/Record.cpp +++ b/llvm/lib/TableGen/Record.cpp @@ -1532,20 +1532,20 @@ std::string DagInit::getAsString() const { // Other implementations //===----------------------------------------------------------------------===// -RecordVal::RecordVal(Init *N, RecTy *T, unsigned P) - : Name(N), Ty(T), Prefix(P) { +RecordVal::RecordVal(Init *N, RecTy *T, bool P) + : NameAndPrefix(N, P), Ty(T) { Value = UnsetInit::get()->convertInitializerTo(Ty); assert(Value && "Cannot create unset value for current type!"); } -RecordVal::RecordVal(const std::string &N, RecTy *T, unsigned P) - : Name(StringInit::get(N)), Ty(T), Prefix(P) { +RecordVal::RecordVal(const std::string &N, RecTy *T, bool P) + : NameAndPrefix(StringInit::get(N), P), Ty(T) { Value = UnsetInit::get()->convertInitializerTo(Ty); assert(Value && "Cannot create unset value for current type!"); } const std::string &RecordVal::getName() const { - return cast(Name)->getValue(); + return cast(getNameInit())->getValue(); } void RecordVal::dump() const { errs() << *this; }