266 ~ShortBranchVerifier() {
267 _assm->clear_short_branch_delta();
268 }
269 };
270 #else
271 // Dummy in product.
272 class ShortBranchVerifier: public StackObj {
273 public:
274 ShortBranchVerifier(AbstractAssembler* assm) {}
275 };
276 #endif
277
278 public:
279
280 // Creation
281 AbstractAssembler(CodeBuffer* code);
282
283 // ensure buf contains all code (call this before using/copying the code)
284 void flush();
285
286 void emit_int8( int8_t x) { code_section()->emit_int8( x); }
287 void emit_int16( int16_t x) { code_section()->emit_int16( x); }
288 void emit_int32( int32_t x) { code_section()->emit_int32( x); }
289 void emit_int64( int64_t x) { code_section()->emit_int64( x); }
290
291 void emit_float( jfloat x) { code_section()->emit_float( x); }
292 void emit_double( jdouble x) { code_section()->emit_double( x); }
293 void emit_address(address x) { code_section()->emit_address(x); }
294
295 // min and max values for signed immediate ranges
296 static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; }
297 static int max_simm(int nbits) { return (intptr_t(1) << (nbits - 1)) - 1; }
298
299 // Define some:
300 static int min_simm10() { return min_simm(10); }
301 static int min_simm13() { return min_simm(13); }
302 static int min_simm16() { return min_simm(16); }
303
304 // Test if x is within signed immediate range for nbits
305 static bool is_simm(intptr_t x, int nbits) { return min_simm(nbits) <= x && x <= max_simm(nbits); }
306
307 // Define some:
308 static bool is_simm5( intptr_t x) { return is_simm(x, 5 ); }
309 static bool is_simm8( intptr_t x) { return is_simm(x, 8 ); }
310 static bool is_simm10(intptr_t x) { return is_simm(x, 10); }
311 static bool is_simm11(intptr_t x) { return is_simm(x, 11); }
312 static bool is_simm12(intptr_t x) { return is_simm(x, 12); }
|
266 ~ShortBranchVerifier() {
267 _assm->clear_short_branch_delta();
268 }
269 };
270 #else
271 // Dummy in product.
272 class ShortBranchVerifier: public StackObj {
273 public:
274 ShortBranchVerifier(AbstractAssembler* assm) {}
275 };
276 #endif
277
278 public:
279
280 // Creation
281 AbstractAssembler(CodeBuffer* code);
282
283 // ensure buf contains all code (call this before using/copying the code)
284 void flush();
285
286 void emit_int8( int8_t x1) { code_section()->emit_int8(x1); }
287
288 void emit_int16( int16_t x) { code_section()->emit_int16(x); }
289 void emit_int16( int8_t x1, int8_t x2) { code_section()->emit_int16(x1, x2); }
290
291 void emit_int24( int8_t x1, int8_t x2, int8_t x3) { code_section()->emit_int24(x1, x2, x3); }
292
293 void emit_int32( int32_t x) { code_section()->emit_int32(x); }
294 void emit_int32( int8_t x1, int8_t x2, int8_t x3, int8_t x4) { code_section()->emit_int32(x1, x2, x3, x4); }
295
296 void emit_int64( int64_t x) { code_section()->emit_int64(x); }
297
298 void emit_float( jfloat x) { code_section()->emit_float(x); }
299 void emit_double( jdouble x) { code_section()->emit_double(x); }
300 void emit_address(address x) { code_section()->emit_address(x); }
301
302 // min and max values for signed immediate ranges
303 static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; }
304 static int max_simm(int nbits) { return (intptr_t(1) << (nbits - 1)) - 1; }
305
306 // Define some:
307 static int min_simm10() { return min_simm(10); }
308 static int min_simm13() { return min_simm(13); }
309 static int min_simm16() { return min_simm(16); }
310
311 // Test if x is within signed immediate range for nbits
312 static bool is_simm(intptr_t x, int nbits) { return min_simm(nbits) <= x && x <= max_simm(nbits); }
313
314 // Define some:
315 static bool is_simm5( intptr_t x) { return is_simm(x, 5 ); }
316 static bool is_simm8( intptr_t x) { return is_simm(x, 8 ); }
317 static bool is_simm10(intptr_t x) { return is_simm(x, 10); }
318 static bool is_simm11(intptr_t x) { return is_simm(x, 11); }
319 static bool is_simm12(intptr_t x) { return is_simm(x, 12); }
|