Fix part 1 of pr4682. PICADD is a 16-bit instruction even in thumb2 mode.
[llvm/avr.git] / lib / Target / X86 / X86ELFWriterInfo.h
blobe882a0c84b6069519dcfd169e01fb281dd61b437
1 //===-- X86ELFWriterInfo.h - ELF Writer Info for X86 ------------*- C++ -*-===//
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 // This file implements ELF writer information for the X86 backend.
12 //===----------------------------------------------------------------------===//
14 #ifndef X86_ELF_WRITER_INFO_H
15 #define X86_ELF_WRITER_INFO_H
17 #include "llvm/Target/TargetELFWriterInfo.h"
19 namespace llvm {
21 class X86ELFWriterInfo : public TargetELFWriterInfo {
23 // ELF Relocation types for X86
24 enum X86RelocationType {
25 R_386_NONE = 0,
26 R_386_32 = 1,
27 R_386_PC32 = 2
30 // ELF Relocation types for X86_64
31 enum X86_64RelocationType {
32 R_X86_64_NONE = 0,
33 R_X86_64_64 = 1,
34 R_X86_64_PC32 = 2,
35 R_X86_64_32 = 10,
36 R_X86_64_32S = 11,
37 R_X86_64_PC64 = 24
40 public:
41 X86ELFWriterInfo(TargetMachine &TM);
42 virtual ~X86ELFWriterInfo();
44 /// getRelocationType - Returns the target specific ELF Relocation type.
45 /// 'MachineRelTy' contains the object code independent relocation type
46 virtual unsigned getRelocationType(unsigned MachineRelTy) const;
48 /// hasRelocationAddend - True if the target uses an addend in the
49 /// ELF relocation entry.
50 virtual bool hasRelocationAddend() const { return is64Bit ? true : false; }
52 /// hasCustomJumpTableIndexRelTy - Returns true if the target has a
53 /// specific relocation type for a jump table index.
54 virtual bool hasCustomJumpTableIndexRelTy() const {
55 return is64Bit ? true : false;
58 /// getJumpTableIndexRelTy - Returns the target specific relocation type
59 /// for a jump table index.
60 virtual unsigned getJumpTableIndexRelTy() const { return R_X86_64_32S; }
62 /// getDefaultAddendForRelTy - Gets the default addend value for a
63 /// relocation entry based on the target ELF relocation type.
64 virtual long int getDefaultAddendForRelTy(unsigned RelTy) const;
66 /// getRelTySize - Returns the size of relocatable field in bits
67 virtual unsigned getRelocationTySize(unsigned RelTy) const;
69 /// isPCRelativeRel - True if the relocation type is pc relative
70 virtual bool isPCRelativeRel(unsigned RelTy) const;
72 /// getJumpTableRelocationTy - Returns the machine relocation type used
73 /// to reference a jumptable.
74 virtual unsigned getAbsoluteLabelMachineRelTy() const;
76 /// computeRelocation - Some relocatable fields could be relocated
77 /// directly, avoiding the relocation symbol emission, compute the
78 /// final relocation value for this symbol.
79 virtual long int computeRelocation(unsigned SymOffset, unsigned RelOffset,
80 unsigned RelTy) const;
83 } // end llvm namespace
85 #endif // X86_ELF_WRITER_INFO_H