<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.3.2">
</HEAD>
<BODY>
Evan,<BR>
<BR>
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. Since we don't have that situation in LLVM, using the various Casting.h facilities allows all that "dynamic" casting to actually be done statically, hence no runtime performance penalty.<BR>
<BR>
If you wonder why LLVM is fast .. this is just one of the many reasons.<BR>
<BR>
Reid.<BR>
<BR>
On Thu, 2005-04-21 at 21:34 -0400, Evan Jones wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">I see a bunch of definitions scattered throughout LLVM, and I could not</FONT>
<FONT COLOR="#000000">find good documentation on them. I don't understand why they exist when</FONT>
<FONT COLOR="#000000">LLVM is being compiled with RTTI enabled. It seems to me that:</FONT>

<FONT COLOR="#000000">isa<T>(x) is a substitute for (dynamic_cast<T>(x) != NULL)</FONT>

<FONT COLOR="#000000">and there are some other similar casting tools defined in Casting.h. Why</FONT>
<FONT COLOR="#000000">should I use these instead of C++'s built-in features?</FONT>

<FONT COLOR="#000000">Evan Jones</FONT>


<FONT COLOR="#000000">_______________________________________________</FONT>
<FONT COLOR="#000000">LLVM Developers mailing list</FONT>
<FONT COLOR="#000000"><A HREF="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</A>         <A HREF="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</A></FONT>
<FONT COLOR="#000000"><A HREF="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev</A></FONT>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>