Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 2 additions & 33 deletions src/build.d
Original file line number Diff line number Diff line change
Expand Up @@ -235,44 +235,13 @@ DFLAGS=-I%@P%/../../../../../druntime/import -I%@P%/../../../../../phobos -L-L%@
return new DependencyRef(dependency);
});

/// Returns: the dependency that builds and executes the optabgen utility
alias opTabGen = memoize!(function() {
auto opTabFiles = ["tytab.d"];
auto opTabFilesBin = opTabFiles.map!(e => env["G"].buildPath(e)).array;
auto opTabBin = env["G"].buildPath("optabgen").exeName;
auto opTabSourceFile = env["C"].buildPath("optabgen.d");

auto commandFunction = (){
auto args = [env["HOST_DMD_RUN"], opTabSourceFile, "-of" ~ opTabBin];
args ~= flags["DFLAGS"];

writefln("(DC) OPTABGEN %s", opTabSourceFile.baseName);
args.runCanThrow;

writefln("(RUN) OPTABBIN %-(%s, %)", opTabFiles);
[opTabBin].runCanThrow;

// move the generated files to the generated folder
opTabFiles.map!(a => srcDir.buildPath(a)).zip(opTabFilesBin).each!(a => a.expand.rename);
}; // defined separately to support older D compilers
Dependency dependency = {
name: "optabgen",
description: "Generate source files for the backend",
targets: opTabFilesBin,
sources: [opTabSourceFile],
commandFunction: commandFunction,
};
return new DependencyRef(dependency);
});

/// Returns: the dependencies that build the D backend
alias dBackend = memoize!(function () {
Dependency dependency = {
name: "dbackend",
target: env["G"].buildPath("dbackend").objName,
sources: sources.backend,
msg: "(DC) D_BACK_OBJS %-(%s, %)".format(sources.backend.map!(e => e.baseName).array),
deps: [opTabGen],
command: [
env["HOST_DMD_RUN"],
"-c",
Expand All @@ -291,7 +260,7 @@ alias backend = memoize!(function() {
msg: "(LIB) %s".format("BACKEND".libName),
sources: [ env["G"].buildPath("dbackend").objName ],
target: env["G"].buildPath("backend").libName,
deps: [opTabGen, dBackend],
deps: [dBackend],
command: [env["HOST_DMD_RUN"], env["MODEL_FLAG"], "-lib", "-of$@", "$<"]
};
return new DependencyRef(dependency);
Expand Down Expand Up @@ -758,7 +727,7 @@ auto sourceFiles()
backend:
dirEntries(env["C"], "*.d", SpanMode.shallow)
.map!(e => e.name)
.filter!(e => !e.baseName.among("dt.d", "obj.d", "optabgen.d"))
.filter!(e => !e.baseName.among("dt.d", "obj.d"))
.array,
backendHeaders: [
// can't be built with -betterC
Expand Down
234 changes: 0 additions & 234 deletions src/dmd/backend/optabgen.d

This file was deleted.

17 changes: 1 addition & 16 deletions src/posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ BACK_HDRS=$C/cc.d $C/cdef.d $C/cgcv.d $C/code.d $C/cv4.d $C/dt.d $C/el.d $C/glob
$C/dlist.d $C/melf.d $C/varstats.di $C/dt.d

BACK_SRC = \
$C/optabgen.d \
$C/bcomplex.d $C/blockopt.d $C/cg.d $C/cg87.d $C/cgxmm.d \
$C/cgcod.d $C/cgcs.d $C/dcgcv.d $C/cgelem.d $C/cgen.d $C/cgobj.d \
$C/compress.d $C/cgreg.d $C/var.d $C/cgcse.d \
Expand Down Expand Up @@ -476,7 +475,6 @@ build-examples: $(EXAMPLES)

clean:
rm -Rf $(GENERATED)
rm -f $(addprefix $D/backend/, $(optabgen_output))
@[ ! -d ${PGO_DIR} ] || echo You should issue manually: rm -rf ${PGO_DIR}

######## Download and install the last dmd buildable without dmd
Expand Down Expand Up @@ -508,19 +506,6 @@ export DEFAULT_DMD_CONF
$G/dmd.conf: $(SRC_MAKE)
echo "$$DEFAULT_DMD_CONF" > $@

######## optabgen generates some source
optabgen_output = tytab.d

$G/optabgen: $C/optabgen.d $C/cc.d $C/oper.d $(HOST_DMD_PATH)
$(HOST_DMD_RUN) -of$@ $(DFLAGS) $(MODEL_FLAG) $(BACK_MV) $<
$G/optabgen
mv $(optabgen_output) $G

optabgen_files = $(addprefix $G/, $(optabgen_output))
$(optabgen_files): optabgen.out
.INTERMEDIATE: optabgen.out
optabgen.out : $G/optabgen

######## VERSION
########################################################################
# The version file should be updated on every build
Expand All @@ -546,7 +531,7 @@ FORCE: ;

-include $(DEPS)

$(G_DOBJS): $G/%.o: $C/%.d $(optabgen_files) posix.mak $(HOST_DMD_PATH)
$(G_DOBJS): $G/%.o: $C/%.d posix.mak $(HOST_DMD_PATH)
@echo " (HOST_DMD_RUN) BACK_DOBJS $<"
$(HOST_DMD_RUN) -c -of$@ $(DFLAGS) $(MODEL_FLAG) $(BACK_BETTERC) $(BACK_DFLAGS) $<

Expand Down
19 changes: 3 additions & 16 deletions src/vcbuild/dmd.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -211,25 +211,12 @@
</DCompile>
</ItemDefinitionGroup>
<ItemGroup>
<DCompile Include="../dmd/**/*.d" Exclude="../dmd/backend/optabgen.d;../dmd/frontend.d;../dmd/asttypename.d" />
<DCompile Include="../dmd/**/*.d" Exclude="../dmd/frontend.d;../dmd/asttypename.d" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="../dmd/**/*.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\dmd\backend\optabgen.d">
<Message>Building and running $(IntDir)%(Filename).exe</Message>
<Command>$(_DCompilerExe) -I.. -version=MARS -of"$(IntDir)generated\%(Filename).exe" "%(FullPath)"
if errorlevel 1 exit /B %ERRORLEVEL%
pushd $(IntDir)generated
"%(Filename).exe"
if errorlevel 1 exit /B %ERRORLEVEL%
popd</Command>
<Outputs>$(IntDir)generated\optab.d;$(IntDir)generated\debtab.d;$(IntDir)generated\cdxxx.d;$(IntDir)generated\elxxx.d;$(IntDir)generated\tytab.d;$(IntDir)generated\\fltables.d;%(Outputs)</Outputs>
<AdditionalInputs>..\dmd\backend\cc.d;..\dmd\backend\cdef.d;..\dmd\backend\oper.d;..\dmd\backend\ty.d;%(AdditionalInputs)</AdditionalInputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
9 changes: 2 additions & 7 deletions src/vcbuild/dmd.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="C++ Header Files">
Expand All @@ -16,9 +16,4 @@
<Filter>C++ Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\dmd\backend\optabgen.d">
<Filter>Generator</Filter>
</CustomBuild>
</ItemGroup>
</Project>
</Project>
Loading