WONKY



LOG | FILES | OVERVIEW


F diff --git a/src/backend/asm/intel/intel_compile.c b/src/backend/asm/intel/intel_compile.c --- a/src/backend/asm/intel/intel_compile.c +++ b/src/backend/asm/intel/intel_compile.c
}
void compile_shift_left_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin)
{
- push_intel_asm_instruction(compile_data,get_intel_asm_simple_instruction(INTEL_ASM_OP_NOP));
+ compile_ast_to_intel_asm(compile_data,(struct AST*)bin->left);
+ compile_ast_to_intel_asm(compile_data,(struct AST*)bin->right);
+
+ rvalue_to_register(compile_data,bin->right->value,INTEL_ASM_REGISTER_RDX);
+ rvalue_to_register(compile_data,bin->left->value,INTEL_ASM_REGISTER_RAX);
+
+ push_intel_asm_instruction(compile_data,get_intel_asm_binary_instruction(get_intel_asm_register(INTEL_ASM_REGISTER_CL),get_intel_asm_register(INTEL_ASM_REGISTER_DL),INTEL_ASM_OP_MOV));
+
+ push_intel_asm_instruction(compile_data,get_intel_asm_binary_instruction(get_intel_asm_register(INTEL_ASM_REGISTER_RAX),get_intel_asm_register(INTEL_ASM_REGISTER_CL),INTEL_ASM_OP_SAL));
+ push_intel_asm_instruction(compile_data,intel_asm_get_push(INTEL_ASM_REGISTER_RAX));
}
void compile_shift_right_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin)
{
- push_intel_asm_instruction(compile_data,get_intel_asm_simple_instruction(INTEL_ASM_OP_NOP));
+ compile_ast_to_intel_asm(compile_data,(struct AST*)bin->left);
+ compile_ast_to_intel_asm(compile_data,(struct AST*)bin->right);
+
+ rvalue_to_register(compile_data,bin->right->value,INTEL_ASM_REGISTER_RDX);
+ rvalue_to_register(compile_data,bin->left->value,INTEL_ASM_REGISTER_RAX);
+
+ push_intel_asm_instruction(compile_data,get_intel_asm_binary_instruction(get_intel_asm_register(INTEL_ASM_REGISTER_CL),get_intel_asm_register(INTEL_ASM_REGISTER_DL),INTEL_ASM_OP_MOV));
+
+ push_intel_asm_instruction(compile_data,get_intel_asm_binary_instruction(get_intel_asm_register(INTEL_ASM_REGISTER_RAX),get_intel_asm_register(INTEL_ASM_REGISTER_CL),INTEL_ASM_OP_SAR));
+ push_intel_asm_instruction(compile_data,intel_asm_get_push(INTEL_ASM_REGISTER_RAX));
}
void compile_less_eq_to_intel_asm(struct Compile_Data_Intel_Asm *compile_data,struct AST_Binary_Expression *bin)
{
F diff --git a/src/backend/asm/intel/intel_instruction.c b/src/backend/asm/intel/intel_instruction.c --- a/src/backend/asm/intel/intel_instruction.c +++ b/src/backend/asm/intel/intel_instruction.c
[INTEL_ASM_OP_IMPORT]=(map_entry)save_intel_asm_import,
[INTEL_ASM_OP_EXPORT]=(map_entry)save_intel_asm_export,
[INTEL_ASM_OP_POP]=(map_entry)save_intel_asm_unary_instruction,
+ [INTEL_ASM_OP_SAL]=(map_entry)save_intel_asm_binary_instruction,
+ [INTEL_ASM_OP_SAR]=(map_entry)save_intel_asm_binary_instruction,
[INTEL_ASM_OP_PUSH]=(map_entry)save_intel_asm_unary_instruction,
[INTEL_ASM_OP_DEFINE_BYTES]=(map_entry)save_intel_asm_define_bytes,
};
[INTEL_ASM_OP_XOR]="XOR",
[INTEL_ASM_OP_OR]="OR",
[INTEL_ASM_OP_CMP]="CMP",
+ [INTEL_ASM_OP_SAL]="SAL",
+ [INTEL_ASM_OP_SAR]="SAR",
};
wonky_assert(map[bin->type]!=NULL);
fprintf(out,"%s ",map[bin->type]);
F diff --git a/src/backend/asm/intel/intel_instruction.hh b/src/backend/asm/intel/intel_instruction.hh --- a/src/backend/asm/intel/intel_instruction.hh +++ b/src/backend/asm/intel/intel_instruction.hh
INTEL_ASM_OP_NOP,
INTEL_ASM_OP_LABEL,
INTEL_ASM_OP_POP,
+ INTEL_ASM_OP_SAL,
+ INTEL_ASM_OP_SAR,
INTEL_ASM_OP_PUSH,
INTEL_ASM_OP_DEFINE_BYTES,
INTEL_ASM_OP_EXPORT,
F diff --git a/src/backend/asm/intel/intel_location.c b/src/backend/asm/intel/intel_location.c --- a/src/backend/asm/intel/intel_location.c +++ b/src/backend/asm/intel/intel_location.c
[INTEL_ASM_REGISTER_AH]="AH",
[INTEL_ASM_REGISTER_BX]="BX",
[INTEL_ASM_REGISTER_DX]="DX",
+ [INTEL_ASM_REGISTER_DL]="DL",
+ [INTEL_ASM_REGISTER_DH]="DH",
[INTEL_ASM_REGISTER_DI]="DI",
[INTEL_ASM_REGISTER_SI]="SI",
[INTEL_ASM_REGISTER_CX]="CX",
+ [INTEL_ASM_REGISTER_CL]="CL",
+ [INTEL_ASM_REGISTER_CH]="CH",
[INTEL_ASM_REGISTER_RSP]="RSP",
[INTEL_ASM_REGISTER_RDI]="RDI",
[INTEL_ASM_REGISTER_RSI]="RSI",
F diff --git a/src/backend/asm/intel/intel_location.hh b/src/backend/asm/intel/intel_location.hh --- a/src/backend/asm/intel/intel_location.hh +++ b/src/backend/asm/intel/intel_location.hh
INTEL_ASM_REGISTER_AH,
INTEL_ASM_REGISTER_BX,
+
INTEL_ASM_REGISTER_DX,
+ INTEL_ASM_REGISTER_DH,
+ INTEL_ASM_REGISTER_DL,
+
INTEL_ASM_REGISTER_DI,
INTEL_ASM_REGISTER_SI,
+
INTEL_ASM_REGISTER_CX,
+ INTEL_ASM_REGISTER_CL,
+ INTEL_ASM_REGISTER_CH,
+
+
INTEL_ASM_REGISTER_RSP,
INTEL_ASM_REGISTER_RDI,