<div class="gmail_quote">On Wed, Sep 23, 2009 at 1:51 PM, Dan Gohman <span dir="ltr"><<a href="mailto:gohman@apple.com">gohman@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
On Sep 22, 2009, at 4:49 PM, Talin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
// Calculate the size of the specified LLVM type.<br>
Constant * DebugInfoBuilder::getSize(const Type * type) {<br>
    Constant * one = ConstantInt::get(Type::Int32Ty, 1);<br>
    return ConstantExpr::getPtrToInt(<br>
        ConstantExpr::getGetElementPtr(<br>
            ConstantPointerNull::get(PointerType::getUnqual(type)),<br>
            &one, 1), Type::Int32Ty);<br>
}<br>
<br>
Constant * DebugInfoBuilder::getAlignment(const Type * type) {<br>
    // Calculates the alignment of T using "sizeof({i8, T}) - sizeof(T)"<br>
    return ConstantExpr::getSub(<br>
        getSize(StructType::get(Type::Int8Ty, type, NULL)),<br>
        getSize(type));<br>
}<br>
</blockquote>
<br></div>
Are ConstantExpr::getAlignOf, getSizeOf, and getOffsetOf what<br>
you're looking for?<br><font color="#888888">
<br></font></blockquote><div>That will work. Now all I need is for the methods of DIFactory to take a Constant* instead of uint64.</div><div><br></div></div>-- <br>-- Talin<br>