Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
18
Issues
18
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
clean-compiler-and-rts
compiler
Commits
37aeaea7
Commit
37aeaea7
authored
Nov 13, 2019
by
johnvg@science.ru.nl
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into itask
parents
46fa16ce
ae841619
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
107 deletions
+29
-107
backendC/CleanCompilerSources/checksupport.c
backendC/CleanCompilerSources/checksupport.c
+13
-52
backendC/CleanCompilerSources/optimisations.c
backendC/CleanCompilerSources/optimisations.c
+16
-55
No files found.
backendC/CleanCompilerSources/checksupport.c
View file @
37aeaea7
...
...
@@ -49,8 +49,6 @@ static int string_and_string_begin_equal (char *s1,char *s2_begin,char *s2_passe
return
0
;
}
#ifdef CLEAN2
static
char
*
print_compiler_generated_function_name
(
char
*
name
,
char
*
name_end
,
unsigned
line_nr
,
File
file
)
{
char
*
parsed_digits
;
...
...
@@ -87,24 +85,19 @@ static char *print_compiler_generated_function_name (char *name, char *name_end,
return
name_end
+
strlen
(
name_end
);
}
#endif
static
char
*
PrintName
(
char
*
name
,
char
*
name_end
,
unsigned
line_nr
,
File
file
)
{
#ifdef CLEAN2
if
(
*
name
==
'\\'
&&
name
+
1
==
name_end
)
return
print_compiler_generated_function_name
(
"<lambda>"
,
name_end
,
line_nr
,
file
);
#endif
if
(
*
name
==
'_'
){
char
*
name_tail
;
#ifdef CLEAN2
if
(
string_and_string_begin_equal
(
"c"
,
name
+
1
,
name_end
))
return
print_compiler_generated_function_name
(
"<case>"
,
name_end
,
line_nr
,
file
);
else
if
(
string_and_string_begin_equal
(
"if"
,
name
+
1
,
name_end
))
return
print_compiler_generated_function_name
(
"<if>"
,
name_end
,
line_nr
,
file
);
#endif
for
(
name_tail
=
name
+
1
;
name_tail
!=
name_end
;
name_tail
++
)
if
(
isdigit
(
*
name_tail
))
...
...
@@ -127,76 +120,44 @@ static char *PrintName (char *name, char *name_end, unsigned line_nr, File file)
FPrintF
(
file
,
" [line: %u]"
,
line_nr
);
return
name_end
;
}
else
{
for
(;
name
!=
name_end
;
name
++
){
if
(
*
name
!=
'.'
){
/* if (*name == ':')
FPutC (' ', file);
else
*/
FPutC
(
*
name
,
file
);
}
}
for
(;
name
!=
name_end
;
name
++
)
FPutC
(
*
name
,
file
);
return
name_end
;
}
}
#define _ANALYSE_IDENT_
/* also in optimisations.c */
void
PrintSymbolOfIdent
(
char
*
name
,
unsigned
line_nr
,
File
file
)
{
char
*
next_char
;
#ifdef _ANALYSE_IDENT_
if
(
*
name
==
cTypeDelimiter
)
{
for
(
next_char
=
name
+
1
;
*
next_char
==
cTypeDelimiter
;
next_char
++
)
for
(
next_char
=
name
;
*
next_char
!=
';'
&&
*
next_char
!=
'\0'
;
++
next_char
)
;
if
(
*
next_char
==
'\0'
)
{
FPutS
(
name
,
file
);
return
;
}
else
next_char
--
;
}
else
{
for
(
next_char
=
name
;
*
next_char
!=
cTypeDelimiter
&&
*
next_char
!=
'\0'
;
next_char
++
)
if
(
*
next_char
==
'.'
)
{
next_char
++
;
if
(
*
next_char
==
'\0'
)
break
;
}
}
next_char
=
PrintName
(
name
,
next_char
,
line_nr
,
file
);
if
(
(
*
next_char
)
==
cTypeDelimiter
)
{
next_char
++
;
if
(
*
next_char
==
';'
){
++
next_char
;
if
(
isdigit
(
*
next_char
))
{
char
*
end_name
;
if
(
isdigit
(
*
next_char
)){
char
*
end_name
;
for
(
end_name
=
next_char
+
1
;
*
end_name
!=
cTypeDelimiter
&&
*
end_name
!=
'\0'
;
end_name
++
)
for
(
end_name
=
next_char
+
1
;
*
end_name
!=
';'
&&
*
end_name
!=
'\0'
;
end_name
++
)
;
if
(
line_nr
>
0
){
FPrintF
(
file
,
" [line: %u]"
,
line_nr
);
}
else
{
FPutC
(
cTypeDelimiter
,
file
);
FPutC
(
';'
,
file
);
PrintName
(
next_char
,
end_name
,
line_nr
,
file
);
}
if
(
*
end_name
==
'\0'
)
return
;
# ifdef CLEAN2
next_char
=
end_name
;
# else
next_char
=
end_name
+
1
;
# endif
}
else
FPutC
(
cTypeDelimiter
,
file
);
FPutC
(
';'
,
file
);
FPutS
(
next_char
,
file
);
}
#else
FPutS
(
name
,
file
);
#endif
}
backendC/CleanCompilerSources/optimisations.c
View file @
37aeaea7
...
...
@@ -1035,45 +1035,6 @@ static void init_apply_symb_function_state_p()
}
#endif
#define cTypeDelimiter ';'
/* also in checksupport.h */
#ifndef CLEAN2
#define _ANALYSE_IDENT_
/* also in checksupport.c */
#endif
static
int
compute_length_before_type_delimiter
(
char
*
fname
)
{
char
*
p
;
unsigned
int
c
;
p
=
fname
;
#ifdef _ANALYSE_IDENT_
--
p
;
do
{
c
=*++
p
;
}
while
(
c
!=
cTypeDelimiter
&&
c
!=
'\0'
);
if
(
c
==
cTypeDelimiter
&&
*
(
p
+
1
)
!=
'\0'
)
{
p
++
;
if
(
isdigit
(
*
p
))
{
for
(
p
=
p
+
1
;
*
p
!=
cTypeDelimiter
&&
*
p
!=
'\0'
;
p
++
)
;
}
}
#else
/* ifndef _ANALYSE_IDENT_ */
--
p
;
do
{
c
=*++
p
;
}
while
(
c
!=
'\0'
);
#endif
/* _ANALYSE_IDENT_ */
return
p
-
fname
;
}
static
char
*
append_n_chars
(
char
*
dest
,
const
char
*
src
,
int
length
)
{
while
(
length
>
0
){
...
...
@@ -1208,15 +1169,15 @@ static char *create_arguments_for_local_function (NodeP node_p,ArgS ***arg_h,Arg
ArgP
arg
;
if
(
function_name_p
!=
NULL
&&
node_p
->
node_symbol
->
symb_kind
==
definition
){
int
length
_before_type_delimiter
;
int
length
;
char
*
f_name
;
f_name
=
node_p
->
node_symbol
->
symb_def
->
sdef_name
;
length
_before_type_delimiter
=
compute_length_before_type_delimiter
(
f_name
);
length
=
strlen
(
f_name
);
if
(
function_name_p
+
2
+
length
_before_type_delimiter
<
end_function_name
){
if
(
function_name_p
+
2
+
length
<
end_function_name
){
*
function_name_p
++=
'.'
;
function_name_p
=
append_n_chars
(
function_name_p
,
f_name
,
length
_before_type_delimiter
);
function_name_p
=
append_n_chars
(
function_name_p
,
f_name
,
length
);
}
else
end_function_name
=
function_name_p
;
}
...
...
@@ -1660,15 +1621,15 @@ static char *create_arguments_for_partially_applied_local_function (NodeP node_p
int
arg_n
;
if
(
function_name_p
!=
NULL
&&
node_p
->
node_symbol
->
symb_kind
==
definition
){
int
length
_before_type_delimiter
;
int
length
;
char
*
f_name
;
f_name
=
node_p
->
node_symbol
->
symb_def
->
sdef_name
;
length
_before_type_delimiter
=
compute_length_before_type_delimiter
(
f_name
);
length
=
strlen
(
f_name
);
if
(
function_name_p
+
2
+
length
_before_type_delimiter
<
end_function_name
){
if
(
function_name_p
+
2
+
length
<
end_function_name
){
*
function_name_p
++=
'.'
;
function_name_p
=
append_n_chars
(
function_name_p
,
f_name
,
length
_before_type_delimiter
);
function_name_p
=
append_n_chars
(
function_name_p
,
f_name
,
length
);
}
else
end_function_name
=
function_name_p
;
}
...
...
@@ -1740,17 +1701,17 @@ static ImpRuleP create_new_partially_applied_local_function (Node node,int old_f
if
(
DoTimeProfiling
||
DoProfiling
){
char
*
f_name
;
int
length
_before_type_delimiter
;
int
length
;
end_function_name
=
function_name
+
sizeof
(
function_name
);
function_name_p
=&
function_name
[
strlen
(
function_name
)];
f_name
=
CurrentSymbol
->
symb_def
->
sdef_name
;
length
_before_type_delimiter
=
compute_length_before_type_delimiter
(
f_name
);
length
=
strlen
(
f_name
);
if
(
function_name_p
+
2
+
length
_before_type_delimiter
<
end_function_name
){
if
(
function_name_p
+
2
+
length
<
end_function_name
){
*
function_name_p
++=
'.'
;
function_name_p
=
append_n_chars
(
function_name_p
,
f_name
,
length
_before_type_delimiter
);
function_name_p
=
append_n_chars
(
function_name_p
,
f_name
,
length
);
}
else
end_function_name
=
function_name_p
;
}
else
{
...
...
@@ -1939,17 +1900,17 @@ static struct node *create_new_local_function (Node node,StateP function_state_p
if
(
DoTimeProfiling
||
DoProfiling
){
char
*
f_name
;
int
length
_before_type_delimiter
;
int
length
;
end_function_name
=
function_name
+
sizeof
(
function_name
);
function_name_p
=&
function_name
[
strlen
(
function_name
)];
f_name
=
CurrentSymbol
->
symb_def
->
sdef_name
;
length
_before_type_delimiter
=
compute_length_before_type_delimiter
(
f_name
);
length
=
strlen
(
f_name
);
if
(
function_name_p
+
2
+
length
_before_type_delimiter
<
end_function_name
){
if
(
function_name_p
+
2
+
length
<
end_function_name
){
*
function_name_p
++=
'.'
;
function_name_p
=
append_n_chars
(
function_name_p
,
f_name
,
length
_before_type_delimiter
);
function_name_p
=
append_n_chars
(
function_name_p
,
f_name
,
length
);
}
else
end_function_name
=
function_name_p
;
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment