Using C++'11 language features in LLVM itself

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
48 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Using C++'11 language features in LLVM itself

Chris Lattner-2
It's seems like a quiet and peaceful day, lets stir things up a bit :)

How crazy would it be for us to start using basic C++'11 language features (but not C++'11 library features) in LLVM: things like auto, rvalue-refs, lambdas, etc?  I think that we can keep things well defined with a few simple requirements: language features must be supported by MSVC 2010 and later, some version of GCC and later (linux folks should pick?), some version of Clang and later (Freebsd folks?).

On the one hand, this would greatly clean up code and is definitely the path forward.  On the other hand, I don't want to substantially harm adoption or use of LLVM by adding another burden to building and developing it.

If doing this would be a big problem for you, please speak up, and explain how/when the problem can be resolved.  We will certainly adopt C++'11 features someday, so even if it isn't soon, it is good to have the discussion to find out what the issues are.

-Chris


_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Reed Kotler
On 01/08/2013 03:45 PM, Chris Lattner wrote:

> It's seems like a quiet and peaceful day, lets stir things up a bit :)
>
> How crazy would it be for us to start using basic C++'11 language features (but not C++'11 library features) in LLVM: things like auto, rvalue-refs, lambdas, etc?  I think that we can keep things well defined with a few simple requirements: language features must be supported by MSVC 2010 and later, some version of GCC and later (linux folks should pick?), some version of Clang and later (Freebsd folks?).
>
> On the one hand, this would greatly clean up code and is definitely the path forward.  On the other hand, I don't want to substantially harm adoption or use of LLVM by adding another burden to building and developing it.
>
> If doing this would be a big problem for you, please speak up, and explain how/when the problem can be resolved.  We will certainly adopt C++'11 features someday, so even if it isn't soon, it is good to have the discussion to find out what the issues are.
>
> -Chris
>
How about being able to use RTTI and exceptions? (stir, stir...)

Reed
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Eli Friedman-2
On Tue, Jan 8, 2013 at 3:54 PM, Reed Kotler <[hidden email]> wrote:

> On 01/08/2013 03:45 PM, Chris Lattner wrote:
>>
>> It's seems like a quiet and peaceful day, lets stir things up a bit :)
>>
>> How crazy would it be for us to start using basic C++'11 language features
>> (but not C++'11 library features) in LLVM: things like auto, rvalue-refs,
>> lambdas, etc?  I think that we can keep things well defined with a few
>> simple requirements: language features must be supported by MSVC 2010 and
>> later, some version of GCC and later (linux folks should pick?), some
>> version of Clang and later (Freebsd folks?).
>>
>> On the one hand, this would greatly clean up code and is definitely the
>> path forward.  On the other hand, I don't want to substantially harm
>> adoption or use of LLVM by adding another burden to building and developing
>> it.
>>
>> If doing this would be a big problem for you, please speak up, and explain
>> how/when the problem can be resolved.  We will certainly adopt C++'11
>> features someday, so even if it isn't soon, it is good to have the
>> discussion to find out what the issues are.
>>
>> -Chris
>>
> How about being able to use RTTI and exceptions? (stir, stir...)

Please don't discuss RTTI/exceptions in this thread.  All the
compilers which can compile LLVM already support both RTTI and
exceptions to a usable level; we don't use them for other reasons.

-Eli
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

dag-7
In reply to this post by Reed Kotler
Reed Kotler <[hidden email]> writes:

> How about being able to use RTTI and exceptions? (stir, stir...)

+1.  RAII is super important.

                                  -David
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Sean Silva
In reply to this post by Chris Lattner-2
On Tue, Jan 8, 2013 at 6:45 PM, Chris Lattner <[hidden email]> wrote:
> some version of GCC and later (linux folks should pick?)

4.6 is the official compiler on Ubuntu 12.04 (released 04/2012), which
is the latest Long Term Support release (which come out every 2 years,
with 3 years desktop support and 5 years server support), so I
wouldn't push farther than that on Linux for the time being.



Another thing to bring up is that we have a lot of classes which have
method pairs `foo_begin()` and `foo_end()` (e.g.
`Function::arg_{begin,end}()`). These don't play nice with range-for
loops (we are already seeing this come up in LLD). We probably should
adopt some lightweight "range" class and a naming convention
(`foo_all()`?) that will interact well with range-for. jyasskin, you
have some standards proposals for such a class, maybe you could try
bringing that into tree?

-- Sean Silva
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

dag-7
In reply to this post by Chris Lattner-2
Chris Lattner <[hidden email]> writes:

> It's seems like a quiet and peaceful day, lets stir things up a bit :)
>
> How crazy would it be for us to start using basic C++'11 language
> features (but not C++'11 library features) in LLVM: things like auto,
> rvalue-refs, lambdas, etc?  I think that we can keep things well
> defined with a few simple requirements: language features must be
> supported by MSVC 2010 and later, some version of GCC and later (linux
> folks should pick?), some version of Clang and later (Freebsd folks?).

Note that this is NOT an official message from Cray in any way, shape or
form.  I've passed on your note to our group for information but I don't
expect a serious problem with this given enough lead time.

I am personally very much in favor of this.  C++11 really is a huge leap
from C++03 in terms of readability, maintainability and safety.

Why not C++11 libraries?  Implementation/capatability reasons?  I don't
know anything about how the various implementation compare in terms of
completeness.  But the libraries use the new language features and
theoretically you get a performance boost "for free."

I'm assuming we wouldn't release an llvm with C++11 until 3.4 at least
which gives folks a good 8 months to a year to prepare.  Doing it in a
3.3 release shortens that considerably but it might be ok.  The biggest
issue for groups like ours is upgrading the compiler we use to build our
compiler.  We have a LOT of components and they all have to work with
the new build environment.  It involves a lot of testing and assurance
which is where we might bump up against a 3.3 release, not having a new
compiler in place before 3.3 is out.

As for gcc version, it looks like 4.7.2 is in Debian Wheezy and that's
usually the most common distribution to lag behind in these kinds of
things.  I think that's sufficiently new for Linux but someone correct
me if that's wrong.

                              -David
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Jeffrey Yasskin-2
In reply to this post by Sean Silva
On Tue, Jan 8, 2013 at 4:17 PM, Sean Silva <[hidden email]> wrote:

> On Tue, Jan 8, 2013 at 6:45 PM, Chris Lattner <[hidden email]> wrote:
>> some version of GCC and later (linux folks should pick?)
>
> 4.6 is the official compiler on Ubuntu 12.04 (released 04/2012), which
> is the latest Long Term Support release (which come out every 2 years,
> with 3 years desktop support and 5 years server support), so I
> wouldn't push farther than that on Linux for the time being.
>
>
>
> Another thing to bring up is that we have a lot of classes which have
> method pairs `foo_begin()` and `foo_end()` (e.g.
> `Function::arg_{begin,end}()`). These don't play nice with range-for
> loops (we are already seeing this come up in LLD). We probably should
> adopt some lightweight "range" class and a naming convention
> (`foo_all()`?) that will interact well with range-for. jyasskin, you
> have some standards proposals for such a class, maybe you could try
> bringing that into tree?

The C++ proposal changes rapidly. While it would be great to get usage
experience from LLVM in order to inform the C++ proposal, I don't have
"what will eventually be in C++" to propose for LLVM. Well, I'd expect
some "range<IteratorType>" template with .begin() and .end() methods,
but I don't even know what name that template will have.

I'm not sure this part of the discussion is on-topic for Chris's
thread, since it's not related to a potential problem with enabling
C++ language features. (Not having a range type doesn't make
range-based for loops fail to compile on some platform, it just makes
them slightly less useful.)

Jeffrey
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

dag-7
In reply to this post by Sean Silva
Sean Silva <[hidden email]> writes:

> On Tue, Jan 8, 2013 at 6:45 PM, Chris Lattner <[hidden email]> wrote:
>> some version of GCC and later (linux folks should pick?)
>
> 4.6 is the official compiler on Ubuntu 12.04 (released 04/2012), which
> is the latest Long Term Support release (which come out every 2 years,
> with 3 years desktop support and 5 years server support), so I
> wouldn't push farther than that on Linux for the time being.

Does 4.6 work sufficiently for C++11?  I haven't used it in quite a
while.

> Another thing to bring up is that we have a lot of classes which have
> method pairs `foo_begin()` and `foo_end()` (e.g.
> `Function::arg_{begin,end}()`). These don't play nice with range-for
> loops (we are already seeing this come up in LLD). We probably should
> adopt some lightweight "range" class and a naming convention
> (`foo_all()`?) that will interact well with range-for. jyasskin, you
> have some standards proposals for such a class, maybe you could try
> bringing that into tree?

+1.  I've done this in my own code and it is so very nice.  :)

                             -David
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Joerg Sonnenberger
In reply to this post by Chris Lattner-2
On Tue, Jan 08, 2013 at 03:45:52PM -0800, Chris Lattner wrote:
> How crazy would it be for us to start using basic C++'11 language
> features (but not C++'11 library features) in LLVM: things like auto,
> rvalue-refs, lambdas, etc?  I think that we can keep things well
> defined with a few simple requirements: language features must be
> supported by MSVC 2010 and later, some version of GCC and later (linux
> folks should pick?), some version of Clang and later (Freebsd folks?).

From a NetBSD perspective, the real big issue is bootstrapping the
compiler. Natively, that would mean supporting GCC 4.1 and 4.5,
disabling optimisation is acceptable. FreeBSD likely wants to add GCC
4.2 to that last.

Joerg
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Sean Silva
In reply to this post by Jeffrey Yasskin-2
On Tue, Jan 8, 2013 at 7:26 PM, Jeffrey Yasskin <[hidden email]> wrote:
> The C++ proposal changes rapidly. While it would be great to get usage
> experience from LLVM in order to inform the C++ proposal, I don't have
> "what will eventually be in C++" to propose for LLVM. Well, I'd expect
> some "range<IteratorType>" template with .begin() and .end() methods,
> but I don't even know what name that template will have.

Ah, I wasn't aware that it wasn't mostly stabilized. As you pointed
out, this isn't critical, so we don't need to rush it then.

> I'm not sure this part of the discussion is on-topic for Chris's
> thread, since it's not related to a potential problem with enabling
> C++ language features. (Not having a range type doesn't make
> range-based for loops fail to compile on some platform, it just makes
> them slightly less useful.)

It's not critical. That was mostly a side note about the "code
cleanup" aspect of Chris's message. It has come up during LLD
development so I though it might be worth putting out there.

-- Sean Silva
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Krzysztof Parzyszek
In reply to this post by Chris Lattner-2
On 1/8/2013 5:45 PM, Chris Lattner wrote:
>
>some version of Clang and later (Freebsd folks?).

FreeBSD 9.1 uses GCC 4.2.1 and Clang 3.0, although I have some doubts
about the clang, at least on PPC32.  Trunk clang compiled with the
system clang crashes on code that the same trunk clang compiles fine
when built with gcc.  It may as well be a source problem in trunk though...

-Krzysztof


--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Óscar Fuentes
In reply to this post by dag-7
<[hidden email]> writes:

>> 4.6 is the official compiler on Ubuntu 12.04 (released 04/2012), which
>> is the latest Long Term Support release (which come out every 2 years,
>> with 3 years desktop support and 5 years server support), so I
>> wouldn't push farther than that on Linux for the time being.
>
> Does 4.6 work sufficiently for C++11?  I haven't used it in quite a
> while.

I've been using gcc 4.6 on Kubuntu 12.04 until 12.10 came out, and it
dealed with the features Chris mentioned without problem.

auto alone is a huge readability aid and is supported since gcc version
4.4.

On this table compiler support for C++11 features is shown with the
respective versions:

http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Justin Holewinski-2
In reply to this post by Sean Silva
The main issue I see is for users who are stuck on ancient compilers for historical/dependency reasons.  I know of build systems that still use Ubuntu 8.04 and Red Hat Enterprise 4, because the effort to convert outweighs the current benefits.

That said, I would be very much in favor of introducing C++11, provided a compiler baseline is well established.  I agree with Sean that GCC 4.6 is the latest we could reasonably go.


On Tue, Jan 8, 2013 at 7:37 PM, Sean Silva <[hidden email]> wrote:
On Tue, Jan 8, 2013 at 7:26 PM, Jeffrey Yasskin <[hidden email]> wrote:
> The C++ proposal changes rapidly. While it would be great to get usage
> experience from LLVM in order to inform the C++ proposal, I don't have
> "what will eventually be in C++" to propose for LLVM. Well, I'd expect
> some "range<IteratorType>" template with .begin() and .end() methods,
> but I don't even know what name that template will have.

Ah, I wasn't aware that it wasn't mostly stabilized. As you pointed
out, this isn't critical, so we don't need to rush it then.

> I'm not sure this part of the discussion is on-topic for Chris's
> thread, since it's not related to a potential problem with enabling
> C++ language features. (Not having a range type doesn't make
> range-based for loops fail to compile on some platform, it just makes
> them slightly less useful.)

It's not critical. That was mostly a side note about the "code
cleanup" aspect of Chris's message. It has come up during LLD
development so I though it might be worth putting out there.

-- Sean Silva
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev



--

Thanks,

Justin Holewinski

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Marc J. Driftmeyer
In reply to this post by dag-7
Seeing as I'm using OS X and Debian Sid which is on GCC 4.7.2-5 which moved over to Wheezy for Debian 7 release it seems more reasonable to target that than using Ubuntu's 4.6.x which is never more conservative than Debian on releases.

- Marc

P.S. I'm more interested in actually seeing if this will improve an actual smooth installation of libc++ with llvm/clang/compiler-rt trunk so I can actually start using libc++ on Linux and not have to hack around to get it working. Get that going and I'm sure with Debian's dual FreeBSD/Linux building of Deb packages with LLVM/Clang you'll get plenty of community testing.


On 01/08/2013 04:24 PM, [hidden email] wrote:
Chris Lattner [hidden email] writes:

It's seems like a quiet and peaceful day, lets stir things up a bit :)

How crazy would it be for us to start using basic C++'11 language
features (but not C++'11 library features) in LLVM: things like auto,
rvalue-refs, lambdas, etc?  I think that we can keep things well
defined with a few simple requirements: language features must be
supported by MSVC 2010 and later, some version of GCC and later (linux
folks should pick?), some version of Clang and later (Freebsd folks?).
Note that this is NOT an official message from Cray in any way, shape or
form.  I've passed on your note to our group for information but I don't
expect a serious problem with this given enough lead time.

I am personally very much in favor of this.  C++11 really is a huge leap
from C++03 in terms of readability, maintainability and safety.

Why not C++11 libraries?  Implementation/capatability reasons?  I don't
know anything about how the various implementation compare in terms of
completeness.  But the libraries use the new language features and
theoretically you get a performance boost "for free."

I'm assuming we wouldn't release an llvm with C++11 until 3.4 at least
which gives folks a good 8 months to a year to prepare.  Doing it in a
3.3 release shortens that considerably but it might be ok.  The biggest
issue for groups like ours is upgrading the compiler we use to build our
compiler.  We have a LOT of components and they all have to work with
the new build environment.  It involves a lot of testing and assurance
which is where we might bump up against a 3.3 release, not having a new
compiler in place before 3.3 is out.

As for gcc version, it looks like 4.7.2 is in Debian Wheezy and that's
usually the most common distribution to lag behind in these kinds of
things.  I think that's sufficiently new for Linux but someone correct
me if that's wrong.

                              -David
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

--
Marc J. Driftmeyer
Email :: [hidden email]
Web :: http://www.reanimality.com
Cell :: (509) 435-5212

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

mjd.vcf (434 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Justin Holewinski-2

On Tue, Jan 8, 2013 at 8:39 PM, Marc J. Driftmeyer <[hidden email]> wrote:
Seeing as I'm using OS X and Debian Sid which is on GCC 4.7.2-5 which moved over to Wheezy for Debian 7 release it seems more reasonable to target that than using Ubuntu's 4.6.x which is never more conservative than Debian on releases.

So you're saying targetting 4.7 is more conservative than 4.6?
 

- Marc

P.S. I'm more interested in actually seeing if this will improve an actual smooth installation of libc++ with llvm/clang/compiler-rt trunk so I can actually start using libc++ on Linux and not have to hack around to get it working. Get that going and I'm sure with Debian's dual FreeBSD/Linux building of Deb packages with LLVM/Clang you'll get plenty of community testing.



On 01/08/2013 04:24 PM, [hidden email] wrote:
Chris Lattner [hidden email] writes:

It's seems like a quiet and peaceful day, lets stir things up a bit :)

How crazy would it be for us to start using basic C++'11 language
features (but not C++'11 library features) in LLVM: things like auto,
rvalue-refs, lambdas, etc?  I think that we can keep things well
defined with a few simple requirements: language features must be
supported by MSVC 2010 and later, some version of GCC and later (linux
folks should pick?), some version of Clang and later (Freebsd folks?).
Note that this is NOT an official message from Cray in any way, shape or
form.  I've passed on your note to our group for information but I don't
expect a serious problem with this given enough lead time.

I am personally very much in favor of this.  C++11 really is a huge leap
from C++03 in terms of readability, maintainability and safety.

Why not C++11 libraries?  Implementation/capatability reasons?  I don't
know anything about how the various implementation compare in terms of
completeness.  But the libraries use the new language features and
theoretically you get a performance boost "for free."

I'm assuming we wouldn't release an llvm with C++11 until 3.4 at least
which gives folks a good 8 months to a year to prepare.  Doing it in a
3.3 release shortens that considerably but it might be ok.  The biggest
issue for groups like ours is upgrading the compiler we use to build our
compiler.  We have a LOT of components and they all have to work with
the new build environment.  It involves a lot of testing and assurance
which is where we might bump up against a 3.3 release, not having a new
compiler in place before 3.3 is out.

As for gcc version, it looks like 4.7.2 is in Debian Wheezy and that's
usually the most common distribution to lag behind in these kinds of
things.  I think that's sufficiently new for Linux but someone correct
me if that's wrong.

                              -David
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

--
Marc J. Driftmeyer
Email :: [hidden email]
Web :: http://www.reanimality.com
Cell :: <a href="tel:%28509%29%20435-5212" value="+15094355212" target="_blank">(509) 435-5212

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




--

Thanks,

Justin Holewinski

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Chris Lattner-2
In reply to this post by Jeffrey Yasskin-2
On Jan 8, 2013, at 4:26 PM, Jeffrey Yasskin <[hidden email]> wrote:

>> Another thing to bring up is that we have a lot of classes which have
>> method pairs `foo_begin()` and `foo_end()` (e.g.
>> `Function::arg_{begin,end}()`). These don't play nice with range-for
>> loops (we are already seeing this come up in LLD). We probably should
>> adopt some lightweight "range" class and a naming convention
>> (`foo_all()`?) that will interact well with range-for. jyasskin, you
>> have some standards proposals for such a class, maybe you could try
>> bringing that into tree?
>
> The C++ proposal changes rapidly. While it would be great to get usage
> experience from LLVM in order to inform the C++ proposal, I don't have
> "what will eventually be in C++" to propose for LLVM. Well, I'd expect
> some "range<IteratorType>" template with .begin() and .end() methods,
> but I don't even know what name that template will have.
>
> I'm not sure this part of the discussion is on-topic for Chris's
> thread, since it's not related to a potential problem with enabling
> C++ language features. (Not having a range type doesn't make
> range-based for loops fail to compile on some platform, it just makes
> them slightly less useful.)

One other specific problem with this is that (I'm told) MSVC 2010 doesn't support range-based for loops.  I don't think it is reasonable to require windows users to be on MSVC 2012.  :-(

-Chris
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Chris Lattner-2
In reply to this post by dag-7
On Jan 8, 2013, at 4:24 PM, [hidden email] wrote:
> I am personally very much in favor of this.  C++11 really is a huge leap
> from C++03 in terms of readability, maintainability and safety.

I agree completely.

> Why not C++11 libraries?  Implementation/capatability reasons?  I don't
> know anything about how the various implementation compare in terms of
> completeness.  But the libraries use the new language features and
> theoretically you get a performance boost "for free."

It's mostly about only changing one thing at a time.  It's already possible to build LLVM in C++'11 mode and with a C++'11 library.  Adding a dependency to *require* C++'11 compiler and/or C++'11 library are two orthogonal changes, and I'd like to tackle them one at a time.
 

> I'm assuming we wouldn't release an llvm with C++11 until 3.4 at least
> which gives folks a good 8 months to a year to prepare.  Doing it in a
> 3.3 release shortens that considerably but it might be ok.  The biggest
> issue for groups like ours is upgrading the compiler we use to build our
> compiler.  We have a LOT of components and they all have to work with
> the new build environment.  It involves a lot of testing and assurance
> which is where we might bump up against a 3.3 release, not having a new
> compiler in place before 3.3 is out.
>
> As for gcc version, it looks like 4.7.2 is in Debian Wheezy and that's
> usually the most common distribution to lag behind in these kinds of
> things.  I think that's sufficiently new for Linux but someone correct
> me if that's wrong.

Wow, requiring GCC 4.7 would be really aggressive, it was just released in March 2012.  Call me conservative, but I was thinking that a reasonable GCC baseline would be GCC 4.4 or something (which is ~3.5 years old).

-Chris

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Richard Smith-33
In reply to this post by Chris Lattner-2
On Tue, Jan 8, 2013 at 6:23 PM, Chris Lattner <[hidden email]> wrote:

> On Jan 8, 2013, at 4:26 PM, Jeffrey Yasskin <[hidden email]> wrote:
>>> Another thing to bring up is that we have a lot of classes which have
>>> method pairs `foo_begin()` and `foo_end()` (e.g.
>>> `Function::arg_{begin,end}()`). These don't play nice with range-for
>>> loops (we are already seeing this come up in LLD). We probably should
>>> adopt some lightweight "range" class and a naming convention
>>> (`foo_all()`?) that will interact well with range-for. jyasskin, you
>>> have some standards proposals for such a class, maybe you could try
>>> bringing that into tree?
>>
>> The C++ proposal changes rapidly. While it would be great to get usage
>> experience from LLVM in order to inform the C++ proposal, I don't have
>> "what will eventually be in C++" to propose for LLVM. Well, I'd expect
>> some "range<IteratorType>" template with .begin() and .end() methods,
>> but I don't even know what name that template will have.
>>
>> I'm not sure this part of the discussion is on-topic for Chris's
>> thread, since it's not related to a potential problem with enabling
>> C++ language features. (Not having a range type doesn't make
>> range-based for loops fail to compile on some platform, it just makes
>> them slightly less useful.)
>
> One other specific problem with this is that (I'm told) MSVC 2010 doesn't support range-based for loops.  I don't think it is reasonable to require windows users to be on MSVC 2012.  :-(

I suspect you're right about that, but I'd appreciate if some MSVC
users would speak up here. We shouldn't hold back on using range-based
for loops if all our MSVC users are happy to move to MSVC 2012
(assuming no problems with other platforms).
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Karen Shaeffer
In reply to this post by Chris Lattner-2
On Tue, Jan 08, 2013 at 06:30:42PM -0800, Chris Lattner wrote:
> On Jan 8, 2013, at 4:24 PM, [hidden email] wrote:
> > I am personally very much in favor of this.  C++11 really is a huge leap
> > from C++03 in terms of readability, maintainability and safety.
>
> I agree completely.

> >
> > As for gcc version, it looks like 4.7.2 is in Debian Wheezy and that's
> > usually the most common distribution to lag behind in these kinds of
> > things.  I think that's sufficiently new for Linux but someone correct
> > me if that's wrong.
>
> Wow, requiring GCC 4.7 would be really aggressive, it was just released in March 2012.  Call me conservative, but I was thinking that a reasonable GCC baseline would be GCC 4.4 or something (which is ~3.5 years old).

Hi,
I was running Ubuntu 12.4, but I bumped up to 12.10. This was because 12.10 runs
gcc-4.7.2. I have a reasonable code base that compiled fine in upgrading from
 4.6(-std=c++0x) to 4.7.2(-std=c++11).

IMO, with linux based systems, it is always safest to stay just a little off the
bleeding edge. Bugs tend to get fixed very quickly, once identified. And then you
have the advantage of the latest features. All things considered, I suspect all the
energy is in 4.7.2 and forward in the context of C++ on linux for new implementations.

I am also aware of the way too common problem of folks stuck in a time warp, because
they have dependencies on old libraries that they cannot upgrade. IMO, a development
effort should not slow the pace of feature adoption to support folks who have not
planned for future upgrades in an intelligent manner. Rather than make everyone pay
the price for such groups, there ought to be a way for them to use an older release
of llvm until they figure out how to upgrade.

I recommend targeting 4.7.2 or later, because all new C++ code on linux is surely
going down that path. You can inconvenience the laggards, or you can turn away the
folks leading the way with new implementations. But you can't satisfy both.

Karen
--
Karen Shaeffer
Neuralscape, Mountain View, CA 94040
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Using C++'11 language features in LLVM itself

Peter Newman
In reply to this post by Richard Smith-33
>> One other specific problem with this is that (I'm told) MSVC 2010 doesn't support range-based for loops.  I don't think it is reasonable to require windows users to be on MSVC 2012.  :-(
> I suspect you're right about that, but I'd appreciate if some MSVC
> users would speak up here. We shouldn't hold back on using range-based
> for loops if all our MSVC users are happy to move to MSVC 2012
> (assuming no problems with other platforms).
>
For our works project, we are still stuck on MSVC 2005 and MSVC 2010
(our software is a binary plugin to established products). Admittedly,
we are still sitting on LLVM 2.8 with patches from 2.9 (2.9 wouldn't
compile in MSVC 2010 for x64) . We want to move to current LLVM (not
least for the NVPTX and AMDIL targets), but have not yet had the
available man hours to do so.

Peter N
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
123