Displaying 20 results from an estimated 10000 matches similar to: "[LLVMdev] isa and friends as an alternative to dynamic cast?"
2005 Apr 22
0
[LLVMdev] isa and friends as an alternative to dynamic cast?
Evan,
In case it wasn't obvious from Misha's answer, the main reason for doing
this is speed. RTTI is not very quick. Since LLVM is well contained,
there are no IR classes that LLVM doesn't know about it. Using
dynamic_cast is really only warranted when blending libraries together
that have inheritance relationships between them that aren't known in
one or more of the libraries.
2005 Apr 22
3
[LLVMdev] isa and friends as an alternative to dynamic cast?
On Thu, 2005-21-04 at 19:43 -0700, Reid Spencer wrote:
> In case it wasn't obvious from Misha's answer, the main reason for
> doing this is speed. RTTI is not very quick.
Right. This is why I was somewhat suprized to see the "isa" facilities
included in LLVM without also disabling rtti. It will reduce the memory
footprint a fair bit if you do disable it, at least based on
2012 Oct 05
2
[LLVMdev] TableGen: Requesting feedback for "TGContext"
> It won't cause a negative effect, go for it! Dynamic_cast is realllly slow compared to dyn_cast, it is worth the memory.
Ok, here's the first batch. It converts the RecTy hierarchy over to
use LLVM-style RTTI. Along the way, I also wrote up a new doc "How to
set up LLVM-style RTTI for your class hierarchy", which covers the
previously undocumented (albeit not that
2005 Apr 22
2
[LLVMdev] isa and friends as an alternative to dynamic cast?
On Thu, 21 Apr 2005, Jeff Cohen wrote:
> That's a good point.
I think there are some issues with doing this (e.g. EH doesn't work, so
the very few places we use it would have to be modified), but other than
that I fully support the idea.
-Chris
> Evan Jones wrote:
>
>> On Thu, 2005-21-04 at 19:43 -0700, Reid Spencer wrote:
>>
>>> In case it wasn't
2012 Oct 05
0
[LLVMdev] TableGen: Requesting feedback for "TGContext"
On Oct 4, 2012, at 5:15 PM, Sean Silva <silvas at purdue.edu> wrote:
>> It won't cause a negative effect, go for it! Dynamic_cast is realllly slow compared to dyn_cast, it is worth the memory.
>
> Ok, here's the first batch. It converts the RecTy hierarchy over to
> use LLVM-style RTTI. Along the way, I also wrote up a new doc "How to
> set up LLVM-style
2005 Apr 24
2
[LLVMdev] isa and friends as an alternative to dynamic cast?
As far as I can tell, exceptions work just fine without RTTI when using
gcc 3.4.2. dynamic_cast, on the hand, crashes without RTTI (no
compilation error or warning is generated).
Jeff Cohen wrote:
> This may be the case with GCC, but VC++ allows exception handling to
> be enabled while RTTI is disabled. According to VC++ documentation,
> RTTI is needed only to support
2005 Apr 24
0
[LLVMdev] isa and friends as an alternative to dynamic cast?
My understanding is that EH works fine without RTTI. However, we use
typeid in LLVM in a few limited spots like lib/VMCore/Pass.cpp
Reid.
On Sat, 2005-04-23 at 20:12 -0700, Jeff Cohen wrote:
> As far as I can tell, exceptions work just fine without RTTI when using
> gcc 3.4.2. dynamic_cast, on the hand, crashes without RTTI (no
> compilation error or warning is generated).
>
>
2012 Oct 04
0
[LLVMdev] TableGen: Requesting feedback for "TGContext"
It won't cause a negative effect, go for it! Dynamic_cast is realllly slow compared to dyn_cast, it is worth the memory.
-Chris
On Oct 3, 2012, at 9:39 PM, Sean Silva <silvas at purdue.edu> wrote:
> Thanks for the feedback!
>
>>> Does anybody have anything else they think should go into TGContext or
>>> any other responsibilities it should have? Or any
2012 Oct 04
2
[LLVMdev] TableGen: Requesting feedback for "TGContext"
Thanks for the feedback!
>> Does anybody have anything else they think should go into TGContext or
>> any other responsibilities it should have? Or any feedback about the
>> idea in general?
>
> All memory allocations should go into its bump pointer, RecordKeeper should as well. Any other global state that exist should also.
Sounds good.
>> I'm also hoping
2005 Apr 24
0
[LLVMdev] isa and friends as an alternative to dynamic cast?
This may be the case with GCC, but VC++ allows exception handling to be
enabled while RTTI is disabled. According to VC++ documentation, RTTI
is needed only to support dynamic_cast, the typeid operator, and the
type_info class.
Chris Lattner wrote:
> On Thu, 21 Apr 2005, Jeff Cohen wrote:
>
>> That's a good point.
>
>
> I think there are some issues with doing this
2010 Nov 15
2
[LLVMdev] dyn_cast vs. dynamic_cast
On Nov 12, 2010, at 5:57 PM, Óscar Fuentes wrote:
>> Could someone
>> please explain why I should use dyn_cast instead of dynamic_cast? (I
>> thought all classes have v-tables...) Thanks,
>
> For reducing executable size, LLVM builds with RTTI disabled where
> possible.
Right, but how does that relate to dyn_cast? I thought v-tables were
present even when RTTI is not
2005 Apr 22
0
[LLVMdev] isa and friends as an alternative to dynamic cast?
That's a good point.
Evan Jones wrote:
>On Thu, 2005-21-04 at 19:43 -0700, Reid Spencer wrote:
>
>
>>In case it wasn't obvious from Misha's answer, the main reason for
>>doing this is speed. RTTI is not very quick.
>>
>>
>
>Right. This is why I was somewhat suprized to see the "isa" facilities
>included in LLVM without also
2005 Apr 22
0
[LLVMdev] isa and friends as an alternative to dynamic cast?
> I see a bunch of definitions scattered throughout LLVM, and I could not
> find good documentation on them. I don't understand why they exist when
> LLVM is being compiled with RTTI enabled. It seems to me that:
>
> isa<T>(x) is a substitute for (dynamic_cast<T>(x) != NULL)
Misha seems to have answered your question, but documentation is found
here:
2017 Jun 09
2
Subclassing LLVM Type
This [1] might worth reading, Malhar.
[1] http://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html
2017-06-10 4:12 GMT+08:00 Tim Northover via llvm-dev <
llvm-dev at lists.llvm.org>:
> On 9 June 2017 at 12:03, Jajoo, Malhar via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > Is there some way around this ( without suggesting a change to my entire
> AST ) ?
>
> LLVM
2017 Jul 31
2
RTTI with smart pointers
Hi,
I would like to use std::shared_ptr in my pass. However I'm facing a
problem wrt RTTI. If I have a code like:
std::shared_ptr<BaseClass> x(new DerivedClass());
...
std::shared_ptr<DerivedClass> p =
std::dynamic_pointer_cast<DerivedClass>(x);
It does not compile since the default RTTI infrastructure is not used by
LLVM. Also, it's not clear to me if the
2017 Jun 09
2
Subclassing LLVM Type
Hi,
I was wondering if it was possible to create a Dummy Type by subclassing LLVM Type.
I do not want to create a new type or even do much with this dummy type , all I need
is a placeholder type until I generate IR.
I want to use this approach as most of my AST is already configured to
accept a Type* and not a DummyType* ( which is my own class )
I explored this a bit and did manage to
2010 Nov 13
3
[LLVMdev] dyn_cast vs. dynamic_cast
LLVM has a relatively large number of proprietary replacements for
standard C++ functions and classes. One of these is dyn_cast to
replace dynamic_cast. The two calls appear to be semantically
equivalent; the only difference that I can see is that dyn_cast
reportedly works on classes that have no v-table [1]. Could someone
please explain why I should use dyn_cast instead of dynamic_cast?
2010 Nov 13
0
[LLVMdev] dyn_cast vs. dynamic_cast
Trevor Harmon <Trevor.W.Harmon at nasa.gov> writes:
[snip]
> Could someone
> please explain why I should use dyn_cast instead of dynamic_cast? (I
> thought all classes have v-tables...) Thanks,
For reducing executable size, LLVM builds with RTTI disabled where
possible.
2017 Jun 28
2
Multiple Inheritance with dyn_cast
Hello,
I recently ran into an issue where I wanted to use dyn_cast with a Multiple Inheritance hierarchy. LLVM’s help page on RTTI claims that it can be done, and that Clang’s Decl and DeclContext implement it; however, when I try to use it I run into odd behavior. Here’s my sample code which doesn’t work:
```
struct Base {
void *ptr;
bool hasInfo;
};
struct Info {
int size;
static
2017 May 23
3
Removing "fno-rtti" flag from llvm-config --cxxflags
Hi everyone,
I just had a question -
I am aware that LLVM supports it's own form of RTTI ( using dyn_cast<>() ,etc) but
I wish to use C++ RTTI currently.
I have tried building with "cmake -G "Unix Makefiles" -LLVM_ENABLE_RTTI=ON"
but that doesnt seem to remove the "fno-rtti" flag from llvm-config
and I still get an error when I try using