[LLVMdev] questions

Chris Lattner sabre at nondot.org
Tue Sep 17 12:17:00 PDT 2002


> What is the difference between getType and getElementType?
> >> dyn_cast<StructType>(PT->getType()))
> >> dyn_cast<StructType>(PT->getElementType()))
> Please bear me if my question is too stupid, I just started
> and got so frustrated by the details.

getType() is a member of the Value class, it returns an instance of Type
that tells you what type a value is (okay, that's annoyingly circular, I
hope it makes sense).

getElementType() is a member of the PointerType class that returns the
type the pointer wraps.  So on an 'int*', it will return 'int'.

> >> I assume that, since "mystru" isn't being used as specified
> in rules
> >> U1-U3, that we shouldn't have to handle it...
> >> But I could be wrong...
> Does our code need to actually read throught the code to see
> if every usage of the pointer is in U1-U3? If we need to do
> that, how can we do it since our code can only run on each
> function and cannot run on the whole file at the same time.

Yes.  You loop over the use of the alloca, see that there is a call on the
use list, and bail out.

-Chris

http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list