Define generic 1, 2 and 4 byte pc relative relocations. They are common
[oota-llvm.git] / lib / MC / MCCodeEmitter.cpp
1 //===-- MCCodeEmitter.cpp - Instruction Encoding --------------------------===//
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/MCCodeEmitter.h"
11
12 using namespace llvm;
13
14 MCCodeEmitter::MCCodeEmitter() {
15 }
16
17 MCCodeEmitter::~MCCodeEmitter() {
18 }
19
20 const MCFixupKindInfo &MCCodeEmitter::getFixupKindInfo(MCFixupKind Kind) const {
21   static const MCFixupKindInfo Builtins[] = {
22     { "FK_Data_1", 0, 8, 0 },
23     { "FK_Data_2", 0, 16, 0 },
24     { "FK_Data_4", 0, 32, 0 },
25     { "FK_Data_8", 0, 64, 0 },
26     { "FK_PCRel_1", 0, 8, MCFixupKindInfo::FKF_IsPCRel },
27     { "FK_PCRel_2", 0, 16, MCFixupKindInfo::FKF_IsPCRel },
28     { "FK_PCRel_4", 0, 32, MCFixupKindInfo::FKF_IsPCRel }
29   };
30   
31   assert(Kind <= 6 && "Unknown fixup kind");
32   return Builtins[Kind];
33 }