Skip to content

Commit

Permalink
Remove the dmd front-end inliner and related code
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed Feb 10, 2024
1 parent 8ab0636 commit f97053d
Show file tree
Hide file tree
Showing 15 changed files with 437 additions and 2,304 deletions.
4 changes: 0 additions & 4 deletions compiler/src/dmd/declaration.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,8 +617,6 @@ class FuncDeclaration : public Declaration
// Sibling nested functions which called this one
FuncDeclarations siblingCallers;

FuncDeclarations *inlinedNestedCallees;

AttributeViolation* safetyViolation;
AttributeViolation* nogcViolation;
AttributeViolation* pureViolation;
Expand Down Expand Up @@ -666,8 +664,6 @@ class FuncDeclaration : public Declaration
bool inferRetType(bool v);
bool hasDualContext() const;
bool hasDualContext(bool v);
bool hasAlwaysInlines() const;
bool hasAlwaysInlines(bool v);
bool isCrtCtor() const;
bool isCrtCtor(bool v);
bool isCrtDtor() const;
Expand Down
1 change: 0 additions & 1 deletion compiler/src/dmd/dmodule.d
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ extern (C++) final class Module : Package
uint errors; // if any errors in file
uint numlines; // number of lines in source file
FileType filetype; // source file type
bool hasAlwaysInlines; // contains references to functions that must be inlined
bool isPackageFile; // if it is a package.d
Package pkg; // if isPackageFile is true, the Package that contains this package.d
Strings contentImportedFiles; // array of files whose content was imported
Expand Down
2 changes: 0 additions & 2 deletions compiler/src/dmd/dsymbol.d
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ enum PASS : ubyte
semantic2done, // semantic2() done
semantic3, // semantic3() started
semantic3done, // semantic3() done
inline, // inline started
inlinedone, // inline done
obj, // toObjFile() run
}

Expand Down
2 changes: 0 additions & 2 deletions compiler/src/dmd/dsymbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ enum class PASS : uint8_t
semantic2done, // semantic2() done
semantic3, // semantic3() started
semantic3done, // semantic3() done
inline_, // inline started
inlinedone, // inline done
obj // toObjFile() run
};

Expand Down
11 changes: 0 additions & 11 deletions compiler/src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -2880,17 +2880,6 @@ private bool functionParameters(const ref Loc loc, Scope* sc,
}
}

/* If calling a pragma(inline, true) function,
* set flag to later scan for inlines.
*/
if (fd && fd.inlining == PINLINE.always)
{
if (sc._module)
sc._module.hasAlwaysInlines = true;
if (sc.func)
sc.func.hasAlwaysInlines = true;
}

const isCtorCall = fd && fd.needThis() && fd.isCtorDeclaration();

const size_t n = (nargs > nparams) ? nargs : nparams; // n = max(nargs, nparams)
Expand Down
4 changes: 0 additions & 4 deletions compiler/src/dmd/frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -3709,7 +3709,6 @@ class FuncDeclaration : public Declaration
Array<VarDeclaration* > closureVars;
Array<VarDeclaration* > outerVars;
Array<FuncDeclaration* > siblingCallers;
Array<FuncDeclaration* >* inlinedNestedCallees;
AttributeViolation* safetyViolation;
AttributeViolation* nogcViolation;
AttributeViolation* pureViolation;
Expand Down Expand Up @@ -3754,8 +3753,6 @@ class FuncDeclaration : public Declaration
bool inferRetType(bool v);
bool hasDualContext() const;
bool hasDualContext(bool v);
bool hasAlwaysInlines() const;
bool hasAlwaysInlines(bool v);
bool isCrtCtor() const;
bool isCrtCtor(bool v);
bool isCrtDtor() const;
Expand Down Expand Up @@ -7195,7 +7192,6 @@ class Module final : public Package
uint32_t errors;
uint32_t numlines;
FileType filetype;
bool hasAlwaysInlines;
bool isPackageFile;
Package* pkg;
Array<const char* > contentImportedFiles;
Expand Down
3 changes: 0 additions & 3 deletions compiler/src/dmd/func.d
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ private struct FUNCFLAG
bool inferRetType; /// Return type is to be inferred
bool hasDualContext; /// has a dual-context 'this' parameter

bool hasAlwaysInlines; /// Contains references to functions that must be inlined
bool isCrtCtor; /// Has attribute pragma(crt_constructor)
bool isCrtDtor; /// Has attribute pragma(crt_destructor)
bool hasEscapingSiblings;/// Has sibling functions that escape
Expand Down Expand Up @@ -372,8 +371,6 @@ extern (C++) class FuncDeclaration : Declaration
/// Sibling nested functions which called this one
FuncDeclarations siblingCallers;

FuncDeclarations *inlinedNestedCallees;

/// In case of failed `@safe` inference, store the error that made the function `@system` for
/// better diagnostics
AttributeViolation* safetyViolation;
Expand Down
17 changes: 0 additions & 17 deletions compiler/src/dmd/glue.d
Original file line number Diff line number Diff line change
Expand Up @@ -857,23 +857,6 @@ public void FuncDeclaration_toObjFile(FuncDeclaration fd, bool multiobj)
}
}

if (fd.inlinedNestedCallees)
{
/* https://issues.dlang.org/show_bug.cgi?id=15333
* If fd contains inlined expressions that come from
* nested function bodies, the enclosing of the functions must be
* generated first, in order to calculate correct frame pointer offset.
*/
foreach (fdc; *fd.inlinedNestedCallees)
{
FuncDeclaration fp = fdc.toParent2().isFuncDeclaration();
if (fp && fp.semanticRun < PASS.obj)
{
toObjFile(fp, multiobj);
}
}
}

if (fd.isNested())
{
//if (!(config.flags3 & CFG3pic))
Expand Down

0 comments on commit f97053d

Please sign in to comment.