Commit 2fcb7497 authored by dsyme's avatar dsyme
Browse files

[project @ 2001-06-11 13:31:49 by dsyme]

Modifications for GHC.NET (the ILX backend)
parent 82da3e51
.assembly test { }
.assembly extern 'mscorlib' { }
.assembly extern ilx 'std' { }
// ENTRYPOINT
.class MainMain {
.method public static void Main(class [mscorlib]System.String[]) {
.entrypoint
ldstr "LOG: *** loading main value" call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String)
ldsfld thunk<(func ( /* unit skipped */ ) --> class [ilx std]PrelBase_Z0T)> class Main::'Main_main'
ldsfld thunk<(func ( /* unit skipped */ ) --> class [std]PrelBase_Z0T)> class Main::'Main_main'
ldstr "LOG: *** evaluating main value"
call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String)
callfunc () --> (func ( /* unit skipped */ ) --> class [ilx std]PrelBase_Z0T)
callfunc () --> (func ( /* unit skipped */ ) --> class [std]PrelBase_Z0T)
ldstr "LOG: *** calling main value"
call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String)
// ldunit
callfunc ( /* unit skipped */ ) --> class [ilx std]PrelBase_Z0T
callfunc ( /* unit skipped */ ) --> class [std]PrelBase_Z0T
pop
......@@ -25,22 +27,22 @@
ldstr "LOG: ***calling critical finalizers manually in main()"
call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String)
ldsfld thunk<(func (thunk<class [ilx std]PrelIOBase_MVar<class [ilx std]PrelIOBase_Handlezuzu>>) --> (func (/* unit skipped */) --> class [ilx std]PrelBase_Z0T))> [ilx std]'PrelHandle'::'PrelHandle_stdHandleFinalizzer'
ldsfld thunk<class [ilx std]PrelIOBase_MVar<class [ilx std]PrelIOBase_Handle__>> [ilx std]'PrelHandle'::'PrelHandle_stdin'
callfunc () (thunk<class [ilx std]PrelIOBase_MVar<class [ilx std]PrelIOBase_Handle__>>) --> (func ( /* unit skipped */ ) --> class [ilx std]PrelBase_Z0T)
callfunc ( /* unit skipped */ ) --> class [ilx std]PrelBase_Z0T
ldsfld thunk<(func (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handlezuzu>>) --> (func (/* unit skipped */) --> class [std]PrelBase_Z0T))> [std]'PrelHandle'::'PrelHandle_stdHandleFinalizzer'
ldsfld thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>> [std]'PrelHandle'::'PrelHandle_stdin'
callfunc () (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>>) --> (func ( /* unit skipped */ ) --> class [std]PrelBase_Z0T)
callfunc ( /* unit skipped */ ) --> class [std]PrelBase_Z0T
pop
ldsfld thunk<(func (thunk<class [ilx std]PrelIOBase_MVar<class [ilx std]PrelIOBase_Handlezuzu>>) --> (func (/* unit skipped */) --> class [ilx std]PrelBase_Z0T))> [ilx std]'PrelHandle'::'PrelHandle_stdHandleFinalizzer'
ldsfld thunk<class [ilx std]PrelIOBase_MVar<class [ilx std]PrelIOBase_Handle__>> [ilx std]'PrelHandle'::'PrelHandle_stdout'
callfunc () (thunk<class [ilx std]PrelIOBase_MVar<class [ilx std]PrelIOBase_Handle__>>) --> (func ( /* unit skipped */ ) --> class [ilx std]PrelBase_Z0T)
callfunc ( /* unit skipped */ ) --> class [ilx std]PrelBase_Z0T
ldsfld thunk<(func (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handlezuzu>>) --> (func (/* unit skipped */) --> class [std]PrelBase_Z0T))> [std]'PrelHandle'::'PrelHandle_stdHandleFinalizzer'
ldsfld thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>> [std]'PrelHandle'::'PrelHandle_stdout'
callfunc () (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>>) --> (func ( /* unit skipped */ ) --> class [std]PrelBase_Z0T)
callfunc ( /* unit skipped */ ) --> class [std]PrelBase_Z0T
pop
ldsfld thunk<(func (thunk<class [ilx std]PrelIOBase_MVar<class [ilx std]PrelIOBase_Handlezuzu>>) --> (func (/* unit skipped */) --> class [ilx std]PrelBase_Z0T))> [ilx std]'PrelHandle'::'PrelHandle_stdHandleFinalizzer'
ldsfld thunk<class [ilx std]PrelIOBase_MVar<class [ilx std]PrelIOBase_Handle__>> [ilx std]'PrelHandle'::'PrelHandle_stderr'
callfunc () (thunk<class [ilx std]PrelIOBase_MVar<class [ilx std]PrelIOBase_Handle__>>) --> (func ( /* unit skipped */ ) --> class [ilx std]PrelBase_Z0T)
callfunc ( /* unit skipped */ ) --> class [ilx std]PrelBase_Z0T
ldsfld thunk<(func (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handlezuzu>>) --> (func (/* unit skipped */) --> class [std]PrelBase_Z0T))> [std]'PrelHandle'::'PrelHandle_stdHandleFinalizzer'
ldsfld thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>> [std]'PrelHandle'::'PrelHandle_stderr'
callfunc () (thunk<class [std]PrelIOBase_MVar<class [std]PrelIOBase_Handle__>>) --> (func ( /* unit skipped */ ) --> class [std]PrelBase_Z0T)
callfunc ( /* unit skipped */ ) --> class [std]PrelBase_Z0T
pop
ldstr "LOG: exit main()\n"
......
......@@ -1442,16 +1442,16 @@ nameReference env n
-- end hack
| otherwise = packageReference (modulePackage (nameModule n))
packageReference p = brackets ((text "ilx") <+> singleQuotes (ppr p <> hscOptionQual))
moduleNameReference m = brackets ((text ".module") <+> (text "ilx") <+> singleQuotes (pprModuleName m <> hscOptionQual <> text ".dll"))
packageReference p = brackets (singleQuotes (ppr p <> hscOptionQual))
moduleNameReference m = brackets ((text ".module") <+> (singleQuotes (pprModuleName m <> hscOptionQual <> text ".dll")))
moduleReference env m
| ilxEnvModule env == m = text ""
| isHomeModule m = moduleNameReference (moduleName m)
-- See hack above
-- See hack above
| isVanillaModule m && not inPrelude = preludePackageReference
| isVanillaModule m && inPrelude = moduleNameReference (moduleName m)
-- end hack
-- end hack
| otherwise = packageReference (modulePackage m)
preludePackageReference = packageReference preludePackage
......
......@@ -17,15 +17,11 @@ CORENV_DEBUG=
CORENV_RETAIL=
LOCALRUN=./
ifeq ($(HOSTNAME),MSRC-HILDA)
CORENV_DEBUG="call devcorb2gen.bat fastchecked"
CORENV_DEBUG="call devcorb2gen.bat checked"
CORENV_RETAIL="call devcorb2gen.bat free"
LOCALRUN=.\\
endif
ILX2IL_HOME=C:/devel/fcom/src
ILX2IL=$(ILX2IL_HOME)/bin/ilx2il.opt.exe
ILVALID=$(ILX2IL_HOME)/bin/ilvalid.opt.exe
ghc:
$(MAKE) -C ../..
......
# 1. To make standard library:
#
# e.g. from lib/std directory:
# $(MAKE) way=ilx-Onot-mono std.ilx-Onot.mono.dll std.ilx-Onot.mono.vlb
# $(MAKE) way=ilx-O-mono std.ilx-O.mono.dll std.ilx-O.mono.vlb
# $(MAKE) way=ilx-Onot-generic std.ilx-Onot.generic.dll
#
# 2. To make tests:
#
# e.g. from ilxGen/tests directory:
#
# $ make -n way=ilx-Onot-mono test1.ilx-Onot.mono.retail.run
#
# $ make -n way=ilx-Onot-mono test1-nostdlib.ilx-Onot.mono.retail.run HC_OPTS="-fno-implicit-prelude -fglasgow-exts"
#
# Add all the ILX ways so dependencies get made correctly.
# (n.b. Actually we only need to add "ilx-Onot" and "ilx-O" for the
# GHC --> ILX dependencies, as these are the portions of the ILX
# ways that are relevant in terms of GHC options,
# but we list some of the others anyway. Also note that
# there are no dependencies required for the ILX --> IL or
# IL --> CLR phases as these operate on the "standalone"
# ILX and IL files).
#
GhcLibWays+= ilx-Onot-mono ilx-Onot ilx-O ilx-O-mono
GhcWithIlx=YES
ILXized=YES
# These are common to all the ILX ways
GHC_ILX_OPTS=-filx -fruntime-types -DILX -DNO_BIG_TUPLES
# Each set of args below defines one ILX way.
ALL_WAYS+=ilx-Onot-generic
WAY_ilx-Onot-generic_NAME=ILX with Haskell Optimizer Off to run on Generic CLR
WAY_ilx-Onot-generic_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot
WAY_ilx-Onot-generic_ILX2IL_OPTS=--generic
WAY_ilx-Onot-generic_ILX=YES
ALL_WAYS+=ilx-Onot-fullgeneric-verifiable
WAY_ilx-Onot-fullgeneric-verifiable_NAME=ILX with Haskell Optimizer Off to run on Generic CLR
WAY_ilx-Onot-fullgeneric-verifiable_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot
WAY_ilx-Onot-fullgeneric-verifiable_ILX2IL_OPTS=--fullgeneric --verifiable
WAY_ilx-Onot-fullgeneric-verifiable_ILX=YES
ALL_WAYS+=ilx-Onot-repgeneric-verifiable
WAY_ilx-Onot-repgeneric-verifiable_NAME=ILX with Haskell Optimizer Off to run on Generic CLR
WAY_ilx-Onot-repgeneric-verifiable_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot
WAY_ilx-Onot-repgeneric-verifiable_ILX2IL_OPTS=--repgeneric --verifiable
WAY_ilx-Onot-repgeneric-verifiable_ILX=YES
ALL_WAYS+=ilx-O-generic
WAY_ilx-O-generic_NAME=ILX with Haskell Optimizer On to run on Generic CLR
WAY_ilx-O-generic_HC_OPTS=-buildtag ilx-O $(GHC_ILX_OPTS) -O
WAY_ilx-O-generic_ILX2IL_OPTS=--generic
WAY_ilx-O-generic_ILX=YES
ALL_WAYS+=ilx-Onot-mono
WAY_ilx-Onot-mono_NAME=ILX with Haskell Optimizer Off to run on V1 CLR
WAY_ilx-Onot-mono_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot
WAY_ilx-Onot-mono_ILX2IL_OPTS=--mono
WAY_ilx-Onot-mono_ILX=YES
ALL_WAYS+=ilx-Onot-mono-verifiable
WAY_ilx-Onot-mono-verifiable_NAME=ILX with Haskell Optimizer Off to run on V1 CLR, verifiable code (CURRENTLY WILL NOT RUN BECAUSE OF LACK OF HIGHER KINDED TYPE PARAMETERS BUT IS USEFUL TO FIND BUGS USING THE VERIFIER)
WAY_ilx-Onot-mono-verifiable_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot
WAY_ilx-Onot-mono-verifiable_ILX2IL_OPTS=--mono --verifiable
WAY_ilx-Onot-mono-verifiable_ILX=YES
ALL_WAYS+=ilx-O-mono
WAY_ilx-O-mono_NAME=ILX with Haskell Optimizer On to run on V1 CLR
WAY_ilx-O-mono_HC_OPTS=-buildtag ilx-O $(GHC_ILX_OPTS) -O
WAY_ilx-O-mono_ILX2IL_OPTS=--mono
WAY_ilx-O-mono_ILX=YES
ALL_WAYS+=ilx-Onot-generic-traced
WAY_ilx-Onot-generic-traced_NAME=ILX with Haskell Optimizer Off to run on Generic CLR
WAY_ilx-Onot-generic-traced_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot
WAY_ilx-Onot-generic-traced_ILX2IL_OPTS=--generic --traced
WAY_ilx-Onot-generic-traced_ILX=YES
ALL_WAYS+=ilx-O-generic-traced
WAY_ilx-O-generic-traced_NAME=ILX with Haskell Optimizer On to run on Generic CLR
WAY_ilx-O-generic-traced_HC_OPTS=-buildtag ilx-O $(GHC_ILX_OPTS) -O
WAY_ilx-O-generic-traced_ILX2IL_OPTS=--generic --traced
WAY_ilx-O-generic-traced_ILX=YES
ALL_WAYS+=ilx-Onot-mono-traced
WAY_ilx-Onot-mono-traced_NAME=ILX with Haskell Optimizer Off to run on V1 CLR
WAY_ilx-Onot-mono-traced_HC_OPTS=-buildtag ilx-Onot $(GHC_ILX_OPTS) -Onot
WAY_ilx-Onot-mono-traced_ILX2IL_OPTS=--mono --traced
WAY_ilx-Onot-mono-traced_ILX=YES
ALL_WAYS+=ilx-O-mono-traced
WAY_ilx-O-mono-traced_NAME=ILX with Haskell Optimizer On to run on V1 CLR
WAY_ilx-O-mono-traced_HC_OPTS=-buildtag ilx-O $(GHC_ILX_OPTS) -O
WAY_ilx-O-mono-traced_ILX2IL_OPTS=--mono --traced
WAY_ilx-O-mono-traced_ILX=YES
# Put a "." after the Haskell portion of the way. Way names can't contain
# dots for some reason elsewhere in the Make system. But we need to be able
# to split out the Haskell portion of the way from the ILX portion (e.g. --generic)
# and the runtime portion (e.g. --retail).
ilx_way=$(subst ilx-Onot-,ilx-Onot.,$(subst ilx-O-,ilx-O.,$(way)))
ilx2il_suffix=$(subst ilx-Onot.,.,$(subst ilx-O.,.,$(ilx_way)))
hs2ilx_suffix=$(subst $(ilx2il_suffix),,$(ilx_way))
HS_ILX=$(subst $(way),$(hs2ilx_suffix),$(HS_OBJS))
HS_IL=$(subst $(hs2ilx_suffix)_o,$(ilx_way).il,$(HS_ILX))
HS_MODS=$(subst $(ilx_way).il,$(ilx_way).dll,$(HS_IL))
debug:
@echo ilx_way=$(ilx_way)
@echo ""
@echo HS_OBJS=$(HS_OBJS)
@echo ""
@echo HS_ILX=$(HS_ILX)
@echo ""
@echo HS_IL=$(HS_IL)
@echo ""
@echo HS_MODS=$(HS_MODS)
@echo ""
@echo ilx2il_suffix=$(ilx2il_suffix)
@echo ""
@echo hs2ilx_suffix=$(hs2ilx_suffix)
ILX2IL=//c/devel/fcom/src/bin/ilx2il.exe
ILVALID=//c/devel/fcom/src/bin/ilvalid.exe
ILVERIFY=//c/devel/fcom/src/bin/ilverify.exe
# We have new rules because only the Haskell-->ILX contribution to the whole "way"
# forms the "way" for the purposes of these rules
%.$(hs2ilx_suffix)_o : %.lhs
$(HC_PRE_OPTS)
$(HC) $(HC_OPTS) -osuf $(hs2ilx_suffix)_o -hisuf $(hs2ilx_suffix)_hi -c $< -o $*.$(hs2ilx_suffix)_o
$(HC_POST_OPTS)
%.$(hs2ilx_suffix)_o : %.hs
$(HC_PRE_OPTS)
$(HC) $(HC_OPTS) -osuf $(hs2ilx_suffix)_o -hisuf $(hs2ilx_suffix)_hi -c $< -o $*.$(hs2ilx_suffix)_o
$(HC_POST_OPTS)
%.$(hs2ilx_suffix)_hi : %.$(hs2ilx_suffix)_o
@if [ ! -f $@ ] ; then \
echo Panic! $< exists, but $@ does not. \
exit 1; \
else exit 0 ; \
fi
.PRECIOUS: %.$(hs2ilx_suffix)_o %.$(hs2ilx_suffix)_hi %.$(ilx_way).il %.$(ilx_way).dll
%.$(ilx_way).il : %.$(hs2ilx_suffix)_o %.$(hs2ilx_suffix)_hi $(ILX2IL)
$(ILX2IL) --suffix $(ilx2il_suffix) $(WAY_$(way)_ILX2IL_OPTS) -o $@ $*.$(hs2ilx_suffix)_o
%.$(ilx_way).dll : %.$(ilx_way).il
echo "call devcorb2gen free" > tmp.bat
echo "ilasm /DEBUG /QUIET /DLL /OUT=$@ $<" >> tmp.bat
cmd /c tmp.bat
%.$(ilx_way).mvl : %.$(ilx_way).il $(HS_IL)
((ILVALID_HOME=c:\\devel\\fcom\\src\\ ILVALID_MSCORLIB=mscorlib.vlb $(ILVALID) c:\\devel\\fcom\\src\\bin\\msilxlib$(ilx2il_suffix).vlb $(addprefix --other-il-module ,$(filter-out $*.$(ilx_way).il,$(HS_IL))) $<) 2>&1) | tee $@
%.$(ilx_way).mvr : %.$(ilx_way).il $(HS_IL)
((ILVALID_HOME=c:\\devel\\fcom\\src\\ ILVALID_MSCORLIB=mscorlib.vlb $(ILVERIFY) c:\\devel\\fcom\\src\\bin\\msilxlib$(ilx2il_suffix).vlb $(addprefix --other-il-module ,$(filter-out $<,$(HS_IL))) $<) 2>&1) | tee $@
.PRECIOUS: %.$(ilx_way).il %.$(ilx_way).ilx %.$(ilx_way).exe %.$(ilx_way).dll
module Test1_nostdlib where
foreign import "ilxHello" unsafe ilxHello :: ()
ilx_main_no_stdlib = ilxHello
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment