386conv.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 378 行 · 第 1/2 页
C
378 行
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: 386 machine type conversion routines.
*
****************************************************************************/
#include "standard.h"
#include "pattern.h"
#include "coderep.h"
#include "opcodes.h"
#include "regset.h"
#include "rtclass.h"
#include "vergen.h"
#include "model.h"
#include "funits.h"
extern name * AllocTemp(type_class_def);
extern instruction* MakeUnary(opcode_defs,name*,name*,type_class_def);
extern void MoveSegOp(instruction*,instruction*,int);
extern void PrefixIns(instruction*,instruction*);
extern instruction* MakeMove(name*,name*,type_class_def);
extern void DupSeg(instruction*,instruction*);
extern void ReplIns(instruction*,instruction*);
extern int RoutineNum;
static opcode_entry C2to1[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( R, ANY, NONE ), V_NO, R_MOVELOW, RG_TWOBYTE,FU_NO,
_Un( R, ANY, NONE ), V_NO, R_MOVOP1TEMP, RG_, FU_NO,
_Un( ANY, ANY, NONE ), V_NO, R_MOVELOW, RG_, FU_NO,
};
static opcode_entry C4to1[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( U, ANY, NONE ), V_CONSTTEMP, G_UNKNOWN, RG_, FU_NO,
_Un( C, ANY, NONE ), V_OP1RELOC, R_MOVOP1TEMP, RG_, FU_NO,
_Un( ANY, ANY, NONE ), V_NO, R_CONVERT_LOW, RG_, FU_NO
};
static opcode_entry C4to2[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( U, ANY, NONE ), V_CONSTTEMP, G_UNKNOWN, RG_, FU_NO,
_Un( C, ANY, NONE ), V_OP1RELOC, R_MOVOP1TEMP, RG_, FU_NO,
_Un( ANY, ANY, NONE ), V_NO, R_MOVELOW, RG_, FU_NO
};
static opcode_entry C8to4[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( U, ANY, NONE ), V_CONSTTEMP, G_UNKNOWN, RG_, FU_NO,
_Un( C, ANY, NONE ), V_OP1RELOC, R_MOVOP1TEMP, RG_, FU_NO,
_Un( ANY, ANY, NONE ), V_NO, R_MOVELOW, RG_, FU_NO
};
static opcode_entry S1to2[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( R, R, NONE ), V_NO, G_SIGNEX, RG_CBW, FU_ALUX,
_Un( R|M, R, NONE ), V_NO, G_MOVSX, RG_BYTE_WORD, FU_ALU1,
_Un( U|C, R, NONE ), V_NO, G_UNKNOWN, RG_BYTE_WORD, FU_NO,
_Un( ANY, M, NONE ), V_NO, R_MOVRESREG, RG_BYTE_WORD, FU_NO,
_Un( ANY, ANY, NONE ), V_NO, G_UNKNOWN, RG_BYTE_WORD_NEED_WORD,FU_NO,
};
static opcode_entry S1to4[] = {
/*********************************/
/* from to eq verify gen reg fu*/
// _Un( R, R, NONE ), V_NO, G_SIGNEX, RG_CBDE, FU_ALUX,
// _Un( R, R, NONE ), V_NO, G_SIGNEX, RG_CBD, FU_ALUX,
// _Un( ANY, R, NONE ), V_NO, R_MOVOP1REG, RG_CBD, FU_NO,
_Un( M, R, NONE ),NVI(V_CYP_SEX), R_CYP_SEX, RG_DBL, FU_NO,
_Un( R|M, R, NONE ), V_NO, G_MOVSX, RG_BYTE_DBL,FU_ALU1,
_Un( U|C, R, NONE ), V_NO, G_UNKNOWN, RG_BYTE_DBL,FU_NO,
_Un( ANY, M, NONE ), V_NO, R_MOVRESREG, RG_BYTE_DBL,FU_NO,
_Un( ANY, ANY, NONE ), V_NO, G_UNKNOWN, RG_BYTE_DBL_NEED_DBL,FU_NO,
};
static opcode_entry S1to8[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( ANY, ANY, NONE ), V_NO, R_CONVERT_UP, RG_, FU_NO,
};
static opcode_entry S2to8[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( ANY, ANY, NONE ), V_NO, R_CONVERT_UP, RG_, FU_NO,
};
static opcode_entry Z1to8[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( ANY, ANY, NONE ), V_NO, R_CONVERT_UP, RG_, FU_NO,
};
static opcode_entry Z2to8[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( ANY, ANY, NONE ), V_NO, R_CONVERT_UP, RG_, FU_NO,
};
static opcode_entry S2to4[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( R, R, NONE ), V_NO, G_SIGNEX, RG_CWDE, FU_ALUX,
_Un( R, R, NONE ), V_NO, G_SIGNEX, RG_CWD, FU_ALUX,
_Un( ANY, R, NONE ), V_NO, R_MOVOP1REG, RG_CWD, FU_NO,
_Un( M, R, NONE ),NVI(V_CYP_SEX), R_CYP_SEX, RG_DBL, FU_NO,
_Un( R|M, R, NONE ), V_NO, G_MOVSX, RG_WORD_DBL,FU_ALU1,
_Un( U|C, R, NONE ), V_NO, G_UNKNOWN, RG_WORD_DBL,FU_NO,
_Un( ANY, M, NONE ), V_NO, R_MOVRESREG, RG_WORD_DBL,FU_NO,
_Un( ANY, ANY, NONE ), V_NO, G_UNKNOWN, RG_WORD_DBL_NEED_DBL,FU_NO,
};
static opcode_entry S4to8[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( R, R, NONE ), V_SIZE, G_SIGNEX, RG_CDQ, FU_ALUX,
_Un( ANY, R, NONE ), V_SIZE, R_MOVOP1REG, RG_CDQ, FU_NO,
_Un( ANY, ANY, NONE ), V_NO, R_CDQ, RG_, FU_NO,
};
static opcode_entry Z1to2[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( R|M, R, NONE ), V_GOOD_CLR, R_CLRHIGH_R, RG_BYTE_2BYTE, FU_NO,
_Un( R|M, R, NONE ), V_NO, G_MOVZX, RG_BYTE_WORD, FU_ALU1,
_Un( U|C, R, NONE ), V_NO, G_UNKNOWN, RG_BYTE_WORD, FU_NO,
_Un( ANY, M, NONE ), V_NO, R_MOVRESREG, RG_BYTE_WORD, FU_NO,
_Un( ANY, ANY, NONE ), V_NO, G_UNKNOWN, RG_BYTE_WORD_NEED_WORD,FU_NO,
};
static opcode_entry Z1to4[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( R|M, R, NONE ), V_GOOD_CLR, R_CLRHIGH_R, RG_BYTE_4BYTE, FU_NO,
_Un( R|M, R, NONE ), V_NO, G_MOVZX, RG_BYTE_DBL, FU_ALU1,
_Un( U|C, R, NONE ), V_NO, G_UNKNOWN, RG_BYTE_DBL, FU_NO,
_Un( ANY, M, NONE ), V_NO, R_MOVRESREG, RG_BYTE_DBL, FU_NO,
_Un( ANY, ANY, NONE ), V_NO, G_UNKNOWN, RG_BYTE_DBL_NEED_DBL,FU_NO,
};
static opcode_entry Z2to4[] = {
/*********************************/
/* from to eq verify gen reg fu*/
_Un( ANY, R, NONE ), V_NO, R_CLRHIGH_R, RG_CWD, FU_NO,
_Un( R|M, R, NONE ), V_GOOD_CLR, R_CLRHIGH_R, RG_WORD_DBL,FU_NO,
_Un( C, ANY, NONE ), V_OP1RELOC, R_MOVOP1TEMP, RG_, FU_NO,
_Un( R|M, R, NONE ), V_NO, G_MOVZX, RG_WORD_DBL,FU_ALU1,
_Un( U|C, R, NONE ), V_NO, G_UNKNOWN, RG_WORD_DBL,FU_NO,
_Un( ANY, M, NONE ), V_NO, R_MOVRESREG, RG_WORD_DBL,FU_NO,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?