LLVM  4.0.0
MCAsmBackend.cpp
Go to the documentation of this file.
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"
13 using namespace llvm;
14 
16 
18 
20  return None;
21 }
22 
24  static const MCFixupKindInfo Builtins[] = {
25  {"FK_Data_1", 0, 8, 0},
26  {"FK_Data_2", 0, 16, 0},
27  {"FK_Data_4", 0, 32, 0},
28  {"FK_Data_8", 0, 64, 0},
29  {"FK_PCRel_1", 0, 8, MCFixupKindInfo::FKF_IsPCRel},
30  {"FK_PCRel_2", 0, 16, MCFixupKindInfo::FKF_IsPCRel},
31  {"FK_PCRel_4", 0, 32, MCFixupKindInfo::FKF_IsPCRel},
32  {"FK_PCRel_8", 0, 64, MCFixupKindInfo::FKF_IsPCRel},
33  {"FK_GPRel_1", 0, 8, 0},
34  {"FK_GPRel_2", 0, 16, 0},
35  {"FK_GPRel_4", 0, 32, 0},
36  {"FK_GPRel_8", 0, 64, 0},
37  {"FK_DTPRel_4", 0, 32, 0},
38  {"FK_DTPRel_8", 0, 64, 0},
39  {"FK_TPRel_4", 0, 32, 0},
40  {"FK_TPRel_8", 0, 64, 0},
41  {"FK_SecRel_1", 0, 8, 0},
42  {"FK_SecRel_2", 0, 16, 0},
43  {"FK_SecRel_4", 0, 32, 0},
44  {"FK_SecRel_8", 0, 64, 0}};
45 
46  assert((size_t)Kind <= array_lengthof(Builtins) && "Unknown fixup kind");
47  return Builtins[Kind];
48 }
49 
51  const MCFixup &Fixup, bool Resolved, uint64_t Value,
52  const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const {
53  if (!Resolved)
54  return true;
55  return fixupNeedsRelaxation(Fixup, Value, DF, Layout);
56 }
virtual bool fixupNeedsRelaxationAdvanced(const MCFixup &Fixup, bool Resolved, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const
Target specific predicate for whether a given fixup requires the associated instruction to be relaxed...
virtual ~MCAsmBackend()
virtual bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const =0
Simple predicate for targets where !Resolved implies requiring relaxation.
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:66
Is this fixup kind PCrelative? This is used by the assembler backend to evaluate fixup values in a ta...
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:29
A relaxable fragment holds on to its MCInst, since it may need to be relaxed during the assembler lay...
Definition: MCFragment.h:249
MCFixupKind
Extensible enumeration to represent the type of a fixup.
Definition: MCFixup.h:23
virtual Optional< MCFixupKind > getFixupKind(StringRef Name) const
Map a relocation name used in .reloc to a fixup kind.
constexpr size_t array_lengthof(T(&)[N])
Find the length of an array.
Definition: STLExtras.h:649
Target independent information on a fixup kind.
const unsigned Kind
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
Definition: Value.h:71
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
virtual const MCFixupKindInfo & getFixupKindInfo(MCFixupKind Kind) const
Get information on a fixup kind.