aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/link.go
diff options
context:
space:
mode:
authorRob Findley <rfindley@google.com>2020-09-11 14:23:34 -0400
committerRob Findley <rfindley@google.com>2020-09-11 14:23:34 -0400
commitf8b1c17aced24a1618c6984794be9770c5d260be (patch)
tree45af8d39b5c3d9f43d439ebec0a2ba42b49efe70 /src/cmd/internal/obj/link.go
parente5d91ab096a9ff9673311f1a7f3f860a7f9c2062 (diff)
parent07c1788357cfe6a4ee5f6f6a54d4fe9f579fa844 (diff)
downloadgo-f8b1c17aced24a1618c6984794be9770c5d260be.tar.gz
go-f8b1c17aced24a1618c6984794be9770c5d260be.zip
[dev.types] all: merge master into dev.typesdev.types
Change-Id: Ia6964cb4e09153c15cc9c5b441373d1b3cb8f757
Diffstat (limited to 'src/cmd/internal/obj/link.go')
-rw-r--r--src/cmd/internal/obj/link.go24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go
index 311e5ae2e8..1d4217b5f5 100644
--- a/src/cmd/internal/obj/link.go
+++ b/src/cmd/internal/obj/link.go
@@ -237,6 +237,19 @@ const (
TYPE_REGLIST
)
+func (a *Addr) Target() *Prog {
+ if a.Type == TYPE_BRANCH && a.Val != nil {
+ return a.Val.(*Prog)
+ }
+ return nil
+}
+func (a *Addr) SetTarget(t *Prog) {
+ if a.Type != TYPE_BRANCH {
+ panic("setting branch target when type is not TYPE_BRANCH")
+ }
+ a.Val = t
+}
+
// Prog describes a single machine instruction.
//
// The general instruction form is:
@@ -255,7 +268,7 @@ const (
// to avoid too much changes in a single swing.
// (1) scheme is enough to express any kind of operand combination.
//
-// Jump instructions use the Pcond field to point to the target instruction,
+// Jump instructions use the To.Val field to point to the target *Prog,
// which must be in the same linked list as the jump instruction.
//
// The Progs for a given function are arranged in a list linked through the Link field.
@@ -274,7 +287,7 @@ type Prog struct {
From Addr // first source operand
RestArgs []Addr // can pack any operands that not fit into {Prog.From, Prog.To}
To Addr // destination operand (second is RegTo2 below)
- Pcond *Prog // target of conditional jump
+ Pool *Prog // constant pool entry, for arm,arm64 back ends
Forwd *Prog // for x86 back end
Rel *Prog // for x86, arm back ends
Pc int64 // for back ends or assembler: virtual or actual program counter, depending on phase
@@ -682,10 +695,9 @@ type Link struct {
GenAbstractFunc func(fn *LSym)
Errors int
- InParallel bool // parallel backend phase in effect
- Framepointer_enabled bool
- UseBASEntries bool // use Base Address Selection Entries in location lists and PC ranges
- IsAsm bool // is the source assembly language, which may contain surprising idioms (e.g., call tables)
+ InParallel bool // parallel backend phase in effect
+ UseBASEntries bool // use Base Address Selection Entries in location lists and PC ranges
+ IsAsm bool // is the source assembly language, which may contain surprising idioms (e.g., call tables)
// state for writing objects
Text []*LSym