Compiler considerations


 
Thread Tools Search this Thread
Top Forums Programming Compiler considerations
# 1  
Old 11-03-2009
Compiler considerations

Hi this is rather basic question but to answer and understand the problem nedded expert.

compilers are OS dependent but OS may use any processor
how the compilers are able to generate code for different processors

just consider the below scenario:



Code:
 
Compilers:              dev c/VC++                 gcc                  turbo 
 
OS:                        windows                    linux                  DOS 
 
Processors:                              intel/motorola/AMD/celeron


any processor i can use for any system.

if we consider gcc, it can generate code for intel or motorola or AMD on some other OS.
how its achieving this.

what are the issues ( related to portability ) considered during the design of the compiler?

will they specify the set of processors that the compiler can generate the code for?

if so, they need to add the code for any newly invented processor.
# 2  
Old 11-03-2009
Side node: gcc isn't restricted to Linux, but also available for Windows, using either MingW or Cygwin, as well as almost any other UNIX (HP-UX, *BSD, Solaris, ...).
# 3  
Old 11-03-2009
Quote:
Originally Posted by MrUser
Hi this is rather basic question but to answer and understand the problem nedded expert.

compilers are OS dependent but OS may use any processor
Compilers are also MPU specific.
Quote:
Originally Posted by MrUser
how the compilers are able to generate code for different processors
They most likely have a database of the instruction set of each mpu.
Quote:
Originally Posted by MrUser
just consider the below scenario:



Code:
 
Compilers:              dev c/VC++                 gcc                  turbo 
 
OS:                        windows                    linux                  DOS 
 
Processors:                              intel/motorola/AMD/celeron


any processor i can use for any system.

if we consider gcc, it can generate code for intel or motorola or AMD on some other OS.
how its achieving this.
By knowing the instruction set of each mpu...easier for a software to remember but not for a programmer.
Quote:
Originally Posted by MrUser
what are the issues ( related to portability ) considered during the design of the compiler?

will they specify the set of processors that the compiler can generate the code for?
Yes they do.
Quote:
Originally Posted by MrUser
if so, they need to add the code for any newly invented processor.
Yes that would be called a newer version of the compiler.
# 4  
Old 11-03-2009
can i print by any means(command or program) the set of processors that my compiler can generate code for?


i am using LINUX 2.4.20-8 smp on i386 machine
# 5  
Old 11-03-2009
If you're using i386, it's time to upgrade. Smilie The basic i686 architecture has taken over for at least a decade now, covering the vast majority of the 32-bit world of processors. A lot of distros don't support i386 any more because that architecture is missing some important fundamental instructions now depended on for things like IPC.

Your compiler can probably generate code for x86 processors and nothing else. Most compilers aren't configured to generate code for anything except their native platform.
# 6  
Old 11-04-2009
Quote:
Originally Posted by MrUser
can i print by any means(command or program) the set of processors that my compiler can generate code for?


i am using LINUX 2.4.20-8 smp on i386 machine
I dont know any command line options you can give to the compiler to figure out the supported mpus but the vendor from who you purchased it should be able to give you that information. So what compiler and version are you using.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

cc compiler and gcc compiler

hi, can we install gcc compiler in unix based OS(sun solar,IBM AIX,HP,etc) and also can we install sun cc compiler in AIX environment and vice versa. and more ..is linux support cc compiler regards Ajay (3 Replies)
Discussion started by: ajaysahoo
3 Replies

2. AIX

XL C/C++ Compiler

Hello, I am trying to use the IBM XL C/C++ Compiler on my AIX server. I have uised smit to install it and it appears to have been successful. When I however type XlC it tells me that I am still using my old compiler which is VisualAge C++ Professional / C for AIX Compiler, Version 5. How can I... (3 Replies)
Discussion started by: dkranes
3 Replies

3. Programming

How Can a Machine Reads a Compiler Since A Compiler is Written in Text! Not Binaries?

To make a programming language you need a compiler, so what was the first programming language and how was is created if you need the compiler first? The compiler itself is considered as a high language comparing to the machine! since the compiler is not created in 1's and 0's... Eventhough i... (12 Replies)
Discussion started by: f.ben.isaac
12 Replies

4. UNIX for Dummies Questions & Answers

xl C/C++ compiler to GCC compiler

Hi, we are converting from IBM-AIX(xl c/c++ compiler) to Linux(GCC complier). As a part of this i need to change the CFLAGS. The xl c/c++ complier CFLAGS is CFLAGS := $(CDEBUG) $(PROJECT_INCLUDE_DIRS) $(COBJECT_MODE) -qcpluscmt -qmakedep -qcheck=all \ -qalign=bit_packed $(LINT_FLAGS)... (0 Replies)
Discussion started by: pbattu1
0 Replies

5. Programming

C compiler

I'm new to C but eager to get started. I purchasewd beginning C by Ivor Horton and realise that I need a C compiler. I looking for the most appropriate and economical way to obtain this, any suggestions would be greatly appreciated. (5 Replies)
Discussion started by: ferret
5 Replies
Login or Register to Ask a Question