00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #define __STDC_LIMIT_MACROS
00041 #include <stdint.h>
00042 #if defined(BUILD_OS_DARWIN)
00043 #include <darwin_elf.h>
00044 #else
00045 #include <elf.h>
00046 #endif
00047
00048 #include "errors.h"
00049 #include "mtypes.h"
00050 #define USE_DST_INTERNALS
00051 #include "dwarf_DST_mem.h"
00052
00053 #include "ipc_file.h"
00054 #include "ipa_inline.h"
00055 #include "ipa_option.h"
00056 #include "ipa_section_annot.h"
00057
00058 void
00059 Mark_use_kill_param (IPA_NODE *caller, IPA_NODE *callee,
00060 IPA_EDGE *edge)
00061 {
00062
00063
00064
00065 if (!(caller->Summary_Proc()->Is_alt_entry() ||
00066 caller->Summary_Proc()->Has_alt_entry() ||
00067 (caller->Get_PU().flags & PU_IS_NESTED_FUNC)))
00068 {
00069 WN *call = edge->Whirl_Node();
00070 if (callee->Get_PU().src_lang == PU_F77_LANG)
00071 {
00072 #ifdef TODO
00073 INT actual_count = WN_num_actuals (call);
00074 INT formal_count = callee->Num_Formals();
00075 INT count = 0;
00076
00077 if (actual_count < formal_count)
00078 count = actual_count;
00079 else
00080 count = formal_count;
00081
00082 IPA_NODE_SECTION_INFO *callee_info = callee->Section_Annot();
00083 STATE_ARRAY *callee_formals_state = callee_info->Get_formals();
00084
00085 for (INT i = 0; i < count; ++i)
00086 {
00087 STATE *state_info = &(*callee_formals_state)[i];
00088 WN *parm = WN_kid (call, i);
00089 Is_True (WN_operator (parm) == OPR_PARM,
00090 ("Invalid kid from a call node"));
00091 if ((Trace_IPA || Trace_Perf) && ((state_info->Is_must_kill() ||
00092 !state_info->Is_euse()) &&
00093 state_info->Is_scalar()))
00094 {
00095 fprintf (TFile, "Setting parameters in %s call ",
00096 DEMANGLE (ST_name(caller->Func_ST())));
00097 fprintf (TFile, "%s: position = ",
00098 DEMANGLE (ST_name(cg->Callee(edge)->Func_ST())));
00099 fprintf (TFile, "%d ", i);
00100 }
00101 if (!state_info->Is_euse() && state_info->Is_scalar()) {
00102 WN_Set_Parm_Not_Exposed_Use (parm);
00103 if (Trace_IPA || Trace_Perf)
00104 fprintf (TFile, "is not exposed use : ");
00105 }
00106 if (state_info->Is_must_kill() && state_info->Is_scalar())
00107 {
00108 WN_Set_Parm_Is_Killed(parm);
00109 if (Trace_IPA || Trace_Perf)
00110 fprintf (TFile, "is killed ");
00111 }
00112 if (Trace_IPA || Trace_Perf)
00113 fputc ('\n', TFile);
00114 }
00115 #endif
00116 }
00117 }
00118 }
00119
00120
00121
00122