...

Source file src/pkg/cmd/compile/internal/ssa/rewritedec.go

     1	// Code generated from gen/dec.rules; DO NOT EDIT.
     2	// generated with: cd gen; go run *.go
     3	
     4	package ssa
     5	
     6	import "fmt"
     7	import "math"
     8	import "cmd/internal/obj"
     9	import "cmd/internal/objabi"
    10	import "cmd/compile/internal/types"
    11	
    12	var _ = fmt.Println   // in case not otherwise used
    13	var _ = math.MinInt8  // in case not otherwise used
    14	var _ = obj.ANOP      // in case not otherwise used
    15	var _ = objabi.GOROOT // in case not otherwise used
    16	var _ = types.TypeMem // in case not otherwise used
    17	
    18	func rewriteValuedec(v *Value) bool {
    19		switch v.Op {
    20		case OpComplexImag:
    21			return rewriteValuedec_OpComplexImag_0(v)
    22		case OpComplexReal:
    23			return rewriteValuedec_OpComplexReal_0(v)
    24		case OpIData:
    25			return rewriteValuedec_OpIData_0(v)
    26		case OpITab:
    27			return rewriteValuedec_OpITab_0(v)
    28		case OpLoad:
    29			return rewriteValuedec_OpLoad_0(v)
    30		case OpSliceCap:
    31			return rewriteValuedec_OpSliceCap_0(v)
    32		case OpSliceLen:
    33			return rewriteValuedec_OpSliceLen_0(v)
    34		case OpSlicePtr:
    35			return rewriteValuedec_OpSlicePtr_0(v)
    36		case OpStore:
    37			return rewriteValuedec_OpStore_0(v)
    38		case OpStringLen:
    39			return rewriteValuedec_OpStringLen_0(v)
    40		case OpStringPtr:
    41			return rewriteValuedec_OpStringPtr_0(v)
    42		}
    43		return false
    44	}
    45	func rewriteValuedec_OpComplexImag_0(v *Value) bool {
    46		// match: (ComplexImag (ComplexMake _ imag))
    47		// cond:
    48		// result: imag
    49		for {
    50			v_0 := v.Args[0]
    51			if v_0.Op != OpComplexMake {
    52				break
    53			}
    54			imag := v_0.Args[1]
    55			v.reset(OpCopy)
    56			v.Type = imag.Type
    57			v.AddArg(imag)
    58			return true
    59		}
    60		return false
    61	}
    62	func rewriteValuedec_OpComplexReal_0(v *Value) bool {
    63		// match: (ComplexReal (ComplexMake real _))
    64		// cond:
    65		// result: real
    66		for {
    67			v_0 := v.Args[0]
    68			if v_0.Op != OpComplexMake {
    69				break
    70			}
    71			_ = v_0.Args[1]
    72			real := v_0.Args[0]
    73			v.reset(OpCopy)
    74			v.Type = real.Type
    75			v.AddArg(real)
    76			return true
    77		}
    78		return false
    79	}
    80	func rewriteValuedec_OpIData_0(v *Value) bool {
    81		// match: (IData (IMake _ data))
    82		// cond:
    83		// result: data
    84		for {
    85			v_0 := v.Args[0]
    86			if v_0.Op != OpIMake {
    87				break
    88			}
    89			data := v_0.Args[1]
    90			v.reset(OpCopy)
    91			v.Type = data.Type
    92			v.AddArg(data)
    93			return true
    94		}
    95		return false
    96	}
    97	func rewriteValuedec_OpITab_0(v *Value) bool {
    98		// match: (ITab (IMake itab _))
    99		// cond:
   100		// result: itab
   101		for {
   102			v_0 := v.Args[0]
   103			if v_0.Op != OpIMake {
   104				break
   105			}
   106			_ = v_0.Args[1]
   107			itab := v_0.Args[0]
   108			v.reset(OpCopy)
   109			v.Type = itab.Type
   110			v.AddArg(itab)
   111			return true
   112		}
   113		return false
   114	}
   115	func rewriteValuedec_OpLoad_0(v *Value) bool {
   116		b := v.Block
   117		config := b.Func.Config
   118		typ := &b.Func.Config.Types
   119		// match: (Load <t> ptr mem)
   120		// cond: t.IsComplex() && t.Size() == 8
   121		// result: (ComplexMake (Load <typ.Float32> ptr mem) (Load <typ.Float32> (OffPtr <typ.Float32Ptr> [4] ptr) mem) )
   122		for {
   123			t := v.Type
   124			mem := v.Args[1]
   125			ptr := v.Args[0]
   126			if !(t.IsComplex() && t.Size() == 8) {
   127				break
   128			}
   129			v.reset(OpComplexMake)
   130			v0 := b.NewValue0(v.Pos, OpLoad, typ.Float32)
   131			v0.AddArg(ptr)
   132			v0.AddArg(mem)
   133			v.AddArg(v0)
   134			v1 := b.NewValue0(v.Pos, OpLoad, typ.Float32)
   135			v2 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr)
   136			v2.AuxInt = 4
   137			v2.AddArg(ptr)
   138			v1.AddArg(v2)
   139			v1.AddArg(mem)
   140			v.AddArg(v1)
   141			return true
   142		}
   143		// match: (Load <t> ptr mem)
   144		// cond: t.IsComplex() && t.Size() == 16
   145		// result: (ComplexMake (Load <typ.Float64> ptr mem) (Load <typ.Float64> (OffPtr <typ.Float64Ptr> [8] ptr) mem) )
   146		for {
   147			t := v.Type
   148			mem := v.Args[1]
   149			ptr := v.Args[0]
   150			if !(t.IsComplex() && t.Size() == 16) {
   151				break
   152			}
   153			v.reset(OpComplexMake)
   154			v0 := b.NewValue0(v.Pos, OpLoad, typ.Float64)
   155			v0.AddArg(ptr)
   156			v0.AddArg(mem)
   157			v.AddArg(v0)
   158			v1 := b.NewValue0(v.Pos, OpLoad, typ.Float64)
   159			v2 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr)
   160			v2.AuxInt = 8
   161			v2.AddArg(ptr)
   162			v1.AddArg(v2)
   163			v1.AddArg(mem)
   164			v.AddArg(v1)
   165			return true
   166		}
   167		// match: (Load <t> ptr mem)
   168		// cond: t.IsString()
   169		// result: (StringMake (Load <typ.BytePtr> ptr mem) (Load <typ.Int> (OffPtr <typ.IntPtr> [config.PtrSize] ptr) mem))
   170		for {
   171			t := v.Type
   172			mem := v.Args[1]
   173			ptr := v.Args[0]
   174			if !(t.IsString()) {
   175				break
   176			}
   177			v.reset(OpStringMake)
   178			v0 := b.NewValue0(v.Pos, OpLoad, typ.BytePtr)
   179			v0.AddArg(ptr)
   180			v0.AddArg(mem)
   181			v.AddArg(v0)
   182			v1 := b.NewValue0(v.Pos, OpLoad, typ.Int)
   183			v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
   184			v2.AuxInt = config.PtrSize
   185			v2.AddArg(ptr)
   186			v1.AddArg(v2)
   187			v1.AddArg(mem)
   188			v.AddArg(v1)
   189			return true
   190		}
   191		// match: (Load <t> ptr mem)
   192		// cond: t.IsSlice()
   193		// result: (SliceMake (Load <t.Elem().PtrTo()> ptr mem) (Load <typ.Int> (OffPtr <typ.IntPtr> [config.PtrSize] ptr) mem) (Load <typ.Int> (OffPtr <typ.IntPtr> [2*config.PtrSize] ptr) mem))
   194		for {
   195			t := v.Type
   196			mem := v.Args[1]
   197			ptr := v.Args[0]
   198			if !(t.IsSlice()) {
   199				break
   200			}
   201			v.reset(OpSliceMake)
   202			v0 := b.NewValue0(v.Pos, OpLoad, t.Elem().PtrTo())
   203			v0.AddArg(ptr)
   204			v0.AddArg(mem)
   205			v.AddArg(v0)
   206			v1 := b.NewValue0(v.Pos, OpLoad, typ.Int)
   207			v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
   208			v2.AuxInt = config.PtrSize
   209			v2.AddArg(ptr)
   210			v1.AddArg(v2)
   211			v1.AddArg(mem)
   212			v.AddArg(v1)
   213			v3 := b.NewValue0(v.Pos, OpLoad, typ.Int)
   214			v4 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
   215			v4.AuxInt = 2 * config.PtrSize
   216			v4.AddArg(ptr)
   217			v3.AddArg(v4)
   218			v3.AddArg(mem)
   219			v.AddArg(v3)
   220			return true
   221		}
   222		// match: (Load <t> ptr mem)
   223		// cond: t.IsInterface()
   224		// result: (IMake (Load <typ.Uintptr> ptr mem) (Load <typ.BytePtr> (OffPtr <typ.BytePtrPtr> [config.PtrSize] ptr) mem))
   225		for {
   226			t := v.Type
   227			mem := v.Args[1]
   228			ptr := v.Args[0]
   229			if !(t.IsInterface()) {
   230				break
   231			}
   232			v.reset(OpIMake)
   233			v0 := b.NewValue0(v.Pos, OpLoad, typ.Uintptr)
   234			v0.AddArg(ptr)
   235			v0.AddArg(mem)
   236			v.AddArg(v0)
   237			v1 := b.NewValue0(v.Pos, OpLoad, typ.BytePtr)
   238			v2 := b.NewValue0(v.Pos, OpOffPtr, typ.BytePtrPtr)
   239			v2.AuxInt = config.PtrSize
   240			v2.AddArg(ptr)
   241			v1.AddArg(v2)
   242			v1.AddArg(mem)
   243			v.AddArg(v1)
   244			return true
   245		}
   246		return false
   247	}
   248	func rewriteValuedec_OpSliceCap_0(v *Value) bool {
   249		// match: (SliceCap (SliceMake _ _ cap))
   250		// cond:
   251		// result: cap
   252		for {
   253			v_0 := v.Args[0]
   254			if v_0.Op != OpSliceMake {
   255				break
   256			}
   257			cap := v_0.Args[2]
   258			v.reset(OpCopy)
   259			v.Type = cap.Type
   260			v.AddArg(cap)
   261			return true
   262		}
   263		return false
   264	}
   265	func rewriteValuedec_OpSliceLen_0(v *Value) bool {
   266		// match: (SliceLen (SliceMake _ len _))
   267		// cond:
   268		// result: len
   269		for {
   270			v_0 := v.Args[0]
   271			if v_0.Op != OpSliceMake {
   272				break
   273			}
   274			_ = v_0.Args[2]
   275			len := v_0.Args[1]
   276			v.reset(OpCopy)
   277			v.Type = len.Type
   278			v.AddArg(len)
   279			return true
   280		}
   281		return false
   282	}
   283	func rewriteValuedec_OpSlicePtr_0(v *Value) bool {
   284		// match: (SlicePtr (SliceMake ptr _ _))
   285		// cond:
   286		// result: ptr
   287		for {
   288			v_0 := v.Args[0]
   289			if v_0.Op != OpSliceMake {
   290				break
   291			}
   292			_ = v_0.Args[2]
   293			ptr := v_0.Args[0]
   294			v.reset(OpCopy)
   295			v.Type = ptr.Type
   296			v.AddArg(ptr)
   297			return true
   298		}
   299		return false
   300	}
   301	func rewriteValuedec_OpStore_0(v *Value) bool {
   302		b := v.Block
   303		config := b.Func.Config
   304		typ := &b.Func.Config.Types
   305		// match: (Store {t} dst (ComplexMake real imag) mem)
   306		// cond: t.(*types.Type).Size() == 8
   307		// result: (Store {typ.Float32} (OffPtr <typ.Float32Ptr> [4] dst) imag (Store {typ.Float32} dst real mem))
   308		for {
   309			t := v.Aux
   310			mem := v.Args[2]
   311			dst := v.Args[0]
   312			v_1 := v.Args[1]
   313			if v_1.Op != OpComplexMake {
   314				break
   315			}
   316			imag := v_1.Args[1]
   317			real := v_1.Args[0]
   318			if !(t.(*types.Type).Size() == 8) {
   319				break
   320			}
   321			v.reset(OpStore)
   322			v.Aux = typ.Float32
   323			v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr)
   324			v0.AuxInt = 4
   325			v0.AddArg(dst)
   326			v.AddArg(v0)
   327			v.AddArg(imag)
   328			v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
   329			v1.Aux = typ.Float32
   330			v1.AddArg(dst)
   331			v1.AddArg(real)
   332			v1.AddArg(mem)
   333			v.AddArg(v1)
   334			return true
   335		}
   336		// match: (Store {t} dst (ComplexMake real imag) mem)
   337		// cond: t.(*types.Type).Size() == 16
   338		// result: (Store {typ.Float64} (OffPtr <typ.Float64Ptr> [8] dst) imag (Store {typ.Float64} dst real mem))
   339		for {
   340			t := v.Aux
   341			mem := v.Args[2]
   342			dst := v.Args[0]
   343			v_1 := v.Args[1]
   344			if v_1.Op != OpComplexMake {
   345				break
   346			}
   347			imag := v_1.Args[1]
   348			real := v_1.Args[0]
   349			if !(t.(*types.Type).Size() == 16) {
   350				break
   351			}
   352			v.reset(OpStore)
   353			v.Aux = typ.Float64
   354			v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr)
   355			v0.AuxInt = 8
   356			v0.AddArg(dst)
   357			v.AddArg(v0)
   358			v.AddArg(imag)
   359			v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
   360			v1.Aux = typ.Float64
   361			v1.AddArg(dst)
   362			v1.AddArg(real)
   363			v1.AddArg(mem)
   364			v.AddArg(v1)
   365			return true
   366		}
   367		// match: (Store dst (StringMake ptr len) mem)
   368		// cond:
   369		// result: (Store {typ.Int} (OffPtr <typ.IntPtr> [config.PtrSize] dst) len (Store {typ.BytePtr} dst ptr mem))
   370		for {
   371			mem := v.Args[2]
   372			dst := v.Args[0]
   373			v_1 := v.Args[1]
   374			if v_1.Op != OpStringMake {
   375				break
   376			}
   377			len := v_1.Args[1]
   378			ptr := v_1.Args[0]
   379			v.reset(OpStore)
   380			v.Aux = typ.Int
   381			v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
   382			v0.AuxInt = config.PtrSize
   383			v0.AddArg(dst)
   384			v.AddArg(v0)
   385			v.AddArg(len)
   386			v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
   387			v1.Aux = typ.BytePtr
   388			v1.AddArg(dst)
   389			v1.AddArg(ptr)
   390			v1.AddArg(mem)
   391			v.AddArg(v1)
   392			return true
   393		}
   394		// match: (Store dst (SliceMake ptr len cap) mem)
   395		// cond:
   396		// result: (Store {typ.Int} (OffPtr <typ.IntPtr> [2*config.PtrSize] dst) cap (Store {typ.Int} (OffPtr <typ.IntPtr> [config.PtrSize] dst) len (Store {typ.BytePtr} dst ptr mem)))
   397		for {
   398			mem := v.Args[2]
   399			dst := v.Args[0]
   400			v_1 := v.Args[1]
   401			if v_1.Op != OpSliceMake {
   402				break
   403			}
   404			cap := v_1.Args[2]
   405			ptr := v_1.Args[0]
   406			len := v_1.Args[1]
   407			v.reset(OpStore)
   408			v.Aux = typ.Int
   409			v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
   410			v0.AuxInt = 2 * config.PtrSize
   411			v0.AddArg(dst)
   412			v.AddArg(v0)
   413			v.AddArg(cap)
   414			v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
   415			v1.Aux = typ.Int
   416			v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
   417			v2.AuxInt = config.PtrSize
   418			v2.AddArg(dst)
   419			v1.AddArg(v2)
   420			v1.AddArg(len)
   421			v3 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
   422			v3.Aux = typ.BytePtr
   423			v3.AddArg(dst)
   424			v3.AddArg(ptr)
   425			v3.AddArg(mem)
   426			v1.AddArg(v3)
   427			v.AddArg(v1)
   428			return true
   429		}
   430		// match: (Store dst (IMake itab data) mem)
   431		// cond:
   432		// result: (Store {typ.BytePtr} (OffPtr <typ.BytePtrPtr> [config.PtrSize] dst) data (Store {typ.Uintptr} dst itab mem))
   433		for {
   434			mem := v.Args[2]
   435			dst := v.Args[0]
   436			v_1 := v.Args[1]
   437			if v_1.Op != OpIMake {
   438				break
   439			}
   440			data := v_1.Args[1]
   441			itab := v_1.Args[0]
   442			v.reset(OpStore)
   443			v.Aux = typ.BytePtr
   444			v0 := b.NewValue0(v.Pos, OpOffPtr, typ.BytePtrPtr)
   445			v0.AuxInt = config.PtrSize
   446			v0.AddArg(dst)
   447			v.AddArg(v0)
   448			v.AddArg(data)
   449			v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
   450			v1.Aux = typ.Uintptr
   451			v1.AddArg(dst)
   452			v1.AddArg(itab)
   453			v1.AddArg(mem)
   454			v.AddArg(v1)
   455			return true
   456		}
   457		return false
   458	}
   459	func rewriteValuedec_OpStringLen_0(v *Value) bool {
   460		// match: (StringLen (StringMake _ len))
   461		// cond:
   462		// result: len
   463		for {
   464			v_0 := v.Args[0]
   465			if v_0.Op != OpStringMake {
   466				break
   467			}
   468			len := v_0.Args[1]
   469			v.reset(OpCopy)
   470			v.Type = len.Type
   471			v.AddArg(len)
   472			return true
   473		}
   474		return false
   475	}
   476	func rewriteValuedec_OpStringPtr_0(v *Value) bool {
   477		// match: (StringPtr (StringMake ptr _))
   478		// cond:
   479		// result: ptr
   480		for {
   481			v_0 := v.Args[0]
   482			if v_0.Op != OpStringMake {
   483				break
   484			}
   485			_ = v_0.Args[1]
   486			ptr := v_0.Args[0]
   487			v.reset(OpCopy)
   488			v.Type = ptr.Type
   489			v.AddArg(ptr)
   490			return true
   491		}
   492		return false
   493	}
   494	func rewriteBlockdec(b *Block) bool {
   495		config := b.Func.Config
   496		typ := &config.Types
   497		_ = typ
   498		v := b.Control
   499		_ = v
   500		switch b.Kind {
   501		}
   502		return false
   503	}
   504	

View as plain text