[llvm] r239021 - [TableGen] Merge single prefix bit in RecordVal into PointerIntPair with Name to reduce memory usage.
Craig Topper
craig.topper at gmail.com
Thu Jun 4 00:40:12 PDT 2015
Author: ctopper
Date: Thu Jun 4 02:40:12 2015
New Revision: 239021
URL: http://llvm.org/viewvc/llvm-project?rev=239021&view=rev
Log:
[TableGen] Merge single prefix bit in RecordVal into PointerIntPair with Name to reduce memory usage.
Modified:
llvm/trunk/include/llvm/TableGen/Record.h
llvm/trunk/lib/TableGen/Record.cpp
Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=239021&r1=239020&r2=239021&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Thu Jun 4 02:40:12 2015
@@ -1113,22 +1113,21 @@ public:
//===----------------------------------------------------------------------===//
class RecordVal {
- Init *Name;
+ PointerIntPair<Init *, 1, bool> 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; }
Modified: llvm/trunk/lib/TableGen/Record.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Record.cpp?rev=239021&r1=239020&r2=239021&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Record.cpp (original)
+++ llvm/trunk/lib/TableGen/Record.cpp Thu Jun 4 02:40:12 2015
@@ -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<StringInit>(Name)->getValue();
+ return cast<StringInit>(getNameInit())->getValue();
}
void RecordVal::dump() const { errs() << *this; }
More information about the llvm-commits
mailing list