void IRGenFunction::emitFunctionBody() { ... emitPrologue(); emitBody(); // Signal end of the compilation process MF->getFunction().setEndState(MachineFunction::End); }
void AMDGPUAsmPrinter::EmitFunctionBodyStart() { ... MF->getTarget().getObjFileLowering() .emitModuleMetadata(*AsmOutFile, MMI); OutStreamer->PushSection(); } void AMDGPUAsmPrinter::EmitFunctionBodyEnd() { ... if (isShader(MF->getFunction())) { if (isFinalizer()) { // Signal end of the compilation process MF->getFunction().setEndState(MachineFunction::End); OutStreamer->EmitIntValue(0xdeadbeef, 4); } } OutStreamer->PopSection(); ... }This code example shows how the MachineFunction end is used in the AMDGPU target's assembler printer. The EmitFunctionBodyStart() method is responsible for generating the function's prologue, while the EmitFunctionBodyEnd() method is responsible for generating the function's epilogue. Inside the latter method, the MachineFunction end is signaled by calling setEndState() and emitting a finalization value. Package library: LLVM – AMDGPU backend In summary, MachineFunction end is a useful method in C++ that signals the end of a function's compilation process. Its usage in LLVM IR generation and AMDGPU backend shows that it is widely used in modern compiler infrastructures.