#include "benchmark/benchmark.h"
#include "llvm/AsmParser/Parser.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Module.h"
#include "llvm/SandboxIR/SandboxIR.h"
#include "llvm/Support/SourceMgr.h"
#include <memory>
#include <sstream>
usingnamespacellvm;
static std::unique_ptr<Module> parseIR(LLVMContext &C, const char *IR) { … }
enum class IR { … };
template <IR IRTy> struct TypeSelect { … };
template <> struct TypeSelect<IR::LLVM> { … };
template <> struct TypeSelect<IR::SBoxNoTracking> { … };
template <> struct TypeSelect<IR::SBoxTracking> { … };
template <IR IRTy>
static typename TypeSelect<IRTy>::BasicBlock *
genIR(std::unique_ptr<llvm::Module> &LLVMM, LLVMContext &LLVMCtx,
sandboxir::Context &Ctx,
std::function<std::string(unsigned)> GenerateIRStr,
unsigned NumInstrs = 0u) { … }
template <IR IRTy> static void finalize(sandboxir::Context &Ctx) { … }
static std::string generateBBWalkIR(unsigned Size) { … }
template <IR IRTy> static void SBoxIRCreation(benchmark::State &State) { … }
template <IR IRTy> static void BBWalk(benchmark::State &State) { … }
static std::string generateGetTypeIR(unsigned Size) { … }
template <IR IRTy> static void GetType(benchmark::State &State) { … }
static std::string generateRAUWIR(unsigned Size) { … }
template <IR IRTy> static void RAUW(benchmark::State &State) { … }
static std::string generateRUOWIR(unsigned NumOperands) { … }
template <IR IRTy> static void RUOW(benchmark::State &State) { … }
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK(…);
BENCHMARK_MAIN(…);