From 01b6d557709060c0002f2e95f48c8c2e30c53f0d Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Fri, 18 Oct 2013 23:09:50 +0200 Subject: [PATCH] Diff reduction: Remove Scope::ignoreTemplates and friends. It is unused since my change to the way codegen is driven. If we want to optimize template codegen again, we should do it properly, contributing the changes back to DMD. --- dmd2/mtype.c | 1 - dmd2/scope.c | 2 -- dmd2/scope.h | 4 ---- dmd2/staticassert.c | 1 - dmd2/template.c | 10 ---------- dmd2/template.h | 1 - 6 files changed, 19 deletions(-) diff --git a/dmd2/mtype.c b/dmd2/mtype.c index dbea4b6c..7f74e68d 100644 --- a/dmd2/mtype.c +++ b/dmd2/mtype.c @@ -7088,7 +7088,6 @@ void TypeTypeof::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol Scope *sc2 = sc->push(); sc2->intypeof = 1; sc2->speculative = true; - sc2->ignoreTemplates++; sc2->flags |= sc->flags & SCOPEstaticif; unsigned oldspecgag = global.speculativeGag; if (global.gag) diff --git a/dmd2/scope.c b/dmd2/scope.c index 2bcc085a..d6166ed2 100644 --- a/dmd2/scope.c +++ b/dmd2/scope.c @@ -79,7 +79,6 @@ Scope::Scope() this->intypeof = 0; this->speculative = 0; this->parameterSpecialization = 0; - this->ignoreTemplates = 0; this->callSuper = 0; this->flags = 0; this->lastdc = NULL; @@ -131,7 +130,6 @@ Scope::Scope(Scope *enclosing) this->intypeof = enclosing->intypeof; this->speculative = enclosing->speculative; this->parameterSpecialization = enclosing->parameterSpecialization; - this->ignoreTemplates = enclosing->ignoreTemplates; this->callSuper = enclosing->callSuper; this->flags = (enclosing->flags & (SCOPEcontract | SCOPEdebug)); this->lastdc = NULL; diff --git a/dmd2/scope.h b/dmd2/scope.h index de5f63f0..6a7868bf 100644 --- a/dmd2/scope.h +++ b/dmd2/scope.h @@ -95,10 +95,6 @@ struct Scope int noaccesscheck; // don't do access checks int needctfe; // inside a ctfe-only expression -#if IN_LLVM - int ignoreTemplates; // set if newly instantiated templates should be ignored when codegen'ing -#endif - unsigned callSuper; // primitive flow analysis for constructors structalign_t structalign; // alignment for struct members diff --git a/dmd2/staticassert.c b/dmd2/staticassert.c index 9d3c7b02..94fc83a0 100644 --- a/dmd2/staticassert.c +++ b/dmd2/staticassert.c @@ -55,7 +55,6 @@ void StaticAssert::semantic2(Scope *sc) ScopeDsymbol *sd = new ScopeDsymbol(); sc = sc->push(sd); sc->flags |= SCOPEstaticassert; - ++sc->ignoreTemplates; Expression *e = exp->ctfeSemantic(sc); e = resolveProperties(sc, e); sc = sc->pop(); diff --git a/dmd2/template.c b/dmd2/template.c index a8fb8229..5afb6d50 100644 --- a/dmd2/template.c +++ b/dmd2/template.c @@ -1850,7 +1850,6 @@ Lmatch: */ makeParamNamesVisibleInConstraint(paramscope, fargs); Expression *e = constraint->syntaxCopy(); - paramscope->ignoreTemplates++; paramscope->flags |= SCOPEstaticif; /* Detect recursive attempts to instantiate this template declaration, @@ -4780,7 +4779,6 @@ TemplateInstance::TemplateInstance(Loc loc, Identifier *ident) this->speculative = 0; #if IN_LLVM - this->ignore = true; this->emittedInModule = NULL; #endif } @@ -4813,7 +4811,6 @@ TemplateInstance::TemplateInstance(Loc loc, TemplateDeclaration *td, Objects *ti this->speculative = 0; #if IN_LLVM - this->ignore = true; this->emittedInModule = NULL; #endif @@ -4960,11 +4957,6 @@ void TemplateInstance::semantic(Scope *sc, Expressions *fargs) return; } -#if IN_LLVM - if (!sc->ignoreTemplates) - ignore = false; -#endif - // get the enclosing template instance from the scope tinst tinst = sc->tinst; @@ -6309,8 +6301,6 @@ void TemplateInstance::semantic3(Scope *sc) sc = sc->push(argsym); sc = sc->push(this); sc->tinst = this; - if (ignore) - sc->ignoreTemplates++; int oldgag = global.gag; int olderrors = global.errors; /* If this is a speculative instantiation, gag errors. diff --git a/dmd2/template.h b/dmd2/template.h index 12d0783f..eb00d66b 100644 --- a/dmd2/template.h +++ b/dmd2/template.h @@ -353,7 +353,6 @@ struct TemplateInstance : ScopeDsymbol AliasDeclaration *isAliasDeclaration(); #if IN_LLVM - bool ignore; // true if the instance must be ignored when codegen'ing Module* emittedInModule; // which module this template instance has been emitted in void codegen(IRState*);