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