1 /*BEGIN_LEGAL
2 
3 Copyright (c) 2018 Intel Corporation
4 
5   Licensed under the Apache License, Version 2.0 (the "License");
6   you may not use this file except in compliance with the License.
7   You may obtain a copy of the License at
8 
9       http://www.apache.org/licenses/LICENSE-2.0
10 
11   Unless required by applicable law or agreed to in writing, software
12   distributed under the License is distributed on an "AS IS" BASIS,
13   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   See the License for the specific language governing permissions and
15   limitations under the License.
16 
17 END_LEGAL */
18 /// @file xed-operand-values-interface.c
19 ///
20 
21 
22 #include "xed-internal-header.h"
23 #include "xed-operand-values-interface.h"
24 #include "xed-util.h"
25 #include "xed-init-pointer-names.h"
26 #include "xed-operand-ctype-enum.h"
27 #include "xed-operand-ctype-map.h"
28 #include "xed-reg-class.h"
29 #include <string.h> //memset
30 
31 #include "xed-ild.h"
32 
33 
34 xed_uint32_t
xed_operand_values_get_memory_displacement_length_bits_raw(const xed_operand_values_t * p)35 xed_operand_values_get_memory_displacement_length_bits_raw(
36     const xed_operand_values_t* p)
37 {
38     if (xed_operand_values_has_memory_displacement(p) == 0)
39         return 0;
40     return xed_operand_values_get_memory_displacement_length_bits(p);
41 }
42 
43 xed_uint32_t
xed_operand_values_get_memory_displacement_length_bits(const xed_operand_values_t * p)44 xed_operand_values_get_memory_displacement_length_bits(
45                                          const xed_operand_values_t* p)
46 {
47     if (xed_operand_values_has_memory_displacement(p) == 0)
48         return 0;
49     return xed3_operand_get_disp_width(p);
50 }
51 
52 
xed_operand_values_get_memory_displacement_int64(const xed_operand_values_t * p)53 xed_int64_t  xed_operand_values_get_memory_displacement_int64(
54                                          const xed_operand_values_t* p) {
55     if (xed_operand_values_has_memory_displacement(p) == 0)
56         return 0;
57 
58     return xed3_operand_get_disp(p);
59 }
60 
61 // unscaled. the raw vs scaled distinction is only relevant for AVX512
62 xed_int64_t
xed_operand_values_get_memory_displacement_int64_raw(const xed_operand_values_t * p)63 xed_operand_values_get_memory_displacement_int64_raw(
64     const xed_operand_values_t* p)
65 {
66     return xed_operand_values_get_memory_displacement_int64(p);
67 }
68 
69 
70