MachineOperand getGlobal is a method used in C++ programming language for retrieving the global variable operand of a machine instruction. This method is commonly used in code generation for compilers and is available in LLVM packages.
Here are some code examples:
// Example 1 auto getGlobal = instruction.getOperand(0).getGlobal(); if (getGlobal) { // This is a global variable std::string globalName = getGlobal->getName().str(); } else { // This is not a global variable }
// Example 2 auto getGlobal = instruction.getOperand(0).getGlobal(); if (getGlobal && getGlobal->hasInitializer()) { // This global has an initializer auto globalInitializer = getGlobal->getInitializer(); } else { // This global does not have an initializer }
These examples demonstrate how to use MachineOperand getGlobal to retrieve the global variable in a machine instruction and check if the variable has an initializer.
Since this method is part of LLVM, it is included in the LLVM packages.
C++ (Cpp) MachineOperand::getGlobal - 30 examples found. These are the top rated real world C++ (Cpp) examples of MachineOperand::getGlobal extracted from open source projects. You can rate examples to help us improve the quality of examples.