@@ -11,7 +11,8 @@ use super::intrinsic_helpers::IntrinsicTypeDefinition;
1111// The number of times each intrinsic will be called.
1212const PASSES : u32 = 20 ;
1313
14- pub fn generate_c_program (
14+ // Formats the main C program template with placeholders
15+ pub fn format_c_main_template (
1516 notices : & str ,
1617 header_files : & [ & str ] ,
1718 arch_identifier : & str ,
@@ -61,7 +62,7 @@ int main(int argc, char **argv) {{
6162 )
6263}
6364
64- pub fn compile_c ( compiler_commands : & [ String ] ) -> bool {
65+ pub fn compile_c_programs ( compiler_commands : & [ String ] ) -> bool {
6566 compiler_commands
6667 . par_iter ( )
6768 . map ( |compiler_command| {
@@ -86,7 +87,8 @@ pub fn compile_c(compiler_commands: &[String]) -> bool {
8687 . is_none ( )
8788}
8889
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 > {
9092 let _ = std:: fs:: create_dir ( "c_programs" ) ;
9193 identifiers
9294 . par_iter ( )
@@ -98,7 +100,7 @@ pub fn create_c_filenames(identifiers: &Vec<String>) -> BTreeMap<&String, String
98100 . collect :: < BTreeMap < & String , String > > ( )
99101}
100102
101- pub fn generate_loop_c < T : IntrinsicTypeDefinition + Sized > (
103+ pub fn generate_c_test_loop < T : IntrinsicTypeDefinition + Sized > (
102104 intrinsic : & dyn IntrinsicDefinition < T > ,
103105 indentation : Indentation ,
104106 additional : & str ,
@@ -119,7 +121,7 @@ pub fn generate_loop_c<T: IntrinsicTypeDefinition + Sized>(
119121 )
120122}
121123
122- pub fn gen_code_c < T : IntrinsicTypeDefinition > (
124+ pub fn generate_c_constraint_blocks < T : IntrinsicTypeDefinition > (
123125 intrinsic : & dyn IntrinsicDefinition < T > ,
124126 indentation : Indentation ,
125127 constraints : & [ & Argument < T > ] ,
@@ -144,7 +146,7 @@ pub fn gen_code_c<T: IntrinsicTypeDefinition>(
144146 name = current. name,
145147 ty = current. ty. c_type( ) ,
146148 val = i,
147- pass = gen_code_c (
149+ pass = generate_c_constraint_blocks (
148150 intrinsic,
149151 body_indentation,
150152 constraints,
@@ -155,11 +157,12 @@ pub fn gen_code_c<T: IntrinsicTypeDefinition>(
155157 } )
156158 . join ( "\n " )
157159 } else {
158- generate_loop_c ( intrinsic, indentation, & name, PASSES , target)
160+ generate_c_test_loop ( intrinsic, indentation, & name, PASSES , target)
159161 }
160162}
161163
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 > (
163166 intrinsic : & dyn IntrinsicDefinition < T > ,
164167 header_files : & [ & str ] ,
165168 target : & str ,
@@ -174,7 +177,7 @@ pub fn gen_c_program<T: IntrinsicTypeDefinition>(
174177 . collect_vec ( ) ;
175178
176179 let indentation = Indentation :: default ( ) ;
177- generate_c_program (
180+ format_c_main_template (
178181 notices,
179182 header_files,
180183 c_target,
@@ -183,7 +186,7 @@ pub fn gen_c_program<T: IntrinsicTypeDefinition>(
183186 . arguments ( )
184187 . gen_arglists_c ( indentation, PASSES )
185188 . as_str ( ) ,
186- gen_code_c (
189+ generate_c_constraint_blocks (
187190 intrinsic,
188191 indentation. nested ( ) ,
189192 constraints. as_slice ( ) ,
0 commit comments