github.com/chenzhuoyu/iasm@v0.9.1/x86_64/pools.go (about)

     1  package x86_64
     2  
     3  // CreateLabel creates a new Label, it may allocate a new one or grab one from a pool.
     4  func CreateLabel(name string) *Label {
     5  	p := new(Label)
     6  
     7  	/* initialize the label */
     8  	p.refs = 1
     9  	p.Name = name
    10  	return p
    11  }
    12  
    13  func newProgram(arch *Arch) *Program {
    14  	p := new(Program)
    15  
    16  	/* initialize the program */
    17  	p.arch = arch
    18  	return p
    19  }
    20  
    21  func newInstruction(name string, argc int, argv Operands) *Instruction {
    22  	p := new(Instruction)
    23  
    24  	/* initialize the instruction */
    25  	p.name = name
    26  	p.argc = argc
    27  	p.argv = argv
    28  	return p
    29  }
    30  
    31  // CreateMemoryOperand creates a new MemoryOperand, it may allocate a new one or grab one from a pool.
    32  func CreateMemoryOperand() *MemoryOperand {
    33  	p := new(MemoryOperand)
    34  
    35  	/* initialize the memory operand */
    36  	p.refs = 1
    37  	return p
    38  }