Just realized that BasicTransformInfoClass is an immutable pass. Not sure how to reconcile this with fact that there will be different answers needed depending on the subtarget. Seems like BasicTansformInfoClass should become a function pass that does not modify anything. On 03/22/2013 09:43 AM, Reed Kotler wrote:> Another way to do this would to be to have a reset virtual function > which is passed the Function, and the address of TLI so that it could be > modified. > > This seems somewhat cleaner. > > The reset virtual function would be added to base class TargetLoweringBase. > > > On 03/22/2013 09:22 AM, reed kotler wrote: >> For being able to change subtargets within a compilation unit, among >> other things, I need to be able to change the target lowering class that >> is used by BasicTTI >> >> For example we have a mips16 and non mips16 version. >> >> On the original call that creates this class, I'd like to pass the >> address of the address of the TargetLoweringBase class. >> >> That way I can insert a function pass before this pass which examines >> the function attributes and changes the pointer. >> >> So we would get: >> >> ImmutablePass * >> llvm::createBasicTargetTransformInfoPass(const TargetLoweringBase >> **TLI_) { >> return new BasicTTI(TLI); >> } >> >> we would add the variable >> >> TargetLoweringBase **TLI_ >> >> and at the beginning of each pass >> >> TLI = *TLI_; >> >> Maybe there is a more elegant way to do this but this is essentially >> what I need to do.
Hi Reed, We will need to reconstruct the target machine and the TTI chain when the function attributes change. We currently don't have code for doing that but I suggest that you talk with Bill Wendling about the best way to implement this. Thanks, Nadav On Mar 22, 2013, at 11:30 AM, Reed Kotler <rkotler at mips.com> wrote:> Just realized that BasicTransformInfoClass is an immutable pass. > > Not sure how to reconcile this with fact that there will be different answers needed depending on the subtarget. > > Seems like BasicTansformInfoClass should become a function pass that does not modify anything. > > On 03/22/2013 09:43 AM, Reed Kotler wrote: >> Another way to do this would to be to have a reset virtual function >> which is passed the Function, and the address of TLI so that it could be >> modified. >> >> This seems somewhat cleaner. >> >> The reset virtual function would be added to base class TargetLoweringBase. >> >> >> On 03/22/2013 09:22 AM, reed kotler wrote: >>> For being able to change subtargets within a compilation unit, among >>> other things, I need to be able to change the target lowering class that >>> is used by BasicTTI >>> >>> For example we have a mips16 and non mips16 version. >>> >>> On the original call that creates this class, I'd like to pass the >>> address of the address of the TargetLoweringBase class. >>> >>> That way I can insert a function pass before this pass which examines >>> the function attributes and changes the pointer. >>> >>> So we would get: >>> >>> ImmutablePass * >>> llvm::createBasicTargetTransformInfoPass(const TargetLoweringBase >>> **TLI_) { >>> return new BasicTTI(TLI); >>> } >>> >>> we would add the variable >>> >>> TargetLoweringBase **TLI_ >>> >>> and at the beginning of each pass >>> >>> TLI = *TLI_; >>> >>> Maybe there is a more elegant way to do this but this is essentially >>> what I need to do. > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130322/e2262deb/attachment.html>
On 03/22/2013 03:22 PM, Nadav Rotem wrote:> Hi Reed, > > We will need to reconstruct the target machine and the TTI chain when > the function attributes change. We currently don't have code for doing > that but I suggest that you talk with Bill Wendling about the best way > to implement this. >Cool. Bill's new attribute work has already made this task much easier for me. I'm willing to contribute to the compiler in this area and any advice is greatly appreciated. If Bill is already scheduled to do this then i can also wait like I did for his attribute work. Reed> Thanks, > Nadav > > On Mar 22, 2013, at 11:30 AM, Reed Kotler <rkotler at mips.com > <mailto:rkotler at mips.com>> wrote: > >> Just realized that BasicTransformInfoClass is an immutable pass. >> >> Not sure how to reconcile this with fact that there will be different >> answers needed depending on the subtarget. >> >> Seems like BasicTansformInfoClass should become a function pass that >> does not modify anything. >> >> On 03/22/2013 09:43 AM, Reed Kotler wrote: >>> Another way to do this would to be to have a reset virtual function >>> which is passed the Function, and the address of TLI so that it could be >>> modified. >>> >>> This seems somewhat cleaner. >>> >>> The reset virtual function would be added to base class >>> TargetLoweringBase. >>> >>> >>> On 03/22/2013 09:22 AM, reed kotler wrote: >>>> For being able to change subtargets within a compilation unit, among >>>> other things, I need to be able to change the target lowering class >>>> that >>>> is used by BasicTTI >>>> >>>> For example we have a mips16 and non mips16 version. >>>> >>>> On the original call that creates this class, I'd like to pass the >>>> address of the address of the TargetLoweringBase class. >>>> >>>> That way I can insert a function pass before this pass which examines >>>> the function attributes and changes the pointer. >>>> >>>> So we would get: >>>> >>>> ImmutablePass * >>>> llvm::createBasicTargetTransformInfoPass(const TargetLoweringBase >>>> **TLI_) { >>>> return new BasicTTI(TLI); >>>> } >>>> >>>> we would add the variable >>>> >>>> TargetLoweringBase **TLI_ >>>> >>>> and at the beginning of each pass >>>> >>>> TLI = *TLI_; >>>> >>>> Maybe there is a more elegant way to do this but this is essentially >>>> what I need to do. >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130322/91127631/attachment.html>
I'm making good progress sorting all of this out. I think that for Mips16/32 I can do what I need without touching target independent code but I'm not done yet so there may be some issues. If my plan works, then I think some of it could be moved into target independent code so that other targets could use it without reinventing the wheel. Most of this would surely be usable by arm/thumb. On 03/22/2013 03:22 PM, Nadav Rotem wrote:> Hi Reed, > > We will need to reconstruct the target machine and the TTI chain when > the function attributes change. We currently don't have code for doing > that but I suggest that you talk with Bill Wendling about the best way > to implement this. > > Thanks, > Nadav > > On Mar 22, 2013, at 11:30 AM, Reed Kotler <rkotler at mips.com > <mailto:rkotler at mips.com>> wrote: > >> Just realized that BasicTransformInfoClass is an immutable pass. >> >> Not sure how to reconcile this with fact that there will be different >> answers needed depending on the subtarget. >> >> Seems like BasicTansformInfoClass should become a function pass that >> does not modify anything. >> >> On 03/22/2013 09:43 AM, Reed Kotler wrote: >>> Another way to do this would to be to have a reset virtual function >>> which is passed the Function, and the address of TLI so that it could be >>> modified. >>> >>> This seems somewhat cleaner. >>> >>> The reset virtual function would be added to base class >>> TargetLoweringBase. >>> >>> >>> On 03/22/2013 09:22 AM, reed kotler wrote: >>>> For being able to change subtargets within a compilation unit, among >>>> other things, I need to be able to change the target lowering class that >>>> is used by BasicTTI >>>> >>>> For example we have a mips16 and non mips16 version. >>>> >>>> On the original call that creates this class, I'd like to pass the >>>> address of the address of the TargetLoweringBase class. >>>> >>>> That way I can insert a function pass before this pass which examines >>>> the function attributes and changes the pointer. >>>> >>>> So we would get: >>>> >>>> ImmutablePass * >>>> llvm::createBasicTargetTransformInfoPass(const TargetLoweringBase >>>> **TLI_) { >>>> return new BasicTTI(TLI); >>>> } >>>> >>>> we would add the variable >>>> >>>> TargetLoweringBase **TLI_ >>>> >>>> and at the beginning of each pass >>>> >>>> TLI = *TLI_; >>>> >>>> Maybe there is a more elegant way to do this but this is essentially >>>> what I need to do. >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Reed Kotler
2013-Mar-28 19:18 UTC
[LLVMdev] proposed change to class BasicTTI and dual mode mips16/32 working
So I have dual mode 16/32 compilation on a per function basis working. I need to clean up some things and then will push the change. I managed to do everything without needing to change anything in target independent code thus far. It was a fun puzzle to solve as to how to do this using only the given APIs. As for the BasicTransformInfoPassass, for this dual mode I'm using createNoTargetTransformInfoPass right now. I will solve this issue of the BasicTransformInfoPass being immutable after this initial checking which gets all the functionality. I was able to make in a function pass but ran into some issues so I put that aside for now. The basic problem was to be able to compile: void __attribute__((mips16)) foo (void) { } void __attribute__((nomips16)) nofoo (void) { } So first function is compiled as mips16 and the second as mips32. Thanks to Bill Wendling for all this new attribute work he did which allowed me to just focus on the exact problem in hand. On 03/22/2013 03:22 PM, Nadav Rotem wrote:> Hi Reed, > > We will need to reconstruct the target machine and the TTI chain when > the function attributes change. We currently don't have code for doing > that but I suggest that you talk with Bill Wendling about the best way > to implement this. > > Thanks, > Nadav > > On Mar 22, 2013, at 11:30 AM, Reed Kotler <rkotler at mips.com > <mailto:rkotler at mips.com>> wrote: > >> Just realized that BasicTransformInfoClass is an immutable pass. >> >> Not sure how to reconcile this with fact that there will be different >> answers needed depending on the subtarget. >> >> Seems like BasicTansformInfoClass should become a function pass that >> does not modify anything. >> >> On 03/22/2013 09:43 AM, Reed Kotler wrote: >>> Another way to do this would to be to have a reset virtual function >>> which is passed the Function, and the address of TLI so that it could be >>> modified. >>> >>> This seems somewhat cleaner. >>> >>> The reset virtual function would be added to base class >>> TargetLoweringBase. >>> >>> >>> On 03/22/2013 09:22 AM, reed kotler wrote: >>>> For being able to change subtargets within a compilation unit, among >>>> other things, I need to be able to change the target lowering class that >>>> is used by BasicTTI >>>> >>>> For example we have a mips16 and non mips16 version. >>>> >>>> On the original call that creates this class, I'd like to pass the >>>> address of the address of the TargetLoweringBase class. >>>> >>>> That way I can insert a function pass before this pass which examines >>>> the function attributes and changes the pointer. >>>> >>>> So we would get: >>>> >>>> ImmutablePass * >>>> llvm::createBasicTargetTransformInfoPass(const TargetLoweringBase >>>> **TLI_) { >>>> return new BasicTTI(TLI); >>>> } >>>> >>>> we would add the variable >>>> >>>> TargetLoweringBase **TLI_ >>>> >>>> and at the beginning of each pass >>>> >>>> TLI = *TLI_; >>>> >>>> Maybe there is a more elegant way to do this but this is essentially >>>> what I need to do. >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Possibly Parallel Threads
- [LLVMdev] proposed change to class BasicTTI
- [LLVMdev] proposed change to class BasicTTI
- [LLVMdev] proposed change to class BasicTTI and dual mode mips16/32 working
- [LLVMdev] proposed change to class BasicTTI and dual mode mips16/32 working
- [LLVMdev] proposed change to class BasicTTI