1 //
2 // Copyright 2024 CloudWeGo Authors
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 17 package x86_64
18 19 // CreateLabel creates a new Label, it may allocate a new one or grab one from a pool.
20 func CreateLabel(name string) *Label {
21 p := new(Label)
22 23 /* initialize the label */
24 p.refs = 1
25 p.Name = name
26 return p
27 }
28 29 func newProgram(arch *Arch) *Program {
30 p := new(Program)
31 32 /* initialize the program */
33 p.arch = arch
34 return p
35 }
36 37 func newInstruction(name string, argc int, argv Operands) *Instruction {
38 p := new(Instruction)
39 40 /* initialize the instruction */
41 p.name = name
42 p.argc = argc
43 p.argv = argv
44 return p
45 }
46 47 // CreateMemoryOperand creates a new MemoryOperand, it may allocate a new one or grab one from a pool.
48 func CreateMemoryOperand() *MemoryOperand {
49 p := new(MemoryOperand)
50 51 /* initialize the memory operand */
52 p.refs = 1
53 return p
54 }
55