[patch] Verify that a GlobalAlias has no section or alignment.

Nick Lewycky nicholas at mxc.ca
Thu Feb 13 23:50:40 PST 2014


Reid Kleckner wrote:
> The more correct design would probably be to have some kind of hierarchy
> like:
>
> Constant : Value

Constant : User. Don't forget ConstantExpr.

> GlobalValue : Constant  # has linkage, vis, etc
> GlobalAlias : GlobalValue
> RealGlobalValue : GlobalValue  # has section and alignment
> Function : RealGlobalValue
> GlobalVariable : RealGlobalValue
>
> It's not clear to me that it's worth it, but we should probably get more
> input.

So I'd like to generalize. We have this problem all over llvm. For 
instance, Value has name ... but some values can't be named, such as 
ConstantInt's. Constants are users, but not all constants can have 
operands such as Functions or ConstantInt's again. We also have some 
operations that are "possibly exact" and "overflowing binary operator" 
which are currently modeled as Operators. What we really want is 
mix-ins, except that we've avoided it because of the complexity; we want 
llvm to be made of simple C++, generally.

Nick

> On Thu, Feb 13, 2014 at 10:15 AM, Reid Kleckner <rnk at google.com
> <mailto:rnk at google.com>> wrote:
>
>     lgtm
>
>
>     On Thu, Feb 13, 2014 at 8:39 AM, Rafael EspĂ­ndola
>     <rafael.espindola at gmail.com <mailto:rafael.espindola at gmail.com>> wrote:
>
>         On 13 February 2014 00:30, Rafael EspĂ­ndola
>         <rafael.espindola at gmail.com <mailto:rafael.espindola at gmail.com>>
>         wrote:
>          > On 12 February 2014 22:23, Reid Kleckner <rnk at google.com
>         <mailto:rnk at google.com>> wrote:
>          >> lgtm, assuming this passes an optimized build of something
>         interesting.
>          >>
>          >> Should we go further and assert(!isa<GlobalAlias>(this) ||
>         S.empty()); in
>          >> GlobalValue::setSection?
>          >
>          > Good point. I can't imagine why some pass would want to set
>         this even
>          > temporarily. We cannot use isa on the header because
>         GlobalAlias is
>          > incomplete there. What do you think of the attached patch? I
>         will try
>          > a clang bootstrap with it tomorrow.
>
>         This passed the bootstrap.
>
>         Cheers,
>         Rafael
>
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list