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 "ipo_defs.h"
00057
00058
00059 void
00060 Mark_readonly_param (IPA_NODE *caller,
00061 IPA_EDGE *edge,
00062 IPA_CALL_GRAPH *cg)
00063 {
00064 IPA_NODE_CONTEXT context (caller);
00065 cg->Map_Callsites (caller);
00066 WN *call = edge->Whirl_Node();
00067
00068 if (Trace_IPA || Trace_Perf) {
00069 fprintf (TFile, "Setting parameters in %s calling ",
00070 DEMANGLE (ST_name(caller->Func_ST())));
00071 fprintf (TFile, "%s: position = ",
00072 DEMANGLE (ST_name(cg->Callee(edge)->Func_ST())));
00073 }
00074
00075 INT actual_count = WN_num_actuals (call);
00076
00077 for (INT i = 0; i < actual_count && i < edge->Max_Num_Readonly_Actuals(); ++i) {
00078 WN *parm = WN_kid (call, i);
00079 Is_True (WN_operator (parm) == OPR_PARM,
00080 ("Invalid kid from a call node"));
00081 if ((Trace_IPA || Trace_Perf) && (edge->Is_Param_Readonly(i) ||
00082 edge->Is_Param_Pass_Not_Saved(i))) {
00083 fprintf (TFile, "%d ", i);
00084 }
00085 if (edge->Is_Param_Readonly(i)) {
00086 WN_Set_Parm_Read_Only (parm);
00087 if (Trace_IPA || Trace_Perf)
00088 fprintf (TFile, "RO ");
00089 }
00090 if (edge->Is_Param_Pass_Not_Saved(i)) {
00091 WN_Set_Parm_Passed_Not_Saved(parm);
00092 if (Trace_IPA || Trace_Perf)
00093 fprintf (TFile, "!saved ");
00094 }
00095 }
00096
00097 if (Trace_IPA || Trace_Perf)
00098 fputc ('\n', TFile);
00099 }