aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorjohnvg2011-03-31 15:26:26 +0000
committerjohnvg2011-03-31 15:26:26 +0000
commitad561c6f2055303bc355cc5e84dbf1e8b614f30e (patch)
treed51044322863053a4d19397bc8e4dfd6b871f5e3 /backend
parentmake the following identical local functions of functions analyseGroups and r... (diff)
use type Component instead of Group in the fusion modules: partition, classify and trans,
because function pointers for generated functions are stored in the Component, they can be found without searching the new functions list git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1895 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backend')
-rw-r--r--backend/backendconvert.icl19
-rw-r--r--backend/backendinterface.icl33
2 files changed, 45 insertions, 7 deletions
diff --git a/backend/backendconvert.icl b/backend/backendconvert.icl
index 357209f..52f2c77 100644
--- a/backend/backendconvert.icl
+++ b/backend/backendconvert.icl
@@ -6,11 +6,10 @@ implementation module backendconvert
import code from library "backend_library"
import StdEnv
-// import StdDebug
-
import frontend
import backend
import backendsupport, backendpreprocess
+import partition
// trace macro
(-*->) infixl
@@ -489,7 +488,21 @@ backEndConvertModulesH predefs {fe_icl =
= (backEnd -*-> "backend done")
where
functionIndices
- = flatten [[(componentIndex, member) \\ member <- group.group_members] \\ group <-: fe_components & componentIndex <- [1..]]
+ = function_indices 0 fe_components
+
+ function_indices i components
+ | i<size components
+ = function_indices2 components.[i].component_members i components
+ = []
+
+ function_indices2 (ComponentMember member members) i components
+ #! inc_i = i+1
+ = [(inc_i,member) : function_indices2 members i components]
+ function_indices2 (GeneratedComponentMember member _ members) i components
+ #! inc_i = i+1
+ = [(inc_i,member) : function_indices2 members i components]
+ function_indices2 NoComponentMembers i components
+ = function_indices (i+1) components
declareOtherDclModules :: {#DclModule} Int NumberSet -> BackEnder
declareOtherDclModules dcls main_dcl_module_n used_module_numbers
diff --git a/backend/backendinterface.icl b/backend/backendinterface.icl
index aa7bc00..41c0b1c 100644
--- a/backend/backendinterface.icl
+++ b/backend/backendinterface.icl
@@ -9,6 +9,7 @@ import frontend
import backend
import backendpreprocess, backendsupport, backendconvert
import Version
+import partition
checkVersion :: VersionsCompatability *File -> (!Bool, !*File)
checkVersion VersionsAreCompatible errorFile
@@ -49,7 +50,19 @@ backEndInterface outputFileName commandLineArgs listTypes typesPath predef_symbo
# varHeap
= backEndPreprocess predefined_idents.[PD_DummyForStrictAliasFun] functionIndices fe_icl var_heap
with
- functionIndices = flatten [group.group_members \\ group <-: fe_components]
+ functionIndices = function_indices 0 fe_components
+
+ function_indices i components
+ | i<size components
+ = function_indices2 components.[i].component_members i components
+ = []
+
+ function_indices2 (ComponentMember member members) i components
+ = [member : function_indices2 members i components]
+ function_indices2 (GeneratedComponentMember member _ members) i components
+ = [member : function_indices2 members i components]
+ function_indices2 NoComponentMembers i components
+ = function_indices (i+1) components
# backEndFiles
= 0
# (backEnd, backEndFiles)
@@ -80,18 +93,30 @@ DictionaryToClassInfo iclModuleIndex iclModule dclModules :==
, dtci_dclModules = dclModules
}
-optionallyPrintFunctionTypes :: ListTypesOption {#Char} DictionaryToClassInfo {!Group} {#FunDef} *AttrVarHeap *File !*BackEnd -> (*AttrVarHeap, *File, *BackEnd)
+optionallyPrintFunctionTypes :: ListTypesOption {#Char} DictionaryToClassInfo {!Component} {#FunDef} *AttrVarHeap *File !*BackEnd -> (*AttrVarHeap, *File, *BackEnd)
optionallyPrintFunctionTypes {lto_listTypesKind, lto_showAttributes} typesPath info components functions attrHeap outFile backEnd
| lto_listTypesKind == ListTypesStrictExports || lto_listTypesKind == ListTypesAll
= printFunctionTypes (lto_listTypesKind == ListTypesAll) lto_showAttributes info components functions attrHeap outFile backEnd
= (attrHeap, outFile, backEnd)
-printFunctionTypes :: Bool Bool DictionaryToClassInfo {!Group} {#FunDef} *AttrVarHeap *File *BackEnd -> (*AttrVarHeap, *File, *BackEnd)
+printFunctionTypes :: Bool Bool DictionaryToClassInfo {!Component} {#FunDef} *AttrVarHeap *File *BackEnd -> (*AttrVarHeap, *File, *BackEnd)
printFunctionTypes all attr info components functions attrHeap file backEnd
= foldSt (printFunctionType all attr info) functionIndicesAndFunctions (attrHeap, file, backEnd)
where
functionIndicesAndFunctions
- = [(member,functions.[member]) \\ group <-: components, member <- group.group_members]
+ = function_indices_and_functions 0 components
+
+ function_indices_and_functions i components
+ | i<size components
+ = function_indices_and_functions2 components.[i].component_members i components
+ = []
+
+ function_indices_and_functions2 (ComponentMember member members) i components
+ = [(member,functions.[member]) : function_indices_and_functions2 members i components]
+ function_indices_and_functions2 (GeneratedComponentMember member _ members) i components
+ = [(member,functions.[member]) : function_indices_and_functions2 members i components]
+ function_indices_and_functions2 NoComponentMembers i components
+ = function_indices_and_functions (i+1) components
printFunctionType :: Bool Bool DictionaryToClassInfo (Int, FunDef) (*AttrVarHeap, *File, *BackEnd) -> (*AttrVarHeap, *File, *BackEnd)
printFunctionType all attr info (functionIndex, {fun_ident,fun_type=Yes type}) (attrHeap, file, backEnd)