Daniel Sanders
2015-Jan-28 19:59 UTC
[LLVMdev] [Mips][TargetOptions] How to properly instantiate TargetOptions in MC layer?
Hi Eric, The main thing we need to fix is that the selection between ELF32/ELF64 needs to depend on the ABI being N64 and not on whether we used a mips-linux-gnu triple versus a mips64-linux-gnu triple. So 'clang -target mips-linux-gnu' -mips64r2 -mabi=64' should produce an ELF64 and 'clang -target mips64-linux-gnu -mips32r2 -mabi=32' should produce an ELF32. In terms of code, we need to get the ABI name to createMipsELFObjectWriter(). One of your commits on Monday (r227102) seems to make this a lot easier than it was looking last week when Vladimir and I were discussing this internally (I've been off sick so I only saw your commit last night). I haven't had chance to try this but I'm currently thinking that createMCAsmBackend() should have an LLVMTargetMachine* argument. The Mips-specific versions of this function can then get the ABI name from there and pass it down to createMipsELFObjectWriter(). From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Eric Christopher Sent: 28 January 2015 00:00 To: Vladimir Medic; llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] [Mips][TargetOptions] How to properly instantiate TargetOptions in MC layer? You can't really get there from here is the short answer. You can possible get MCTargetOptions, but then you need to change all of the constructors and calls across all of the backends to do this. I fixed all of the things that are currently in tree - what are you seeing or what do you need migrated around? -eric ps. Also, cc'ing me on it would have likely gotten you a faster answer, I just noticed this while going through email. On Tue Jan 27 2015 at 5:49:58 AM Vladimir Medic <Vladimir.Medic at imgtec.com<mailto:Vladimir.Medic at imgtec.com>> wrote: Hi all, we have several features in Mips that are dependent on target abi. A recent commit(r224492) introduced a new -target-abi option to TargetOptions struct that provides access to abi string. This info is stored in MCSubtarget class(ARMSubratget in this case) and distributed to other libraries. Unfortunately, for Mips we need this info in other classes that don't have access to MCSubtarget class, like MCAsmBackend and MCTargetStreamer and instantiating a new copy od TargetOption causes link errors as it is already instantiated in some drivers(llc.cpp for example). What would be the proper way to get the TargetOptions struct available in other classes? Kind regards, Vladimir _______________________________________________ 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/20150128/123d6392/attachment.html>
Vladimir Medic
2015-Jan-29 11:49 UTC
[LLVMdev] [Mips][TargetOptions] How to properly instantiate TargetOptions in MC layer?
Hi Eric, as I was working on the same issues that are covered in your patch I also made a change in clang driver to pass this option to the assembler. Could you please review it and tell me your opinion? http://reviews.llvm.org/D6091 Thanks Vladimir ________________________________ From: Daniel Sanders Sent: Wednesday, January 28, 2015 8:59 PM To: Eric Christopher; Vladimir Medic; llvmdev at cs.uiuc.edu Subject: RE: [LLVMdev] [Mips][TargetOptions] How to properly instantiate TargetOptions in MC layer? Hi Eric, The main thing we need to fix is that the selection between ELF32/ELF64 needs to depend on the ABI being N64 and not on whether we used a mips-linux-gnu triple versus a mips64-linux-gnu triple. So 'clang -target mips-linux-gnu' -mips64r2 -mabi=64' should produce an ELF64 and 'clang -target mips64-linux-gnu -mips32r2 -mabi=32' should produce an ELF32. In terms of code, we need to get the ABI name to createMipsELFObjectWriter(). One of your commits on Monday (r227102) seems to make this a lot easier than it was looking last week when Vladimir and I were discussing this internally (I've been off sick so I only saw your commit last night). I haven't had chance to try this but I'm currently thinking that createMCAsmBackend() should have an LLVMTargetMachine* argument. The Mips-specific versions of this function can then get the ABI name from there and pass it down to createMipsELFObjectWriter(). From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Eric Christopher Sent: 28 January 2015 00:00 To: Vladimir Medic; llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] [Mips][TargetOptions] How to properly instantiate TargetOptions in MC layer? You can't really get there from here is the short answer. You can possible get MCTargetOptions, but then you need to change all of the constructors and calls across all of the backends to do this. I fixed all of the things that are currently in tree - what are you seeing or what do you need migrated around? -eric ps. Also, cc'ing me on it would have likely gotten you a faster answer, I just noticed this while going through email. On Tue Jan 27 2015 at 5:49:58 AM Vladimir Medic <Vladimir.Medic at imgtec.com<mailto:Vladimir.Medic at imgtec.com>> wrote: Hi all, we have several features in Mips that are dependent on target abi. A recent commit(r224492) introduced a new -target-abi option to TargetOptions struct that provides access to abi string. This info is stored in MCSubtarget class(ARMSubratget in this case) and distributed to other libraries. Unfortunately, for Mips we need this info in other classes that don't have access to MCSubtarget class, like MCAsmBackend and MCTargetStreamer and instantiating a new copy od TargetOption causes link errors as it is already instantiated in some drivers(llc.cpp for example). What would be the proper way to get the TargetOptions struct available in other classes? Kind regards, Vladimir _______________________________________________ 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/20150129/55cbe5de/attachment.html>
Eric Christopher
2015-Jan-29 20:00 UTC
[LLVMdev] [Mips][TargetOptions] How to properly instantiate TargetOptions in MC layer?
On Wed Jan 28 2015 at 11:59:18 AM Daniel Sanders <Daniel.Sanders at imgtec.com> wrote:> Hi Eric, > > > The main thing we need to fix is that the selection between ELF32/ELF64 > needs to depend on the ABI being N64 and not on whether we used a mips- > linux-gnu triple versus a mips64-linux-gnu triple. So 'clang -target > mips-linux-gnu' -mips64r2 -mabi=64' should produce an ELF64 and 'clang > -target mips64-linux-gnu -mips32r2 -mabi=32' should produce an ELF32. In > terms of code, we need to get the ABI name to createMipsELFObjectWriter(). > > >*nod* Frustrating, but not your fault for sure ;)> One of your commits on Monday (r227102) seems to make this a lot easier > than it was looking last week when Vladimir and I were discussing this > internally (I've been off sick so I only saw your commit last night). I > haven't had chance to try this but I'm currently thinking that > createMCAsmBackend() should have an LLVMTargetMachine* argument. The > Mips-specific versions of this function can then get the ABI name from > there and pass it down to createMipsELFObjectWriter(). >Nope, can't do this. Unfortunately this will break the layering in that MC isn't allowed to depend in this way. At best you can pass MCOptions down to that level. -eric> > > *From:* llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] *On > Behalf Of *Eric Christopher > *Sent:* 28 January 2015 00:00 > *To:* Vladimir Medic; llvmdev at cs.uiuc.edu > *Subject:* Re: [LLVMdev] [Mips][TargetOptions] How to properly > instantiate TargetOptions in MC layer? > > > > You can't really get there from here is the short answer. You can possible > get MCTargetOptions, but then you need to change all of the constructors > and calls across all of the backends to do this. > > I fixed all of the things that are currently in tree - what are you seeing > or what do you need migrated around? > > > > -eric > > > > ps. Also, cc'ing me on it would have likely gotten you a faster answer, I > just noticed this while going through email. > > > > On Tue Jan 27 2015 at 5:49:58 AM Vladimir Medic <Vladimir.Medic at imgtec.com> > wrote: > > Hi all, > we have several features in Mips that are dependent on target abi. A > recent commit(r224492) introduced a new -target-abi option to TargetOptions > struct that provides access to abi string. This info is stored in > MCSubtarget class(ARMSubratget in this case) and distributed to other > libraries. Unfortunately, for Mips we need this info in other classes that > don't have access to MCSubtarget class, like MCAsmBackend and > MCTargetStreamer and instantiating a new copy od TargetOption causes link > errors as it is already instantiated in some drivers(llc.cpp for example). > What would be the proper way to get the TargetOptions struct available in > other classes? > > Kind regards, > > Vladimir > > _______________________________________________ > 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/20150129/2719e8c9/attachment.html>
Eric Christopher
2015-Jan-29 20:00 UTC
[LLVMdev] [Mips][TargetOptions] How to properly instantiate TargetOptions in MC layer?
I've added myself to the review thread and commented. Thanks! -eric On Thu Jan 29 2015 at 3:49:46 AM Vladimir Medic <Vladimir.Medic at imgtec.com> wrote:> Hi Eric, > as I was working on the same issues that are covered in your patch I also > made a change in clang driver to pass this option to the assembler. Could > you please review it and tell me your opinion? > http://reviews.llvm.org/D6091 > > Thanks > > Vladimir > ------------------------------ > *From:* Daniel Sanders > *Sent:* Wednesday, January 28, 2015 8:59 PM > *To:* Eric Christopher; Vladimir Medic; llvmdev at cs.uiuc.edu > *Subject:* RE: [LLVMdev] [Mips][TargetOptions] How to properly > instantiate TargetOptions in MC layer? > > Hi Eric, > > > The main thing we need to fix is that the selection between ELF32/ELF64 > needs to depend on the ABI being N64 and not on whether we used a mips- > linux-gnu triple versus a mips64-linux-gnu triple. So 'clang -target > mips-linux-gnu' -mips64r2 -mabi=64' should produce an ELF64 and 'clang > -target mips64-linux-gnu -mips32r2 -mabi=32' should produce an ELF32. In > terms of code, we need to get the ABI name to createMipsELFObjectWriter(). > > > One of your commits on Monday (r227102) seems to make this a lot easier > than it was looking last week when Vladimir and I were discussing this > internally (I've been off sick so I only saw your commit last night). I > haven't had chance to try this but I'm currently thinking that > createMCAsmBackend() should have an LLVMTargetMachine* argument. The > Mips-specific versions of this function can then get the ABI name from > there and pass it down to createMipsELFObjectWriter(). > > > > *From:* llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] *On > Behalf Of *Eric Christopher > *Sent:* 28 January 2015 00:00 > *To:* Vladimir Medic; llvmdev at cs.uiuc.edu > *Subject:* Re: [LLVMdev] [Mips][TargetOptions] How to properly > instantiate TargetOptions in MC layer? > > > > You can't really get there from here is the short answer. You can possible > get MCTargetOptions, but then you need to change all of the constructors > and calls across all of the backends to do this. > > I fixed all of the things that are currently in tree - what are you seeing > or what do you need migrated around? > > > > -eric > > > > ps. Also, cc'ing me on it would have likely gotten you a faster answer, I > just noticed this while going through email. > > > > On Tue Jan 27 2015 at 5:49:58 AM Vladimir Medic <Vladimir.Medic at imgtec.com> > wrote: > > Hi all, > we have several features in Mips that are dependent on target abi. A > recent commit(r224492) introduced a new -target-abi option to TargetOptions > struct that provides access to abi string. This info is stored in > MCSubtarget class(ARMSubratget in this case) and distributed to other > libraries. Unfortunately, for Mips we need this info in other classes that > don't have access to MCSubtarget class, like MCAsmBackend and > MCTargetStreamer and instantiating a new copy od TargetOption causes link > errors as it is already instantiated in some drivers(llc.cpp for example). > What would be the proper way to get the TargetOptions struct available in > other classes? > > Kind regards, > > Vladimir > > _______________________________________________ > 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/20150129/61645e27/attachment.html>
Maybe Matching Threads
- [LLVMdev] [Mips][TargetOptions] How to properly instantiate TargetOptions in MC layer?
- [LLVMdev] [Mips][TargetOptions] How to properly instantiate TargetOptions in MC layer?
- [LLVMdev] deglobalizing TargetOptions
- [LLVMdev] deglobalizing TargetOptions
- [LLVMdev] deglobalizing TargetOptions