blob: b9b1f894e7261f0e84c8441cc5fe84c6768a5b29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set ts=8 sts=2 et sw=2 tw=80:
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef jit_riscv64_constant_Constant_riscv64_h
#define jit_riscv64_constant_Constant_riscv64_h
#include "mozilla/Assertions.h"
#include "mozilla/Types.h"
#include <stdio.h>
#include "jit/riscv64/constant/Base-constant-riscv.h"
#include "jit/riscv64/constant/Constant-riscv-a.h"
#include "jit/riscv64/constant/Constant-riscv-c.h"
#include "jit/riscv64/constant/Constant-riscv-d.h"
#include "jit/riscv64/constant/Constant-riscv-f.h"
#include "jit/riscv64/constant/Constant-riscv-i.h"
#include "jit/riscv64/constant/Constant-riscv-m.h"
#include "jit/riscv64/constant/Constant-riscv-v.h"
#include "jit/riscv64/constant/Constant-riscv-zicsr.h"
#include "jit/riscv64/constant/Constant-riscv-zifencei.h"
namespace js {
namespace jit {
// A reasonable (ie, safe) buffer size for the disassembly of a single
// instruction.
const int ReasonableBufferSize = 256;
// Difference between address of current opcode and value read from pc
// register.
static constexpr int kPcLoadDelta = 4;
// Bits available for offset field in branches
static constexpr int kBranchOffsetBits = 13;
// Bits available for offset field in jump
static constexpr int kJumpOffsetBits = 21;
// Bits available for offset field in compresed jump
static constexpr int kCJalOffsetBits = 12;
// Bits available for offset field in 4 branch
static constexpr int kCBranchOffsetBits = 9;
// Max offset for b instructions with 12-bit offset field (multiple of 2)
static constexpr int kMaxBranchOffset = (1 << (kBranchOffsetBits - 1)) - 1;
static constexpr int kCBranchOffset = (1 << (kCBranchOffsetBits - 1)) - 1;
// Max offset for jal instruction with 20-bit offset field (multiple of 2)
static constexpr int kMaxJumpOffset = (1 << (kJumpOffsetBits - 1)) - 1;
static constexpr int kCJumpOffset = (1 << (kCJalOffsetBits - 1)) - 1;
static constexpr int kTrampolineSlotsSize = 2 * kInstrSize;
static_assert(kCJalOffsetBits == kOffset12);
static_assert(kCBranchOffsetBits == kOffset9);
static_assert(kJumpOffsetBits == kOffset21);
static_assert(kBranchOffsetBits == kOffset13);
// Vector as used by the original code to allow for minimal modification.
// Functions exactly like a character array with helper methods.
} // namespace jit
} // namespace js
#endif // jit_riscv64_constant_Constant_riscv64_h
|