Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1531056
| From | "Wangnan (F)" <wangnan0@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 14/30] perf clang: Support compile IR to BPF object and add testcase |
| Date | 2016-11-28 07:40 +0100 |
| Message-ID | <sInLz-6YK-11@gated-at.bofh.it> (permalink) |
| References | <sHFhv-3nx-5@gated-at.bofh.it> <sHFhv-3nx-19@gated-at.bofh.it> <sHOXv-14Z-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 2016/11/27 1:25, Alexei Starovoitov wrote:
> On Sat, Nov 26, 2016 at 07:03:38AM +0000, Wang Nan wrote:
>> getBPFObjectFromModule() is introduced to compile LLVM IR(Module)
>> to BPF object. Add new testcase for it.
>>
>> Test result:
>> $ ./buildperf/perf test -v clang
>> 51: Test builtin clang support :
>> 51.1: Test builtin clang compile C source to IR :
>> --- start ---
>> test child forked, pid 21822
>> test child finished with 0
>> ---- end ----
>> Test builtin clang support subtest 0: Ok
>> 51.2: Test builtin clang compile C source to ELF object :
>> --- start ---
>> test child forked, pid 21823
>> test child finished with 0
>> ---- end ----
>> Test builtin clang support subtest 1: Ok
>>
>> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> ...
>> + legacy::PassManager PM;
>> + if (TargetMachine->addPassesToEmitFile(PM, ostream,
>> + TargetMachine::CGFT_ObjectFile)) {
>> + llvm::errs() << "TargetMachine can't emit a file of this type\n";
>> + return std::unique_ptr<llvm::SmallVectorImpl<char>>(nullptr);;
>> + }
>> + PM.run(*Module);
> I'm pretty sure you want to add FunctionInlingPass as well otherwise
> I think llvm won't be doing much inlining and only very very simple
> programs will compile fine. See what we did on bcc side.
Thank you for your information. I though inlining should be done during
C to IR phase, and we have use -O2 for it. Let me check it.
> Also did you consider skipping elf generation and using in memory
> instead ? That will improve compile/run time.
>
Maybe in future work? Current design reuse libelf and bpf-loader for
loading BPF code. Skipping ELF generation make compiling faster, but
require another loader to be coexist with bpf-loader.c, or we need
a new libbpf. In my current experience, outputting ELF is not so slow
for both server and smartphone.
Thank you.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 14/30] perf clang: Support compile IR to BPF object and add testcase Wang Nan <wangnan0@huawei.com> - 2016-11-26 08:10 +0100
Re: [PATCH v3 14/30] perf clang: Support compile IR to BPF object and add testcase Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-11-26 18:30 +0100
Re: [PATCH v3 14/30] perf clang: Support compile IR to BPF object and add testcase "Wangnan (F)" <wangnan0@huawei.com> - 2016-11-28 07:40 +0100
Re: [PATCH v3 14/30] perf clang: Support compile IR to BPF object and add testcase "Wangnan (F)" <wangnan0@huawei.com> - 2016-11-28 11:40 +0100
Re: [PATCH v3 14/30] perf clang: Support compile IR to BPF object and add testcase Alexei Starovoitov <alexei.starovoitov@gmail.com> - 2016-11-28 20:40 +0100
[tip:perf/core] perf clang: Support compile IR to BPF object and add testcase tip-bot for Wang Nan <tipbot@zytor.com> - 2016-12-06 09:50 +0100
csiph-web