This is the mail archive of the gcc-help@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 : [gcc front end] add options





----- Message d'origine ----
De : Andi Hellmund <mail@andihellmund.com>
à : charfi asma <charfiasma@yahoo.fr>
Cc : gcc-help@gcc.gnu.org
Envoyà le : Mar 1 fÃvrier 2011, 17h 39min 58s
Objet : Re: [gcc front end] add options

On 2/1/2011 4:43 PM, charfi asma wrote:
> Hello,
>
> I built a new gcc front end
> I would like to use the -fopenmp options when compiling my source file
> I could use the C front end options like -S -fdump-tree-all -O*, .... but when 
>I
> use -fopenmp I get this error:
>
> uml1: warning: command line option â-fopenmpâ is valid for
> C/C++/Fortran/ObjC/ObjC++ but not for  [enabled by default]
>
> should I modify my lang-specs.h ? If yes what kind of modification ?
>
> here is its content:
>
> {".uml", "@uml", 0, 1, 0},
> {"@uml", "uml1 %i %(invoke_as)", 0, 1, 0},
> {"@uml",  "uml1 %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}",
>      0, 1, 0},
>
>
> thank you very much
>
> Asma
>    
Hey Asma,

I think adding -fopenmp to lang-specs.h wouldn't help since the error 
message comes from uml1 (compiler proper). And by the way, the -f* 
options are usually already included in %{cc1_options}. The original 
definition of the -fopenmp option is available in c.opt (in c-family 
directory of 4.6), but please have a look at the lang.opt file of the 
Fortran front-end for details. This is how this is implemented there:

fopenmp
Fortran
; Documented in C

This then allows the Fortran front-end to "reuse" the definition of the 
C (family) front-ends.

Best regards,
Andre-Marcel


Hello,

thank you Philip and Andi for your help.

I added the fopenmp options to my lang.opt file as fortran fe does, but I always 
get the same warning expect that my fe language name is added to the list of fe 
that enable the use of fopenmp

uml1: warning: command line option â-fopenmpâ is valid for 
C/C++/Fortran/ObjC/ObjC++/uml but not for  [enabled by default]


yes the error in my front end comes from the uml1.c because I tried to build the 
Generic form correspending to #pragma omp parallel
I get the gimplified expression as provided by c++ front end
here is my gimple 

main ()
gimple_bind <
  <unnamed-signed:32> D.28;
  struct MyClass x;

  gimple_omp_parallel <
    BODY <
      gimple_bind <
        gimple_call <MyOperation1, NULL, &x>
        gimple_call <MyOperation2, NULL, &x>
      >
    >
    CLAUSES < shared(x) >, NULL, NULL
  >
  gimple_assign <integer_cst, D.28, 0, NULL>
  gimple_return <D.28>
>


MyOperation2 (struct MyClass * this)
gimple_bind <
  gimple_assign <integer_cst, this->MyAttribute2, 15, NULL>
  gimple_return <NULL>
>


MyOperation1 (struct MyClass * this)
gimple_bind <
  gimple_assign <integer_cst, this->MyAttribute1, 10, NULL>
  gimple_return <NULL>
>



but it does not contain the built-in function (as gimple generated from c++ fe)

<built-in> (struct .omp_data_s.0 * .omp_data_i)
{
  struct MyClass c [value-expr: *.omp_data_i->c];
  struct MyClass * D.1788;
  struct MyClass * D.1787;
  struct MyClass * D.1786;
  struct MyClass * D.1785;

<bb 5>:

<bb 3>:
  gimple_assign <component_ref, D.1785, .omp_data_i->c, NULL>
....
}

one of the reason is that my flag_openmp is always null, even if I specify 
-fopenmp while compiling.
i,e: when my front end calls the execute_lower_omp(void) it does nothing
execute_lower_omp (void)
{
  gimple_seq body;

  /* This pass always runs, to provide PROP_gimple_lomp.
     But there is nothing to do unless -fopenmp is given.  */
  if (flag_openmp == 0)
    return 0;
....
}

any idea to change fe flag_openmp value ?  

thank you very much.

Asma




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