35 lines · cpp
1//===----------------------------------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "CodeGenTestPass.h"10 11#include "llvm/CodeGen/MachineFrameInfo.h"12#include "llvm/CodeGen/MachineFunctionPass.h"13 14using namespace llvm;15 16#define DEBUG_TYPE "codegen-test"17#define CODEGEN_TEST_NAME "CodeGen Test Pass"18 19CodeGenTest::CodeGenTest() : MachineFunctionPass(ID) {}20 21bool CodeGenTest::runOnMachineFunction(MachineFunction &MF) {22 outs() << CODEGEN_TEST_NAME << " running on " << MF.getName()23 << "\n"; // used for the lit test24 if (RunCallback)25 RunCallback();26 return true;27}28 29StringRef CodeGenTest::getPassName() const { return CODEGEN_TEST_NAME; }30 31char CodeGenTest::ID = 0;32std::function<void()> CodeGenTest::RunCallback;33 34INITIALIZE_PASS(CodeGenTest, DEBUG_TYPE, CODEGEN_TEST_NAME, false, false)35