SDAG: Cleanup initialization of SDDbgValue, NFC

Cleanup how `SDDbgValue` is initialized, and rearrange the fields to
save two pointers in the struct layout.  No real functionality change
though (and I doubt the memory savings would show up in a profile).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237997 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith 2015-05-22 05:35:53 +00:00
parent 82967c0bcd
commit 73993abb6c

View File

@ -35,7 +35,6 @@ public:
FRAMEIX = 2 // value is contents of a stack location FRAMEIX = 2 // value is contents of a stack location
}; };
private: private:
enum DbgValueKind kind;
union { union {
struct { struct {
SDNode *Node; // valid for expressions SDNode *Node; // valid for expressions
@ -46,17 +45,18 @@ private:
} u; } u;
MDNode *Var; MDNode *Var;
MDNode *Expr; MDNode *Expr;
bool IsIndirect;
uint64_t Offset; uint64_t Offset;
DebugLoc DL; DebugLoc DL;
unsigned Order; unsigned Order;
bool Invalid; enum DbgValueKind kind;
bool IsIndirect;
bool Invalid = false;
public: public:
// Constructor for non-constants. // Constructor for non-constants.
SDDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R, bool indir, SDDbgValue(MDNode *Var, MDNode *Expr, SDNode *N, unsigned R, bool indir,
uint64_t off, DebugLoc dl, unsigned O) uint64_t off, DebugLoc dl, unsigned O)
: Var(Var), Expr(Expr), IsIndirect(indir), Offset(off), DL(dl), Order(O), : Var(Var), Expr(Expr), Offset(off), DL(dl), Order(O), IsIndirect(indir) {
Invalid(false) {
kind = SDNODE; kind = SDNODE;
u.s.Node = N; u.s.Node = N;
u.s.ResNo = R; u.s.ResNo = R;
@ -65,8 +65,7 @@ public:
// Constructor for constants. // Constructor for constants.
SDDbgValue(MDNode *Var, MDNode *Expr, const Value *C, uint64_t off, SDDbgValue(MDNode *Var, MDNode *Expr, const Value *C, uint64_t off,
DebugLoc dl, unsigned O) DebugLoc dl, unsigned O)
: Var(Var), Expr(Expr), IsIndirect(false), Offset(off), DL(dl), Order(O), : Var(Var), Expr(Expr), Offset(off), DL(dl), Order(O), IsIndirect(false) {
Invalid(false) {
kind = CONST; kind = CONST;
u.Const = C; u.Const = C;
} }
@ -74,8 +73,7 @@ public:
// Constructor for frame indices. // Constructor for frame indices.
SDDbgValue(MDNode *Var, MDNode *Expr, unsigned FI, uint64_t off, DebugLoc dl, SDDbgValue(MDNode *Var, MDNode *Expr, unsigned FI, uint64_t off, DebugLoc dl,
unsigned O) unsigned O)
: Var(Var), Expr(Expr), IsIndirect(false), Offset(off), DL(dl), Order(O), : Var(Var), Expr(Expr), Offset(off), DL(dl), Order(O), IsIndirect(false) {
Invalid(false) {
kind = FRAMEIX; kind = FRAMEIX;
u.FrameIx = FI; u.FrameIx = FI;
} }