f



GCC porting question

Hi,
   Can gcc be ported to a machine which do not have diaplacement
addressing mode?
If yes then what sould macros related to base register be defined as?
for ex ( REG_OK_FOR_BASE_P, BASE_REG_CLASS  )

Regards,
C Jaiprakash
0
7/14/2003 3:58:10 AM
comp.compilers 3310 articles. 1 followers. Post Follow

3 Replies
891 Views

Similar Articles

[PageSpeed] 18

 "C Jaiprakash, Noida" <cjaiprakash@noida.hcltech.com> wrote:
|    Can gcc be ported to a machine which do not have diaplacement
| addressing mode?
| If yes then what sould macros related to base register be defined as?
| for ex ( REG_OK_FOR_BASE_P, BASE_REG_CLASS  )

Yes it can; check out the AMD 29K port to see how to do this.

--

     -- Tim Olson
0
Tim
7/16/2003 3:53:01 AM
"C Jaiprakash, Noida" wrote:
>
> Hi,
>    Can gcc be ported to a machine which do not have diaplacement
> addressing mode?

Yes.  I've done it.

> If yes then what sould macros related to base register be defined as?
> for ex ( REG_OK_FOR_BASE_P, BASE_REG_CLASS  )

I was working with a machine where the 32 GP registers were OK for an
indirect load, hence the otherwise-magical 32s below.  Here are the
relevant lines from tm.h.

#define BASE_REG_CLASS ALL_REGS

#define REGNO_OK_FOR_BASE_P(REGNO) \
  ((REGNO) < 32 || (unsigned) reg_renumber[REGNO] < 32)
#ifndef REG_OK_STRICT
# define REG_OK_FOR_BASE_P(X) 1
#else
# define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
#endif

Tag me off-group if I can help further.  (or on-group, if John would
prefer that?)

 - ken
0
Ken
7/17/2003 4:28:50 AM
"C Jaiprakash, Noida" <cjaiprakash@noida.hcltech.com> writes:

> Hi,
>    Can gcc be ported to a machine which do not have diaplacement
> addressing mode?
> If yes then what sould macros related to base register be defined as?
> for ex ( REG_OK_FOR_BASE_P, BASE_REG_CLASS  )

Sure, you can do it.  The IA-64 is one such machine.  Looking at the
gcc/config/ia64/ia64.h file, I see (note, I am not an expert on this port, for
help with it, consult the gcc help mailing list):

/* A macro whose definition is the name of the class to which a valid base
   register must belong.  A base register is one used in an address which is
   the register value plus a displacement.  */
#define BASE_REG_CLASS GENERAL_REGS

/* A macro whose definition is the name of the class to which a valid index
   register must belong.  An index register is one used in an address where its
   value is either multiplied by a scale factor or added to another register
   (as well as added to a displacement).  This is needed for POST_MODIFY.  */
#define INDEX_REG_CLASS GENERAL_REGS

        /* code snipped */

/* A C expression which is nonzero if register number NUM is suitable for use
   as a base register in operand addresses.  It may be either a suitable hard
   register or a pseudo register that has been allocated such a hard reg.  */
#define REGNO_OK_FOR_BASE_P(REGNO) \
  (GENERAL_REGNO_P (REGNO) || GENERAL_REGNO_P (reg_renumber[REGNO]))

/* A C expression which is nonzero if register number NUM is suitable for use
   as an index register in operand addresses.  It may be either a suitable hard
   register or a pseudo register that has been allocated such a hard reg.
   This is needed for POST_MODIFY.  */
#define REGNO_OK_FOR_INDEX_P(NUM) REGNO_OK_FOR_BASE_P (NUM)

        /* code snipped */

/* A C expression that is 1 if the RTX X is a constant which is a valid
   address.  */

#define CONSTANT_ADDRESS_P(X) 0

/* The max number of registers that can appear in a valid memory address.  */

#define MAX_REGS_PER_ADDRESS 2

/* A C compound statement with a conditional `goto LABEL;' executed if X (an
   RTX) is a legitimate memory address on the target machine for a memory
   operand of mode MODE.  */

#define LEGITIMATE_ADDRESS_REG(X)					\
  ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))			\
   || (GET_CODE (X) == SUBREG && GET_CODE (XEXP (X, 0)) == REG		\
       && REG_OK_FOR_BASE_P (XEXP (X, 0))))

#define LEGITIMATE_ADDRESS_DISP(R, X)					\
  (GET_CODE (X) == PLUS							\
   && rtx_equal_p (R, XEXP (X, 0))					\
   && (LEGITIMATE_ADDRESS_REG (XEXP (X, 1))				\
       || (GET_CODE (XEXP (X, 1)) == CONST_INT				\
	   && INTVAL (XEXP (X, 1)) >= -256				\
	   && INTVAL (XEXP (X, 1)) < 256)))

#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) 			\
do {									\
  if (LEGITIMATE_ADDRESS_REG (X))					\
    goto LABEL;								\
  else if ((GET_CODE (X) == POST_INC || GET_CODE (X) == POST_DEC)	\
	   && LEGITIMATE_ADDRESS_REG (XEXP (X, 0))			\
	   && XEXP (X, 0) != arg_pointer_rtx)				\
    goto LABEL;								\
  else if (GET_CODE (X) == POST_MODIFY					\
	   && LEGITIMATE_ADDRESS_REG (XEXP (X, 0))			\
	   && XEXP (X, 0) != arg_pointer_rtx				\
	   && LEGITIMATE_ADDRESS_DISP (XEXP (X, 0), XEXP (X, 1)))	\
    goto LABEL;								\
} while (0)

/* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
   use as a base register.  */

#ifdef REG_OK_STRICT
#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
#else
#define REG_OK_FOR_BASE_P(X) \
  (GENERAL_REGNO_P (REGNO (X)) || (REGNO (X) >= FIRST_PSEUDO_REGISTER))
#endif

/* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
   use as an index register.  This is needed for POST_MODIFY.  */

#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)

--
Michael Meissner
email: mrmnews@the-meissners.org
http://www.the-meissners.org
0
Michael
7/17/2003 4:32:17 AM
Reply:

Similar Artilces:

gcc 4 linking to a file compiled with gcc 2.96 question
Hi, I've been told there is a switch for gcc which will match the ABI of code compiled with previous versions. I don't have the gcc manual to hand and man gcc isn't showing much (web access is down currently). Anyone know what the switch is? Reason I'm asking is this. If you've ever used the PS2 SDK from Sony, you'll know what an abhorent mess it is. Sony provide the object files without the source (which is a pain) and version 2.95.4 of gcc. My idea is to use a modern Linux distro (Mandriva, FC or SuSE) on a dual boot machine, use KDevelop to build the softwa...

BSS problem in DJGPP port of GCC 4 (was: Re: Question about djcross-gcc-4.1.1-2)
>It seems to be bug in binutils. It does not appear even in C++ when option >-fno-exceptions is specified (so no .eh_frame section). Actually, the -fno-exceptions causes files like eh_alloc.o not to be linked into the resulting executable. The stdc++ library is compiled with several compiler flags, one of them being -fdata-sections. Consider the following small test program: --- cut begin--- static int int_array[500000]; int main (void) { return 0; } --- cut end--- Compiling this C file *without* the -fdata-sections option gives the desired output: $ i586-pc-msdosdjgpp-size...

BSS problem in DJGPP port of GCC 4 (was: Re: Question about djcross-gcc-4.1.1-2) #2
>It seems to be bug in binutils. It does not appear even in C++ when option >-fno-exceptions is specified (so no .eh_frame section). Actually, the -fno-exceptions causes files like eh_alloc.o not to be linked into the resulting executable. The stdc++ library is compiled with several compiler flags, one of them being -fdata-sections. Consider the following small test program: --- cut begin--- static int int_array[500000]; int main (void) { return 0; } --- cut end--- Compiling this C file *without* the -fdata-sections option gives the desired output: $ i586-pc-msdosdjgpp-size...

A Newbie question about gcc compilation
Dear All, I have problems with linking libraries using gcc. 1. How can I link linraries with extension so.3, for example libstdc++.so.3; 2. I have lots of libraries under one directory. Is it possible for me to use the wildcard characters instead of typing all the names of libraries? Thanks for your time and help Webb Dear Webb, webb_hsu@yahoo.com (webb) writes: >Dear All, >I have problems with linking libraries using gcc. >1. How can I link linraries with extension so.3, for example >libstdc++.so.3; This should be found automatically if you invoke gcc as g++. >2. I hav...

GCC compiler specific question
Hi, I am looking for a builtin functionality of the GCC. Is there a way get an unambiguous number of each compiled/linked c-function? I want to use it as an index into a table for all functions of an embedded (cross GCC, M68k) executable. With the help of this index I would be able to define a table where I can store profiling information of my code e.g. by using timer values of a hardware timer, the function name (__func__) and so on. I didn't find something suitable in the GCC manual. Thanks for you help. On 16 Mar 2006 23:53:02 -0800, "Karl-Heinz Rossmann" <karl-heinz.ro...

gcc compiling for profiler question
Hi I'm trying to create a gmon.out file with gcc so I can run my program through gmon. However the -pg option doesn't seem to work. Is there a trick to generating this file? Thanks for any help B2003 On 30 Jan, 09:30, Boltar <boltar2...@yahoo.co.uk> wrote: > Hi > > I'm trying to create a gmon.out file with gcc so I can run my program > through gmon. However the -pg option doesn't seem to work. Is there a > trick to generating this file? I meant gprof , not gmon. B2003 You must run the program once before the output is generated. Same as gcov. On 30...

A !GCC-compiler question (C++)
Hello, using Microsoft Visual Studio following programme works properly: #include <iostream> using namespace std; void main() { cout << "Hello World!" << endl; } Using the GCC-compiler (4.1.1) for RISC OS doesn't work: *gcc cpp.test -o test test.cpp:1:20: error: iostream: No such file or directory test.cpp:3: error: '::main' must return 'int' test.cpp: In function 'int main()': test.cpp:5: error: 'cout' was not declared in this scope test.cpp:5: error: 'endl' was not declared in this scope Can me anybody give a shor...

Question on GCC Java compiler
Hi, I've always understood that gcj (the GCC Java compiler) was something like a C or C++ compiler, only that it compiles Java code (and that is limited to non-graphical stuff). In other words, that it would produce a standard, native-code executable that behaves as the standard Java language dictates that such program must behave. Is this true? I tried recently a sockets example (a quick program that connects to port 13 and reads the datetime), and get linking errors that sound pretty strange; so, it made me think that maybe gcj is basically the same as the standard ...

c compiler question (!GCC)
Hi, I compiled the programme: | #include <stdio.h> | | void* main() | { | int e=1; | do { | printf("\nEingabe: "); | fflush(stdin); | scanf("%d",&e); | printf("\nEingabe war: %d",e); | } while (e != 0); | return; | } The result is: > *test2 > > Eingabe: 123 > 432 > 2435 > 7546 > 345 > 756 > 456 > 345 > 5 > 0 > > Eingabe war: 123 > Eingabe: > Eingabe war: 432 > Eingabe: > Eingabe war: 2435 > Eingabe: > Eingabe war: 7546 > Eingabe: > Eingabe war: 345 > Eingabe: > Eingabe war: 756 &...

Questions about GCC, Linux and porting
As I may have some time soon I would like to start c programming for RISC OS. Now I have a couple of general questions I hope you can help me with. I started to read www.riscos.info which is good but it seems to be a bit outdated, so the questions are: Is GCC (3.3.3) now 32 bit compatible. That means: Code compiled with this version will run on a Iyonix natively unless I use the option to make it 26 bit? Does it support dynamic linking now or why is the SharedUnixLibrary required? Is there any reason I should start with LCC? If I would like to do some porting from linux, I guess I need a l...

gcc compile / link questions
I compile and link Python extension modules using the script gcc -fPIC -g -I/usr/local/include/python2.3 \ -Wall -Wstrict-prototypes -c mymodule.c g++ -shared mymodule.o -L/usr/local/lib -o mymodule.so It works for me but it isn't pretty. Is there a better way to write it? Gcc finds all the libraries that need to be linked in. For example, "/usr/local/lib/python2.3/site-packages/numarray/libnumarray.so". How does gcc do this? I created a .so file "utilities.so" that contains some C functions that are called in mymodule.c but are not visible from Python. Both &...

GNU GCC compiler optimization question
Hello, I have a question regarding compiler optimization of a cross compiler GCC (m68k). We are using version 3.4.0. When activating compiler optimization with the options =84- O1, -O2, - O3 =93 there is a number of individual optimization flags set in the background. With =84- O1 =93 there are, as in the GNU documentation described, at least 10 optimization flags (-funit-at-a-time, -fomit- frame-pointer, -fdefer-pop, -fmerge-constants, -fthread-jumps, -floop- optimize, -fif-conversion, -fif-conversion2, -fdelayed-branch, -fguess- branch-probability, -fcprop-registers). The following sentenc...

gcc
Hi: I've built a couple gcc/ada cross compilers in the past but I'm really having trouble with this one. I have to build a gcc 4.1.2 based Ada cross compiler. The host is Linux. The target is a powerpc-mpc8248-linux-uclibc (PowerPC 603, Linux 2.6.20, uClibc-0.9.29). When building the compiler, I get a message cp -p ../../gcc/ada/sinfo.ads ../../gcc/ada/nmake.adt .../../gcc/ada/xnmake.adb ada/bldtools/nmake_b (cd ada/bldtools/nmake_b; gnatmake -q xnmake ; ./xnmake -b ../../nmake.adb ) gnatbind: Cannot find: s-stalib.ali gnatmake: *** bind failed. Would anyone know why the...

Simple question regarding GCC compiler
Hi All, I notice that people are using the gcc compiler. Excuse my ignorance but are you using it as a cross compiler from a Unix/cygwin environment or natively on the Amiga? I notice that there is an old version of gcc (Amiga hosted) on the Aminet. Is there a site somewhere with prebuilt binaries for the amiga? Thanks, Shaun Shaun James <yibbidy@bigpond.net.au> wrote: > I notice that people are using the gcc compiler. Excuse my ignorance but > are you using it as a cross compiler from a Unix/cygwin environment or > natively on the Amiga? Both :) I ...

Web resources about - GCC porting question - comp.compilers

West Lothian question - Wikipedia, the free encyclopedia
He illustrated his point by pointing out the absurdity of a Member of Parliament for West Lothian being able to vote on matters affecting the ...

First Hill Streetcar launch party planned — only question is when — UPDATE: SATURDAY SOFT LAUNCH
As of last Wednesday, Seattle Department of Transportation officials have a plan for the event to launch the First Hill Streetcar including a ...


Five Brainless Job Interview Questions That Need To Die
Liz Ryan lays out five stupid and pointless job-interview questions whose time has passed

Woman questions husband's shooting by Phoenix-area police
A Texas woman is questioning what led suburban Phoenix police to fatally shoot her unarmed husband at a hotel.

New series ‘Dark Net’ raises questions about tech’s hidden side
Many of us have a love/hate relationship with the role technology plays in our lives. We adore our mobile devices, our favorite apps, and websites, ...

Exhibit of Bill Cosby's Art Led to Ethical Questions
A Smithsonian exhibit funded by Bill Cosby and his wife that showcases art from their private collection led to questions about the cultural ...

Quick Question: Can You Still Get A Car With A Non-Black B-Pillar?
I’m not exactly sure when it happened, but at some point in the world of auto design, we all just seemed to agree that the B-pillar was a shameful, ...

Study questions link between teen pot smoking and IQ decline
Albuquerque’s source for local news and live streaming video online. KRQE reports on news, weather, traffic, investigations and sports for New ...

Vogue Asks Derek Zoolander 73 Questions While Visiting His Really, Really Ridiculously Good-Looking Apartment ...
Host Joe Sabia of Vogue recently asked Derek Zoolander ( Ben Stiller ) 73 questions while taking an interesting tour of Zoolander’s “really, ...

Resources last updated: 1/24/2016 6:37:35 AM