/src/keystone/llvm/lib/MC/MCAsmBackend.cpp
Line | Count | Source |
1 | | //===-- MCAsmBackend.cpp - Target MC Assembly Backend ----------------------==// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | |
10 | | #include "llvm/MC/MCAsmBackend.h" |
11 | | #include "llvm/ADT/STLExtras.h" |
12 | | #include "llvm/MC/MCFixupKindInfo.h" |
13 | | using namespace llvm_ks; |
14 | | |
15 | 129k | MCAsmBackend::MCAsmBackend() : HasDataInCodeSupport(false) {} |
16 | | |
17 | 129k | MCAsmBackend::~MCAsmBackend() {} |
18 | | |
19 | 7.06k | Optional<MCFixupKind> MCAsmBackend::getFixupKind(StringRef Name) const { |
20 | 7.06k | return None; |
21 | 7.06k | } |
22 | | |
23 | 581k | const MCFixupKindInfo &MCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const { |
24 | 581k | static const MCFixupKindInfo Builtins[] = { |
25 | 581k | {"FK_Data_1", 0, 8, 0}, |
26 | 581k | {"FK_Data_2", 0, 16, 0}, |
27 | 581k | {"FK_Data_4", 0, 32, 0}, |
28 | 581k | {"FK_Data_8", 0, 64, 0}, |
29 | 581k | {"FK_PCRel_1", 0, 8, MCFixupKindInfo::FKF_IsPCRel}, |
30 | 581k | {"FK_PCRel_2", 0, 16, MCFixupKindInfo::FKF_IsPCRel}, |
31 | 581k | {"FK_PCRel_4", 0, 32, MCFixupKindInfo::FKF_IsPCRel}, |
32 | 581k | {"FK_PCRel_8", 0, 64, MCFixupKindInfo::FKF_IsPCRel}, |
33 | 581k | {"FK_GPRel_1", 0, 8, 0}, |
34 | 581k | {"FK_GPRel_2", 0, 16, 0}, |
35 | 581k | {"FK_GPRel_4", 0, 32, 0}, |
36 | 581k | {"FK_GPRel_8", 0, 64, 0}, |
37 | 581k | {"FK_SecRel_1", 0, 8, 0}, |
38 | 581k | {"FK_SecRel_2", 0, 16, 0}, |
39 | 581k | {"FK_SecRel_4", 0, 32, 0}, |
40 | 581k | {"FK_SecRel_8", 0, 64, 0}}; |
41 | | |
42 | 581k | assert((size_t)Kind <= array_lengthof(Builtins) && "Unknown fixup kind"); |
43 | 581k | return Builtins[Kind]; |
44 | 581k | } |
45 | | |
46 | | bool MCAsmBackend::fixupNeedsRelaxationAdvanced( |
47 | | const MCFixup &Fixup, bool Resolved, uint64_t Value, |
48 | 20.0k | const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const { |
49 | 20.0k | if (!Resolved) |
50 | 580 | return true; |
51 | 19.4k | unsigned KsError; |
52 | 19.4k | return fixupNeedsRelaxation(Fixup, Value, DF, Layout, KsError); |
53 | 20.0k | } |