[llvm] r204489 - ProfileData: Introduce InstrProfWriter using the naive text format

Nick Lewycky nlewycky at google.com
Fri Apr 18 17:26:29 PDT 2014


On 21 March 2014 10:46, Justin Bogner <mail at justinbogner.com> wrote:

> Author: bogner
> Date: Fri Mar 21 12:46:22 2014
> New Revision: 204489
>
> URL: http://llvm.org/viewvc/llvm-project?rev=204489&view=rev
> Log:
> ProfileData: Introduce InstrProfWriter using the naive text format
>
> This isn't a format we'll want to write out in practice, but moving it
> to the writer library simplifies llvm-profdata and isolates it from
> further changes to the format.
>
> This also allows us to update the tests to not rely on the text output
> format.
>

[...]


> Added: llvm/trunk/lib/ProfileData/InstrProfWriter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ProfileData/InstrProfWriter.cpp?rev=204489&view=auto
>
> ==============================================================================
> --- llvm/trunk/lib/ProfileData/InstrProfWriter.cpp (added)
> +++ llvm/trunk/lib/ProfileData/InstrProfWriter.cpp Fri Mar 21 12:46:22 2014
> @@ -0,0 +1,58 @@
> +//=-- InstrProfWriter.cpp - Instrumented profiling writer
> -------------------=//
> +//
> +//                     The LLVM Compiler Infrastructure
> +//
> +// This file is distributed under the University of Illinois Open Source
> +// License. See LICENSE.TXT for details.
> +//
>
> +//===----------------------------------------------------------------------===//
> +//
> +// This file contains support for writing profiling data for clang's
> +// instrumentation based PGO and coverage.
> +//
>
> +//===----------------------------------------------------------------------===//
> +
> +#include "llvm/ProfileData/InstrProfWriter.h"
> +#include "llvm/Support/Endian.h"
> +
> +using namespace llvm;
> +
> +error_code InstrProfWriter::addFunctionCounts(StringRef FunctionName,
> +                                              uint64_t FunctionHash,
> +                                              ArrayRef<uint64_t>
> Counters) {
> +  auto Where = FunctionData.find(FunctionName);
> +  if (Where == FunctionData.end()) {
> +    // If this is the first time we've seen this function, just add it.
> +    FunctionData[FunctionName] = {FunctionHash, Counters};
> +    return instrprof_error::success;;
>

Extra bonus semicolon!

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140418/fabe482a/attachment.html>


More information about the llvm-commits mailing list