This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Update for hot/cold partitioning optimization


Thank you for looking at this and getting back to me. Just for clarification, I am assuming from what
you state in your email that (*targetm.have_named_sections) will return false for the som architecture.
Is that correct? If so, then in_section should never receive the value "in_unlikely_executed_text", which
means the original macro (below) should be fine whether or not we are doing hot/cold partitioning. Is that
your (better) understanding of the situation? All I'm trying to do is make sure the hot/cold partitioning
stuff doesn't break anything on other architectures. If you think the original macro will work just fine,
then I will pull my modification to it out of the patch; otherwise I would appreciate a suggestion as
to the right thing for me to do. Again, thanks for your input!


-- Caroline Tice
ctice@apple.com

Original macro:

#define ASM_OUTPUT_FUNCTION_PREFIX(FILE, NAME) \
{ \
const char *name = (*targetm.strip_name_encoding) (NAME); \
if (TARGET_GAS && in_section == in_text) \
fputs ("\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE); \
else if (TARGET_GAS && in_section == in_unlikely_executed_text) \
fputs ("\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY\n", FILE); \
else if (TARGET_GAS) \
fprintf (FILE, \
"\t.SUBSPA .%s\n", name); \
}



On Jul 15, 2004, at 5:18 PM, John David Anglin wrote:


I would appreciate it if people with experience with the following config
files could make sure I didn't do the wrong thing in there by accident:


	gcc/config/arm/pe.h
	gcc/config/i386/cygming.h
	gcc/config/mcore/mcore.h
	gcc/config/pa/som.h

The som.h change is not correct. The macro ASM_OUTPUT_FUNCTION_PREFIX is partially a reminant from named sections which were deleted a couple of years due to problems with nm and collect2. This macro essentially emits the equivalent of a .section directive before starting to output a function. If you look at varasm.c, you will see it is not suitable for switching sections.

The .nsubspa directive creates a new subspace with the name $CODE$.
The subtle aspect to .nsubspa is that there can be multiple subspaces
all with the name $CODE$ and they are all unique.  How the linker
sorts these subspaces is more or less up to it.  The .subspa
direction can be used to switch to an existing subspace with a given
name.  However, when you have multiple subspaces with the same name,
I believe .subspa will put you in the first (default) subspace with
the specified name.  This is not what's needed for switching back and
forth between sections.

Currently, we never switch subspaces while emitting the body of a
function.  We are very dependent on knowning the distance between
insns for the emissions of branches and the distance to the beginning
of the function for calls.  Assuming we start outputing text and
then switch to emitting unlikely text in a new subspace, this is
going to have lots of implications for branches between the two
subspaces.  Effectively, these become calls.  GAS currently doesn't
support calls to alternate entry points.  So, I don't think this
is going to work with SOM without a lot of careful thought.  It's
also going to interact with a patch I'm about to submit regarding
COMDAT support.

Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]