Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(919)

Delta Between Two Patch Sets: x86asm/inst.go

Issue 98990043: code review 98990043: x86asm: instruction definition (Closed)
Left Patch Set: diff -r 876d94cecc2e https://code.google.com/p/rsc.x86/ Created 9 years, 10 months ago
Right Patch Set: diff -r 876d94cecc2e https://code.google.com/p/rsc.x86/ Created 9 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | x86asm/inst_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2014 The Go Authors. All rights reserved. 1 // Copyright 2014 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Package x86asm implements decoding of x86 machine code. 5 // Package x86asm implements decoding of x86 machine code.
6 package x86asm 6 package x86asm
7 7
8 import ( 8 import (
9 "bytes" 9 "bytes"
10 "fmt" 10 "fmt"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 TR0 307 TR0
308 TR1 308 TR1
309 TR2 309 TR2
310 TR3 310 TR3
311 TR4 311 TR4
312 TR5 312 TR5
313 TR6 313 TR6
314 TR7 314 TR7
315 ) 315 )
316 316
317 const regMax = TR7
318
317 func (Reg) isArg() {} 319 func (Reg) isArg() {}
318 320
319 func (r Reg) String() string { 321 func (r Reg) String() string {
320 i := int(r) 322 i := int(r)
321 if i < 0 || i >= len(regNames) || regNames[i] == "" { 323 if i < 0 || i >= len(regNames) || regNames[i] == "" {
322 return fmt.Sprintf("Reg(%d)", i) 324 return fmt.Sprintf("Reg(%d)", i)
323 } 325 }
324 return regNames[i] 326 return regNames[i]
325 } 327 }
326 328
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 func (r Rel) String() string { 367 func (r Rel) String() string {
366 return fmt.Sprintf(".%+d", r) 368 return fmt.Sprintf(".%+d", r)
367 } 369 }
368 370
369 // An Imm is an integer constant. 371 // An Imm is an integer constant.
370 type Imm int64 372 type Imm int64
371 373
372 func (Imm) isArg() {} 374 func (Imm) isArg() {}
373 375
374 func (i Imm) String() string { 376 func (i Imm) String() string {
375 » return fmt.Sprintf("$%#x", int64(i)) 377 » return fmt.Sprintf("%#x", int64(i))
376 } 378 }
377 379
378 func (i Inst) String() string { 380 func (i Inst) String() string {
379 var buf bytes.Buffer 381 var buf bytes.Buffer
380 for _, p := range i.Prefix { 382 for _, p := range i.Prefix {
381 if p == 0 { 383 if p == 0 {
382 break 384 break
383 } 385 }
384 if p&PrefixImplicit != 0 { 386 if p&PrefixImplicit != 0 {
385 continue 387 continue
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 DR7: "DR7", 567 DR7: "DR7",
566 TR0: "TR0", 568 TR0: "TR0",
567 TR1: "TR1", 569 TR1: "TR1",
568 TR2: "TR2", 570 TR2: "TR2",
569 TR3: "TR3", 571 TR3: "TR3",
570 TR4: "TR4", 572 TR4: "TR4",
571 TR5: "TR5", 573 TR5: "TR5",
572 TR6: "TR6", 574 TR6: "TR6",
573 TR7: "TR7", 575 TR7: "TR7",
574 } 576 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b