#include "llvm/IR/Function.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionAnalysis.h" using namespace llvm; void PrintFunctionName(MachineFunction &MF) { // Get the name of the MachineFunction std::string name = MF.getName().str(); // Print the name errs() << "The name of the MachineFunction is: " << name << "\n"; } int main() { // Load an LLVM function and its associated MachineFunction Module *M = ...; Function *F = M->getFunction("foo"); MachineFunction &MF = getAnalysisIn this example, we define a function `PrintFunctionName` that takes a MachineFunction as input and prints its name to the console using `errs()`. We then load an LLVM function and its associated MachineFunction using the `getAnalysis` function from the `MachineFunctionAnalysis` pass. Finally, we call `PrintFunctionName` on the MachineFunction to print its name. Package library: LLVM.(*F).getMF(); // Print the name of the MachineFunction PrintFunctionName(MF); return 0; }