Craig Topper via llvm-dev
2019-Mar-23 21:06 UTC
[llvm-dev] Generating object files more efficiently
-march for clang and -march for llc do different things unfortunately. -march for clang at least on x86 is the same as -mcpu in llc. Which is an artifact of gcc compatibility. ~Craig On Sat, Mar 23, 2019 at 1:40 PM Doerfert, Johannes via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Oh, my bad. > > > Idk why llc seems to know that architecture but clang does not. > > Doesn't make sense to me, sorry. > ------------------------------ > *From:* J S <mm92126 at hotmail.com> > *Sent:* Saturday, March 23, 2019 3:32:03 PM > *To:* Doerfert, Johannes > *Cc:* via llvm-dev > *Subject:* Re: [llvm-dev] Generating object files more efficiently > > It is my actual target architecture > ------------------------------ > *From:* Doerfert, Johannes <jdoerfert at anl.gov> > *Sent:* Saturday, March 23, 2019 1:30 PM > *To:* J S > *Cc:* via llvm-dev > *Subject:* Re: [llvm-dev] Generating object files more efficiently > > > I copied "-march=XYZ" from your original email, > > you have to replace it with your actual target architecture or simply drop > it. > ------------------------------ > *From:* J S <mm92126 at hotmail.com> > *Sent:* Saturday, March 23, 2019 3:26:59 PM > *To:* Doerfert, Johannes > *Cc:* via llvm-dev > *Subject:* Re: [llvm-dev] Generating object files more efficiently > > > > Johannes, > > > I tried the last one and it gave me this: > > > error: unknown target CPU 'XYZ' > note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, > silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, > westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, > core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, > cannonlake, icelake-client, icelake-server, knl, knm, k8, athlon64, > athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, > barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, > znver2, > x86-64 > > > ------------------------------ > *From:* Doerfert, Johannes <jdoerfert at anl.gov> > *Sent:* Saturday, March 23, 2019 1:15 PM > *To:* J S > *Cc:* via llvm-dev > *Subject:* Re: [llvm-dev] Generating object files more efficiently > > I would have guessed: > > object: > clang -c foo.c -o foo.o -march=XYZ > > shared library: > clang -shared foo.c -o foo.so -march=XYZ > > executable: > clang foo.c -o foo -march=XYZ > > > On 03/23, J S via llvm-dev wrote: > > Currently I compile my C code in 2 steps in order to generate .o files > > > > clang -emit-llvm -c foo.c -o foo.bc > > llc -march=XYZ foo.bc -filetype=obj > > > > Is there a way to generate either .o or .elf files in just 1 command? > > > > Thanks. > > > > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > llvm-dev Info Page > <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> > lists.llvm.org > To see the collection of prior postings to the list, visit the llvm-dev > Archives.. Using llvm-dev: To post a message to all the list members, send > email to llvm-dev at lists.llvm.org. You can subscribe to the list, or > change your existing subscription, in the sections below. > > > > -- > > Johannes Doerfert > Researcher > > Argonne National Laboratory > Lemont, IL 60439, USA > > jdoerfert at anl.gov > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://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/20190323/72905221/attachment.html>
Craig Topper via llvm-dev
2019-Mar-23 21:10 UTC
[llvm-dev] Generating object files more efficiently
In order for clang to support a new target you need to add support in lib/Basic/Targets.cpp in the AllocateTarget function and add new files to the lib/Basic/Targets/ directory. ~Craig On Sat, Mar 23, 2019 at 2:06 PM Craig Topper <craig.topper at gmail.com> wrote:> -march for clang and -march for llc do different things unfortunately. > -march for clang at least on x86 is the same as -mcpu in llc. Which is an > artifact of gcc compatibility. > > ~Craig > > > On Sat, Mar 23, 2019 at 1:40 PM Doerfert, Johannes via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Oh, my bad. >> >> >> Idk why llc seems to know that architecture but clang does not. >> >> Doesn't make sense to me, sorry. >> ------------------------------ >> *From:* J S <mm92126 at hotmail.com> >> *Sent:* Saturday, March 23, 2019 3:32:03 PM >> *To:* Doerfert, Johannes >> *Cc:* via llvm-dev >> *Subject:* Re: [llvm-dev] Generating object files more efficiently >> >> It is my actual target architecture >> ------------------------------ >> *From:* Doerfert, Johannes <jdoerfert at anl.gov> >> *Sent:* Saturday, March 23, 2019 1:30 PM >> *To:* J S >> *Cc:* via llvm-dev >> *Subject:* Re: [llvm-dev] Generating object files more efficiently >> >> >> I copied "-march=XYZ" from your original email, >> >> you have to replace it with your actual target architecture or simply >> drop it. >> ------------------------------ >> *From:* J S <mm92126 at hotmail.com> >> *Sent:* Saturday, March 23, 2019 3:26:59 PM >> *To:* Doerfert, Johannes >> *Cc:* via llvm-dev >> *Subject:* Re: [llvm-dev] Generating object files more efficiently >> >> >> >> Johannes, >> >> >> I tried the last one and it gave me this: >> >> >> error: unknown target CPU 'XYZ' >> note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, >> silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, >> westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, >> core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, >> cannonlake, icelake-client, icelake-server, knl, knm, k8, athlon64, >> athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, >> barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, >> znver2, >> x86-64 >> >> >> ------------------------------ >> *From:* Doerfert, Johannes <jdoerfert at anl.gov> >> *Sent:* Saturday, March 23, 2019 1:15 PM >> *To:* J S >> *Cc:* via llvm-dev >> *Subject:* Re: [llvm-dev] Generating object files more efficiently >> >> I would have guessed: >> >> object: >> clang -c foo.c -o foo.o -march=XYZ >> >> shared library: >> clang -shared foo.c -o foo.so -march=XYZ >> >> executable: >> clang foo.c -o foo -march=XYZ >> >> >> On 03/23, J S via llvm-dev wrote: >> > Currently I compile my C code in 2 steps in order to generate .o files >> > >> > clang -emit-llvm -c foo.c -o foo.bc >> > llc -march=XYZ foo.bc -filetype=obj >> > >> > Is there a way to generate either .o or .elf files in just 1 command? >> > >> > Thanks. >> > >> >> > _______________________________________________ >> > LLVM Developers mailing list >> > llvm-dev at lists.llvm.org >> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> llvm-dev Info Page >> <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> >> lists.llvm.org >> To see the collection of prior postings to the list, visit the llvm-dev >> Archives.. Using llvm-dev: To post a message to all the list members, send >> email to llvm-dev at lists.llvm.org. You can subscribe to the list, or >> change your existing subscription, in the sections below. >> >> >> >> -- >> >> Johannes Doerfert >> Researcher >> >> Argonne National Laboratory >> Lemont, IL 60439, USA >> >> jdoerfert at anl.gov >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://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/20190323/8e9bcd43/attachment.html>
J S via llvm-dev
2019-Mar-23 22:18 UTC
[llvm-dev] Generating object files more efficiently
Thanks, Craig, FYI, I also had to update clang/lib/Basic/CMakeLists.txt ________________________________ From: Craig Topper <craig.topper at gmail.com> Sent: Saturday, March 23, 2019 2:10 PM To: Doerfert, Johannes Cc: J S; via llvm-dev Subject: Re: [llvm-dev] Generating object files more efficiently In order for clang to support a new target you need to add support in lib/Basic/Targets.cpp in the AllocateTarget function and add new files to the lib/Basic/Targets/ directory. ~Craig On Sat, Mar 23, 2019 at 2:06 PM Craig Topper <craig.topper at gmail.com<mailto:craig.topper at gmail.com>> wrote: -march for clang and -march for llc do different things unfortunately. -march for clang at least on x86 is the same as -mcpu in llc. Which is an artifact of gcc compatibility. ~Craig On Sat, Mar 23, 2019 at 1:40 PM Doerfert, Johannes via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: Oh, my bad. Idk why llc seems to know that architecture but clang does not. Doesn't make sense to me, sorry. ________________________________ From: J S <mm92126 at hotmail.com<mailto:mm92126 at hotmail.com>> Sent: Saturday, March 23, 2019 3:32:03 PM To: Doerfert, Johannes Cc: via llvm-dev Subject: Re: [llvm-dev] Generating object files more efficiently It is my actual target architecture ________________________________ From: Doerfert, Johannes <jdoerfert at anl.gov<mailto:jdoerfert at anl.gov>> Sent: Saturday, March 23, 2019 1:30 PM To: J S Cc: via llvm-dev Subject: Re: [llvm-dev] Generating object files more efficiently I copied "-march=XYZ" from your original email, you have to replace it with your actual target architecture or simply drop it. ________________________________ From: J S <mm92126 at hotmail.com<mailto:mm92126 at hotmail.com>> Sent: Saturday, March 23, 2019 3:26:59 PM To: Doerfert, Johannes Cc: via llvm-dev Subject: Re: [llvm-dev] Generating object files more efficiently Johannes, I tried the last one and it gave me this: error: unknown target CPU 'XYZ' note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cannonlake, icelake-client, icelake-server, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, x86-64 ________________________________ From: Doerfert, Johannes <jdoerfert at anl.gov<mailto:jdoerfert at anl.gov>> Sent: Saturday, March 23, 2019 1:15 PM To: J S Cc: via llvm-dev Subject: Re: [llvm-dev] Generating object files more efficiently I would have guessed: object: clang -c foo.c -o foo.o -march=XYZ shared library: clang -shared foo.c -o foo.so -march=XYZ executable: clang foo.c -o foo -march=XYZ On 03/23, J S via llvm-dev wrote:> Currently I compile my C code in 2 steps in order to generate .o files > > clang -emit-llvm -c foo.c -o foo.bc > llc -march=XYZ foo.bc -filetype=obj > > Is there a way to generate either .o or .elf files in just 1 command? > > Thanks. >> _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-devllvm-dev Info Page<https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> lists.llvm.org<http://lists.llvm.org> To see the collection of prior postings to the list, visit the llvm-dev Archives.. Using llvm-dev: To post a message to all the list members, send email to llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>. You can subscribe to the list, or change your existing subscription, in the sections below. -- Johannes Doerfert Researcher Argonne National Laboratory Lemont, IL 60439, USA jdoerfert at anl.gov<mailto:jdoerfert at anl.gov> _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> https://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/20190323/acc7852f/attachment.html>