#include "llvm/MC/MCInstrAnalysis.h"
#include "MCTargetDesc/RISCVMCTargetDesc.h"
#include "llvm/MC/MCInstBuilder.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "gtest/gtest.h"
#include <memory>
usingnamespacellvm;
namespace {
class InstrAnalysisTest : public testing::TestWithParam<const char *> { … };
}
static MCInst jal(unsigned RD) { … }
static MCInst jalr(unsigned RD, unsigned RS1 = RISCV::X10) { … }
static MCInst cjr(unsigned RS1) { … }
static MCInst cj() { … }
static MCInst cjal() { … }
static MCInst cjalr(unsigned RS1) { … }
static MCInst beq() { … }
static MCInst cbeqz() { … }
TEST_P(InstrAnalysisTest, IsTerminator) { … }
TEST_P(InstrAnalysisTest, IsCall) { … }
TEST_P(InstrAnalysisTest, IsReturn) { … }
TEST_P(InstrAnalysisTest, IsBranch) { … }
TEST_P(InstrAnalysisTest, IsUnconditionalBranch) { … }
TEST_P(InstrAnalysisTest, IsIndirectBranch) { … }
INSTANTIATE_TEST_SUITE_P(…);