gcc internal variable: optimize has a mystical problem

This commit is contained in:
fanfuqiang 2018-11-02 23:47:17 +08:00
szülő 47ed529af4
commit f7e8dd92cb
2 fájl változott, egészen pontosan 11 új sor hozzáadva és 10 régi sor törölve

Fájl megtekintése

@ -15,6 +15,7 @@
#include "tree-pass.h" #include "tree-pass.h"
#include "rap-hl-cfi.h" #include "rap-hl-cfi.h"
#include "diagnostic.h" #include "diagnostic.h"
#include "options.h"
/* There are many optimization methrod can do for RAP. /* There are many optimization methrod can do for RAP.
From simple to complex and aside with the gcc internal work stage. From simple to complex and aside with the gcc internal work stage.
@ -35,7 +36,7 @@
//extern struct simple_ipa_opt_pass pass_ipa_pta; //extern struct simple_ipa_opt_pass pass_ipa_pta;
/* Contains the beed called optimization level of GCC */ /* Contains the beed called optimization level of GCC */
int cfi_gcc_optimize_level = 0; volatile int cfi_gcc_optimize_level = 0;
/* Count how many function we have optimized */ /* Count how many function we have optimized */
int rap_opt_statistics_data = 0; int rap_opt_statistics_data = 0;
/* Contain the statistics data, maybe gcc will called many times, we need output /* Contain the statistics data, maybe gcc will called many times, we need output
@ -47,7 +48,7 @@ static bitmap sensi_funcs;
/* Contains the type database which are pointer analysis can not sloved */ /* Contains the type database which are pointer analysis can not sloved */
static struct pointer_set_t *pointer_types; static struct pointer_set_t *pointer_types;
// //
static bool will_call_ipa_ptai = false; static bool will_call_ipa_pta = false;
/* For compatiable with the original RAP */ /* For compatiable with the original RAP */
typedef int rap_hash_value_type; typedef int rap_hash_value_type;
/* Used for disable dom info, because dom info is function based, /* Used for disable dom info, because dom info is function based,
@ -75,6 +76,7 @@ rap_check_will_call_passes (void* gcc_data, void* user_data)
// gcc internal defined pass name. // gcc internal defined pass name.
extern struct simple_ipa_opt_pass pass_ipa_pta; extern struct simple_ipa_opt_pass pass_ipa_pta;
extern struct gcc_options global_options;
/* Try make GCC call ipa-pta pass if optimization level is NOT 0 */ /* Try make GCC call ipa-pta pass if optimization level is NOT 0 */
void void
rap_try_call_ipa_pta (void* gcc_data, void* user_data) rap_try_call_ipa_pta (void* gcc_data, void* user_data)
@ -83,17 +85,16 @@ rap_try_call_ipa_pta (void* gcc_data, void* user_data)
/* If already execute pta pass, return immediatelly. */ /* If already execute pta pass, return immediatelly. */
if (will_call_ipa_pta) if (will_call_ipa_pta)
return; return;
if (/*optimize && */
if (optimize (0 == errorcount + sorrycount) &&
&& !(errorcount || sorrycount) (void *)current_pass == (void *)&pass_ipa_pta)
&& (void *)current_pass == (void *)&pass_ipa_pta)
/*(! strcmp ((current_pass)->name, "pta")))*/
{ {
will_call_ipa_pta = true;
*(bool*)gcc_data = true; *(bool*)gcc_data = true;
/* The variable optimize is defined int GCC */ /* The variable optimize is defined int GCC */
*(int*)user_data = optimize; *(volatile int*)user_data = optimize;
} }
//gcc_assert (init);
return; return;
} }

Fájl megtekintése

@ -14,7 +14,7 @@
#define RAP_OPT_H #define RAP_OPT_H
/* Contains the beed called optimization level of GCC */ /* Contains the beed called optimization level of GCC */
extern int cfi_gcc_optimize_level; extern volatile int cfi_gcc_optimize_level;
/* Count how many function we have optimized */ /* Count how many function we have optimized */
extern int rap_opt_statistics_data; extern int rap_opt_statistics_data;