__builtin_expect no-op
Taken from David Mertens tcc branch on github
    https://github.com/run4flat/tinycc.git
			
			
This commit is contained in:
		
							parent
							
								
									5ee097fce9
								
							
						
					
					
						commit
						e010b1396b
					
				
					 2 changed files with 38 additions and 0 deletions
				
			
		
							
								
								
									
										37
									
								
								tccgen.c
									
										
									
									
									
								
							
							
						
						
									
										37
									
								
								tccgen.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -84,6 +84,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym, int case_re
 | 
			
		|||
static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r, int has_init, int v, int scope);
 | 
			
		||||
static int decl0(int l, int is_for_loop_init);
 | 
			
		||||
static void expr_eq(void);
 | 
			
		||||
static void expr_lor_const(void);
 | 
			
		||||
static void unary_type(CType *type);
 | 
			
		||||
static void vla_runtime_type_size(CType *type, int *a);
 | 
			
		||||
static void vla_sp_restore(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -3938,6 +3939,22 @@ ST_FUNC void unary(void)
 | 
			
		|||
        vtop->type.t |= VT_UNSIGNED;
 | 
			
		||||
        break;
 | 
			
		||||
 | 
			
		||||
    case TOK_builtin_expect:
 | 
			
		||||
        {
 | 
			
		||||
            /* __builtin_expect is a no-op for now */
 | 
			
		||||
            int saved_nocode_wanted;
 | 
			
		||||
            next();
 | 
			
		||||
            skip('(');
 | 
			
		||||
            expr_eq();
 | 
			
		||||
            skip(',');
 | 
			
		||||
            saved_nocode_wanted = nocode_wanted;
 | 
			
		||||
            nocode_wanted = 1;
 | 
			
		||||
            expr_lor_const();
 | 
			
		||||
            vpop();
 | 
			
		||||
            nocode_wanted = saved_nocode_wanted;
 | 
			
		||||
            skip(')');
 | 
			
		||||
        }
 | 
			
		||||
        break;
 | 
			
		||||
    case TOK_builtin_types_compatible_p:
 | 
			
		||||
        {
 | 
			
		||||
            CType type1, type2;
 | 
			
		||||
| 
						 | 
				
			
			@ -4466,6 +4483,26 @@ static void expr_or(void)
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* XXX: fix this mess */
 | 
			
		||||
static void expr_land_const(void)
 | 
			
		||||
{
 | 
			
		||||
    expr_or();
 | 
			
		||||
    while (tok == TOK_LAND) {
 | 
			
		||||
        next();
 | 
			
		||||
        expr_or();
 | 
			
		||||
        gen_op(TOK_LAND);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
static void expr_lor_const(void)
 | 
			
		||||
{
 | 
			
		||||
    expr_land_const();
 | 
			
		||||
    while (tok == TOK_LOR) {
 | 
			
		||||
        next();
 | 
			
		||||
        expr_land_const();
 | 
			
		||||
        gen_op(TOK_LOR);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void expr_land(void)
 | 
			
		||||
{
 | 
			
		||||
    expr_or();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								tcctok.h
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								tcctok.h
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -131,6 +131,7 @@
 | 
			
		|||
     DEF(TOK_builtin_constant_p, "__builtin_constant_p")
 | 
			
		||||
     DEF(TOK_builtin_frame_address, "__builtin_frame_address")
 | 
			
		||||
     DEF(TOK_builtin_return_address, "__builtin_return_address")
 | 
			
		||||
     DEF(TOK_builtin_expect, "__builtin_expect")
 | 
			
		||||
#ifdef TCC_TARGET_X86_64
 | 
			
		||||
#ifdef TCC_TARGET_PE
 | 
			
		||||
     DEF(TOK_builtin_va_start, "__builtin_va_start")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue