Home | History | Annotate | Download | only in s390
      1 // Copyright 2015 the V8 project authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #if V8_TARGET_ARCH_S390
      6 
      7 #include "src/s390/constants-s390.h"
      8 
      9 namespace v8 {
     10 namespace internal {
     11 
     12 Instruction::OpcodeFormatType Instruction::OpcodeFormatTable[] = {
     13     // Based on Figure B-3 in z/Architecture Principles of
     14     // Operation.
     15     TWO_BYTE_OPCODE,           // 0x00
     16     TWO_BYTE_OPCODE,           // 0x01
     17     TWO_BYTE_DISJOINT_OPCODE,  // 0x02
     18     TWO_BYTE_DISJOINT_OPCODE,  // 0x03
     19     ONE_BYTE_OPCODE,           // 0x04
     20     ONE_BYTE_OPCODE,           // 0x05
     21     ONE_BYTE_OPCODE,           // 0x06
     22     ONE_BYTE_OPCODE,           // 0x07
     23     ONE_BYTE_OPCODE,           // 0x08
     24     ONE_BYTE_OPCODE,           // 0x09
     25     ONE_BYTE_OPCODE,           // 0x0A
     26     ONE_BYTE_OPCODE,           // 0x0B
     27     ONE_BYTE_OPCODE,           // 0x0C
     28     ONE_BYTE_OPCODE,           // 0x0D
     29     ONE_BYTE_OPCODE,           // 0x0E
     30     ONE_BYTE_OPCODE,           // 0x0F
     31     ONE_BYTE_OPCODE,           // 0x10
     32     ONE_BYTE_OPCODE,           // 0x11
     33     ONE_BYTE_OPCODE,           // 0x12
     34     ONE_BYTE_OPCODE,           // 0x13
     35     ONE_BYTE_OPCODE,           // 0x14
     36     ONE_BYTE_OPCODE,           // 0x15
     37     ONE_BYTE_OPCODE,           // 0x16
     38     ONE_BYTE_OPCODE,           // 0x17
     39     ONE_BYTE_OPCODE,           // 0x18
     40     ONE_BYTE_OPCODE,           // 0x19
     41     ONE_BYTE_OPCODE,           // 0x1A
     42     ONE_BYTE_OPCODE,           // 0x1B
     43     ONE_BYTE_OPCODE,           // 0x1C
     44     ONE_BYTE_OPCODE,           // 0x1D
     45     ONE_BYTE_OPCODE,           // 0x1E
     46     ONE_BYTE_OPCODE,           // 0x1F
     47     ONE_BYTE_OPCODE,           // 0x20
     48     ONE_BYTE_OPCODE,           // 0x21
     49     ONE_BYTE_OPCODE,           // 0x22
     50     ONE_BYTE_OPCODE,           // 0x23
     51     ONE_BYTE_OPCODE,           // 0x24
     52     ONE_BYTE_OPCODE,           // 0x25
     53     ONE_BYTE_OPCODE,           // 0x26
     54     ONE_BYTE_OPCODE,           // 0x27
     55     ONE_BYTE_OPCODE,           // 0x28
     56     ONE_BYTE_OPCODE,           // 0x29
     57     ONE_BYTE_OPCODE,           // 0x2A
     58     ONE_BYTE_OPCODE,           // 0x2B
     59     ONE_BYTE_OPCODE,           // 0x2C
     60     ONE_BYTE_OPCODE,           // 0x2D
     61     ONE_BYTE_OPCODE,           // 0x2E
     62     ONE_BYTE_OPCODE,           // 0x2F
     63     ONE_BYTE_OPCODE,           // 0x30
     64     ONE_BYTE_OPCODE,           // 0x31
     65     ONE_BYTE_OPCODE,           // 0x32
     66     ONE_BYTE_OPCODE,           // 0x33
     67     ONE_BYTE_OPCODE,           // 0x34
     68     ONE_BYTE_OPCODE,           // 0x35
     69     ONE_BYTE_OPCODE,           // 0x36
     70     ONE_BYTE_OPCODE,           // 0x37
     71     ONE_BYTE_OPCODE,           // 0x38
     72     ONE_BYTE_OPCODE,           // 0x39
     73     ONE_BYTE_OPCODE,           // 0x3A
     74     ONE_BYTE_OPCODE,           // 0x3B
     75     ONE_BYTE_OPCODE,           // 0x3C
     76     ONE_BYTE_OPCODE,           // 0x3D
     77     ONE_BYTE_OPCODE,           // 0x3E
     78     ONE_BYTE_OPCODE,           // 0x3F
     79     ONE_BYTE_OPCODE,           // 0x40
     80     ONE_BYTE_OPCODE,           // 0x41
     81     ONE_BYTE_OPCODE,           // 0x42
     82     ONE_BYTE_OPCODE,           // 0x43
     83     ONE_BYTE_OPCODE,           // 0x44
     84     ONE_BYTE_OPCODE,           // 0x45
     85     ONE_BYTE_OPCODE,           // 0x46
     86     ONE_BYTE_OPCODE,           // 0x47
     87     ONE_BYTE_OPCODE,           // 0x48
     88     ONE_BYTE_OPCODE,           // 0x49
     89     ONE_BYTE_OPCODE,           // 0x4A
     90     ONE_BYTE_OPCODE,           // 0x4B
     91     ONE_BYTE_OPCODE,           // 0x4C
     92     ONE_BYTE_OPCODE,           // 0x4D
     93     ONE_BYTE_OPCODE,           // 0x4E
     94     ONE_BYTE_OPCODE,           // 0x4F
     95     ONE_BYTE_OPCODE,           // 0x50
     96     ONE_BYTE_OPCODE,           // 0x51
     97     ONE_BYTE_OPCODE,           // 0x52
     98     ONE_BYTE_OPCODE,           // 0x53
     99     ONE_BYTE_OPCODE,           // 0x54
    100     ONE_BYTE_OPCODE,           // 0x55
    101     ONE_BYTE_OPCODE,           // 0x56
    102     ONE_BYTE_OPCODE,           // 0x57
    103     ONE_BYTE_OPCODE,           // 0x58
    104     ONE_BYTE_OPCODE,           // 0x59
    105     ONE_BYTE_OPCODE,           // 0x5A
    106     ONE_BYTE_OPCODE,           // 0x5B
    107     ONE_BYTE_OPCODE,           // 0x5C
    108     ONE_BYTE_OPCODE,           // 0x5D
    109     ONE_BYTE_OPCODE,           // 0x5E
    110     ONE_BYTE_OPCODE,           // 0x5F
    111     ONE_BYTE_OPCODE,           // 0x60
    112     ONE_BYTE_OPCODE,           // 0x61
    113     ONE_BYTE_OPCODE,           // 0x62
    114     ONE_BYTE_OPCODE,           // 0x63
    115     ONE_BYTE_OPCODE,           // 0x64
    116     ONE_BYTE_OPCODE,           // 0x65
    117     ONE_BYTE_OPCODE,           // 0x66
    118     ONE_BYTE_OPCODE,           // 0x67
    119     ONE_BYTE_OPCODE,           // 0x68
    120     ONE_BYTE_OPCODE,           // 0x69
    121     ONE_BYTE_OPCODE,           // 0x6A
    122     ONE_BYTE_OPCODE,           // 0x6B
    123     ONE_BYTE_OPCODE,           // 0x6C
    124     ONE_BYTE_OPCODE,           // 0x6D
    125     ONE_BYTE_OPCODE,           // 0x6E
    126     ONE_BYTE_OPCODE,           // 0x6F
    127     ONE_BYTE_OPCODE,           // 0x70
    128     ONE_BYTE_OPCODE,           // 0x71
    129     ONE_BYTE_OPCODE,           // 0x72
    130     ONE_BYTE_OPCODE,           // 0x73
    131     ONE_BYTE_OPCODE,           // 0x74
    132     ONE_BYTE_OPCODE,           // 0x75
    133     ONE_BYTE_OPCODE,           // 0x76
    134     ONE_BYTE_OPCODE,           // 0x77
    135     ONE_BYTE_OPCODE,           // 0x78
    136     ONE_BYTE_OPCODE,           // 0x79
    137     ONE_BYTE_OPCODE,           // 0x7A
    138     ONE_BYTE_OPCODE,           // 0x7B
    139     ONE_BYTE_OPCODE,           // 0x7C
    140     ONE_BYTE_OPCODE,           // 0x7D
    141     ONE_BYTE_OPCODE,           // 0x7E
    142     ONE_BYTE_OPCODE,           // 0x7F
    143     ONE_BYTE_OPCODE,           // 0x80
    144     ONE_BYTE_OPCODE,           // 0x81
    145     ONE_BYTE_OPCODE,           // 0x82
    146     ONE_BYTE_OPCODE,           // 0x83
    147     ONE_BYTE_OPCODE,           // 0x84
    148     ONE_BYTE_OPCODE,           // 0x85
    149     ONE_BYTE_OPCODE,           // 0x86
    150     ONE_BYTE_OPCODE,           // 0x87
    151     ONE_BYTE_OPCODE,           // 0x88
    152     ONE_BYTE_OPCODE,           // 0x89
    153     ONE_BYTE_OPCODE,           // 0x8A
    154     ONE_BYTE_OPCODE,           // 0x8B
    155     ONE_BYTE_OPCODE,           // 0x8C
    156     ONE_BYTE_OPCODE,           // 0x8D
    157     ONE_BYTE_OPCODE,           // 0x8E
    158     ONE_BYTE_OPCODE,           // 0x8F
    159     ONE_BYTE_OPCODE,           // 0x90
    160     ONE_BYTE_OPCODE,           // 0x91
    161     ONE_BYTE_OPCODE,           // 0x92
    162     ONE_BYTE_OPCODE,           // 0x93
    163     ONE_BYTE_OPCODE,           // 0x94
    164     ONE_BYTE_OPCODE,           // 0x95
    165     ONE_BYTE_OPCODE,           // 0x96
    166     ONE_BYTE_OPCODE,           // 0x97
    167     ONE_BYTE_OPCODE,           // 0x98
    168     ONE_BYTE_OPCODE,           // 0x99
    169     ONE_BYTE_OPCODE,           // 0x9A
    170     ONE_BYTE_OPCODE,           // 0x9B
    171     TWO_BYTE_DISJOINT_OPCODE,  // 0x9C
    172     TWO_BYTE_DISJOINT_OPCODE,  // 0x9D
    173     TWO_BYTE_DISJOINT_OPCODE,  // 0x9E
    174     TWO_BYTE_DISJOINT_OPCODE,  // 0x9F
    175     TWO_BYTE_DISJOINT_OPCODE,  // 0xA0
    176     TWO_BYTE_DISJOINT_OPCODE,  // 0xA1
    177     TWO_BYTE_DISJOINT_OPCODE,  // 0xA2
    178     TWO_BYTE_DISJOINT_OPCODE,  // 0xA3
    179     TWO_BYTE_DISJOINT_OPCODE,  // 0xA4
    180     THREE_NIBBLE_OPCODE,       // 0xA5
    181     TWO_BYTE_DISJOINT_OPCODE,  // 0xA6
    182     THREE_NIBBLE_OPCODE,       // 0xA7
    183     ONE_BYTE_OPCODE,           // 0xA8
    184     ONE_BYTE_OPCODE,           // 0xA9
    185     ONE_BYTE_OPCODE,           // 0xAA
    186     ONE_BYTE_OPCODE,           // 0xAB
    187     ONE_BYTE_OPCODE,           // 0xAC
    188     ONE_BYTE_OPCODE,           // 0xAD
    189     ONE_BYTE_OPCODE,           // 0xAE
    190     ONE_BYTE_OPCODE,           // 0xAF
    191     ONE_BYTE_OPCODE,           // 0xB0
    192     ONE_BYTE_OPCODE,           // 0xB1
    193     TWO_BYTE_OPCODE,           // 0xB2
    194     TWO_BYTE_OPCODE,           // 0xB3
    195     TWO_BYTE_DISJOINT_OPCODE,  // 0xB4
    196     TWO_BYTE_DISJOINT_OPCODE,  // 0xB5
    197     TWO_BYTE_DISJOINT_OPCODE,  // 0xB6
    198     TWO_BYTE_DISJOINT_OPCODE,  // 0xB7
    199     TWO_BYTE_DISJOINT_OPCODE,  // 0xB8
    200     TWO_BYTE_OPCODE,           // 0xB9
    201     ONE_BYTE_OPCODE,           // 0xBA
    202     ONE_BYTE_OPCODE,           // 0xBB
    203     ONE_BYTE_OPCODE,           // 0xBC
    204     ONE_BYTE_OPCODE,           // 0xBD
    205     ONE_BYTE_OPCODE,           // 0xBE
    206     ONE_BYTE_OPCODE,           // 0xBF
    207     THREE_NIBBLE_OPCODE,       // 0xC0
    208     THREE_NIBBLE_OPCODE,       // 0xC1
    209     THREE_NIBBLE_OPCODE,       // 0xC2
    210     THREE_NIBBLE_OPCODE,       // 0xC3
    211     THREE_NIBBLE_OPCODE,       // 0xC4
    212     THREE_NIBBLE_OPCODE,       // 0xC5
    213     THREE_NIBBLE_OPCODE,       // 0xC6
    214     ONE_BYTE_OPCODE,           // 0xC7
    215     THREE_NIBBLE_OPCODE,       // 0xC8
    216     THREE_NIBBLE_OPCODE,       // 0xC9
    217     THREE_NIBBLE_OPCODE,       // 0xCA
    218     THREE_NIBBLE_OPCODE,       // 0xCB
    219     THREE_NIBBLE_OPCODE,       // 0xCC
    220     TWO_BYTE_DISJOINT_OPCODE,  // 0xCD
    221     TWO_BYTE_DISJOINT_OPCODE,  // 0xCE
    222     TWO_BYTE_DISJOINT_OPCODE,  // 0xCF
    223     ONE_BYTE_OPCODE,           // 0xD0
    224     ONE_BYTE_OPCODE,           // 0xD1
    225     ONE_BYTE_OPCODE,           // 0xD2
    226     ONE_BYTE_OPCODE,           // 0xD3
    227     ONE_BYTE_OPCODE,           // 0xD4
    228     ONE_BYTE_OPCODE,           // 0xD5
    229     ONE_BYTE_OPCODE,           // 0xD6
    230     ONE_BYTE_OPCODE,           // 0xD7
    231     ONE_BYTE_OPCODE,           // 0xD8
    232     ONE_BYTE_OPCODE,           // 0xD9
    233     ONE_BYTE_OPCODE,           // 0xDA
    234     ONE_BYTE_OPCODE,           // 0xDB
    235     ONE_BYTE_OPCODE,           // 0xDC
    236     ONE_BYTE_OPCODE,           // 0xDD
    237     ONE_BYTE_OPCODE,           // 0xDE
    238     ONE_BYTE_OPCODE,           // 0xDF
    239     ONE_BYTE_OPCODE,           // 0xE0
    240     ONE_BYTE_OPCODE,           // 0xE1
    241     ONE_BYTE_OPCODE,           // 0xE2
    242     TWO_BYTE_DISJOINT_OPCODE,  // 0xE3
    243     TWO_BYTE_DISJOINT_OPCODE,  // 0xE4
    244     TWO_BYTE_OPCODE,           // 0xE5
    245     TWO_BYTE_DISJOINT_OPCODE,  // 0xE6
    246     TWO_BYTE_DISJOINT_OPCODE,  // 0xE7
    247     ONE_BYTE_OPCODE,           // 0xE8
    248     ONE_BYTE_OPCODE,           // 0xE9
    249     ONE_BYTE_OPCODE,           // 0xEA
    250     TWO_BYTE_DISJOINT_OPCODE,  // 0xEB
    251     TWO_BYTE_DISJOINT_OPCODE,  // 0xEC
    252     TWO_BYTE_DISJOINT_OPCODE,  // 0xED
    253     ONE_BYTE_OPCODE,           // 0xEE
    254     ONE_BYTE_OPCODE,           // 0xEF
    255     ONE_BYTE_OPCODE,           // 0xF0
    256     ONE_BYTE_OPCODE,           // 0xF1
    257     ONE_BYTE_OPCODE,           // 0xF2
    258     ONE_BYTE_OPCODE,           // 0xF3
    259     ONE_BYTE_OPCODE,           // 0xF4
    260     ONE_BYTE_OPCODE,           // 0xF5
    261     ONE_BYTE_OPCODE,           // 0xF6
    262     ONE_BYTE_OPCODE,           // 0xF7
    263     ONE_BYTE_OPCODE,           // 0xF8
    264     ONE_BYTE_OPCODE,           // 0xF9
    265     ONE_BYTE_OPCODE,           // 0xFA
    266     ONE_BYTE_OPCODE,           // 0xFB
    267     ONE_BYTE_OPCODE,           // 0xFC
    268     ONE_BYTE_OPCODE,           // 0xFD
    269     TWO_BYTE_DISJOINT_OPCODE,  // 0xFE
    270     TWO_BYTE_DISJOINT_OPCODE,  // 0xFF
    271 };
    272 
    273 // These register names are defined in a way to match the native disassembler
    274 // formatting. See for example the command "objdump -d <binary file>".
    275 const char* Registers::names_[kNumRegisters] = {
    276     "r0", "r1", "r2",  "r3", "r4", "r5",  "r6",  "r7",
    277     "r8", "r9", "r10", "fp", "ip", "r13", "r14", "sp"};
    278 
    279 const char* DoubleRegisters::names_[kNumDoubleRegisters] = {
    280     "f0", "f1", "f2",  "f3",  "f4",  "f5",  "f6",  "f7",
    281     "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15"};
    282 
    283 int DoubleRegisters::Number(const char* name) {
    284   for (int i = 0; i < kNumDoubleRegisters; i++) {
    285     if (strcmp(names_[i], name) == 0) {
    286       return i;
    287     }
    288   }
    289 
    290   // No register with the requested name found.
    291   return kNoRegister;
    292 }
    293 
    294 int Registers::Number(const char* name) {
    295   // Look through the canonical names.
    296   for (int i = 0; i < kNumRegisters; i++) {
    297     if (strcmp(names_[i], name) == 0) {
    298       return i;
    299     }
    300   }
    301 
    302   // No register with the requested name found.
    303   return kNoRegister;
    304 }
    305 
    306 }  // namespace internal
    307 }  // namespace v8
    308 
    309 #endif  // V8_TARGET_ARCH_S390
    310