69 #include "config_CLANG_PLUGIN_DIR.hpp" 70 #include "config_EXTRA_CLANGPP_COMPILER_OPTION.hpp" 71 #include "config_GCC_PLUGIN_DIR.hpp" 72 #include "config_HAVE_I386_CLANG10_COMPILER.hpp" 73 #include "config_HAVE_I386_CLANG10_M32.hpp" 74 #include "config_HAVE_I386_CLANG10_M64.hpp" 75 #include "config_HAVE_I386_CLANG10_MX32.hpp" 76 #include "config_HAVE_I386_CLANG11_COMPILER.hpp" 77 #include "config_HAVE_I386_CLANG11_M32.hpp" 78 #include "config_HAVE_I386_CLANG11_M64.hpp" 79 #include "config_HAVE_I386_CLANG11_MX32.hpp" 80 #include "config_HAVE_I386_CLANG12_COMPILER.hpp" 81 #include "config_HAVE_I386_CLANG12_M32.hpp" 82 #include "config_HAVE_I386_CLANG12_M64.hpp" 83 #include "config_HAVE_I386_CLANG12_MX32.hpp" 84 #include "config_HAVE_I386_CLANG13_COMPILER.hpp" 85 #include "config_HAVE_I386_CLANG13_M32.hpp" 86 #include "config_HAVE_I386_CLANG13_M64.hpp" 87 #include "config_HAVE_I386_CLANG13_MX32.hpp" 88 #include "config_HAVE_I386_CLANG16_COMPILER.hpp" 89 #include "config_HAVE_I386_CLANG16_M32.hpp" 90 #include "config_HAVE_I386_CLANG16_M64.hpp" 91 #include "config_HAVE_I386_CLANG16_MX32.hpp" 92 #include "config_HAVE_I386_CLANG4_COMPILER.hpp" 93 #include "config_HAVE_I386_CLANG4_M32.hpp" 94 #include "config_HAVE_I386_CLANG4_M64.hpp" 95 #include "config_HAVE_I386_CLANG4_MX32.hpp" 96 #include "config_HAVE_I386_CLANG5_COMPILER.hpp" 97 #include "config_HAVE_I386_CLANG5_M32.hpp" 98 #include "config_HAVE_I386_CLANG5_M64.hpp" 99 #include "config_HAVE_I386_CLANG5_MX32.hpp" 100 #include "config_HAVE_I386_CLANG6_COMPILER.hpp" 101 #include "config_HAVE_I386_CLANG6_M32.hpp" 102 #include "config_HAVE_I386_CLANG6_M64.hpp" 103 #include "config_HAVE_I386_CLANG6_MX32.hpp" 104 #include "config_HAVE_I386_CLANG7_COMPILER.hpp" 105 #include "config_HAVE_I386_CLANG7_M32.hpp" 106 #include "config_HAVE_I386_CLANG7_M64.hpp" 107 #include "config_HAVE_I386_CLANG7_MX32.hpp" 108 #include "config_HAVE_I386_CLANG8_COMPILER.hpp" 109 #include "config_HAVE_I386_CLANG8_M32.hpp" 110 #include "config_HAVE_I386_CLANG8_M64.hpp" 111 #include "config_HAVE_I386_CLANG8_MX32.hpp" 112 #include "config_HAVE_I386_CLANG9_COMPILER.hpp" 113 #include "config_HAVE_I386_CLANG9_M32.hpp" 114 #include "config_HAVE_I386_CLANG9_M64.hpp" 115 #include "config_HAVE_I386_CLANG9_MX32.hpp" 116 #include "config_HAVE_I386_CLANGVVD_COMPILER.hpp" 117 #include "config_HAVE_I386_CLANGVVD_M32.hpp" 118 #include "config_HAVE_I386_CLANGVVD_M64.hpp" 119 #include "config_HAVE_I386_CLANGVVD_MX32.hpp" 120 #include "config_HAVE_I386_GCC49_COMPILER.hpp" 121 #include "config_HAVE_I386_GCC49_M32.hpp" 122 #include "config_HAVE_I386_GCC49_M64.hpp" 123 #include "config_HAVE_I386_GCC49_MX32.hpp" 124 #include "config_HAVE_I386_GCC5_COMPILER.hpp" 125 #include "config_HAVE_I386_GCC5_M32.hpp" 126 #include "config_HAVE_I386_GCC5_M64.hpp" 127 #include "config_HAVE_I386_GCC5_MX32.hpp" 128 #include "config_HAVE_I386_GCC6_COMPILER.hpp" 129 #include "config_HAVE_I386_GCC6_M32.hpp" 130 #include "config_HAVE_I386_GCC6_M64.hpp" 131 #include "config_HAVE_I386_GCC6_MX32.hpp" 132 #include "config_HAVE_I386_GCC7_COMPILER.hpp" 133 #include "config_HAVE_I386_GCC7_M32.hpp" 134 #include "config_HAVE_I386_GCC7_M64.hpp" 135 #include "config_HAVE_I386_GCC7_MX32.hpp" 136 #include "config_HAVE_I386_GCC8_COMPILER.hpp" 137 #include "config_HAVE_I386_GCC8_M32.hpp" 138 #include "config_HAVE_I386_GCC8_M64.hpp" 139 #include "config_HAVE_I386_GCC8_MX32.hpp" 140 #include "config_I386_CLANG10_ASTANALYZER_PLUGIN.hpp" 141 #include "config_I386_CLANG10_CSROA_PLUGIN.hpp" 142 #include "config_I386_CLANG10_EMPTY_PLUGIN.hpp" 143 #include "config_I386_CLANG10_EXE.hpp" 144 #include "config_I386_CLANG10_EXPANDMEMOPS_PLUGIN.hpp" 145 #include "config_I386_CLANG10_GEPICANON_PLUGIN.hpp" 146 #include "config_I386_CLANG10_SSA_PLUGIN.hpp" 147 #include "config_I386_CLANG10_SSA_PLUGINCPP.hpp" 148 #include "config_I386_CLANG10_TOPFNAME_PLUGIN.hpp" 149 #include "config_I386_CLANG10_VERSION.hpp" 150 #include "config_I386_CLANG11_ASTANALYZER_PLUGIN.hpp" 151 #include "config_I386_CLANG11_CSROA_PLUGIN.hpp" 152 #include "config_I386_CLANG11_EMPTY_PLUGIN.hpp" 153 #include "config_I386_CLANG11_EXE.hpp" 154 #include "config_I386_CLANG11_EXPANDMEMOPS_PLUGIN.hpp" 155 #include "config_I386_CLANG11_GEPICANON_PLUGIN.hpp" 156 #include "config_I386_CLANG11_SSA_PLUGIN.hpp" 157 #include "config_I386_CLANG11_SSA_PLUGINCPP.hpp" 158 #include "config_I386_CLANG11_TOPFNAME_PLUGIN.hpp" 159 #include "config_I386_CLANG11_VERSION.hpp" 160 #include "config_I386_CLANG12_ASTANALYZER_PLUGIN.hpp" 161 #include "config_I386_CLANG12_CSROA_PLUGIN.hpp" 162 #include "config_I386_CLANG12_EMPTY_PLUGIN.hpp" 163 #include "config_I386_CLANG12_EXE.hpp" 164 #include "config_I386_CLANG12_EXPANDMEMOPS_PLUGIN.hpp" 165 #include "config_I386_CLANG12_GEPICANON_PLUGIN.hpp" 166 #include "config_I386_CLANG12_SSA_PLUGIN.hpp" 167 #include "config_I386_CLANG12_SSA_PLUGINCPP.hpp" 168 #include "config_I386_CLANG12_TOPFNAME_PLUGIN.hpp" 169 #include "config_I386_CLANG12_VERSION.hpp" 170 #include "config_I386_CLANG13_ASTANALYZER_PLUGIN.hpp" 171 #include "config_I386_CLANG13_CSROA_PLUGIN.hpp" 172 #include "config_I386_CLANG13_EMPTY_PLUGIN.hpp" 173 #include "config_I386_CLANG13_EXE.hpp" 174 #include "config_I386_CLANG13_EXPANDMEMOPS_PLUGIN.hpp" 175 #include "config_I386_CLANG13_GEPICANON_PLUGIN.hpp" 176 #include "config_I386_CLANG13_SSA_PLUGIN.hpp" 177 #include "config_I386_CLANG13_SSA_PLUGINCPP.hpp" 178 #include "config_I386_CLANG13_TOPFNAME_PLUGIN.hpp" 179 #include "config_I386_CLANG13_VERSION.hpp" 180 #include "config_I386_CLANG16_ASTANALYZER_PLUGIN.hpp" 181 #include "config_I386_CLANG16_CSROA_PLUGIN.hpp" 182 #include "config_I386_CLANG16_EMPTY_PLUGIN.hpp" 183 #include "config_I386_CLANG16_EXE.hpp" 184 #include "config_I386_CLANG16_EXPANDMEMOPS_PLUGIN.hpp" 185 #include "config_I386_CLANG16_GEPICANON_PLUGIN.hpp" 186 #include "config_I386_CLANG16_SSA_PLUGIN.hpp" 187 #include "config_I386_CLANG16_SSA_PLUGINCPP.hpp" 188 #include "config_I386_CLANG16_TOPFNAME_PLUGIN.hpp" 189 #include "config_I386_CLANG16_VERSION.hpp" 190 #include "config_I386_CLANG4_ASTANALYZER_PLUGIN.hpp" 191 #include "config_I386_CLANG4_CSROA_PLUGIN.hpp" 192 #include "config_I386_CLANG4_EMPTY_PLUGIN.hpp" 193 #include "config_I386_CLANG4_EXE.hpp" 194 #include "config_I386_CLANG4_EXPANDMEMOPS_PLUGIN.hpp" 195 #include "config_I386_CLANG4_GEPICANON_PLUGIN.hpp" 196 #include "config_I386_CLANG4_SSA_PLUGIN.hpp" 197 #include "config_I386_CLANG4_SSA_PLUGINCPP.hpp" 198 #include "config_I386_CLANG4_TOPFNAME_PLUGIN.hpp" 199 #include "config_I386_CLANG4_VERSION.hpp" 200 #include "config_I386_CLANG5_ASTANALYZER_PLUGIN.hpp" 201 #include "config_I386_CLANG5_CSROA_PLUGIN.hpp" 202 #include "config_I386_CLANG5_EMPTY_PLUGIN.hpp" 203 #include "config_I386_CLANG5_EXE.hpp" 204 #include "config_I386_CLANG5_EXPANDMEMOPS_PLUGIN.hpp" 205 #include "config_I386_CLANG5_GEPICANON_PLUGIN.hpp" 206 #include "config_I386_CLANG5_SSA_PLUGIN.hpp" 207 #include "config_I386_CLANG5_SSA_PLUGINCPP.hpp" 208 #include "config_I386_CLANG5_TOPFNAME_PLUGIN.hpp" 209 #include "config_I386_CLANG5_VERSION.hpp" 210 #include "config_I386_CLANG6_ASTANALYZER_PLUGIN.hpp" 211 #include "config_I386_CLANG6_CSROA_PLUGIN.hpp" 212 #include "config_I386_CLANG6_EMPTY_PLUGIN.hpp" 213 #include "config_I386_CLANG6_EXE.hpp" 214 #include "config_I386_CLANG6_EXPANDMEMOPS_PLUGIN.hpp" 215 #include "config_I386_CLANG6_GEPICANON_PLUGIN.hpp" 216 #include "config_I386_CLANG6_SSA_PLUGIN.hpp" 217 #include "config_I386_CLANG6_SSA_PLUGINCPP.hpp" 218 #include "config_I386_CLANG6_TOPFNAME_PLUGIN.hpp" 219 #include "config_I386_CLANG6_VERSION.hpp" 220 #include "config_I386_CLANG7_ASTANALYZER_PLUGIN.hpp" 221 #include "config_I386_CLANG7_CSROA_PLUGIN.hpp" 222 #include "config_I386_CLANG7_EMPTY_PLUGIN.hpp" 223 #include "config_I386_CLANG7_EXE.hpp" 224 #include "config_I386_CLANG7_EXPANDMEMOPS_PLUGIN.hpp" 225 #include "config_I386_CLANG7_GEPICANON_PLUGIN.hpp" 226 #include "config_I386_CLANG7_SSA_PLUGIN.hpp" 227 #include "config_I386_CLANG7_SSA_PLUGINCPP.hpp" 228 #include "config_I386_CLANG7_TOPFNAME_PLUGIN.hpp" 229 #include "config_I386_CLANG7_VERSION.hpp" 230 #include "config_I386_CLANG8_ASTANALYZER_PLUGIN.hpp" 231 #include "config_I386_CLANG8_CSROA_PLUGIN.hpp" 232 #include "config_I386_CLANG8_EMPTY_PLUGIN.hpp" 233 #include "config_I386_CLANG8_EXE.hpp" 234 #include "config_I386_CLANG8_EXPANDMEMOPS_PLUGIN.hpp" 235 #include "config_I386_CLANG8_GEPICANON_PLUGIN.hpp" 236 #include "config_I386_CLANG8_SSA_PLUGIN.hpp" 237 #include "config_I386_CLANG8_SSA_PLUGINCPP.hpp" 238 #include "config_I386_CLANG8_TOPFNAME_PLUGIN.hpp" 239 #include "config_I386_CLANG8_VERSION.hpp" 240 #include "config_I386_CLANG9_ASTANALYZER_PLUGIN.hpp" 241 #include "config_I386_CLANG9_CSROA_PLUGIN.hpp" 242 #include "config_I386_CLANG9_EMPTY_PLUGIN.hpp" 243 #include "config_I386_CLANG9_EXE.hpp" 244 #include "config_I386_CLANG9_EXPANDMEMOPS_PLUGIN.hpp" 245 #include "config_I386_CLANG9_GEPICANON_PLUGIN.hpp" 246 #include "config_I386_CLANG9_SSA_PLUGIN.hpp" 247 #include "config_I386_CLANG9_SSA_PLUGINCPP.hpp" 248 #include "config_I386_CLANG9_TOPFNAME_PLUGIN.hpp" 249 #include "config_I386_CLANG9_VERSION.hpp" 250 #include "config_I386_CLANGPP10_EXE.hpp" 251 #include "config_I386_CLANGPP11_EXE.hpp" 252 #include "config_I386_CLANGPP12_EXE.hpp" 253 #include "config_I386_CLANGPP13_EXE.hpp" 254 #include "config_I386_CLANGPP16_EXE.hpp" 255 #include "config_I386_CLANGPP4_EXE.hpp" 256 #include "config_I386_CLANGPP5_EXE.hpp" 257 #include "config_I386_CLANGPP6_EXE.hpp" 258 #include "config_I386_CLANGPP7_EXE.hpp" 259 #include "config_I386_CLANGPP8_EXE.hpp" 260 #include "config_I386_CLANGPP9_EXE.hpp" 261 #include "config_I386_CLANGPPVVD_EXE.hpp" 262 #include "config_I386_CLANGVVD_ASTANALYZER_PLUGIN.hpp" 263 #include "config_I386_CLANGVVD_CSROA_PLUGIN.hpp" 264 #include "config_I386_CLANGVVD_EMPTY_PLUGIN.hpp" 265 #include "config_I386_CLANGVVD_EXE.hpp" 266 #include "config_I386_CLANGVVD_EXPANDMEMOPS_PLUGIN.hpp" 267 #include "config_I386_CLANGVVD_GEPICANON_PLUGIN.hpp" 268 #include "config_I386_CLANGVVD_SSA_PLUGIN.hpp" 269 #include "config_I386_CLANGVVD_SSA_PLUGINCPP.hpp" 270 #include "config_I386_CLANGVVD_TOPFNAME_PLUGIN.hpp" 271 #include "config_I386_CLANGVVD_VERSION.hpp" 272 #include "config_I386_CLANG_CPP10_EXE.hpp" 273 #include "config_I386_CLANG_CPP11_EXE.hpp" 274 #include "config_I386_CLANG_CPP12_EXE.hpp" 275 #include "config_I386_CLANG_CPP13_EXE.hpp" 276 #include "config_I386_CLANG_CPP16_EXE.hpp" 277 #include "config_I386_CLANG_CPP4_EXE.hpp" 278 #include "config_I386_CLANG_CPP5_EXE.hpp" 279 #include "config_I386_CLANG_CPP6_EXE.hpp" 280 #include "config_I386_CLANG_CPP7_EXE.hpp" 281 #include "config_I386_CLANG_CPP8_EXE.hpp" 282 #include "config_I386_CLANG_CPP9_EXE.hpp" 283 #include "config_I386_CLANG_CPPVVD_EXE.hpp" 284 #include "config_I386_CPP49_EXE.hpp" 285 #include "config_I386_CPP5_EXE.hpp" 286 #include "config_I386_CPP6_EXE.hpp" 287 #include "config_I386_CPP7_EXE.hpp" 288 #include "config_I386_CPP8_EXE.hpp" 289 #include "config_I386_GCC49_EMPTY_PLUGIN.hpp" 290 #include "config_I386_GCC49_EXE.hpp" 291 #include "config_I386_GCC49_SSA_PLUGIN.hpp" 292 #include "config_I386_GCC49_SSA_PLUGINCPP.hpp" 293 #include "config_I386_GCC49_TOPFNAME_PLUGIN.hpp" 294 #include "config_I386_GCC49_VERSION.hpp" 295 #include "config_I386_GCC5_EMPTY_PLUGIN.hpp" 296 #include "config_I386_GCC5_EXE.hpp" 297 #include "config_I386_GCC5_SSA_PLUGIN.hpp" 298 #include "config_I386_GCC5_SSA_PLUGINCPP.hpp" 299 #include "config_I386_GCC5_TOPFNAME_PLUGIN.hpp" 300 #include "config_I386_GCC5_VERSION.hpp" 301 #include "config_I386_GCC6_EMPTY_PLUGIN.hpp" 302 #include "config_I386_GCC6_EXE.hpp" 303 #include "config_I386_GCC6_SSA_PLUGIN.hpp" 304 #include "config_I386_GCC6_SSA_PLUGINCPP.hpp" 305 #include "config_I386_GCC6_TOPFNAME_PLUGIN.hpp" 306 #include "config_I386_GCC6_VERSION.hpp" 307 #include "config_I386_GCC7_EMPTY_PLUGIN.hpp" 308 #include "config_I386_GCC7_EXE.hpp" 309 #include "config_I386_GCC7_SSA_PLUGIN.hpp" 310 #include "config_I386_GCC7_SSA_PLUGINCPP.hpp" 311 #include "config_I386_GCC7_TOPFNAME_PLUGIN.hpp" 312 #include "config_I386_GCC7_VERSION.hpp" 313 #include "config_I386_GCC8_EMPTY_PLUGIN.hpp" 314 #include "config_I386_GCC8_EXE.hpp" 315 #include "config_I386_GCC8_SSA_PLUGIN.hpp" 316 #include "config_I386_GCC8_SSA_PLUGINCPP.hpp" 317 #include "config_I386_GCC8_TOPFNAME_PLUGIN.hpp" 318 #include "config_I386_GCC8_VERSION.hpp" 319 #include "config_I386_GPP49_EXE.hpp" 320 #include "config_I386_GPP5_EXE.hpp" 321 #include "config_I386_GPP6_EXE.hpp" 322 #include "config_I386_GPP7_EXE.hpp" 323 #include "config_I386_GPP8_EXE.hpp" 324 #include "config_I386_LLVM10_LINK_EXE.hpp" 325 #include "config_I386_LLVM10_OPT_EXE.hpp" 326 #include "config_I386_LLVM11_LINK_EXE.hpp" 327 #include "config_I386_LLVM11_OPT_EXE.hpp" 328 #include "config_I386_LLVM12_LINK_EXE.hpp" 329 #include "config_I386_LLVM12_OPT_EXE.hpp" 330 #include "config_I386_LLVM13_LINK_EXE.hpp" 331 #include "config_I386_LLVM13_OPT_EXE.hpp" 332 #include "config_I386_LLVM16_LINK_EXE.hpp" 333 #include "config_I386_LLVM16_OPT_EXE.hpp" 334 #include "config_I386_LLVM4_LINK_EXE.hpp" 335 #include "config_I386_LLVM4_OPT_EXE.hpp" 336 #include "config_I386_LLVM5_LINK_EXE.hpp" 337 #include "config_I386_LLVM5_OPT_EXE.hpp" 338 #include "config_I386_LLVM6_LINK_EXE.hpp" 339 #include "config_I386_LLVM6_OPT_EXE.hpp" 340 #include "config_I386_LLVM7_LINK_EXE.hpp" 341 #include "config_I386_LLVM7_OPT_EXE.hpp" 342 #include "config_I386_LLVM8_LINK_EXE.hpp" 343 #include "config_I386_LLVM8_OPT_EXE.hpp" 344 #include "config_I386_LLVM9_LINK_EXE.hpp" 345 #include "config_I386_LLVM9_OPT_EXE.hpp" 346 #include "config_I386_LLVMVVD_LINK_EXE.hpp" 347 #include "config_I386_LLVMVVD_OPT_EXE.hpp" 348 #include "config_NPROFILE.hpp" 375 return std::regex_replace(str, std::regex(
"([\\(\\) ])"),
"\\$1");
383 compiler_target(_compiler_target),
385 output_level(_Param->getOption<int>(OPT_output_level)),
386 debug_level(_Param->get_class_debug_level(
"CompilerWrapper"))
389 if(
Param->isOption(OPT_gcc_write_xml))
399 const std::string& parameters_line,
int cm,
const std::string& costTable)
403 "Empty compilation must not require any other compilation mode.");
406 const auto output_temporary_directory =
Param->getOption<std::string>(OPT_output_temporary_directory);
407 const auto compiler_output_filename = output_temporary_directory +
STR_CST_gcc_output;
409 const auto isWholeProgram =
410 Param->isOption(OPT_gcc_optimizations) &&
411 Param->getOption<std::string>(OPT_gcc_optimizations).find(
"whole-program") != std::string::npos &&
412 Param->getOption<std::string>(OPT_gcc_optimizations).find(
"no-whole-program") == std::string::npos;
413 const auto top_fnames = [&]() -> std::string {
414 if(
Param->isOption(OPT_top_functions_names))
416 auto fnames =
Param->getOption<std::string>(OPT_top_functions_names);
422 THROW_ASSERT(!isWholeProgram || top_fnames ==
"main",
"Unexpected -fwhole-program with non-main top function.");
424 std::string real_filename = input_filename;
429 command = compiler.llvm_opt;
433 THROW_ASSERT(cm == CM_COMPILER_LTO,
"Plugins must not be enabled when linker is required");
434 command = compiler.llvm_link;
446 command = compiler.gcc;
449 command +=
" -D__NO_INLINE__";
450 command +=
" " + compiler.extra_options;
452 if(compiler.is_clang || (cm & CM_ANALYZER_ALL))
454 command +=
" -isystem /mingw64/include -isystem /mingw64/x86_64-w64-mingw32/include -isystem " 455 "/mingw64/include/c++/v1/";
459 if(!(
Param->getOption<
bool>(OPT_compute_size_of)))
463 if((
Param->isOption(OPT_discrepancy) &&
Param->getOption<
bool>(OPT_discrepancy)) ||
464 (
Param->isOption(OPT_discrepancy_hw) &&
Param->getOption<
bool>(OPT_discrepancy_hw)))
466 command +=
" -D__BAMBU_DISCREPANCY__";
473 if(compiler.is_clang)
481 if(input_filename ==
"-")
483 THROW_ERROR(
"Reading from standard input which does not contain any function definition");
485 static int empty_counter = 0;
486 real_filename = output_temporary_directory +
"/empty_" + std::to_string(empty_counter++) +
".c";
487 CopyFile(input_filename, real_filename);
489 std::ofstream empty_file(real_filename, std::ios_base::app);
490 empty_file <<
"\nvoid __bambu_empty_function__(){}\n";
492 if(compiler.is_clang)
495 " -mllvm -pandaGE-outputdir=" + output_temporary_directory +
496 " -mllvm -pandaGE-infile=" + real_filename;
500 command +=
" -fplugin=" + compiler.empty_plugin_obj +
" -fplugin-arg-" + compiler.empty_plugin_name +
501 "-outputdir=" + output_temporary_directory;
508 boost::replace_all(command,
"-mlong-double-64",
"");
511 boost::replace_all(command,
"-fhls",
"");
512 boost::replace_all(command,
"-target fpga64-xilinx-linux-gnu",
"");
514 command +=
" -fplugin=" + compiler.ASTAnalyzer_plugin_obj;
515 command +=
" -Xclang -add-plugin -Xclang " + compiler.ASTAnalyzer_plugin_name;
519 command +=
" -Xclang -plugin-arg-" + compiler.ASTAnalyzer_plugin_name +
" -Xclang -action";
520 command +=
" -Xclang -plugin-arg-" + compiler.ASTAnalyzer_plugin_name +
" -Xclang analyze";
521 command +=
" -Xclang -plugin-arg-" + compiler.ASTAnalyzer_plugin_name +
" -Xclang -outputdir";
523 " -Xclang -plugin-arg-" + compiler.ASTAnalyzer_plugin_name +
" -Xclang " + output_temporary_directory;
525 if(
Param->isOption(OPT_input_format) &&
529 command +=
" -Xclang -plugin-arg-" + compiler.ASTAnalyzer_plugin_name +
" -Xclang -cppflag";
531 if(top_fnames.size())
533 command +=
" -Xclang -plugin-arg-" + compiler.ASTAnalyzer_plugin_name +
" -Xclang -topfname";
534 command +=
" -Xclang -plugin-arg-" + compiler.ASTAnalyzer_plugin_name +
" -Xclang " + top_fnames;
539 command +=
" -Xclang -plugin-arg-" + compiler.ASTAnalyzer_plugin_name +
" -Xclang -action";
540 command +=
" -Xclang -plugin-arg-" + compiler.ASTAnalyzer_plugin_name +
" -Xclang optimize";
544 const auto load_plugin = [&](
const std::string& plugin_obj) {
554 const auto append_arg = [&](
const std::string&
arg) {
557 command +=
" -mllvm " +
arg;
561 command +=
" " +
arg;
566 THROW_ASSERT(!(cm & CM_LTO_FLAG),
"Internalizing symbols in partial object files is not expected");
567 if(compiler.is_clang)
570 append_arg(
"-internalize-outputdir=" + output_temporary_directory);
571 append_arg(
"-panda-TFN=" + top_fnames);
574 append_arg(
"-add-noalias");
577 if(!extern_symbols.empty())
579 append_arg(
"-panda-ESL=" + extern_symbols);
581 if(isWholeProgram || !
Param->getOption<
bool>(OPT_expose_globals))
583 append_arg(
"-panda-Internalize");
585 if(
Param->IsParameter(
"enable-CSROA") &&
Param->GetParameter<
int>(
"enable-CSROA") == 1 &&
586 !compiler.CSROA_plugin_obj.empty() && !compiler.expandMemOps_plugin_obj.empty())
589 append_arg(
"-panda-KN=" + top_fnames);
590 if(
Param->IsParameter(
"max-CSROA"))
592 auto max_CSROA =
Param->GetParameter<
int>(
"max-CSROA");
593 append_arg(
"-csroa-max-transformations=" +
STR(max_CSROA));
602 command +=
" -fplugin=" + compiler.topfname_plugin_obj +
" -fplugin-arg-" + compiler.topfname_plugin_name +
603 "-topfname=" + top_fnames;
609 if(compiler.is_clang)
616 if(compiler.is_clang)
619 append_arg(
"-panda-outputdir=" + output_temporary_directory);
620 append_arg(
"-panda-infile=" + input_filename);
621 append_arg(
"-panda-cost-table=\"" + costTable +
"\"");
622 if(top_fnames.size())
624 append_arg(
"-panda-topfname=" + top_fnames);
630 command +=
" -fplugin=" + compiler.ssa_plugin_obj +
" -fplugin-arg-" + compiler.ssa_plugin_name +
631 "-outputdir=" + output_temporary_directory;
635 command +=
" " + parameters_line;
637 const auto _output_filename = output_filename.size() ?
639 std::filesystem::path(output_temporary_directory +
"/" +
642 command +=
" -o " + _output_filename;
644 if(real_filename ==
"-" || real_filename ==
"/dev/null")
646 command +=
" " + real_filename;
651 for(
const auto& src : srcs)
653 const auto extension = std::filesystem::path(src).extension().string();
655 if(extension ==
".S")
659 command +=
" \"" + src +
"\"";
665 long int gcc_compilation_time = 0;
680 if(output_filename.empty())
682 std::remove(_output_filename.c_str());
687 if(std::filesystem::exists(std::filesystem::path(compiler_output_filename)))
691 "Front-end compiler returns an error during compilation " + std::to_string(errno));
692 THROW_ERROR(
"Front-end compiler returns an error during compilation " + std::to_string(errno));
696 THROW_ERROR(
"Error in front-end compiler invocation");
706 input_filename = real_filename;
711 const std::string& costTable)
715 if(source_files.size() == 0)
721 const auto multi_source = source_files.size() > 1;
722 const auto enable_LTO = (compiler.is_clang && multi_source);
723 const auto compile_only =
Param->isOption(OPT_gcc_S) &&
Param->getOption<
bool>(OPT_gcc_S);
724 const auto preprocess_only =
Param->isOption(OPT_gcc_E) &&
Param->getOption<
bool>(OPT_gcc_E);
726 const auto output_temporary_directory =
Param->getOption<std::string>(OPT_output_temporary_directory);
740 if(
Param->isOption(OPT_aligned_access) &&
Param->getOption<
bool>(OPT_aligned_access))
742 THROW_ERROR(
"Option --aligned-access cannot be used with -O3 or vectorization");
747 #if HAVE_I386_CLANG4_COMPILER || HAVE_I386_CLANG5_COMPILER || HAVE_I386_CLANG6_COMPILER || \ 748 HAVE_I386_CLANG7_COMPILER || HAVE_I386_CLANG8_COMPILER || HAVE_I386_CLANG9_COMPILER || \ 749 HAVE_I386_CLANG10_COMPILER || HAVE_I386_CLANG11_COMPILER || HAVE_I386_CLANG12_COMPILER || \ 750 HAVE_I386_CLANG13_COMPILER || HAVE_I386_CLANG16_COMPILER || HAVE_I386_CLANGVVD_COMPILER 751 if(
Param->IsParameter(
"disable-pragma-parsing") &&
Param->GetParameter<
int>(
"disable-pragma-parsing") == 1)
755 else if(!compiler.is_clang)
757 std::string analyzing_compiling_parameters;
758 if(
Param->isOption(OPT_gcc_standard))
760 analyzing_compiling_parameters +=
" --std=" +
Param->getOption<std::string>(OPT_gcc_standard);
762 if(
Param->isOption(OPT_gcc_defines))
764 const auto defines =
Param->getOption<std::list<std::string>>(OPT_gcc_defines);
765 for(
const auto& define : defines)
770 if(
Param->isOption(OPT_gcc_undefines))
772 const auto undefines =
Param->getOption<std::list<std::string>>(OPT_gcc_undefines);
773 for(
const auto& undefine : undefines)
778 if(
Param->isOption(OPT_gcc_warnings))
780 const auto warnings =
Param->getOption<std::list<std::string>>(OPT_gcc_warnings);
781 for(
const auto& warning : warnings)
785 analyzing_compiling_parameters +=
" -W" + warning;
789 if(
Param->isOption(OPT_gcc_includes))
791 analyzing_compiling_parameters +=
" " +
Param->getOption<std::string>(OPT_gcc_includes);
793 for(
auto& source_file : source_files)
800 THROW_WARNING(
"Pragma analysis is not available without Clang/LLVM compiler");
804 const auto compiler_mode = [&]() ->
int {
806 if(preprocess_only || compile_only)
810 if(compiler.is_clang)
828 std::list<std::string> obj_files;
829 THROW_ASSERT(!multi_source || !(compile_only || preprocess_only),
"");
830 for(
auto& source_file : source_files)
832 const auto leaf_name = source_file ==
"-" ?
"stdin-" : std::filesystem::path(source_file).filename().string();
834 const auto obj_file = ((compile_only || preprocess_only) &&
Param->isOption(OPT_output_file)) ?
835 Param->getOption<std::string>(OPT_output_file) :
836 unique_path(output_temporary_directory +
"/" + leaf_name +
".%%%%%%.o").string();
840 obj_files.push_back(obj_file);
842 else if(!(compile_only || preprocess_only))
845 if(!std::filesystem::exists(gimple_file))
849 gimple_file = output_temporary_directory +
"/" + std::filesystem::path(source_file).filename().string() +
852 obj_files.push_back(gimple_file);
858 const auto leaf_name = std::filesystem::path(source_files.front()).
filename().string();
859 const auto ext_symbols_filename = output_temporary_directory +
"external-symbols.txt";
861 std::string lto_obj = output_temporary_directory +
"/" + leaf_name +
".lto.bc";
864 lto_source = lto_obj;
865 lto_obj = output_temporary_directory +
"/" + leaf_name +
".lto-opt.bc";
870 lto_source = lto_obj;
871 lto_obj = output_temporary_directory +
"/" + leaf_name +
".lto-dump.bc";
872 THROW_ASSERT(std::filesystem::exists(ext_symbols_filename),
"File not found: " + ext_symbols_filename);
875 " --internalize-public-api-file=" + ext_symbols_filename +
" " + plugin_prefix +
"internalize " +
876 clang_recipes(optimization_set,
"") + plugin_prefix + compiler.ssa_plugin_name;
880 if(!std::filesystem::exists(gimple_obj))
882 THROW_ERROR(
"Object file not found: " + gimple_obj);
886 long int merge_time = 0;
898 else if(!
Param->isOption(OPT_gcc_E) && !
Param->isOption(OPT_gcc_S))
900 for(
const auto& obj_file : obj_files)
902 if(!std::filesystem::exists(obj_file))
909 long int merge_time = 0;
932 if(
Param->isOption(OPT_gcc_read_xml))
934 ReadXml(
Param->getOption<std::string>(OPT_gcc_read_xml));
938 switch(optimization_set)
986 #if HAVE_I386_CLANG4_COMPILER || HAVE_I386_CLANG5_COMPILER || HAVE_I386_CLANG6_COMPILER || \ 987 HAVE_I386_CLANG7_COMPILER || HAVE_I386_CLANG8_COMPILER || HAVE_I386_CLANG9_COMPILER || \ 988 HAVE_I386_CLANG10_COMPILER || HAVE_I386_CLANG11_COMPILER || HAVE_I386_CLANG12_COMPILER || \ 989 HAVE_I386_CLANG13_COMPILER || HAVE_I386_CLANG16_COMPILER || HAVE_I386_CLANGVVD_COMPILER 1032 if(
Param->isOption(OPT_gcc_standard))
1034 auto standard =
Param->getOption<std::string>(OPT_gcc_standard);
1038 if(
Param->isOption(OPT_gcc_E) &&
Param->getOption<
bool>(OPT_gcc_E))
1042 if(
Param->isOption(OPT_gcc_S) &&
Param->getOption<
bool>(OPT_gcc_S))
1047 if(
Param->isOption(OPT_gcc_defines))
1050 for(
const auto& define : defines)
1057 if(
Param->isOption(OPT_gcc_undefines))
1060 for(
const auto& undefine : undefines)
1067 if(
Param->isOption(OPT_gcc_warnings))
1070 for(
const auto& warning : warnings)
1072 if(!warning.empty())
1084 if(
Param->isOption(OPT_gcc_includes))
1090 if(
Param->isOption(OPT_gcc_libraries))
1093 for(
const auto& library : libraries)
1100 if(
Param->isOption(OPT_gcc_library_directories))
1103 for(
const auto& library_directory : library_directories)
1117 bool is_clang =
false;
1256 if(
Param->getOption<
bool>(OPT_parse_pragma))
1262 if(
Param->getOption<
int>(OPT_gcc_openmp_simd) && !is_clang)
1281 switch(optimization_set)
1305 optimization_flags[
"auto-inc-dec"] =
false;
1306 optimization_flags[
"cprop-registers"] =
false;
1307 optimization_flags[
"dce"] =
false;
1308 optimization_flags[
"defer-pop"] =
false;
1309 optimization_flags[
"delayed-branch"] =
false;
1310 optimization_flags[
"dse"] =
false;
1311 optimization_flags[
"guess-branch-probability"] =
false;
1312 optimization_flags[
"if-conversion"] =
false;
1313 optimization_flags[
"if-conversion2"] =
false;
1314 optimization_flags[
"ipa-pure-const"] =
false;
1315 optimization_flags[
"ipa-reference"] =
false;
1316 optimization_flags[
"merge-constants"] =
false;
1317 optimization_flags[
"split-wide-types"] =
false;
1318 optimization_flags[
"tree-builtin-call-dce"] =
false;
1319 optimization_flags[
"tree-ccp"] =
false;
1320 optimization_flags[
"tree-ch"] =
false;
1321 optimization_flags[
"tree-dce"] =
false;
1322 optimization_flags[
"tree-dominator-opts"] =
false;
1323 optimization_flags[
"tree-dse"] =
false;
1324 optimization_flags[
"tree-forwprop"] =
false;
1325 optimization_flags[
"tree-fre"] =
false;
1326 optimization_flags[
"tree-phiprop"] =
false;
1327 optimization_flags[
"tree-pta"] =
false;
1328 optimization_flags[
"tree-sra"] =
false;
1329 optimization_flags[
"tree-ter"] =
false;
1339 optimization_flags[
"compare-elim"] =
false;
1340 optimization_flags[
"ipa-profile"] =
false;
1341 optimization_flags[
"tree-bit-ccp"] =
false;
1342 optimization_flags[
"tree-copy-prop"] =
false;
1343 optimization_flags[
"tree-copyrename"] =
false;
1344 optimization_flags[
"tree-slsr"] =
false;
1349 optimization_flags[
"compare-elim"] =
false;
1350 optimization_flags[
"ipa-profile"] =
false;
1351 optimization_flags[
"tree-bit-ccp"] =
false;
1352 optimization_flags[
"tree-copy-prop"] =
false;
1353 optimization_flags[
"tree-copyrename"] =
false;
1354 optimization_flags[
"tree-slsr"] =
false;
1359 optimization_flags[
"compare-elim"] =
false;
1360 optimization_flags[
"ipa-profile"] =
false;
1361 optimization_flags[
"tree-bit-ccp"] =
false;
1362 optimization_flags[
"tree-copy-prop"] =
false;
1363 optimization_flags[
"tree-copyrename"] =
false;
1364 optimization_flags[
"tree-slsr"] =
false;
1369 optimization_flags[
"compare-elim"] =
false;
1370 optimization_flags[
"ipa-profile"] =
false;
1371 optimization_flags[
"tree-bit-ccp"] =
false;
1372 optimization_flags[
"tree-copy-prop"] =
false;
1373 optimization_flags[
"tree-copyrename"] =
false;
1374 optimization_flags[
"tree-slsr"] =
false;
1379 optimization_flags[
"compare-elim"] =
false;
1380 optimization_flags[
"ipa-profile"] =
false;
1381 optimization_flags[
"tree-bit-ccp"] =
false;
1382 optimization_flags[
"tree-copy-prop"] =
false;
1383 optimization_flags[
"tree-copyrename"] =
false;
1384 optimization_flags[
"tree-slsr"] =
false;
1461 optimization_flags[
"ipa-pure-const"] =
true;
1462 optimization_flags[
"tree-dce"] =
true;
1466 optimization_flags[
"vectorize"] =
false;
1467 optimization_flags[
"slp-vectorize"] =
false;
1470 const auto flag_cpp =
1471 Param->isOption(OPT_input_format) &&
1477 optimization_flags[
"exceptions"] =
false;
1478 optimization_flags[
"threadsafe-statics"] =
false;
1479 optimization_flags[
"use-cxa-atexit"] =
false;
1493 const auto flag_cpp =
1494 Param->isOption(OPT_input_format) &&
1498 std::string gcc_extra_options;
1499 if(
Param->isOption(OPT_gcc_extra_options))
1501 gcc_extra_options =
Param->getOption<std::string>(OPT_gcc_extra_options);
1512 const bool debug_condition =
static_cast<int>(
compiler_target) & static_cast<int>(compatible_compilers);
1514 "Required compiler is not among the compatible one: " +
STR(static_cast<int>(
compiler_target)) +
1515 " vs " +
STR(static_cast<int>(compatible_compilers)));
1519 const std::string gcc_plugin_dir =
1520 (
Param->isOption(OPT_gcc_plugindir) ?
Param->getOption<std::string>(OPT_gcc_plugindir) :
1523 const std::string clang_plugin_dir =
1524 (
Param->isOption(OPT_gcc_plugindir) ?
Param->getOption<std::string>(OPT_gcc_plugindir) +
"/../clang_plugin" :
1527 const std::string plugin_ext =
".so";
1529 #if HAVE_I386_GCC49_COMPILER || HAVE_I386_GCC5_COMPILER || HAVE_I386_GCC6_COMPILER || HAVE_I386_GCC7_COMPILER || \ 1530 HAVE_I386_GCC8_COMPILER 1531 auto fillASTAnalyzer_plugin = [&] {
1532 #if HAVE_I386_CLANG16_COMPILER 1535 #elif HAVE_I386_CLANG13_COMPILER 1538 #elif HAVE_I386_CLANG12_COMPILER 1541 #elif HAVE_I386_CLANG11_COMPILER 1544 #elif HAVE_I386_CLANG10_COMPILER 1547 #elif HAVE_I386_CLANG9_COMPILER 1550 #elif HAVE_I386_CLANG8_COMPILER 1553 #elif HAVE_I386_CLANG7_COMPILER 1556 #elif HAVE_I386_CLANG6_COMPILER 1559 #elif HAVE_I386_CLANG5_COMPILER 1562 #elif HAVE_I386_CLANG4_COMPILER 1565 #elif HAVE_I386_CLANGVVD_COMPILER 1571 #if HAVE_I386_GCC49_COMPILER 1576 compiler.
extra_options =
" -mlong-double-64 -D_FORTIFY_SOURCE=0 " + gcc_extra_options;
1580 #if HAVE_I386_GCC49_MX32 1591 compiler.
empty_plugin_obj = gcc_plugin_dir + I386_GCC49_EMPTY_PLUGIN + plugin_ext;
1594 gcc_plugin_dir + (flag_cpp ? I386_GCC49_SSA_PLUGINCPP : I386_GCC49_SSA_PLUGIN) + plugin_ext;
1595 compiler.
ssa_plugin_name = (flag_cpp ? I386_GCC49_SSA_PLUGINCPP : I386_GCC49_SSA_PLUGIN);
1598 fillASTAnalyzer_plugin();
1601 #if HAVE_I386_GCC5_COMPILER 1606 compiler.
extra_options =
" -mlong-double-64 -D_FORTIFY_SOURCE=0 " + gcc_extra_options;
1610 #if HAVE_I386_GCC5_MX32 1621 compiler.
empty_plugin_obj = gcc_plugin_dir + I386_GCC5_EMPTY_PLUGIN + plugin_ext;
1624 gcc_plugin_dir + (flag_cpp ? I386_GCC5_SSA_PLUGINCPP : I386_GCC5_SSA_PLUGIN) + plugin_ext;
1625 compiler.
ssa_plugin_name = (flag_cpp ? I386_GCC5_SSA_PLUGINCPP : I386_GCC5_SSA_PLUGIN);
1628 fillASTAnalyzer_plugin();
1632 #if HAVE_I386_GCC6_COMPILER 1637 compiler.
extra_options =
" -mlong-double-64 -D_FORTIFY_SOURCE=0 " + gcc_extra_options;
1641 #if HAVE_I386_GCC6_MX32 1652 compiler.
empty_plugin_obj = gcc_plugin_dir + I386_GCC6_EMPTY_PLUGIN + plugin_ext;
1655 gcc_plugin_dir + (flag_cpp ? I386_GCC6_SSA_PLUGINCPP : I386_GCC6_SSA_PLUGIN) + plugin_ext;
1656 compiler.
ssa_plugin_name = (flag_cpp ? I386_GCC6_SSA_PLUGINCPP : I386_GCC6_SSA_PLUGIN);
1659 fillASTAnalyzer_plugin();
1663 #if HAVE_I386_GCC7_COMPILER 1668 compiler.
extra_options =
" -mlong-double-64 -D_FORTIFY_SOURCE=0 " + gcc_extra_options;
1672 #if HAVE_I386_GCC7_MX32 1683 compiler.
empty_plugin_obj = gcc_plugin_dir + I386_GCC7_EMPTY_PLUGIN + plugin_ext;
1686 gcc_plugin_dir + (flag_cpp ? I386_GCC7_SSA_PLUGINCPP : I386_GCC7_SSA_PLUGIN) + plugin_ext;
1687 compiler.
ssa_plugin_name = (flag_cpp ? I386_GCC7_SSA_PLUGINCPP : I386_GCC7_SSA_PLUGIN);
1690 fillASTAnalyzer_plugin();
1694 #if HAVE_I386_GCC8_COMPILER 1699 compiler.
extra_options =
" -mlong-double-64 -D_FORTIFY_SOURCE=0 " + gcc_extra_options;
1703 #if HAVE_I386_GCC8_MX32 1714 compiler.
empty_plugin_obj = gcc_plugin_dir + I386_GCC8_EMPTY_PLUGIN + plugin_ext;
1717 gcc_plugin_dir + (flag_cpp ? I386_GCC8_SSA_PLUGINCPP : I386_GCC8_SSA_PLUGIN) + plugin_ext;
1718 compiler.
ssa_plugin_name = (flag_cpp ? I386_GCC8_SSA_PLUGINCPP : I386_GCC8_SSA_PLUGIN);
1721 fillASTAnalyzer_plugin();
1725 #if HAVE_I386_CLANG4_COMPILER 1732 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1734 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG4_EMPTY_PLUGIN + plugin_ext;
1737 clang_plugin_dir + (flag_cpp ? I386_CLANG4_SSA_PLUGINCPP : I386_CLANG4_SSA_PLUGIN) + plugin_ext;
1738 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG4_SSA_PLUGINCPP : I386_CLANG4_SSA_PLUGIN);
1743 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG4_CSROA_PLUGIN + plugin_ext;
1745 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG4_TOPFNAME_PLUGIN + plugin_ext;
1754 #if HAVE_I386_CLANG5_COMPILER 1761 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1763 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG5_EMPTY_PLUGIN + plugin_ext;
1766 clang_plugin_dir + (flag_cpp ? I386_CLANG5_SSA_PLUGINCPP : I386_CLANG5_SSA_PLUGIN) + plugin_ext;
1767 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG5_SSA_PLUGINCPP : I386_CLANG5_SSA_PLUGIN);
1772 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG5_CSROA_PLUGIN + plugin_ext;
1774 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG5_TOPFNAME_PLUGIN + plugin_ext;
1783 #if HAVE_I386_CLANG6_COMPILER 1790 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1792 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG6_EMPTY_PLUGIN + plugin_ext;
1795 clang_plugin_dir + (flag_cpp ? I386_CLANG6_SSA_PLUGINCPP : I386_CLANG6_SSA_PLUGIN) + plugin_ext;
1796 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG6_SSA_PLUGINCPP : I386_CLANG6_SSA_PLUGIN);
1801 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG6_CSROA_PLUGIN + plugin_ext;
1803 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG6_TOPFNAME_PLUGIN + plugin_ext;
1812 #if HAVE_I386_CLANG7_COMPILER 1819 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1821 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG7_EMPTY_PLUGIN + plugin_ext;
1824 clang_plugin_dir + (flag_cpp ? I386_CLANG7_SSA_PLUGINCPP : I386_CLANG7_SSA_PLUGIN) + plugin_ext;
1825 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG7_SSA_PLUGINCPP : I386_CLANG7_SSA_PLUGIN);
1830 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG7_CSROA_PLUGIN + plugin_ext;
1832 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG7_TOPFNAME_PLUGIN + plugin_ext;
1841 #if HAVE_I386_CLANG8_COMPILER 1848 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1850 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG8_EMPTY_PLUGIN + plugin_ext;
1853 clang_plugin_dir + (flag_cpp ? I386_CLANG8_SSA_PLUGINCPP : I386_CLANG8_SSA_PLUGIN) + plugin_ext;
1854 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG8_SSA_PLUGINCPP : I386_CLANG8_SSA_PLUGIN);
1859 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG8_CSROA_PLUGIN + plugin_ext;
1861 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG8_TOPFNAME_PLUGIN + plugin_ext;
1870 #if HAVE_I386_CLANG9_COMPILER 1877 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1879 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG9_EMPTY_PLUGIN + plugin_ext;
1882 clang_plugin_dir + (flag_cpp ? I386_CLANG9_SSA_PLUGINCPP : I386_CLANG9_SSA_PLUGIN) + plugin_ext;
1883 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG9_SSA_PLUGINCPP : I386_CLANG9_SSA_PLUGIN);
1888 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG9_CSROA_PLUGIN + plugin_ext;
1890 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG9_TOPFNAME_PLUGIN + plugin_ext;
1899 #if HAVE_I386_CLANG10_COMPILER 1906 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1908 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG10_EMPTY_PLUGIN + plugin_ext;
1911 clang_plugin_dir + (flag_cpp ? I386_CLANG10_SSA_PLUGINCPP : I386_CLANG10_SSA_PLUGIN) + plugin_ext;
1912 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG10_SSA_PLUGINCPP : I386_CLANG10_SSA_PLUGIN);
1917 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG10_CSROA_PLUGIN + plugin_ext;
1919 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG10_TOPFNAME_PLUGIN + plugin_ext;
1928 #if HAVE_I386_CLANG11_COMPILER 1935 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1937 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG11_EMPTY_PLUGIN + plugin_ext;
1940 clang_plugin_dir + (flag_cpp ? I386_CLANG11_SSA_PLUGINCPP : I386_CLANG11_SSA_PLUGIN) + plugin_ext;
1941 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG11_SSA_PLUGINCPP : I386_CLANG11_SSA_PLUGIN);
1946 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG11_CSROA_PLUGIN + plugin_ext;
1948 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG11_TOPFNAME_PLUGIN + plugin_ext;
1957 #if HAVE_I386_CLANG12_COMPILER 1964 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1966 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG12_EMPTY_PLUGIN + plugin_ext;
1969 clang_plugin_dir + (flag_cpp ? I386_CLANG12_SSA_PLUGINCPP : I386_CLANG12_SSA_PLUGIN) + plugin_ext;
1970 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG12_SSA_PLUGINCPP : I386_CLANG12_SSA_PLUGIN);
1975 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG12_CSROA_PLUGIN + plugin_ext;
1977 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG12_TOPFNAME_PLUGIN + plugin_ext;
1986 #if HAVE_I386_CLANG13_COMPILER 1993 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
1995 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG13_EMPTY_PLUGIN + plugin_ext;
1998 clang_plugin_dir + (flag_cpp ? I386_CLANG13_SSA_PLUGINCPP : I386_CLANG13_SSA_PLUGIN) + plugin_ext;
1999 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG13_SSA_PLUGINCPP : I386_CLANG13_SSA_PLUGIN);
2004 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG13_CSROA_PLUGIN + plugin_ext;
2006 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG13_TOPFNAME_PLUGIN + plugin_ext;
2015 #if HAVE_I386_CLANG16_COMPILER 2022 " -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
2024 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANG16_EMPTY_PLUGIN + plugin_ext;
2027 clang_plugin_dir + (flag_cpp ? I386_CLANG16_SSA_PLUGINCPP : I386_CLANG16_SSA_PLUGIN) + plugin_ext;
2028 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANG16_SSA_PLUGINCPP : I386_CLANG16_SSA_PLUGIN);
2033 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANG16_CSROA_PLUGIN + plugin_ext;
2035 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANG16_TOPFNAME_PLUGIN + plugin_ext;
2044 #if HAVE_I386_CLANGVVD_COMPILER 2051 " -D__VIVADO__ -D_FORTIFY_SOURCE=0 " + gcc_extra_options + (flag_cpp ? EXTRA_CLANGPP_COMPILER_OPTION :
"");
2053 compiler.
extra_options +=
" -target fpga64-xilinx-linux-gnu";
2054 compiler.
empty_plugin_obj = clang_plugin_dir + I386_CLANGVVD_EMPTY_PLUGIN + plugin_ext;
2057 clang_plugin_dir + (flag_cpp ? I386_CLANGVVD_SSA_PLUGINCPP : I386_CLANGVVD_SSA_PLUGIN) + plugin_ext;
2058 compiler.
ssa_plugin_name = (flag_cpp ? I386_CLANGVVD_SSA_PLUGINCPP : I386_CLANGVVD_SSA_PLUGIN);
2061 compiler.
GepiCanon_plugin_obj = clang_plugin_dir + I386_CLANGVVD_GEPICANON_PLUGIN + plugin_ext;
2063 compiler.
CSROA_plugin_obj = clang_plugin_dir + I386_CLANGVVD_CSROA_PLUGIN + plugin_ext;
2065 compiler.
topfname_plugin_obj = clang_plugin_dir + I386_CLANGVVD_TOPFNAME_PLUGIN + plugin_ext;
2074 if(compiler.
gcc ==
"")
2084 const auto flag_cpp =
2085 Param->isOption(OPT_input_format) &&
2089 #if HAVE_I386_CLANG16_COMPILER 2091 #elif HAVE_I386_CLANG13_COMPILER 2093 #elif HAVE_I386_CLANG12_COMPILER 2095 #elif HAVE_I386_CLANG11_COMPILER 2097 #elif HAVE_I386_CLANG10_COMPILER 2099 #elif HAVE_I386_CLANG9_COMPILER 2101 #elif HAVE_I386_CLANG8_COMPILER 2103 #elif HAVE_I386_CLANG7_COMPILER 2105 #elif HAVE_I386_CLANG6_COMPILER 2107 #elif HAVE_I386_CLANG5_COMPILER 2109 #elif HAVE_I386_CLANG4_COMPILER 2111 #elif HAVE_I386_CLANGVVD_COMPILER 2125 cpp +
" -v < /dev/null 2>&1 | grep -v -E \"(#|Configured with|Using built-in|Target|Thread model|gcc " 2127 "search list|ignoring nonexistent directory|cc1 -E -quiet|cc1.exe -E " 2128 "-quiet|COMPILER_PATH|LIBRARY_PATH|COLLECT_GCC|OFFLOAD_TARGET_NAMES|OFFLOAD_TARGET_DEFAULT|ignoring " 2130 "directory|ignoring nonexistent directory|InstalledDir|clang version|Found candidate|Selected GCC " 2131 "installation|Candidate multilib|Selected multilib|-cc1)\" | tr '\\n' ' ' | tr '\\r' ' ' | sed " 2138 THROW_ERROR(
"Error in retrieving gcc system include. Error is " + std::to_string(ret));
2141 std::string list_of_dirs;
2144 if(includefile.is_open())
2147 while(!includefile.eof())
2149 getline(includefile, line);
2152 list_of_dirs +=
line;
2158 THROW_ERROR(
"Error in retrieving gcc system include");
2176 const std::string
command = gcc +
" " + compiler_option;
2177 const std::string output_file_name =
2182 THROW_ERROR(
"Error in retrieving gcc configuration");
2188 bool no_frontend_compiler_parameters)
const 2193 command +=
"-D__NO_INLINE__ ";
2195 std::string local_compiler_extra_options = no_frontend_compiler_parameters ?
"" : compiler.extra_options;
2196 if(extra_compiler_options.find(
"-m32") != std::string::npos)
2198 boost::replace_all(local_compiler_extra_options,
"-mx32",
"");
2202 if(local_compiler_extra_options.find(
"-m32") != std::string::npos)
2204 boost::replace_all(local_compiler_extra_options,
"-m32",
"");
2209 command += local_compiler_extra_options +
" " + extra_compiler_options +
" ";
2210 boost::replace_all(command,
"-target fpga64-xilinx-linux-gnu",
"");
2216 const std::string& extra_compiler_options,
2217 bool no_frontend_compiler_parameters)
const 2219 std::list<std::string> sorted_file_names;
2220 for(
const auto& file_name : file_names)
2222 sorted_file_names.push_back(file_name);
2224 CreateExecutable(sorted_file_names, executable_name, extra_compiler_options, no_frontend_compiler_parameters);
2228 const std::string& extra_compiler_options,
2229 bool no_frontend_compiler_parameters)
const 2231 std::string file_names_string;
2232 bool has_cpp_file =
false;
2233 for(
const auto& file_name : file_names)
2235 auto file_format =
Param->GetFileFormat(file_name,
false);
2236 if(file_format == Parameters_FileFormat::FF_CPP || file_format == Parameters_FileFormat::FF_LLVM_CPP)
2238 has_cpp_file =
true;
2240 file_names_string += file_name +
" ";
2243 "-->Creating executable " + executable_name +
" from " + file_names_string);
2246 std::string
command = compiler.gcc +
" ";
2248 command +=
"-o " + executable_name +
" ";
2249 command += file_names_string +
" ";
2254 command = std::regex_replace(command, std::regex(
"[-]{1,2}std=c\\+\\+\\w+"),
"");
2258 const auto compiler_output_filename =
2266 " - Command is " + command);
2280 if(
Param->isOption(OPT_gcc_optimizations))
2285 THROW_ASSERT(parameter !=
"",
"unexpected condition:" +
Param->getOption<std::string>(OPT_gcc_optimizations));
2287 const size_t found = parameter.find(
"no-");
2291 std::string
str = parameter.substr(found + std::string(
"no-").size());
2301 if(
Param->isOption(OPT_gcc_parameters))
2306 const size_t equal_size = parameter.find(
'=');
2307 if(equal_size == std::string::npos)
2309 THROW_ERROR(
"--param argument without value " + parameter);
2311 const std::string
key = parameter.substr(0, equal_size);
2312 const std::string
value = parameter.substr(equal_size + 1, parameter.size() - equal_size + 1);
2320 switch(optimization_set)
2356 std::string optimizations;
2369 optimizations += std::string(
"-Wstrict-aliasing ");
2374 if(it->first ==
"argument-alias" && (argument_noalias || argument_noalias_global || argument_noalias_anything))
2378 else if(it->first ==
"argument-noalias" && (argument_noalias_global || argument_noalias_anything))
2382 else if(it->first ==
"argument-noalias-global" && (argument_noalias_anything))
2387 if(it->first ==
"fp-contract")
2391 optimizations += std::string(
"-f") + it->first +
"=on ";
2395 optimizations += std::string(
"-f") + it->first +
"=off ";
2400 optimizations += std::string(
"-f") + it->first +
" ";
2404 optimizations += std::string(
"-fno-") + it->first +
" ";
2410 optimizations += std::string(
"-f") + it2->first +
"=" + std::to_string(it2->second) +
" ";
2412 std::map<std::string, int>::const_iterator it3, it3_end =
parameter_values.end();
2415 optimizations +=
"--param " + it3->first +
"=" + std::to_string(it3->second) +
" ";
2417 return optimizations;
2431 xml_node::node_list::const_iterator root_child, root_child_end = root_children.end();
2432 for(root_child = root_children.begin(); root_child != root_child_end; ++root_child)
2434 const auto* root_child_element = GetPointer<const xml_element>(*root_child);
2435 if(!root_child_element)
2442 xml_node::node_list::const_iterator optimizations_child,
2443 optimizations_child_end = optimizations_children.end();
2444 for(optimizations_child = optimizations_children.begin(); optimizations_child != optimizations_child_end;
2445 ++optimizations_child)
2447 const auto* optimizations_child_element = GetPointer<const xml_element>(*optimizations_child);
2448 if(!optimizations_child_element)
2454 const xml_node::node_list parameter_values_children = optimizations_child_element->get_children();
2455 xml_node::node_list::const_iterator parameter_value,
2456 parameter_value_end = parameter_values_children.end();
2457 for(parameter_value = parameter_values_children.begin(); parameter_value != parameter_value_end;
2460 const auto* parameter_value_element = GetPointer<const xml_element>(*parameter_value);
2461 if(!parameter_value_element)
2468 THROW_ERROR(
"Parameter value node without name or value");
2471 std::stoi(parameter_value_element->get_attribute(
STR_XML_gcc_value)->get_value());
2477 optimizations_child_element->get_children();
2478 xml_node::node_list::const_iterator optimization_flag,
2479 optimization_flag_end = optimization_flags_children.end();
2480 for(optimization_flag = optimization_flags_children.begin();
2481 optimization_flag != optimization_flag_end; ++optimization_flag)
2483 const auto* optimization_flag_element = GetPointer<const xml_element>(*optimization_flag);
2484 if(!optimization_flag_element)
2491 THROW_ERROR(
"Optimization flag node without name or value");
2495 std::stoi(optimization_flag_element->get_attribute(
STR_XML_gcc_value)->get_value()));
2501 optimizations_child_element->get_children();
2502 xml_node::node_list::const_iterator optimization_value,
2503 optimization_value_end = optimization_value_children.end();
2504 for(optimization_value = optimization_value_children.begin();
2505 optimization_value != optimization_value_end; ++optimization_value)
2507 const auto* optimization_value_element = GetPointer<const xml_element>(*optimization_value);
2508 if(!optimization_value_element)
2515 THROW_ERROR(
"Optimization value node without name or value");
2518 std::stoi(optimization_value_element->get_attribute(
STR_XML_gcc_value)->get_value());
2536 xml_node::node_list::const_iterator define, define_end = defines.end();
2537 for(define = defines.begin(); define != define_end; ++define)
2539 const auto* define_element = GetPointer<const xml_element>(*define);
2546 THROW_ERROR(
"Optimization value node without name or value");
2555 xml_node::node_list::const_iterator undefine, undefine_end = undefines.end();
2556 for(undefine = undefines.begin(); undefine != undefine_end; ++undefine)
2558 const auto* undefine_element = GetPointer<const xml_element>(*undefine);
2559 if(!undefine_element)
2565 THROW_ERROR(
"Optimization value node without name or value");
2574 xml_node::node_list::const_iterator warning, warning_end = warnings.end();
2575 for(warning = warnings.begin(); warning != warning_end; ++warning)
2577 const auto* warning_element = GetPointer<const xml_element>(*warning);
2578 if(!warning_element)
2584 THROW_ERROR(
"Optimization value node without name or value");
2593 xml_node::node_list::const_iterator include, include_end = includes.end();
2594 for(include = includes.begin(); include != include_end; ++include)
2596 const auto* include_element = GetPointer<const xml_element>(*include);
2597 if(!include_element)
2603 THROW_ERROR(
"Optimization value node without name or value");
2612 xml_node::node_list::const_iterator library, library_end = libraries.end();
2613 for(library = libraries.begin(); library != library_end; ++library)
2615 const auto* library_element = GetPointer<const xml_element>(*library);
2616 if(!library_element)
2622 THROW_ERROR(
"Optimization value node without name or value");
2631 xml_node::node_list::const_iterator library_directory, library_directory_end = library_directories.end();
2632 for(library_directory = library_directories.begin(); library_directory != library_directory_end;
2633 ++library_directory)
2635 const auto* library_directory_element = GetPointer<const xml_element>(*library_directory);
2636 if(!library_directory_element)
2642 THROW_ERROR(
"Optimization value node without name or value");
2645 "-L" + library_directory_element->get_attribute(
STR_XML_gcc_value)->get_value() +
" ";
2651 catch(
const char* msg)
2653 THROW_ERROR(
"Error " + std::string(msg) +
" during reading of gcc configuration from " + file_name);
2655 catch(
const std::string& msg)
2657 THROW_ERROR(
"Error " + msg +
" during reading of gcc configuration from " + file_name);
2659 catch(
const std::exception& ex)
2661 THROW_ERROR(
"Error " + std::string(ex.what()) +
" during reading of gcc configuration from " + file_name);
2665 THROW_ERROR(
"Unknown exception during reading of gcc configuration from " + file_name);
2675 std::map<std::string, int>::const_iterator parameter_value, parameter_value_end = this->
parameter_values.end();
2676 for(parameter_value = this->
parameter_values.begin(); parameter_value != parameter_value_end; ++parameter_value)
2683 std::map<std::string, bool>::const_iterator optimization_flag,
2685 for(optimization_flag = this->
optimization_flags.begin(); optimization_flag != optimization_flag_end;
2686 ++optimization_flag)
2693 std::map<std::string, int>::const_iterator optimization_value,
2695 for(optimization_value = this->
optimization_values.begin(); optimization_value != optimization_value_end;
2696 ++optimization_value)
2707 std::string includes;
2709 for(
const auto& source_file : source_files)
2711 std::filesystem::path absolute_path = std::filesystem::absolute(source_file);
2712 std::string new_path =
"-iquote " + absolute_path.parent_path().string() +
" ";
2714 boost::replace_all(new_path,
"\\",
"/");
2717 includes.find(new_path) == std::string::npos)
2719 includes += new_path;
2726 const std::string& fname)
const 2730 const auto& expandMemOps_plugin_name = compiler.expandMemOps_plugin_name;
2731 const auto& GepiCanon_plugin_name = compiler.GepiCanon_plugin_name;
2732 const auto& CSROA_plugin_name = compiler.CSROA_plugin_name;
2734 const auto& expandMemOps_plugin_obj = compiler.expandMemOps_plugin_obj;
2735 const auto& GepiCanon_plugin_obj = compiler.GepiCanon_plugin_obj;
2736 const auto& CSROA_plugin_obj = compiler.CSROA_plugin_obj;
2747 if(
Param->IsParameter(
"enable-CSROA") &&
Param->GetParameter<
int>(
"enable-CSROA") == 1 &&
2748 !GepiCanon_plugin_obj.empty())
2754 if(
Param->IsParameter(
"enable-CSROA") &&
Param->GetParameter<
int>(
"enable-CSROA") == 1
2756 && !CSROA_plugin_obj.empty()
2763 recipe +=
" -panda-KN=" + fname;
2764 if(
Param->IsParameter(
"max-CSROA"))
2766 auto max_CSROA =
Param->GetParameter<
int>(
"max-CSROA");
2767 recipe +=
" -csroa-max-transformations=" +
STR(max_CSROA);
2776 std::string complex_recipe;
2777 complex_recipe +=
" -tti -targetlibinfo -tbaa -scoped-noalias -assumption-cache-tracker -profile-summary-info " 2778 "-forceattrs -inferattrs " +
2779 (
"-" + expandMemOps_plugin_name) +
" -domtree -mem2reg ";
2780 if(
Param->IsParameter(
"enable-CSROA") &&
Param->GetParameter<
int>(
"enable-CSROA") == 1
2782 && !GepiCanon_plugin_obj.empty() && !CSROA_plugin_obj.empty()
2787 (
"-" + GepiCanon_plugin_name +
"PS ") + (
"-" + GepiCanon_plugin_name +
"COL ") +
2788 (
"-" + GepiCanon_plugin_name +
"BVR ") +
2789 "-loops -loop-simplify -lcssa-verification -lcssa -basicaa -aa -scalar-evolution -loop-unroll " +
2790 (
"-" + CSROA_plugin_name +
"FV ") +
2791 "-ipsccp -globaldce -domtree -mem2reg -deadargelim -basiccg -argpromotion -domtree -loops " 2792 "-loop-simplify -lcssa-verification -lcssa -basicaa -aa -scalar-evolution -loop-unroll " 2795 if(
Param->IsParameter(
"enable-CSROA") &&
Param->GetParameter<
int>(
"enable-CSROA") == 1
2797 && !GepiCanon_plugin_obj.empty() && !CSROA_plugin_obj.empty()
2801 complex_recipe +=
"-" + expandMemOps_plugin_name + (
" -" + GepiCanon_plugin_name +
"PS ") +
2802 (
"-" + GepiCanon_plugin_name +
"COL ") + (
"-" + GepiCanon_plugin_name +
"BVR ") +
2803 (
"-" + CSROA_plugin_name +
"D ");
2806 "-ipsccp -globalopt -dse -loop-unroll -instcombine -libcalls-shrinkwrap -tailcallelim -simplifycfg " 2807 "-reassociate -domtree -loops -loop-simplify -lcssa-verification -lcssa -basicaa -aa -scalar-evolution " 2808 "-loop-rotate -licm -loop-unswitch -simplifycfg -domtree -basicaa -aa -dse -loop-unroll -instcombine " 2809 "-loops -loop-simplify -lcssa-verification -lcssa -scalar-evolution -indvars -loop-idiom " 2811 "-loop-unroll -mldst-motion -aa -memdep -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -gvn " 2812 "-basicaa -aa -memdep -memcpyopt -sccp -domtree -demanded-bits -bdce -basicaa -aa -dse -loop-unroll " 2813 "-instcombine -lazy-value-info -jump-threading -correlated-propagation -domtree -basicaa -aa -memdep " 2815 "-loops -loop-simplify -lcssa-verification -lcssa -aa -scalar-evolution -licm -postdomtree -adce " 2816 "-simplifycfg -domtree -basicaa -aa -loop-unroll -instcombine -barrier -elim-avail-extern -basiccg " 2817 "-rpo-functionattrs -globals-aa -float2int -domtree -loops -loop-simplify -lcssa-verification -lcssa " 2818 "-basicaa -aa -scalar-evolution -loop-rotate -loop-accesses -lazy-branch-prob -lazy-block-freq " 2819 "-opt-remark-emitter -loop-distribute -loop-simplify -lcssa-verification -lcssa -branch-prob " 2821 "-scalar-evolution -basicaa -aa -loop-accesses -demanded-bits -lazy-branch-prob -lazy-block-freq " 2822 "-opt-remark-emitter -disable-slp-vectorization -disable-loop-vectorization -scalarizer-loop-simplify " 2823 "-scalar-evolution -aa -loop-accesses -loop-load-elim -basicaa -aa -dse -loop-unroll -instcombine " 2824 "-simplifycfg -domtree -basicaa -aa -dse -loop-unroll -instcombine -loops -loop-simplify " 2825 "-lcssa-verification -lcssa -scalar-evolution -loop-unroll ";
2826 if(
Param->IsParameter(
"enable-CSROA") &&
Param->GetParameter<
int>(
"enable-CSROA") == 1
2828 && !GepiCanon_plugin_obj.empty() && !CSROA_plugin_obj.empty()
2832 complex_recipe +=
" -" + expandMemOps_plugin_name +
" -" + CSROA_plugin_name +
"WI ";
2835 "-domtree -basicaa -aa -memdep -dse -aa -memoryssa -early-cse-memssa -constprop -ipsccp -globaldce " 2836 "-domtree -mem2reg -deadargelim -basiccg -argpromotion -domtree -loops -loop-simplify " 2837 "-lcssa-verification " 2838 "-lcssa -basicaa -aa -scalar-evolution -loop-unroll -dse -loop-unroll -instcombine -loop-simplify " 2839 "-lcssa-verification -lcssa -scalar-evolution -licm -alignment-from-assumptions -strip-dead-prototypes " 2840 "-globaldce -constmerge -domtree -loops -branch-prob -block-freq -loop-simplify -lcssa-verification " 2841 "-lcssa -basicaa -aa -scalar-evolution -branch-prob -block-freq -loop-sink -instsimplify ";
2842 recipe += complex_recipe;
2846 recipe +=
" -O" +
opt_level +
" -disable-slp-vectorization -disable-loop-vectorization -scalarizer";
2847 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2852 recipe +=
" -O" +
opt_level +
" -disable-slp-vectorization -disable-loop-vectorization -scalarizer";
2853 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2857 recipe +=
" -O" +
opt_level +
" -disable-slp-vectorization -disable-loop-vectorization -scalarizer";
2858 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2862 recipe +=
" -O" +
opt_level +
" -disable-slp-vectorization -disable-loop-vectorization -scalarizer";
2863 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2867 recipe +=
" -O" +
opt_level +
" -disable-slp-vectorization -disable-loop-vectorization -scalarizer";
2868 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2872 recipe +=
" -O" +
opt_level +
" -disable-slp-vectorization -scalarizer";
2873 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2877 recipe +=
" -O" +
opt_level +
" -disable-slp-vectorization -scalarizer";
2878 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2882 recipe +=
" -O" +
opt_level +
" --disable-vector-combine -vectorize-loops=false -vectorize-slp=false -scalarizer";
2883 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2887 recipe +=
" -O" +
opt_level +
" --disable-vector-combine -vectorize-loops=false -vectorize-slp=false -scalarizer";
2888 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2892 recipe +=
" -O" +
opt_level +
" --disable-vector-combine -vectorize-loops=false -vectorize-slp=false -scalarizer";
2893 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2898 " --disable-vector-combine -vectorize-loops=false -vectorize-slp=false " + plugin_prefix +
"scalarizer";
2899 recipe += plugin_prefix + expandMemOps_plugin_name + plugin_prefix +
"simplifycfg ";
2903 recipe +=
" -O" +
opt_level +
" --disable-vector-combine -scalarizer";
2904 recipe +=
" -" + expandMemOps_plugin_name +
" -simplifycfg ";
2910 return " " + recipe;
2915 const auto gcc_m32_mx32 = parameters->getOption<std::string>(OPT_gcc_m32_mx32);
2916 if(gcc_m32_mx32 ==
"-m32" || gcc_m32_mx32 ==
"-m32 -mno-sse2")
2920 else if(gcc_m32_mx32 ==
"-mx32")
2924 else if(gcc_m32_mx32 ==
"-m64")
2930 THROW_ERROR(
"-m parameter not supported: " + gcc_m32_mx32);
2939 THROW_ERROR(
"Comparisong between different compiler families not possible");
2941 return ct >= compare;
2970 #if HAVE_I386_GCC49_COMPILER 2973 #
if HAVE_I386_GCC5_COMPILER
2976 #if HAVE_I386_GCC6_COMPILER 2979 #
if HAVE_I386_GCC7_COMPILER
2982 #if HAVE_I386_GCC8_COMPILER 2985 #
if HAVE_I386_CLANG4_COMPILER
2988 #if HAVE_I386_CLANG5_COMPILER 2991 #
if HAVE_I386_CLANG6_COMPILER
2994 #if HAVE_I386_CLANG7_COMPILER 2997 #
if HAVE_I386_CLANG8_COMPILER
3000 #if HAVE_I386_CLANG9_COMPILER 3003 #
if HAVE_I386_CLANG10_COMPILER
3006 #if HAVE_I386_CLANG11_COMPILER 3009 #
if HAVE_I386_CLANG12_COMPILER
3012 #if HAVE_I386_CLANG13_COMPILER 3015 #
if HAVE_I386_CLANG16_COMPILER
3018 #if HAVE_I386_CLANGVVD_COMPILER 3027 #if HAVE_I386_CLANG7_COMPILER && defined(_WIN32) 3029 #elif HAVE_I386_GCC49_COMPILER 3031 #elif HAVE_I386_GCC8_COMPILER 3033 #elif HAVE_I386_GCC7_COMPILER 3035 #elif HAVE_I386_GCC6_COMPILER 3037 #elif HAVE_I386_GCC5_COMPILER 3039 #elif HAVE_I386_CLANG4_COMPILER 3041 #elif HAVE_I386_CLANG5_COMPILER 3043 #elif HAVE_I386_CLANG6_COMPILER 3045 #elif HAVE_I386_CLANG7_COMPILER 3047 #elif HAVE_I386_CLANG8_COMPILER 3049 #elif HAVE_I386_CLANG9_COMPILER 3051 #elif HAVE_I386_CLANG10_COMPILER 3053 #elif HAVE_I386_CLANG11_COMPILER 3055 #elif HAVE_I386_CLANG12_COMPILER 3057 #elif HAVE_I386_CLANG13_COMPILER 3059 #elif HAVE_I386_CLANG16_COMPILER 3061 #elif HAVE_I386_CLANGVVD_COMPILER 3114 #pragma GCC diagnostic push 3115 #pragma GCC diagnostic ignored "-Wunused-parameter" 3120 #if(HAVE_I386_GCC49_COMPILER && HAVE_I386_GCC49_M64) 3123 #if(HAVE_I386_GCC5_COMPILER && HAVE_I386_GCC5_M64) 3126 #if(HAVE_I386_GCC6_COMPILER && HAVE_I386_GCC6_M64) 3129 #if(HAVE_I386_GCC7_COMPILER && HAVE_I386_GCC7_M64) 3132 #if(HAVE_I386_GCC8_COMPILER && HAVE_I386_GCC8_M64) 3135 #if(HAVE_I386_CLANG4_COMPILER && HAVE_I386_CLANG4_M64) 3138 #if(HAVE_I386_CLANG5_COMPILER && HAVE_I386_CLANG5_M64) 3141 #if(HAVE_I386_CLANG6_COMPILER && HAVE_I386_CLANG6_M64) 3144 #if(HAVE_I386_CLANG7_COMPILER && HAVE_I386_CLANG7_M64) 3147 #if(HAVE_I386_CLANG8_COMPILER && HAVE_I386_CLANG8_M64) 3150 #if(HAVE_I386_CLANG9_COMPILER && HAVE_I386_CLANG9_M64) 3153 #if(HAVE_I386_CLANG10_COMPILER && HAVE_I386_CLANG10_M64) 3156 #if(HAVE_I386_CLANG11_COMPILER && HAVE_I386_CLANG11_M64) 3159 #if(HAVE_I386_CLANG12_COMPILER && HAVE_I386_CLANG12_M64) 3162 #if(HAVE_I386_CLANG13_COMPILER && HAVE_I386_CLANG13_M64) 3165 #if(HAVE_I386_CLANG16_COMPILER && HAVE_I386_CLANG16_M64) 3168 #if(HAVE_I386_CLANGVVD_COMPILER && HAVE_I386_CLANGVVD_M64) 3177 #if(HAVE_I386_GCC49_COMPILER && HAVE_I386_GCC49_MX32) 3180 #if(HAVE_I386_GCC5_COMPILER && HAVE_I386_GCC5_MX32) 3183 #if(HAVE_I386_GCC6_COMPILER && HAVE_I386_GCC6_MX32) 3186 #if(HAVE_I386_GCC7_COMPILER && HAVE_I386_GCC7_MX32) 3189 #if(HAVE_I386_GCC8_COMPILER && HAVE_I386_GCC8_MX32) 3192 #if(HAVE_I386_CLANG4_COMPILER && HAVE_I386_CLANG4_MX32) 3195 #if(HAVE_I386_CLANG5_COMPILER && HAVE_I386_CLANG5_MX32) 3198 #if(HAVE_I386_CLANG6_COMPILER && HAVE_I386_CLANG6_MX32) 3201 #if(HAVE_I386_CLANG7_COMPILER && HAVE_I386_CLANG7_MX32) 3204 #if(HAVE_I386_CLANG8_COMPILER && HAVE_I386_CLANG8_MX32) 3207 #if(HAVE_I386_CLANG9_COMPILER && HAVE_I386_CLANG9_MX32) 3210 #if(HAVE_I386_CLANG10_COMPILER && HAVE_I386_CLANG10_MX32) 3213 #if(HAVE_I386_CLANG11_COMPILER && HAVE_I386_CLANG11_MX32) 3216 #if(HAVE_I386_CLANG12_COMPILER && HAVE_I386_CLANG12_MX32) 3219 #if(HAVE_I386_CLANG13_COMPILER && HAVE_I386_CLANG13_MX32) 3222 #if(HAVE_I386_CLANG16_COMPILER && HAVE_I386_CLANG16_MX32) 3225 #if(HAVE_I386_CLANGVVD_COMPILER && HAVE_I386_CLANGVVD_MX32) 3234 #if(HAVE_I386_GCC49_COMPILER && HAVE_I386_GCC49_M32) 3237 #if(HAVE_I386_GCC5_COMPILER && HAVE_I386_GCC5_M32) 3240 #if(HAVE_I386_GCC6_COMPILER && HAVE_I386_GCC6_M32) 3243 #if(HAVE_I386_GCC7_COMPILER && HAVE_I386_GCC7_M32) 3246 #if(HAVE_I386_GCC8_COMPILER && HAVE_I386_GCC8_M32) 3255 #if(HAVE_I386_CLANG4_COMPILER && HAVE_I386_CLANG4_M32) 3258 #if(HAVE_I386_CLANG5_COMPILER && HAVE_I386_CLANG5_M32) 3261 #if(HAVE_I386_CLANG6_COMPILER && HAVE_I386_CLANG6_M32) 3264 #if(HAVE_I386_CLANG7_COMPILER && HAVE_I386_CLANG7_M32) 3267 #if(HAVE_I386_CLANG8_COMPILER && HAVE_I386_CLANG8_M32) 3270 #if(HAVE_I386_CLANG9_COMPILER && HAVE_I386_CLANG9_M32) 3273 #if(HAVE_I386_CLANG10_COMPILER && HAVE_I386_CLANG10_M32) 3276 #if(HAVE_I386_CLANG11_COMPILER && HAVE_I386_CLANG11_M32) 3279 #if(HAVE_I386_CLANG12_COMPILER && HAVE_I386_CLANG12_M32) 3282 #if(HAVE_I386_CLANG13_COMPILER && HAVE_I386_CLANG13_M32) 3285 #if(HAVE_I386_CLANG16_COMPILER && HAVE_I386_CLANG16_M32) 3288 #if(HAVE_I386_CLANGVVD_COMPILER && HAVE_I386_CLANGVVD_M32) 3294 #pragma GCC diagnostic pop 3298 #if HAVE_I386_GCC49_COMPILER 3301 return I386_GCC49_VERSION;
3304 #if HAVE_I386_GCC5_COMPILER 3307 return I386_GCC5_VERSION;
3310 #if HAVE_I386_GCC6_COMPILER 3313 return I386_GCC6_VERSION;
3316 #if HAVE_I386_GCC7_COMPILER 3319 return I386_GCC7_VERSION;
3322 #if HAVE_I386_GCC8_COMPILER 3325 return I386_GCC8_VERSION;
3328 #if HAVE_I386_CLANG4_COMPILER 3331 return I386_CLANG4_VERSION;
3334 #if HAVE_I386_CLANG5_COMPILER 3337 return I386_CLANG5_VERSION;
3340 #if HAVE_I386_CLANG6_COMPILER 3343 return I386_CLANG6_VERSION;
3346 #if HAVE_I386_CLANG7_COMPILER 3349 return I386_CLANG7_VERSION;
3352 #if HAVE_I386_CLANG8_COMPILER 3355 return I386_CLANG8_VERSION;
3358 #if HAVE_I386_CLANG9_COMPILER 3361 return I386_CLANG9_VERSION;
3364 #if HAVE_I386_CLANG10_COMPILER 3367 return I386_CLANG10_VERSION;
3370 #if HAVE_I386_CLANG11_COMPILER 3373 return I386_CLANG11_VERSION;
3376 #if HAVE_I386_CLANG12_COMPILER 3379 return I386_CLANG12_VERSION;
3382 #if HAVE_I386_CLANG13_COMPILER 3385 return I386_CLANG13_VERSION;
3388 #if HAVE_I386_CLANG16_COMPILER 3391 return I386_CLANG16_VERSION;
3394 #if HAVE_I386_CLANGVVD_COMPILER 3397 return I386_CLANGVVD_VERSION;
3406 std::string extern_symbols;
3407 const auto XMLfilename = [&]() -> std::string {
3408 if(
Param->isOption(OPT_xml_memory_allocation))
3410 return Param->getOption<std::string>(OPT_xml_memory_allocation);
3413 const auto output_temporary_directory =
Param->getOption<std::string>(OPT_output_temporary_directory);
3414 const auto leaf_name = std::filesystem::path(filename).filename().string();
3415 const auto generate_xml = output_temporary_directory +
"/" + leaf_name +
".memory_allocation.xml";
3416 if((std::filesystem::exists(std::filesystem::path(generate_xml))))
3418 return generate_xml;
3420 return std::string(
"");
3422 if(XMLfilename.size())
3431 for(
const auto& l : list)
3433 if(
const auto* child = GetPointer<xml_element>(l))
3435 if(child->get_name() ==
"memory_allocation")
3437 for(
const auto& it : child->get_children())
3439 if(
const auto* mem_node = GetPointer<xml_element>(it))
3441 if(mem_node->get_name() ==
"object")
3443 std::string is_internal;
3444 if(!
CE_XVM(is_internal, mem_node))
3446 THROW_ERROR(
"expected the is_internal attribute");
3449 if(is_internal ==
"T")
3452 else if(is_internal ==
"F")
3454 if(!
CE_XVM(name, mem_node))
3460 extern_symbols += name +
",";
3464 THROW_ERROR(
"unexpected value for is_internal attribute");
3475 return extern_symbols;
3483 return " -fpass-plugin=" + plugin_obj +
" -Xclang -load -Xclang " + plugin_obj;
3485 return " -fplugin=" + plugin_obj;
3490 boost::replace_all(plugin_obj,
".so",
"_opt.so");
3491 auto flags =
" -load=" + plugin_obj;
3495 flags +=
" -load-pass-plugin=" + plugin_obj;
3507 flags +=
" -p 'default<O" + O_level +
">'";
3511 flags +=
" -O" + O_level;
int debug_level
debug level
static size_t CGetPointerSize(const ParameterConstRef parameters)
Return the size of the pointer in bit.
std::string load_plugin_opt(std::string plugin_obj, CompilerWrapper_CompilerTarget target) const
std::string get_value() const
Get the value of this attribute.
void InitializeCompilerParameters()
Initialize the frontend compiler parameters line.
std::map< std::string, int > parameter_values
The values of optimizations parameters.
std::string expandMemOps_plugin_obj
The plugin expanding MemOps calls.
#define DEBUG_LEVEL_VERY_PEDANTIC
extremely verbose debugging print is performed.
std::string GetAnalyzeCompiler() const
#define INDENT_DBG_MEX(dbgLevel, curDbgLevel, mex)
We are producing a debug version of the program, so the message is printed;.
static int getCompatibleCompilers()
void SetCompilerDefault()
Set the default options for the frontend compiler.
const std::string AddSourceCodeIncludes(const std::list< std::string > &source_files) const
Add includes of source file directories.
File containing functions and utilities to support the printing of debug messagges.
std::string WriteOptimizationsString()
Write the string containing the frontend compiler optimization options.
void GetSystemIncludes(std::vector< std::string > &includes) const
Return the list of the frontend compiler system includes.
#define OUTPUT_LEVEL_NONE
no output print is performed.
#define STR_CST_string_separator
The character used to separate concatenated string.
#define STR_XML_gcc_undefines
Node containing information about undefines.
#define STR_XML_gcc_includes
Node containing information about includes.
static std::string bambu_ir_info
The version of the frontend compiler.
Class storing information of a compiler.
#define STR_XML_gcc_parameter_value
Node containing information about a parameter value.
const std::vector< std::string > SplitString(const std::string &input, const std::string &separators)
Function which splits a string into tokens.
#define STR_XML_gcc_name
Attribute containing information about name of optimization/parameter.
std::string CSROA_plugin_obj
The plugin performing Custom Scalar Replacement of Aggregates.
std::string gcc
The compiler frontend executable.
std::string expandMemOps_plugin_name
#define INDENT_OUT_MEX(outLevel, curOutLevel, mex)
std::string clang_recipes(const CompilerWrapper_OptimizationSet optimization_level, const std::string &fname) const
std::map< std::string, int > optimization_values
The value of parametric activate optimizations.
#define STR_CST_string_sizeof
The string used to replace sizeof keyword in the original source code (second step) ...
exceptions managed by PandA
#define STR_XML_gcc_optimization_flag
Node containing information about an optimization flag.
static int getDefaultCompiler()
static bool hasCompilerM64(CompilerWrapper_CompilerTarget ct)
void WriteXml(const std::string &file_name) const
Write the frontend compiler configuration on file.
CompilerWrapper(const ParameterConstRef Param, const CompilerWrapper_CompilerTarget _compiler_target, const CompilerWrapper_OptimizationSet OS)
Constructor.
Specification of the tree (GCC raw) parsing interface function.
#define CE_XVM(variable, node)
Check existence XML Value Macro. Check if an XML attribute is present in the XML tree.
static bool isCurrentOrNewer(CompilerWrapper_CompilerTarget ct, CompilerWrapper_CompilerTarget compare)
static bool isGccCheck(CompilerWrapper_CompilerTarget ct)
std::string ssa_plugin_obj
The plugin to dump ssa gimple.
#define STR_XML_gcc_defines
Node containing information about defines.
#define OUTPUT_LEVEL_MINIMUM
minimum debugging print is performed.
Include a set of utilities used to manage CPU time measures.
CompilerWrapper_OptimizationSet
Possible optimization sets.
const CompilerWrapper_OptimizationSet OS
The set of optimizations to be applied.
std::map< std::string, bool > optimization_flags
The set of activated optimizations.
#define STR_XML_gcc_parameter_values
Node containing information about parameter values.
#define THROW_WARNING(str_expr)
helper function used to throw a warning in a standard way: though it uses PRINT_DBG_MEX, the debug level used is such that the message is always printed
#define STR(s)
Macro which performs a lexical_cast to a string.
void line(int x1, int y1, int x2, int y2, unsigned int color)
Auxiliary methods for manipulating string.
const CompilerWrapper_CompilerTarget compiler_target
The target compiler to be used.
bool IsError(const int error_value)
Utility include.
std::string llvm_opt
The clang llvm-opt executable.
const ParameterConstRef Param
The set of input parameters.
void CompileFile(std::string &input_filename, const std::string &output_file, const std::string ¶meters_line, int cm, const std::string &costTable)
Invoke the frontend compiler to compile file(s)
std::string GetCompilerParameters(const std::string &extra_compiler_options, bool no_frontend_compiler_parameters=false) const
std::string GepiCanon_plugin_obj
The plugin canocalizing GEPIs.
std::filesystem::path unique_path(const std::filesystem::path &model)
void ReadParameters()
Analyze the command line options.
#define THROW_UNREACHABLE(str_expr)
helper function used to specify that some points should never be reached
#define START_TIME(time_var)
Macro used to store the start time into time_var.
#define STR_XML_gcc_warnings
Node containing information about warnings.
std::string topfname_plugin_obj
The plugin making visible only the top function.
#define STR_CST_file_IO_shell_output_file
The file used to store shell output.
#define STR_CST_gcc_output
The file where output messages of gcc are saved.
void CopyFile(std::filesystem::path file_source, std::filesystem::path file_target)
Copy file; if target already exist, overwrite.
#define STR_CST_bambu_ir_suffix
The suffix of gimple files.
void dump_exec_time(const std::string &thing, long et)
#define STR_XML_gcc_optimization_values
Node containing information about optimization values.
#define STR_CST_gcc_obj_file
The output file for tree-panda-gcc.
constants used in Input/Output
void QueryCompilerConfig(const std::string &compiler_option) const
Function that print of stdout some useful information passing the given option.
void write_to_file_formatted(const std::filesystem::path &filename)
Write the document to a file.
#define STOP_TIME(time_var)
Macro used to store the elapsed time into time_var.
xml_element * create_root_node(const std::string &_name)
Creates the root node.
utility function used to read files.
CompilerWrapper_CompilerTarget
target of the compiler
#define STR_XML_gcc_root
The root node of a gcc configuration.
Classes specification of the tree_node data structures.
#define STR_XML_gcc_standard
Node containing information about standard.
std::string topfname_plugin_name
xml_attribute * get_attribute(const std::string &name) const
Obtain the attribute with this name.
void merge_tree_managers(const tree_managerRef &source_tree_manager)
merge two tree manager: this with TM_source
This file collects some utility functions and macros.
void Exec()
Parse an XML document from a file.
static bool isClangCheck(CompilerWrapper_CompilerTarget ct)
std::list< xml_nodeRef > node_list
type for list of xml nodes
#define THROW_ERROR(str_expr)
helper function used to throw an error in a standard way
std::string ssa_plugin_name
std::string load_plugin(const std::string &plugin_obj, CompilerWrapper_CompilerTarget target) const
#define STR_XML_gcc_optimization_value
Node containing information about an optimization value.
std::string ASTAnalyzer_plugin_obj
AST analysis.
static bool hasCompilerGCCM32(CompilerWrapper_CompilerTarget ct)
static bool hasCompilerMX32(CompilerWrapper_CompilerTarget ct)
static std::string WriteOptimizationLevel(const CompilerWrapper_OptimizationSet optimization_level)
Writes the optimization level as a string.
void ReadXml(const std::string &file_name)
Read the frontend compiler configuration from file.
std::string empty_plugin_obj
The plugin to dump empty gimple.
std::string ASTAnalyzer_plugin_name
#define STR_CST_gcc_include
The temporary directory used by compiler.
#define STR_XML_gcc_value
Attribute containing information about value stored in a node.
std::string GepiCanon_plugin_name
std::string add_plugin_prefix(CompilerWrapper_CompilerTarget target, std::string O_level="") const
static bool hasCompilerCLANGM32(CompilerWrapper_CompilerTarget ct)
int PandaSystem(const ParameterConstRef Param, const std::string &system_command, bool host_exec, const std::string &output, const unsigned int type, const bool background, const size_t timeout)
System call forcing execution with bash.
std::string extra_options
The extra_options.
Compiler GetCompiler() const
Return the compiler for a given target.
std::string CSROA_plugin_name
#define OUTPUT_LEVEL_PEDANTIC
verbose debugging print is performed.
std::string GetPath(std::filesystem::path path)
#define STR_CST_panda_sizeof
The string used to replace sizeof keyword in the original source code (first step) ...
Class specification of the tree_reindex support class.
static std::string getCompilerVersion(int ct)
Bambu optimizations for soft float: O3 + -finline-limit=10000.
std::string compiler_linking_parameters
The compiler parameters for executable creation.
#define STR_XML_gcc_library_directories
Node containing information about library_directories.
void FillTreeManager(const tree_managerRef TM, std::vector< std::string > &source_files, const std::string &costTable)
This function fills the tree manager with the nodes created from a set of source files.
#define STR_XML_gcc_libraries
Node containing information about libraries.
Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: htt...
xml_documentRef get_document()
Obtain the parsed document.
void CreateExecutable(const std::list< std::string > &file_names, const std::string &executable_name, const std::string &extra_compiler_options, bool no_frontend_compiler_parameters=false) const
Create an executable starting from source code.
Parameters_FileFormat
File formats.
#define THROW_ERROR_CODE(code, str_expr)
helper function used to throw an error with a code error
int output_level
debug level
std::string llvm_link
The clang llvm-link executable.
static std::string __escape_define(const std::string &str)
this class is used to manage the command-line or XML options.
Bambu optimizationss + OPT_compiler_opt_level.
#define LOAD_XVM(variable, node)
LOAD XML Value Macro. Set a variable starting from an XML value. Conversion is performed if needed...
Some macro used to interface with the XML library.
node_list const & get_children()
Obtain the list of child nodes.
void util_print_cpu_stats(std::ostream &os)
std::string container_to_string(_InputIt first, _InputIt last, const std::string &separator, bool trim_empty=true)
#define STR_XML_gcc_optimization_flags
Node containing information about optimization flags.
std::string readExternalSymbols(const std::string &filename) const
std::string cpp
The cpp executable.
#define PRINT_OUT_MEX(profLevel, curprofLevel, mex)
void CopyStdout(const std::string &filename)
Copy a file to the standard output.
#define OUTPUT_LEVEL_VERBOSE
verbose debugging print is performed.
void SetBambuDefault()
Set the default options for the frontend compiler in bambu.
Utility managing CPU statistics.
void GetCompilerConfig() const
Dump the frontend compiler configuration.
std::string empty_plugin_name
~CompilerWrapper()
Destructor.
#define DEBUG_LEVEL_VERBOSE
verbose debugging print is performed.
std::string relocate_compiler_path(const std::string &path, bool resolve_path=false)
xml_element * add_child_element(const std::string &name)
Add a child element to this node.
xml_attribute * set_attribute(const std::string &name, const std::string &value)
Set the value of the attribute with this name, and optionally with this namespace.
std::string frontend_compiler_parameters
The frontend compiler parameters line for compiling a file.
tree_managerRef ParseTreeFile(const ParameterConstRef &Param, const std::string &f)
Function that parse the dump of the patched GCC.
Class specification of the manager of the tree structures extracted from the raw file.
#define STR_XML_gcc_optimizations
Node containing information about optimizations.
static std::string getCompilerSuffix(CompilerWrapper_CompilerTarget pc)
bool is_clang
true when compiler is based on clang/llvm
#define THROW_ASSERT(cond, str_expr)
helper function used to check an assert and if needed to throw an error in a standard way ...
Implementation of the wrapper to Gcc for C sources.