summaryrefslogtreecommitdiff
path: root/include/llvm/MC/MCFixup.h
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-11-28 14:17:56 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-11-28 14:17:56 +0000
commite04ed7e45f194f14a7b28bbf3f55694d8e2bcf80 (patch)
tree854092273f97215528c062e83ee8d5ef3ff4eff4 /include/llvm/MC/MCFixup.h
parent9a08ca318e63912e4c19977abc1173f30866b704 (diff)
downloadllvm-e04ed7e45f194f14a7b28bbf3f55694d8e2bcf80.tar.gz
llvm-e04ed7e45f194f14a7b28bbf3f55694d8e2bcf80.tar.bz2
llvm-e04ed7e45f194f14a7b28bbf3f55694d8e2bcf80.tar.xz
Define generic 1, 2 and 4 byte pc relative relocations. They are common
and at least the 4 byte one will be needed to implement the .cfi_* directives. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120240 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCFixup.h')
-rw-r--r--include/llvm/MC/MCFixup.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/include/llvm/MC/MCFixup.h b/include/llvm/MC/MCFixup.h
index eed4c349e8..5352c642e6 100644
--- a/include/llvm/MC/MCFixup.h
+++ b/include/llvm/MC/MCFixup.h
@@ -22,6 +22,9 @@ enum MCFixupKind {
FK_Data_2, ///< A two-byte fixup.
FK_Data_4, ///< A four-byte fixup.
FK_Data_8, ///< A eight-byte fixup.
+ FK_PCRel_1, ///< A one-byte pc relative fixup.
+ FK_PCRel_2, ///< A two-byte pc relative fixup.
+ FK_PCRel_4, ///< A four-byte pc relative fixup.
FirstTargetFixupKind = 128,
@@ -77,13 +80,15 @@ public:
/// getKindForSize - Return the generic fixup kind for a value with the given
/// size. It is an error to pass an unsupported size.
- static MCFixupKind getKindForSize(unsigned Size) {
+ static MCFixupKind getKindForSize(unsigned Size, bool isPCRel) {
switch (Size) {
default: assert(0 && "Invalid generic fixup size!");
- case 1: return FK_Data_1;
- case 2: return FK_Data_2;
- case 4: return FK_Data_4;
- case 8: return FK_Data_8;
+ case 1: return isPCRel ? FK_PCRel_1 : FK_Data_1;
+ case 2: return isPCRel ? FK_PCRel_2 : FK_Data_2;
+ case 4: return isPCRel ? FK_PCRel_4 : FK_Data_4;
+ case 8:
+ assert(!isPCRel && "8 byte pc relative fixup is not supported.");
+ return FK_Data_8;
}
}
};