[LLVMdev] Instruction ctor: insertBefore

Chris Lattner sabre at nondot.org
Thu Jun 24 12:35:02 PDT 2004


On Thu, 24 Jun 2004, Reid Spencer wrote:

> I'm not opposed to mutable and its probably reasonable in this case.
> However, I'd defer to Chris' opinion for anything in VMCore. We try to
> limit the number of changes/additions there because the impact can be
> quite large if something goes wrong.

I don't think that mutable is a good idea.  The idea is that you are
modifying the code that you are inserting the instruction into.  In the
C++ const sense, you are only modifying the next/prev pointers of the
surrounding instructions and autoinsertion of the instruction name into
the function symbol table.

In the logical sense (not just what is being enforced by C++'s const), the
code you are inserting into IS being modified.  As such, I think that
keeping it non-const makes sense.

-Chris


> On Thu, 2004-06-24 at 04:41, Vladimir Prus wrote:
> > Hi Reid,
> >
> > > Instructions are members of a linked list. Consequently if you insert
> > > some Instruction, that instruction gets changed. So, its not const.
> > >
> > > Simple enough?
> >
> > Yes, thank you.
> >
> > I started thinking if "mutable" is right here, but that's long philosophical
> > issue ;-)
> >
> > - Volodya
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-Chris

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




More information about the llvm-dev mailing list