aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-26 22:44:13 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-26 22:44:13 +0000
commit5ac8aff3d7431dc7e4d64d960574a10c9f7e0078 (patch)
tree0d53de6ca54215a3940a376038efee1eed32af42 /lib
parent7216dc9cb49f47254595120cf15a737cee53f0bd (diff)
Some micro-optimizations for DISABLE_SMART_POINTERS:
- When it's safe, ActionResult uses the low bit of the pointer for the "invalid" flag rather than a separate "bool" value. This keeps GCC from generating some truly awful code, for a > 3x speedup in the result-passing microbenchmark. - When DISABLE_SMART_POINTERS is defined, store an ActionResult within ASTOwningResult rather than an ASTOwningPtr. Brings the performance benefits of the above to smart pointers with DISABLE_SMART_POINTERS defined. Sadly, these micro-benchmark performance improvements don't seem to make much of a difference on Cocoa.h right now. However, they're harmless and might help with future optimizations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Parse/ParseDecl.cpp2
-rw-r--r--lib/Parse/ParseDeclCXX.cpp8
-rw-r--r--lib/Parse/ParseExprCXX.cpp6
-rw-r--r--lib/Sema/Sema.h4
-rw-r--r--lib/Sema/SemaExprObjC.cpp4
5 files changed, 12 insertions, 12 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 0ac9e08982..5a8f223488 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -37,7 +37,7 @@ Parser::TypeTy *Parser::ParseTypeName() {
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
ParseDeclarator(DeclaratorInfo);
- return Actions.ActOnTypeName(CurScope, DeclaratorInfo).Val;
+ return Actions.ActOnTypeName(CurScope, DeclaratorInfo).get();
}
/// ParseAttributes - Parse a non-empty attributes list.
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 26787aec12..1041410f2a 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -393,13 +393,13 @@ void Parser::ParseBaseClause(DeclTy *ClassDecl)
while (true) {
// Parse a base-specifier.
BaseResult Result = ParseBaseSpecifier(ClassDecl);
- if (Result.isInvalid) {
+ if (Result.isInvalid()) {
// Skip the rest of this base specifier, up until the comma or
// opening brace.
SkipUntil(tok::comma, tok::l_brace, true, true);
} else {
// Add this to our array of base specifiers.
- BaseInfo.push_back(Result.Val);
+ BaseInfo.push_back(Result.get());
}
// If the next token is a comma, consume it and keep reading
@@ -835,8 +835,8 @@ void Parser::ParseConstructorInitializer(DeclTy *ConstructorDecl) {
do {
MemInitResult MemInit = ParseMemInitializer(ConstructorDecl);
- if (!MemInit.isInvalid)
- MemInitializers.push_back(MemInit.Val);
+ if (!MemInit.isInvalid())
+ MemInitializers.push_back(MemInit.get());
if (Tok.is(tok::comma))
ConsumeToken();
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 04e53a94ef..945ff245fb 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -333,7 +333,7 @@ Parser::OwningExprResult Parser::ParseCXXThis() {
Parser::OwningExprResult
Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) {
Declarator DeclaratorInfo(DS, Declarator::TypeNameContext);
- TypeTy *TypeRep = Actions.ActOnTypeName(CurScope, DeclaratorInfo).Val;
+ TypeTy *TypeRep = Actions.ActOnTypeName(CurScope, DeclaratorInfo).get();
assert(Tok.is(tok::l_paren) && "Expected '('!");
SourceLocation LParenLoc = ConsumeParen();
@@ -629,10 +629,10 @@ Parser::TypeTy *Parser::ParseConversionFunctionId() {
// Finish up the type.
Action::TypeResult Result = Actions.ActOnTypeName(CurScope, D);
- if (Result.isInvalid)
+ if (Result.isInvalid())
return 0;
else
- return Result.Val;
+ return Result.get();
}
/// ParseCXXNewExpression - Parse a C++ new-expression. New is used to allocate
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 51d2e38c93..0adea514d0 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -252,9 +252,9 @@ public:
OwningExprResult Owned(Expr* E) { return OwningExprResult(*this, E); }
OwningExprResult Owned(ExprResult R) {
- if (R.isInvalid)
+ if (R.isInvalid())
return ExprError();
- return OwningExprResult(*this, R.Val);
+ return OwningExprResult(*this, R.get());
}
OwningStmtResult Owned(Stmt* S) { return OwningStmtResult(*this, S); }
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 8f4d677179..607e640b32 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -202,7 +202,7 @@ Sema::ExprResult Sema::ActOnClassMessage(
superTy = Context.getPointerType(superTy);
ExprResult ReceiverExpr = new ObjCSuperExpr(SourceLocation(), superTy);
// We are really in an instance method, redirect.
- return ActOnInstanceMessage(ReceiverExpr.Val, Sel, lbrac, rbrac,
+ return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, rbrac,
Args, NumArgs);
}
// We are sending a message to 'super' within a class method. Do nothing,
@@ -216,7 +216,7 @@ Sema::ExprResult Sema::ActOnClassMessage(
ExprResult ReceiverExpr = new DeclRefExpr(VD, VD->getType(),
receiverLoc);
// We are really in an instance method, redirect.
- return ActOnInstanceMessage(ReceiverExpr.Val, Sel, lbrac, rbrac,
+ return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, rbrac,
Args, NumArgs);
}
return Diag(receiverLoc, diag::err_undeclared_var_use) << receiverName;