Home | History | Annotate | Download | only in common

Lines Matching defs:label

73 // A Label represents a value not yet known that we need to store in a
78 // A label can be in one of three states:
80 // - defined as the sum of some other label and a constant, or
83 // A label's value never changes, but it can accumulate constraints.
84 // Adding labels and integers is permitted, and yields a label.
85 // Subtracting a constant from a label is permitted, and also yields a
86 // label. Subtracting two labels that have some relationship to each
91 // Label a; // a's value is undefined
92 // Label b; // b's value is undefined
94 // Label c = a + 4; // okay, even though a's value is unknown
97 // Label d = b - 2; // okay; d == a+6, even though c is gone
105 // Label objects' lifetimes are unconstrained: notice that, in the
108 // particular, it's not necessary to ensure that a Label lives beyond
110 class Label {
112 Label(); // An undefined label.
113 Label(uint64_t value); // A label with a fixed value
114 Label(const Label &value); // A label equal to another.
115 ~Label();
117 // Return this label's value; it must be known.
121 // Label + size_t becomes ambigious, because it can't decide whether
122 // to convert the Label to a uint64_t and then to a size_t, or use
123 // the overloaded operator that returns a new label, even though the
124 // former could fail if the label is not yet defined and the latter won't.
127 Label &operator=(uint64_t value);
128 Label &operator=(const Label &value);
129 Label operator+(uint64_t addend) const;
130 Label operator-(uint64_t subtrahend) const;
131 uint64_t operator-(const Label &subtrahend) const;
136 // Return true if this label's value is known. If VALUE_P is given,
140 // Return true if the offset from LABEL to this label is known. If
149 // Label l, m;
158 bool IsKnownOffsetFrom(const Label &label, uint64_t *offset_p = NULL) const;
161 // A label's value, or if that is not yet known, how the value is
232 // This label's value.
236 inline Label operator+(uint64_t a, const Label &l) { return l + a; }
237 // Note that int-Label isn't defined, as negating a Label is not an
254 // to compute immediately, you can create a label, append the
255 // label's value to the section, and then set the label's value
256 // later, when it's convenient to do so. Once a label's value is
264 // Note that there is no specified "start of section" label. This is
311 Section &Append(Endianness endianness, size_t size, const Label &label);
339 // Append VALUE or LABEL to this section, with the given bit width and
361 Section &L8(const Label &label), &L16(const Label &label),
362 &L32(const Label &label), &L64(const Label &label),
363 &B8(const Label &label), &B16(const Label &label),
364 &B32(const Label &label), &B64(const Label &label),
365 &D8(const Label &label), &D16(const Label &label),
366 &D32(const Label &label), &D64(const Label &label);
384 // Note that VALUE cannot be a Label (we would have to implement
400 // Note that VALUE cannot be a Label (we would have to implement
416 // Return a label representing the start of the section.
418 // It is up to the user whether this label represents the section's
422 // provides a single start label, for use with the Here and Mark
432 Label start() const { return start_; }
434 // Return a label representing the point at which the next Appended
436 Label Here() const { return start_ + Size(); }
438 // Set *LABEL to Here, and return a reference to this section.
439 Section &Mark(Label *label) { *label = Here(); return *this; }
441 // If there are no undefined label references left in this
448 // Used internally. A reference to a label's value.
451 const Label &set_label)
453 label(set_label) { }
464 // The label to which this is a reference.
465 Label label;
477 // A label referring to the beginning of the section.
478 Label start_;