1 //===- bolt/Profile/YAMLProfileWriter.h - Write profile in YAML -*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef BOLT_PROFILE_YAML_PROFILE_WRITER_H 10 #define BOLT_PROFILE_YAML_PROFILE_WRITER_H 11 12 #include "llvm/Support/raw_ostream.h" 13 #include <system_error> 14 15 namespace llvm { 16 namespace bolt { 17 class RewriteInstance; 18 19 class YAMLProfileWriter { 20 YAMLProfileWriter() = delete; 21 22 std::string Filename; 23 24 std::unique_ptr<raw_fd_ostream> OS; 25 26 public: YAMLProfileWriter(const std::string & Filename)27 explicit YAMLProfileWriter(const std::string &Filename) 28 : Filename(Filename) {} 29 30 /// Save execution profile for that instance. 31 std::error_code writeProfile(const RewriteInstance &RI); 32 }; 33 34 } // namespace bolt 35 } // namespace llvm 36 37 #endif 38