OLD | NEW |
1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// | 1 //===- subzero/src/IceOperand.h - High-level operands -----------*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 247 matching lines...) Loading... |
258 | 258 |
259 public: | 259 public: |
260 static RelocOffset *create(GlobalContext *Ctx) { | 260 static RelocOffset *create(GlobalContext *Ctx) { |
261 return new (Ctx->allocate<RelocOffset>()) RelocOffset(); | 261 return new (Ctx->allocate<RelocOffset>()) RelocOffset(); |
262 } | 262 } |
263 | 263 |
264 static RelocOffset *create(GlobalContext *Ctx, RelocOffsetT Value) { | 264 static RelocOffset *create(GlobalContext *Ctx, RelocOffsetT Value) { |
265 return new (Ctx->allocate<RelocOffset>()) RelocOffset(Value); | 265 return new (Ctx->allocate<RelocOffset>()) RelocOffset(Value); |
266 } | 266 } |
267 | 267 |
| 268 void setSubtract(bool Value) { Subtract = Value; } |
268 bool hasOffset() const { return HasOffset; } | 269 bool hasOffset() const { return HasOffset; } |
269 | 270 |
270 RelocOffsetT getOffset() const { | 271 RelocOffsetT getOffset() const { |
271 assert(HasOffset); | 272 assert(HasOffset); |
272 return Offset; | 273 return Offset; |
273 } | 274 } |
274 | 275 |
275 void setOffset(const RelocOffsetT Value) { | 276 void setOffset(const RelocOffsetT Value) { |
276 assert(!HasOffset); | 277 assert(!HasOffset); |
277 Offset = Value; | 278 if (Subtract) { |
| 279 assert(Value != std::numeric_limits<RelocOffsetT>::lowest()); |
| 280 Offset = -Value; |
| 281 } else { |
| 282 Offset = Value; |
| 283 } |
278 HasOffset = true; | 284 HasOffset = true; |
279 } | 285 } |
280 | 286 |
281 private: | 287 private: |
282 RelocOffset() = default; | 288 RelocOffset() = default; |
283 explicit RelocOffset(RelocOffsetT Offset) { setOffset(Offset); } | 289 explicit RelocOffset(RelocOffsetT Offset) { setOffset(Offset); } |
284 | 290 |
| 291 bool Subtract = false; |
285 bool HasOffset = false; | 292 bool HasOffset = false; |
286 RelocOffsetT Offset; | 293 RelocOffsetT Offset; |
287 }; | 294 }; |
288 | 295 |
289 /// RelocatableTuple bundles the parameters that are used to construct an | 296 /// RelocatableTuple bundles the parameters that are used to construct an |
290 /// ConstantRelocatable. It is done this way so that ConstantRelocatable can fit | 297 /// ConstantRelocatable. It is done this way so that ConstantRelocatable can fit |
291 /// into the global constant pool template mechanism. | 298 /// into the global constant pool template mechanism. |
292 class RelocatableTuple { | 299 class RelocatableTuple { |
293 RelocatableTuple() = delete; | 300 RelocatableTuple() = delete; |
294 RelocatableTuple &operator=(const RelocatableTuple &) = delete; | 301 RelocatableTuple &operator=(const RelocatableTuple &) = delete; |
(...skipping 510 matching lines...) Loading... |
805 private: | 812 private: |
806 const Cfg *Func; | 813 const Cfg *Func; |
807 MetadataKind Kind; | 814 MetadataKind Kind; |
808 CfgVector<VariableTracking> Metadata; | 815 CfgVector<VariableTracking> Metadata; |
809 const static InstDefList NoDefinitions; | 816 const static InstDefList NoDefinitions; |
810 }; | 817 }; |
811 | 818 |
812 } // end of namespace Ice | 819 } // end of namespace Ice |
813 | 820 |
814 #endif // SUBZERO_SRC_ICEOPERAND_H | 821 #endif // SUBZERO_SRC_ICEOPERAND_H |
OLD | NEW |