MachineFunction& MF = ...; // get current function const TargetSubtargetInfo& STI = MF.getSubtarget(); std::string CPU = STI.getCPU();
MachineFunction& MF = ...; // get current function const TargetSubtargetInfo& STI = MF.getSubtarget(); unsigned WordSize = STI.getRegisterInfo()->getPointerSize();This example gets the current function's subtarget and retrieves the word size of the target architecture by accessing the target's register information using the TargetSubtargetInfo::getRegisterInfo method. Package/library: LLVM