diff options
author | John McCall <rjmccall@apple.com> | 2010-10-26 08:39:16 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-10-26 08:39:16 +0000 |
commit | 8e6285af719adc6f86d6faa235d22a08eb68ee3a (patch) | |
tree | 96033c3c348ba398637cfa7d2a09ec34cfcae41e /lib/AST/Stmt.cpp | |
parent | 3fa5cae9b3812cab9fab6c042c3329bb70a3d046 (diff) |
Optimize field space usage in CompoundStmt, LabelStmt, Expr, and CastExpr.
There's probably still significant padding waste on x86-64 UNIXen, but
the difference in 32-bit compiles should be significant.
There are a lot of Expr nodes left that could lose a word this way.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117359 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Stmt.cpp')
-rw-r--r-- | lib/AST/Stmt.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index cc4b6c9ddb..4f46b35040 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -46,7 +46,7 @@ static StmtClassNameTable &getStmtInfoTableEntry(Stmt::StmtClass E) { } const char *Stmt::getStmtClassName() const { - return getStmtInfoTableEntry((StmtClass)sClass).Name; + return getStmtInfoTableEntry((StmtClass) StmtBits.sClass).Name; } void Stmt::PrintStats() { @@ -87,7 +87,7 @@ bool Stmt::CollectingStats(bool Enable) { void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) { if (this->Body) C.Deallocate(Body); - this->NumStmts = NumStmts; + this->CompoundStmtBits.NumStmts = NumStmts; Body = new (C) Stmt*[NumStmts]; memcpy(Body, Stmts, sizeof(Stmt *) * NumStmts); @@ -106,7 +106,7 @@ SourceRange ReturnStmt::getSourceRange() const { } bool Stmt::hasImplicitControlFlow() const { - switch (sClass) { + switch (StmtBits.sClass) { default: return false; @@ -604,7 +604,9 @@ Stmt::child_iterator NullStmt::child_end() { return child_iterator(); } // CompoundStmt Stmt::child_iterator CompoundStmt::child_begin() { return &Body[0]; } -Stmt::child_iterator CompoundStmt::child_end() { return &Body[0]+NumStmts; } +Stmt::child_iterator CompoundStmt::child_end() { + return &Body[0]+CompoundStmtBits.NumStmts; +} // CaseStmt Stmt::child_iterator CaseStmt::child_begin() { return &SubExprs[0]; } |