Package ghidra.program.model.lang

# Class RegisterBuilder

java.lang.Object
ghidra.program.model.lang.RegisterBuilder

public class RegisterBuilder extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RegisterBuilder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `addAlias(String registerName, String alias)`
  Add an alias to a previously defined register.
  `boolean`
  `addLaneSize(String registerName, int laneSizeInBytes)`
  Add a vector lane size to the specified register.
  `void`
  `addRegister(Register register)`
  `void`
  `addRegister(String name, String description, Address address, int numBytes, boolean bigEndian, int typeFlags)`
  `void`
  `addRegister(String name, String description, Address address, int numBytes, int leastSignificantBit, int bitLength, boolean bigEndian, int typeFlags)`
  `Address`
  `getProcessContextAddress()`
  Returns the processor context address of the first context register added to this builder.
  `Register`
  `getRegister(String name)`
  Returns the register with the given name;
  `RegisterManager`
  `getRegisterManager()`
  Compute current register collection and instantiate a `RegisterManager`
  `boolean`
  `renameRegister(String oldName, String newName)`
  Rename a register.
  `boolean`
  `setFlag(String registerName, int registerFlag)`
  Set a register flag for the specified register
  `boolean`
  `setGroup(String registerName, String groupName)`
  Set the group name for the specified register

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RegisterBuilder

    public RegisterBuilder()

- ## Method Details

  - ### addRegister

    public void addRegister(String name, String description, Address address, int numBytes, boolean bigEndian, int typeFlags)

  - ### addRegister

    public void addRegister(String name, String description, Address address, int numBytes, int leastSignificantBit, int bitLength, boolean bigEndian, int typeFlags)

  - ### addRegister

    public void addRegister(Register register)

  - ### getProcessContextAddress

    public Address getProcessContextAddress()
    Returns the processor context address of the first context register added to this builder.
    Returns:
      context address

  - ### getRegisterManager

    public RegisterManager getRegisterManager()
    Compute current register collection and instantiate a `RegisterManager`
    Returns:
      new register manager instance

  - ### getRegister

    public Register getRegister(String name)
    Returns the register with the given name;
    Parameters:
      `name` - the name of the register to retrieve
    Returns:
      register or null if not found

  - ### renameRegister

    public boolean renameRegister(String oldName, String newName)
    Rename a register. This allows generic register names declared within the language specification (*.slaspec) to be renamed for a processor variant specification (*.pspec).
    Parameters:
      `oldName` - original register name
      `newName` - new register name
    Returns:
      true if rename was successful, else false

  - ### addAlias

    public boolean addAlias(String registerName, String alias)
    Add an alias to a previously defined register.
    Parameters:
      `registerName` - defined register
      `alias` - alias to be added to defined register
    Returns:
      true if alias addition was successful, else false

  - ### setGroup

    public boolean setGroup(String registerName, String groupName)
    Set the group name for the specified register
    Parameters:
      `registerName` - register name
      `groupName` - group name
    Returns:
      true if register was found, else false

  - ### setFlag

    public boolean setFlag(String registerName, int registerFlag)
    Set a register flag for the specified register
    Parameters:
      `registerName` - register name
      `registerFlag` - Register defined flag bit(s)
    Returns:
      true if register was found, else false

  - ### addLaneSize

    public boolean addLaneSize(String registerName, int laneSizeInBytes)
    Add a vector lane size to the specified register.
    Parameters:
      `registerName` - register name
      `laneSizeInBytes` - the size of the lane to add in bytes
    Returns:
      true if register was found, else false
    Throws:
      `UnsupportedOperationException` - if register is unable to support the definition of lanes.
      `IllegalArgumentException` - if `laneSizeInBytes` is invalid