Joan Lluch via llvm-dev
2019-May-05 17:26 UTC
[llvm-dev] How to get CLang array alloca alignments to be smaller than 16 bytes?
Hi Tim, I appreciate your reply, but I can’t still find any relation with “LargeArrayMinWidth” and x86 target. This variable is only in the TargetInfo.cpp and TargetInfo.h files and it’s not even in any x86 related file. I think there should be something else that causes my issue. I have my backend very advanced and already producing good assembly code, but this supposedly simple thing has got me stuck. Are you sure there’s nothing else beyond LargeArrayMinWidth that causes this? John Tel: 620 28 45 13> On 5 May 2019, at 19:07, Tim Northover <t.p.northover at gmail.com> wrote: > > (Adding llvm-dev back in, in case someone else searches with similar > questions; though cfe-dev might be better for these issues). > > On Sun, 5 May 2019 at 17:54, Joan Lluch <joan.lluch at icloud.com> wrote: >> I have implemented all the steps to register a target backend for LLVM and so far I’m doing ok with it, but I do not know how to select a particular target on Clang. I just modified the “TargetInfo.cpp” file as I posted on my previous email to get 16 bit ints. So, any more insights will be appreciated. > > There are probably about 5-10 different places that need at least > basic modification for a new target in Clang. It's something done > pretty rarely so there's not really any documentation, I'd suggest > grepping the source for an existing target (e.g. aarch64) and > copy/pasting that with modifications for yours. > > This will mostly involve creating a few new subclasses for your > target, and telling generic clang code about them in one or two spots, > but I'm afraid I don't recall exact files & lines. > > If you can run "clang -target myarch-none-elf" and get a Module > targeting your CPU (i.e. with the correct "target triple" and > "datalayout") that's a good first step. At some point you'll want to > actually think about the ABI decisions you've made and perhaps modify > them (like this array issue), but to begin with you can leave it as > is. > >> On the other hand I’m unable to find LargeArrayMinSize in any project files (not even in lib/Basic/Targets/X86.cpp) > > Sorry, I think that may actually be "LargeArrayMinWidth". I > investigated on a different computer to where I typed up my first > reply so didn't have the exact text on screen. > >> LargeArrayAlign is only in TargetInfo.h and TargetInfo.cpp which is set to a value of 0 (Zero) > > The default is set to 0 in TargetInfo.cpp, but I see it overridden in > X86.h, even in the 7.0 branch (again, typo in my original comment, > where I said .cpp). You'll be creating the equivalent file as part of > adding support to Clang for your target. > > Cheers. > > Tim.-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190505/7b920f7f/attachment.html>
Tim Northover via llvm-dev
2019-May-05 18:10 UTC
[llvm-dev] How to get CLang array alloca alignments to be smaller than 16 bytes?
On Sun, 5 May 2019 at 18:26, Joan Lluch <joan.lluch at icloud.com> wrote:> I appreciate your reply, but I can’t still find any relation with “LargeArrayMinWidth” and x86 target.Are you looking in Clang's source, and that from the same 7.0 version? If not, you should be. It traces back to 2010; r105500 to be exact: https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20100531/030985.html For a long while references were in a single file (Targets.cpp), but they'd been split up into one file per target before 7.0 (Targets/XYZ.cpp).> I think there should be something else that causes my issue.I think that's unlikely.> Are you sure there’s nothing else beyond LargeArrayMinWidth that causes this?No, but I am sure the LargeArray stuff exists and behaviour I see from multiple targets matches what I'd expect from the values I see set in the source. Cheers. Tim.
Joan Lluch via llvm-dev
2019-May-05 18:41 UTC
[llvm-dev] How to get CLang array alloca alignments to be smaller than 16 bytes?
> Are you looking in Clang's source, and that from the same 7.0 version?Yes, I am, and it’s the same version (7.0.1). “LargeArrayMinWidth” is only on the following files: TargetInfo.cpp TargetInfo.h So I still think there’s something else that makes the difference on the x86 target. Anyway, I will now investigate other targets as my temporary frontend. It is right that other targets do not create such big alignments. Thanks for your help. John Tel: 620 28 45 13> On 5 May 2019, at 20:10, Tim Northover <t.p.northover at gmail.com> wrote: > > On Sun, 5 May 2019 at 18:26, Joan Lluch <joan.lluch at icloud.com> wrote: >> I appreciate your reply, but I can’t still find any relation with “LargeArrayMinWidth” and x86 target. > > Are you looking in Clang's source, and that from the same 7.0 version? > If not, you should be. It traces back to 2010; r105500 to be exact: > https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20100531/030985.html > > For a long while references were in a single file (Targets.cpp), but > they'd been split up into one file per target before 7.0 > (Targets/XYZ.cpp). > >> I think there should be something else that causes my issue. > > I think that's unlikely. > >> Are you sure there’s nothing else beyond LargeArrayMinWidth that causes this? > > No, but I am sure the LargeArray stuff exists and behaviour I see from > multiple targets matches what I'd expect from the values I see set in > the source. > > Cheers. > > Tim.-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190505/0e721cd8/attachment.html>
Seemingly Similar Threads
- How to get CLang array alloca alignments to be smaller than 16 bytes?
- How to get CLang array alloca alignments to be smaller than 16 bytes?
- How to get CLang array alloca alignments to be smaller than 16 bytes?
- How to get CLang array alloca alignments to be smaller than 16 bytes?
- How exactly is datatype alignment determined?