40 lines
646 B
Go
40 lines
646 B
Go
package llvm
|
|
|
|
import "fmt"
|
|
|
|
type Value interface {
|
|
fmt.Stringer
|
|
Type () Type
|
|
Name () string
|
|
Identifier () string
|
|
}
|
|
|
|
type Register struct {
|
|
Ty Type
|
|
RegisterName string
|
|
}
|
|
|
|
func (this *Register) Type () Type {
|
|
return this.Ty
|
|
}
|
|
|
|
func (this *Register) Named () bool {
|
|
return this.RegisterName != ""
|
|
}
|
|
|
|
func (this *Register) Name () string {
|
|
return this.RegisterName
|
|
}
|
|
|
|
func (this *Register) Identifier () string {
|
|
return EncodeRegisterName(this.Name())
|
|
}
|
|
|
|
func (this *Register) SetName (name string) {
|
|
this.RegisterName = name
|
|
}
|
|
|
|
func (this *Register) String () string {
|
|
return fmt.Sprintf("%v %v", this.Ty, this.Identifier())
|
|
}
|