Target specific passes in clang.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Target specific passes in clang.

Sanjiv Gupta
I am looking for a single driver that should be able to generate the assembly for a given target.
 
It should be able to generate the bitcode, run standard LTO passes, run target specific module passes and final function passes to generate assembly. So pretty much clang -emit-llvm-bc, llvm-ld , opt and llc functionality in a single executable.
 
Besides, the option to be able to invoke native assembler and native linker to generate final executable should also be handled by this driver.
 
Currently, clang takes a -triple option to specify the target.
Can a target schedule these things in clang?
 
Right now we are using a .td based compilerdriver plugin to invoke these different set of executables.
 
- Sanjiv
 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Target specific passes in clang.

Daniel Dunbar
Hi Sanjiv,

I'm not exactly sure what you are asking for.

Clang already runs various passes as part of -O0, -O1, etc. Adding a
target hook for that would be relatively straightforward, although we
want to make sure that one doesn't have to link in LLVM just to run
-fsyntax-only.

I also plan to make the clang driver accept .ll and .bc files,
eventually, but I'm not sure if this is what you are asking.

 - Daniel

On Thu, Feb 18, 2010 at 10:15 PM, Sanjiv Gupta
<[hidden email]> wrote:

> I am looking for a single driver that should be able to generate the
> assembly for a given target.
>
> It should be able to generate the bitcode, run standard LTO passes, run
> target specific module passes and final function passes to generate
> assembly. So pretty much clang -emit-llvm-bc, llvm-ld , opt and llc
> functionality in a single executable.
>
> Besides, the option to be able to invoke native assembler and native linker
> to generate final executable should also be handled by this driver.
>
> Currently, clang takes a -triple option to specify the target.
> Can a target schedule these things in clang?
>
> Right now we are using a .td based compilerdriver plugin to invoke these
> different set of executables.
>
> - Sanjiv
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Target specific passes in clang.

Sanjiv Gupta
I am looking for a driver for pic16.
Given .c files , it should generate pic16 executable.

 .c --> Generate BC (.bc) --> LTO (.bc) --> PIC16 specific module passes
(.bc) --> pic16 Code gen (.s) --> pic16 assembler (.o) --> pic16 linker
(.exe)

All, in one program. Obviously assembler and linker would be separate
programs, which the driver should be able invoke.

If clang can do till .s step, that is also great. But note that I want to
run some pic16 specific module passes in between.

- Sanjiv



----- Original Message -----
From: "Daniel Dunbar" <[hidden email]>
To: "Sanjiv Gupta" <[hidden email]>
Cc: <[hidden email]>
Sent: Saturday, February 20, 2010 3:48 PM
Subject: Re: [cfe-dev] Target specific passes in clang.


Hi Sanjiv,

I'm not exactly sure what you are asking for.

Clang already runs various passes as part of -O0, -O1, etc. Adding a
target hook for that would be relatively straightforward, although we
want to make sure that one doesn't have to link in LLVM just to run
-fsyntax-only.

I also plan to make the clang driver accept .ll and .bc files,
eventually, but I'm not sure if this is what you are asking.

 - Daniel

On Thu, Feb 18, 2010 at 10:15 PM, Sanjiv Gupta
<[hidden email]> wrote:

> I am looking for a single driver that should be able to generate the
> assembly for a given target.
>
> It should be able to generate the bitcode, run standard LTO passes, run
> target specific module passes and final function passes to generate
> assembly. So pretty much clang -emit-llvm-bc, llvm-ld , opt and llc
> functionality in a single executable.
>
> Besides, the option to be able to invoke native assembler and native
> linker
> to generate final executable should also be handled by this driver.
>
> Currently, clang takes a -triple option to specify the target.
> Can a target schedule these things in clang?
>
> Right now we are using a .td based compilerdriver plugin to invoke these
> different set of executables.
>
> - Sanjiv
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Target specific passes in clang.

Daniel Dunbar
On Sat, Feb 20, 2010 at 10:11 PM, Sanjiv Gupta
<[hidden email]> wrote:
> I am looking for a driver for pic16.
> Given .c files , it should generate pic16 executable.
>
> .c --> Generate BC (.bc) --> LTO (.bc) --> PIC16 specific module passes
> (.bc) --> pic16 Code gen (.s) --> pic16 assembler (.o) --> pic16 linker
> (.exe)

The question is, is this just that you want to run new passes on an
individual .bc before .s? Or you want to run them before final code
generation?

It sounds like what you want is:
--
$ clang -c -emit-llvm -o a.bc a.c
$ clang -c -emit-llvm -o b.bc b.c
$ clang -emit-llvm -o t.bc a.bc b.bc # Let's suppose this ran LTO, in
practice we may need a new syntax.
$ clang -o t t.bc # This would run code generation, assembly, link.
--
where in step (4) you had the option of defining some passes to be run
before code generation.

Is this what you are looking for?

 - Daniel

> All, in one program. Obviously assembler and linker would be separate
> programs, which the driver should be able invoke.
>
> If clang can do till .s step, that is also great. But note that I want to
> run some pic16 specific module passes in between.
>
> - Sanjiv
>
>
>
> ----- Original Message ----- From: "Daniel Dunbar" <[hidden email]>
> To: "Sanjiv Gupta" <[hidden email]>
> Cc: <[hidden email]>
> Sent: Saturday, February 20, 2010 3:48 PM
> Subject: Re: [cfe-dev] Target specific passes in clang.
>
>
> Hi Sanjiv,
>
> I'm not exactly sure what you are asking for.
>
> Clang already runs various passes as part of -O0, -O1, etc. Adding a
> target hook for that would be relatively straightforward, although we
> want to make sure that one doesn't have to link in LLVM just to run
> -fsyntax-only.
>
> I also plan to make the clang driver accept .ll and .bc files,
> eventually, but I'm not sure if this is what you are asking.
>
> - Daniel
>
> On Thu, Feb 18, 2010 at 10:15 PM, Sanjiv Gupta
> <[hidden email]> wrote:
>>
>> I am looking for a single driver that should be able to generate the
>> assembly for a given target.
>>
>> It should be able to generate the bitcode, run standard LTO passes, run
>> target specific module passes and final function passes to generate
>> assembly. So pretty much clang -emit-llvm-bc, llvm-ld , opt and llc
>> functionality in a single executable.
>>
>> Besides, the option to be able to invoke native assembler and native
>> linker
>> to generate final executable should also be handled by this driver.
>>
>> Currently, clang takes a -triple option to specify the target.
>> Can a target schedule these things in clang?
>>
>> Right now we are using a .td based compilerdriver plugin to invoke these
>> different set of executables.
>>
>> - Sanjiv
>>
>> _______________________________________________
>> cfe-dev mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
>
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Target specific passes in clang.

Sanjiv Gupta
On Sun, 2010-02-21 at 09:32 -0800, Daniel Dunbar wrote:

> It sounds like what you want is:
> --
> $ clang -c -emit-llvm -o a.bc a.c
> $ clang -c -emit-llvm -o b.bc b.c
> $ clang -emit-llvm -o t.bc a.bc b.bc # Let's suppose this ran LTO, in
> practice we may need a new syntax.
Right. Currently we use llvm-ld here.

> $ clang -o t t.bc # This would run code generation, assembly, link.
> --
> where in step (4) you had the option of defining some passes to be run
> before code generation.
>
> Is this what you are looking for?
>
Precisely.
$ clang a.c b.c

should do all the 4 steps above. Much like a cross compiler driver, lets
say xyz-gcc.

- Sanjiv


>  - Daniel
>
> > All, in one program. Obviously assembler and linker would be separate
> > programs, which the driver should be able invoke.
> >
> > If clang can do till .s step, that is also great. But note that I want to
> > run some pic16 specific module passes in between.
> >
> > - Sanjiv
> >
> >
> >
> > ----- Original Message ----- From: "Daniel Dunbar" <[hidden email]>
> > To: "Sanjiv Gupta" <[hidden email]>
> > Cc: <[hidden email]>
> > Sent: Saturday, February 20, 2010 3:48 PM
> > Subject: Re: [cfe-dev] Target specific passes in clang.
> >
> >
> > Hi Sanjiv,
> >
> > I'm not exactly sure what you are asking for.
> >
> > Clang already runs various passes as part of -O0, -O1, etc. Adding a
> > target hook for that would be relatively straightforward, although we
> > want to make sure that one doesn't have to link in LLVM just to run
> > -fsyntax-only.
> >
> > I also plan to make the clang driver accept .ll and .bc files,
> > eventually, but I'm not sure if this is what you are asking.
> >
> > - Daniel
> >
> > On Thu, Feb 18, 2010 at 10:15 PM, Sanjiv Gupta
> > <[hidden email]> wrote:
> >>
> >> I am looking for a single driver that should be able to generate the
> >> assembly for a given target.
> >>
> >> It should be able to generate the bitcode, run standard LTO passes, run
> >> target specific module passes and final function passes to generate
> >> assembly. So pretty much clang -emit-llvm-bc, llvm-ld , opt and llc
> >> functionality in a single executable.
> >>
> >> Besides, the option to be able to invoke native assembler and native
> >> linker
> >> to generate final executable should also be handled by this driver.
> >>
> >> Currently, clang takes a -triple option to specify the target.
> >> Can a target schedule these things in clang?
> >>
> >> Right now we are using a .td based compilerdriver plugin to invoke these
> >> different set of executables.
> >>
> >> - Sanjiv
> >>
> >> _______________________________________________
> >> cfe-dev mailing list
> >> [hidden email]
> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >>
> >>
> >
> >

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev