(IIIT) Siddharth Bhat via llvm-dev
2017-Aug-17 06:53 UTC
[llvm-dev] Inst->replaceAllUsesWith and uses in ConstantExpr
I see. Is there a pre-existing way to do this in LLVM? Cheers, ~Siddharth. On Thu, 17 Aug 2017 at 02:12 Craig Topper <craig.topper at gmail.com> wrote:> ConstantExprs are immutable, they can't be changed once they are created. > And a ConstantExpr can reference other ConstantExprs. So replacing all uses > of a Value in a ConstantExpr would require creating a new immutable object > for each ConstantExpr that references the one you're changing. And that > would continue rippling outward. > > ~Craig > > On Wed, Aug 16, 2017 at 5:01 PM, (IIIT) Siddharth Bhat via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Whoops, sorry, I meant "value->replaceAllUsesWith". >> >> Should I create a new post with an updated title? >> >> Thanks >> Siddharth >> >> On Thu 17 Aug, 2017, 01:05 Tim Northover <t.p.northover at gmail.com> wrote: >> >>> On 16 August 2017 at 15:39, (IIIT) Siddharth Bhat via llvm-dev >>> <llvm-dev at lists.llvm.org> wrote: >>> > From what I have observed, using `Inst->replaceAllUsesWith` does not >>> replace >>> > uses of the `Inst` in `ConstantExpr`s. Is there some way to have a >>> universal >>> > replaceAllUsesWith? >>> >>> Where are you seeing instructions used in ConstantExprs? That sounds >>> really dodgy to me. Instructions are horribly non-Constant so I'd have >>> thought it would be banned (even for technically plausible things like >>> "and(i32 %inst, 0)"). >>> >>> Cheers. >>> >>> Tim. >>> >> -- >> Sending this from my phone, please excuse any typos! >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> > --Sending this from my phone, please excuse any typos! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170817/58162388/attachment.html>
Nemanja Ivanovic via llvm-dev
2017-Aug-17 08:22 UTC
[llvm-dev] Inst->replaceAllUsesWith and uses in ConstantExpr
Siddarth, Perhaps to provide a short explanation why you want to RAUW ConstantExpr's. Then others are likely to be able to provide you with more useful feedback for how you can accomplish your goal. On Thu, Aug 17, 2017 at 8:53 AM, (IIIT) Siddharth Bhat via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I see. Is there a pre-existing way to do this in LLVM? > > Cheers, > ~Siddharth. > > On Thu, 17 Aug 2017 at 02:12 Craig Topper <craig.topper at gmail.com> wrote: > >> ConstantExprs are immutable, they can't be changed once they are created. >> And a ConstantExpr can reference other ConstantExprs. So replacing all uses >> of a Value in a ConstantExpr would require creating a new immutable object >> for each ConstantExpr that references the one you're changing. And that >> would continue rippling outward. >> >> ~Craig >> >> On Wed, Aug 16, 2017 at 5:01 PM, (IIIT) Siddharth Bhat via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> >>> Whoops, sorry, I meant "value->replaceAllUsesWith". >>> >>> Should I create a new post with an updated title? >>> >>> Thanks >>> Siddharth >>> >>> On Thu 17 Aug, 2017, 01:05 Tim Northover <t.p.northover at gmail.com> >>> wrote: >>> >>>> On 16 August 2017 at 15:39, (IIIT) Siddharth Bhat via llvm-dev >>>> <llvm-dev at lists.llvm.org> wrote: >>>> > From what I have observed, using `Inst->replaceAllUsesWith` does not >>>> replace >>>> > uses of the `Inst` in `ConstantExpr`s. Is there some way to have a >>>> universal >>>> > replaceAllUsesWith? >>>> >>>> Where are you seeing instructions used in ConstantExprs? That sounds >>>> really dodgy to me. Instructions are horribly non-Constant so I'd have >>>> thought it would be banned (even for technically plausible things like >>>> "and(i32 %inst, 0)"). >>>> >>>> Cheers. >>>> >>>> Tim. >>>> >>> -- >>> Sending this from my phone, please excuse any typos! >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> llvm-dev at lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>> >>> >> -- > Sending this from my phone, please excuse any typos! > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170817/8364e8d4/attachment.html>
via llvm-dev
2017-Aug-17 09:12 UTC
[llvm-dev] Backend for Instruction List (IL) according to 61131-3
Hello, does anybody know about a backend for IL according to 61131-3? If there is no, what do you think, is it technically possible to write one and how much effort does this mean? I'm new to all this stuff of llvm and so on, but it seems for me that IL is quite similar to assembler. Best Regards Alx -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170817/437e3160/attachment.html>
(IIIT) Siddharth Bhat via llvm-dev
2017-Aug-17 19:01 UTC
[llvm-dev] Inst->replaceAllUsesWith and uses in ConstantExpr
Sure. Essentially, I'm trying to replace malloc and free with custom variants of these calls. However, in certain situations, we receive these calls within bitcasts, for example, call void bitcast (void (i8*)* @free to void (%struct.fson_string*)*) (%struct.fson_string* %13) #2 A simple replaceAllUsesWith is not going to work, because the @free is within a bitcast, which is a ConstantExpr. Unless I did something wrong, this particular occurence of @free was not replaced even when I called replaceAllUsesOf on the @free object. I currently have a really hacky way of achieving this: I expand every ConstantExpr that uses this Value into Instructions, on which I then call replaceUsesOfWith. However, a neater solution would be appreciated. Cheers, Siddharth. On Thu, 17 Aug 2017 at 10:22 Nemanja Ivanovic via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Siddarth, > Perhaps to provide a short explanation why you want to RAUW > ConstantExpr's. Then others are likely to be able to provide you with more > useful feedback for how you can accomplish your goal. > > On Thu, Aug 17, 2017 at 8:53 AM, (IIIT) Siddharth Bhat via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> I see. Is there a pre-existing way to do this in LLVM? >> >> Cheers, >> ~Siddharth. >> >> On Thu, 17 Aug 2017 at 02:12 Craig Topper <craig.topper at gmail.com> wrote: >> >>> ConstantExprs are immutable, they can't be changed once they are >>> created. And a ConstantExpr can reference other ConstantExprs. So replacing >>> all uses of a Value in a ConstantExpr would require creating a new >>> immutable object for each ConstantExpr that references the one you're >>> changing. And that would continue rippling outward. >>> >>> ~Craig >>> >>> On Wed, Aug 16, 2017 at 5:01 PM, (IIIT) Siddharth Bhat via llvm-dev < >>> llvm-dev at lists.llvm.org> wrote: >>> >>>> Whoops, sorry, I meant "value->replaceAllUsesWith". >>>> >>>> Should I create a new post with an updated title? >>>> >>>> Thanks >>>> Siddharth >>>> >>>> On Thu 17 Aug, 2017, 01:05 Tim Northover <t.p.northover at gmail.com> >>>> wrote: >>>> >>>>> On 16 August 2017 at 15:39, (IIIT) Siddharth Bhat via llvm-dev >>>>> <llvm-dev at lists.llvm.org> wrote: >>>>> > From what I have observed, using `Inst->replaceAllUsesWith` does not >>>>> replace >>>>> > uses of the `Inst` in `ConstantExpr`s. Is there some way to have a >>>>> universal >>>>> > replaceAllUsesWith? >>>>> >>>>> Where are you seeing instructions used in ConstantExprs? That sounds >>>>> really dodgy to me. Instructions are horribly non-Constant so I'd have >>>>> thought it would be banned (even for technically plausible things like >>>>> "and(i32 %inst, 0)"). >>>>> >>>>> Cheers. >>>>> >>>>> Tim. >>>>> >>>> -- >>>> Sending this from my phone, please excuse any typos! >>>> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> llvm-dev at lists.llvm.org >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >>>> >>>> >>> -- >> Sending this from my phone, please excuse any typos! >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Sending this from my phone, please excuse any typos! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170817/d60ec60e/attachment.html>