7 #include <llvm/ADT/StringRef.h>
8 #include <llvm/ADT/SmallVector.h>
9 #include <llvm/Support/Endian.h>
16 constexpr uint32_t kLLIRMagic = 0x52494C4C;
18 bool IsLLIRObject(llvm::StringRef buffer);
26 template<>
struct sized_uint<1> {
typedef uint8_t type; };
27 template<>
struct sized_uint<2> {
typedef uint16_t type; };
28 template<>
struct sized_uint<4> {
typedef uint32_t type; };
29 template<>
struct sized_uint<8> {
typedef uint64_t type; };
35 template<
typename T> T ReadData(llvm::StringRef buffer, uint64_t offset)
37 namespace endian = llvm::support::endian;
38 if (offset +
sizeof(T) > buffer.size()) {
39 llvm::report_fatal_error(
"invalid bitcode file");
42 auto *data = buffer.data() + offset;
43 return endian::read<T, llvm::support::little, 1>(data);
50 std::unique_ptr<Prog> Parse(llvm::StringRef buffer, std::string_view name);
55 std::string Abspath(llvm::StringRef path);
60 std::string ParseToolName(llvm::StringRef argv0,
const char *tool);