summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCObjectFormat.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-10-16 18:23:53 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-10-16 18:23:53 +0000
commit4262a2222506c97685b4f0f9ff51c2eb9ee59115 (patch)
tree53633d5fe813ac9891a74f95e8bb0d2d93c18946 /llvm/lib/MC/MCObjectFormat.cpp
parent556658c79e34ce1fe126e2634d47b80e8b3e78fd (diff)
downloadbcm5719-llvm-4262a2222506c97685b4f0f9ff51c2eb9ee59115.tar.gz
bcm5719-llvm-4262a2222506c97685b4f0f9ff51c2eb9ee59115.zip
Add a MCObjectFormat class so that code common to all targets that use a
single object format can be shared. This also adds support for mov zed+(bar-foo), %eax on ELF and COFF targets. llvm-svn: 116675
Diffstat (limited to 'llvm/lib/MC/MCObjectFormat.cpp')
-rw-r--r--llvm/lib/MC/MCObjectFormat.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCObjectFormat.cpp b/llvm/lib/MC/MCObjectFormat.cpp
new file mode 100644
index 00000000000..07d361c8a49
--- /dev/null
+++ b/llvm/lib/MC/MCObjectFormat.cpp
@@ -0,0 +1,31 @@
+//===- lib/MC/MCObjectFormat.cpp - MCObjectFormat implementation ----------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCObjectFormat.h"
+#include "llvm/MC/MCSymbol.h"
+
+using namespace llvm;
+
+bool MCELFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
+ const MCSymbol &B) const {
+ // On ELF A - B is absolute if A and B are in the same section.
+ return &A.getSection() == &B.getSection();
+}
+
+bool MCMachOObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
+ const MCSymbol &B) const {
+ // On MachO A - B is absolute only if in a set.
+ return IsSet;
+}
+
+bool MCCOFFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A,
+ const MCSymbol &B) const {
+ // On COFF A - B is absolute if A and B are in the same section.
+ return &A.getSection() == &B.getSection();
+}
OpenPOWER on IntegriCloud