github.com/bir3/gocompiler@v0.9.2202/src/cmd/compile/internal/riscv64/gsubr.go (about)

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package riscv64
     6  
     7  import (
     8  	"github.com/bir3/gocompiler/src/cmd/compile/internal/objw"
     9  	"github.com/bir3/gocompiler/src/cmd/internal/obj"
    10  	"github.com/bir3/gocompiler/src/cmd/internal/obj/riscv"
    11  )
    12  
    13  func ginsnop(pp *objw.Progs) *obj.Prog {
    14  	// Hardware nop is ADD $0, ZERO
    15  	p := pp.Prog(riscv.AADD)
    16  	p.From.Type = obj.TYPE_CONST
    17  	p.Reg = riscv.REG_ZERO
    18  	p.To = obj.Addr{Type: obj.TYPE_REG, Reg: riscv.REG_ZERO}
    19  	return p
    20  }