300 Register reg() { return _r; } 301 }; 302 303 class Pre : public PrePost { 304 public: 305 Pre(Register reg, int o) : PrePost(reg, o) { } 306 }; 307 class Post : public PrePost { 308 Register _idx; 309 public: 310 Post(Register reg, int o) : PrePost(reg, o) { _idx = NULL; } 311 Post(Register reg, Register idx) : PrePost(reg, 0) { _idx = idx; } 312 Register idx_reg() { return _idx; } 313 }; 314 315 namespace ext 316 { 317 enum operation { uxtb, uxth, uxtw, uxtx, sxtb, sxth, sxtw, sxtx }; 318 }; 319 320 // abs methods which cannot overflow and so are well-defined across 321 // the entire domain of integer types. 322 static inline unsigned int uabs(unsigned int n) { 323 union { 324 unsigned int result; 325 int value; 326 }; 327 result = n; 328 if (value < 0) result = -result; 329 return result; 330 } 331 static inline unsigned long uabs(unsigned long n) { 332 union { 333 unsigned long result; 334 long value; 335 }; 336 result = n; 337 if (value < 0) result = -result; 338 return result; 339 } 340 static inline unsigned long uabs(long n) { return uabs((unsigned long)n); } 341 static inline unsigned long uabs(int n) { return uabs((unsigned int)n); } 342 343 // Addressing modes 344 class Address { 345 public: 346 347 enum mode { no_mode, base_plus_offset, pre, post, post_reg, pcrel, 348 base_plus_offset_reg, literal }; 349 350 // Shift and extend for base reg + reg offset addressing 351 class extend { 352 int _option, _shift; 353 ext::operation _op; 354 public: 355 extend() { } 356 extend(int s, int o, ext::operation op) : _option(o), _shift(s), _op(op) { } 357 int option() const{ return _option; } 358 int shift() const { return _shift; } 359 ext::operation op() const { return _op; } 360 }; 361 class uxtw : public extend { 362 public: | 300 Register reg() { return _r; } 301 }; 302 303 class Pre : public PrePost { 304 public: 305 Pre(Register reg, int o) : PrePost(reg, o) { } 306 }; 307 class Post : public PrePost { 308 Register _idx; 309 public: 310 Post(Register reg, int o) : PrePost(reg, o) { _idx = NULL; } 311 Post(Register reg, Register idx) : PrePost(reg, 0) { _idx = idx; } 312 Register idx_reg() { return _idx; } 313 }; 314 315 namespace ext 316 { 317 enum operation { uxtb, uxth, uxtw, uxtx, sxtb, sxth, sxtw, sxtx }; 318 }; 319 320 // Addressing modes 321 class Address { 322 public: 323 324 enum mode { no_mode, base_plus_offset, pre, post, post_reg, pcrel, 325 base_plus_offset_reg, literal }; 326 327 // Shift and extend for base reg + reg offset addressing 328 class extend { 329 int _option, _shift; 330 ext::operation _op; 331 public: 332 extend() { } 333 extend(int s, int o, ext::operation op) : _option(o), _shift(s), _op(op) { } 334 int option() const{ return _option; } 335 int shift() const { return _shift; } 336 ext::operation op() const { return _op; } 337 }; 338 class uxtw : public extend { 339 public: |