Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. problem with compiler

problem with compiler

Scheduled Pinned Locked Moved C / C++ / MFC
questionlinuxhelp
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Ngoc Linh Nguyen
    wrote on last edited by
    #1

    I have a problem when i have being composed a compiler program for my processor. A system operation( windows, linux ...), how can it run on another processor AMD or Intel? While AMD processors and Intel processors have instructions set different. Can someone answer my question?

    J U 2 Replies Last reply
    0
    • N Ngoc Linh Nguyen

      I have a problem when i have being composed a compiler program for my processor. A system operation( windows, linux ...), how can it run on another processor AMD or Intel? While AMD processors and Intel processors have instructions set different. Can someone answer my question?

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      Every compiler has options to specify the target processor type and version (the supported commands). If such options are not used, the compilers will generate code that can run on all Intel and AMD CPUs limited to a minimum processor generation depending on the compiler and version. For GCC see i386 and x86-64 Options - Using the GNU Compiler Collection (GCC)[^]. For Visual C/C++ there is only one option: /arch (x86)[^].

      N 1 Reply Last reply
      0
      • J Jochen Arndt

        Every compiler has options to specify the target processor type and version (the supported commands). If such options are not used, the compilers will generate code that can run on all Intel and AMD CPUs limited to a minimum processor generation depending on the compiler and version. For GCC see i386 and x86-64 Options - Using the GNU Compiler Collection (GCC)[^]. For Visual C/C++ there is only one option: /arch (x86)[^].

        N Offline
        N Offline
        Ngoc Linh Nguyen
        wrote on last edited by
        #3

        Thank you very much! Jochen Arndt, Regarding GPU, I know that, graphic module in a program can be run by CPU. Also, I know that GPU's instruction set of ATI (or Nvidia) and CPU's instruction set (Intel, AMD) are different. Is it that, insider a operation system has be exiting a dynamic compiler or a normal compiler compile a program to all machine architecture targets? Newest Ubuntu 64 bits have about 1GB size. If it was compiled to specify one machine architecture, Its size would be smaller ? And how many about size? Regards!

        J 1 Reply Last reply
        0
        • N Ngoc Linh Nguyen

          Thank you very much! Jochen Arndt, Regarding GPU, I know that, graphic module in a program can be run by CPU. Also, I know that GPU's instruction set of ATI (or Nvidia) and CPU's instruction set (Intel, AMD) are different. Is it that, insider a operation system has be exiting a dynamic compiler or a normal compiler compile a program to all machine architecture targets? Newest Ubuntu 64 bits have about 1GB size. If it was compiled to specify one machine architecture, Its size would be smaller ? And how many about size? Regards!

          J Offline
          J Offline
          Jochen Arndt
          wrote on last edited by
          #4

          GPU's are complete different. They are accessed by operation system dependant drivers for normal operation. While it is possible to perform calculations on modern GPU's, these use their own compilers (e.g. The LLVM Compiler Infrastructure Project[^]). Intel and AMD have basically the same instruction set. The same applies to other x86 based CPUs (VIA, Cyrix). There are only a very few manufacturer specific instructions. Compilers will not use these instructions by default and might even not provide options to use them. But even then compiling for a specific manufacturer would result only in marginal decreased code size. See also Differences between AMD64 and Intel 64 at x86-64 - Wikipedia, the free encyclopedia[^] The code size can be slightly decreased (together with slightly increased performance) when generating code for newer processor generations. This is mainly achieved by enabling Streaming SIMD Extensions - Wikipedia, the free encyclopedia[^] for older processors and Advanced Vector Extensions - Wikipedia, the free encyclopedia[^] and the FMA instruction set - Wikipedia, the free encyclopedia[^] for newer ones. Operating system distributions should run on all systems matching the minimum requirements. Therefore, they are usually build to support also older CPU's. However, they (and also applications) may detect the CPU and use modern instructions when supported. While this increases the code size it will also increase performance. I can't tell you how much the size decreases when compiling a Linux kernel for a more recent CPU. If you really want to know it, you have to do it. But reducing the code size should be not necessary nowadays where systems have a lot of storage (RAM

          N 1 Reply Last reply
          0
          • J Jochen Arndt

            GPU's are complete different. They are accessed by operation system dependant drivers for normal operation. While it is possible to perform calculations on modern GPU's, these use their own compilers (e.g. The LLVM Compiler Infrastructure Project[^]). Intel and AMD have basically the same instruction set. The same applies to other x86 based CPUs (VIA, Cyrix). There are only a very few manufacturer specific instructions. Compilers will not use these instructions by default and might even not provide options to use them. But even then compiling for a specific manufacturer would result only in marginal decreased code size. See also Differences between AMD64 and Intel 64 at x86-64 - Wikipedia, the free encyclopedia[^] The code size can be slightly decreased (together with slightly increased performance) when generating code for newer processor generations. This is mainly achieved by enabling Streaming SIMD Extensions - Wikipedia, the free encyclopedia[^] for older processors and Advanced Vector Extensions - Wikipedia, the free encyclopedia[^] and the FMA instruction set - Wikipedia, the free encyclopedia[^] for newer ones. Operating system distributions should run on all systems matching the minimum requirements. Therefore, they are usually build to support also older CPU's. However, they (and also applications) may detect the CPU and use modern instructions when supported. While this increases the code size it will also increase performance. I can't tell you how much the size decreases when compiling a Linux kernel for a more recent CPU. If you really want to know it, you have to do it. But reducing the code size should be not necessary nowadays where systems have a lot of storage (RAM

            N Offline
            N Offline
            Ngoc Linh Nguyen
            wrote on last edited by
            #5

            Hi Jochen Arndt, I am trying to develop a processor ( you can think it is a IP ). It will be a IP module beside ARM core and the other IPs into a SoC ( example Snapdragon 820 etc... ). My processor can't running a program which were compiled for ARM architecture. And it only can run one program at a time. It was used to boost up the speed of a program when user need. The ISA for my processor is difference ARM's ISA. I want to make a driver/compiler for my IP, which can compile machine code of a program for the ARM core to machine code for my processor. Have you ever seem a driver/compiler like that? And It has ability to do? Thank for your responds!

            J 1 Reply Last reply
            0
            • N Ngoc Linh Nguyen

              Hi Jochen Arndt, I am trying to develop a processor ( you can think it is a IP ). It will be a IP module beside ARM core and the other IPs into a SoC ( example Snapdragon 820 etc... ). My processor can't running a program which were compiled for ARM architecture. And it only can run one program at a time. It was used to boost up the speed of a program when user need. The ISA for my processor is difference ARM's ISA. I want to make a driver/compiler for my IP, which can compile machine code of a program for the ARM core to machine code for my processor. Have you ever seem a driver/compiler like that? And It has ability to do? Thank for your responds!

              J Offline
              J Offline
              Jochen Arndt
              wrote on last edited by
              #6

              I have not seen such a compiler (which does not mean they do not exist). But the behaviour of a "driver" is similar to an emulator or the virtual execution system for intermediate languages like CIL used with .Net languages.

              N 2 Replies Last reply
              0
              • J Jochen Arndt

                I have not seen such a compiler (which does not mean they do not exist). But the behaviour of a "driver" is similar to an emulator or the virtual execution system for intermediate languages like CIL used with .Net languages.

                N Offline
                N Offline
                Ngoc Linh Nguyen
                wrote on last edited by
                #7

                Thank you! Best Regards!

                1 Reply Last reply
                0
                • J Jochen Arndt

                  I have not seen such a compiler (which does not mean they do not exist). But the behaviour of a "driver" is similar to an emulator or the virtual execution system for intermediate languages like CIL used with .Net languages.

                  N Offline
                  N Offline
                  Ngoc Linh Nguyen
                  wrote on last edited by
                  #8

                  Hi Jochen Arndt, Actually, I want to invite you for my project( processor that i am trying to make compiler/driver for it ). I will send project's material for you so that you clearly understand. Are you ok ? Regards!

                  J 1 Reply Last reply
                  0
                  • N Ngoc Linh Nguyen

                    Hi Jochen Arndt, Actually, I want to invite you for my project( processor that i am trying to make compiler/driver for it ). I will send project's material for you so that you clearly understand. Are you ok ? Regards!

                    J Offline
                    J Offline
                    Jochen Arndt
                    wrote on last edited by
                    #9

                    Thank you for your invitation. But I have not enough free time to be engaged in such a project.

                    1 Reply Last reply
                    0
                    • N Ngoc Linh Nguyen

                      I have a problem when i have being composed a compiler program for my processor. A system operation( windows, linux ...), how can it run on another processor AMD or Intel? While AMD processors and Intel processors have instructions set different. Can someone answer my question?

                      U Offline
                      U Offline
                      User 12392074
                      wrote on last edited by
                      #10

                      Compiler Problems Can't Locate the Compiler:- On UNIX systems, you may see the following error message if your path isn't set properly: javac: Command not found Use setenv or a similar command to modify your PATH environment variable so that it includes the directory where the Java compiler lives. Syntax Errors:- If you mistype part of a program, the compiler may issue a syntax error. The message usually displays the type of the error, the line number where the error was detected, the code on that line, and the position of the error within the code. Here's an error caused by omitting a semicolon (;) at the end of a statement: testing.java:14: `;' expected. System.out.println("Input has " + count + " chars.") ^ 1 error Sometimes the compiler can't guess your intent and prints a confusing error message or multiple error messages if the error cascades over several lines. For example, the following code snippet omits a semicolon (;) from the bold line: while (System.in.read() != -1) count++ System.out.println("Input has " + count + " chars."); When processing this code, the compiler issues two error messages: testing.java:13: Invalid type expression. count++ ^ testing.java:14: Invalid declaration. System.out.println("Input has " + count + " chars."); ^ 2 errors The compiler issues two error messages because after it processes count++, the compiler's state indicates that it's in the middle of an expression. Without the semicolon, the compiler has no way of knowing that the statement is complete. If you see any compiler errors, then your program did not successfully compile, and the compiler did not create a .class file. Carefully verify the program, fix any errors that you detect, and try again. Semantic Errors:- In addition to verifying that your program is syntactically correct, the compiler checks for other basic correctness. For example, the compiler warns you each time you use a variable that has not been initialized: testing.java:13: Variable count may not have been initialized. count++ ^ testing.java:14: Variable count may not have been initialized. System.out.println("Input has " + count + " chars."); ^ 2 errors bikram singh majithia

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups