@@ -11,7 +11,8 @@ use super::intrinsic_helpers::IntrinsicTypeDefinition;
11
11
// The number of times each intrinsic will be called.
12
12
const PASSES : u32 = 20 ;
13
13
14
- pub fn generate_c_program (
14
+ // Formats the main C program template with placeholders
15
+ pub fn format_c_main_template (
15
16
notices : & str ,
16
17
header_files : & [ & str ] ,
17
18
arch_identifier : & str ,
@@ -61,7 +62,7 @@ int main(int argc, char **argv) {{
61
62
)
62
63
}
63
64
64
- pub fn compile_c ( compiler_commands : & [ String ] ) -> bool {
65
+ pub fn compile_c_programs ( compiler_commands : & [ String ] ) -> bool {
65
66
compiler_commands
66
67
. par_iter ( )
67
68
. map ( |compiler_command| {
@@ -86,7 +87,8 @@ pub fn compile_c(compiler_commands: &[String]) -> bool {
86
87
. is_none ( )
87
88
}
88
89
89
- pub fn create_c_filenames ( identifiers : & Vec < String > ) -> BTreeMap < & String , String > {
90
+ // Creates directory structure and file path mappings
91
+ pub fn setup_c_file_paths ( identifiers : & Vec < String > ) -> BTreeMap < & String , String > {
90
92
let _ = std:: fs:: create_dir ( "c_programs" ) ;
91
93
identifiers
92
94
. par_iter ( )
@@ -98,7 +100,7 @@ pub fn create_c_filenames(identifiers: &Vec<String>) -> BTreeMap<&String, String
98
100
. collect :: < BTreeMap < & String , String > > ( )
99
101
}
100
102
101
- pub fn generate_loop_c < T : IntrinsicTypeDefinition + Sized > (
103
+ pub fn generate_c_test_loop < T : IntrinsicTypeDefinition + Sized > (
102
104
intrinsic : & dyn IntrinsicDefinition < T > ,
103
105
indentation : Indentation ,
104
106
additional : & str ,
@@ -119,7 +121,7 @@ pub fn generate_loop_c<T: IntrinsicTypeDefinition + Sized>(
119
121
)
120
122
}
121
123
122
- pub fn gen_code_c < T : IntrinsicTypeDefinition > (
124
+ pub fn generate_c_constraint_blocks < T : IntrinsicTypeDefinition > (
123
125
intrinsic : & dyn IntrinsicDefinition < T > ,
124
126
indentation : Indentation ,
125
127
constraints : & [ & Argument < T > ] ,
@@ -144,7 +146,7 @@ pub fn gen_code_c<T: IntrinsicTypeDefinition>(
144
146
name = current. name,
145
147
ty = current. ty. c_type( ) ,
146
148
val = i,
147
- pass = gen_code_c (
149
+ pass = generate_c_constraint_blocks (
148
150
intrinsic,
149
151
body_indentation,
150
152
constraints,
@@ -155,11 +157,12 @@ pub fn gen_code_c<T: IntrinsicTypeDefinition>(
155
157
} )
156
158
. join ( "\n " )
157
159
} else {
158
- generate_loop_c ( intrinsic, indentation, & name, PASSES , target)
160
+ generate_c_test_loop ( intrinsic, indentation, & name, PASSES , target)
159
161
}
160
162
}
161
163
162
- pub fn gen_c_program < T : IntrinsicTypeDefinition > (
164
+ // Compiles C test programs using specified compiler
165
+ pub fn create_c_test_program < T : IntrinsicTypeDefinition > (
163
166
intrinsic : & dyn IntrinsicDefinition < T > ,
164
167
header_files : & [ & str ] ,
165
168
target : & str ,
@@ -174,7 +177,7 @@ pub fn gen_c_program<T: IntrinsicTypeDefinition>(
174
177
. collect_vec ( ) ;
175
178
176
179
let indentation = Indentation :: default ( ) ;
177
- generate_c_program (
180
+ format_c_main_template (
178
181
notices,
179
182
header_files,
180
183
c_target,
@@ -183,7 +186,7 @@ pub fn gen_c_program<T: IntrinsicTypeDefinition>(
183
186
. arguments ( )
184
187
. gen_arglists_c ( indentation, PASSES )
185
188
. as_str ( ) ,
186
- gen_code_c (
189
+ generate_c_constraint_blocks (
187
190
intrinsic,
188
191
indentation. nested ( ) ,
189
192
constraints. as_slice ( ) ,
0 commit comments