Difference between revisions of "NuPlusInstrInfo.cpp"

From NaplesPU Documentation
Jump to: navigation, search
(Created page with "Category:C++ Classes The '''NuPlusInstrInfo''' class implements the NuPlusInstrInfo interface generetaed by Tablegen which inherits from [http://llvm.org/docs/CodeGenerato...")
 
 
Line 6: Line 6:
 
*'''isLoadFromStackSlot''', determines if the specified machine instruction is a direct load from a stack slot and return the virtual or physical register number of the destination along with the FrameIndex of the loaded stack slot. If not, return 0.
 
*'''isLoadFromStackSlot''', determines if the specified machine instruction is a direct load from a stack slot and return the virtual or physical register number of the destination along with the FrameIndex of the loaded stack slot. If not, return 0.
 
*'''isStoreToStackSlot''', similar to isLoadFromStackSlot.
 
*'''isStoreToStackSlot''', similar to isLoadFromStackSlot.
*'''analyzeBranch''', analyze the branching code at the end of MBB, returning true if it cannot be understood, false otherwise.
+
*'''analyzeBranch''', analyzes the branching code at the end of a basic block, returning true if it cannot be understood (e.g. it isn't implemented for a target). To support these cases, RemoveBranch and InsertBranch must be implemented. Differently, upon success, this method return false together with several information related to the type of branch. For more information, check the ''include/llvm/Target/TargetInstrInfo.h'' file.
 
*'''RemoveBranch''', invoked in cases where AnalyzeBranch returns success, it removes the branching code at the end of the specific MBB and returns the number of instructions that were removed.
 
*'''RemoveBranch''', invoked in cases where AnalyzeBranch returns success, it removes the branching code at the end of the specific MBB and returns the number of instructions that were removed.
 
*'''InsertBranch''', inserts a branch code into the end of the specified MachineBasicBlock.
 
*'''InsertBranch''', inserts a branch code into the end of the specified MachineBasicBlock.

Latest revision as of 19:41, 18 June 2018

The NuPlusInstrInfo class implements the NuPlusInstrInfo interface generetaed by Tablegen which inherits from TargetInstrInfo class. It describes the target machine instruction set to the code generator.

The NuPlusInstrInfo class implements the following methods:

  • getRegisterInfo, returns the NuPlusRegisterInfo private object.
  • isLoadFromStackSlot, determines if the specified machine instruction is a direct load from a stack slot and return the virtual or physical register number of the destination along with the FrameIndex of the loaded stack slot. If not, return 0.
  • isStoreToStackSlot, similar to isLoadFromStackSlot.
  • analyzeBranch, analyzes the branching code at the end of a basic block, returning true if it cannot be understood (e.g. it isn't implemented for a target). To support these cases, RemoveBranch and InsertBranch must be implemented. Differently, upon success, this method return false together with several information related to the type of branch. For more information, check the include/llvm/Target/TargetInstrInfo.h file.
  • RemoveBranch, invoked in cases where AnalyzeBranch returns success, it removes the branching code at the end of the specific MBB and returns the number of instructions that were removed.
  • InsertBranch, inserts a branch code into the end of the specified MachineBasicBlock.
  • copyPhysReg, emits instructions to copy a pair of physical registers.
  • storeRegToStackSlot, stores the specified register of the given register class to the specified stack frame index.
  • loadRegFromStackSlot, similar to storeRegToStackSlot,
  • adjustStackPointer, utility function that emits instructions to adjust the stack pointer with the given amount.
  • loadConstant, utility function that emits the necessary instructions to load an immediate value. It is only used in adjustStackPointer.
  • getMemOperand, returns a MachineMemOperand describing a Load/Store operation to the stack. It is used in storeRegToStackSlot and loadRegFromStackSlot.