summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-06-11 19:16:03 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-06-11 19:16:03 +0000
commit1656366e4dcd4083272e92a38b9e62bd20448cf5 (patch)
treeff5b437f0357a361e46389acaa23f4196f787c08 /llvm/include
parent9d79bdaaad4216b49ff63c91309314b6a44304ee (diff)
downloadbcm5719-llvm-1656366e4dcd4083272e92a38b9e62bd20448cf5.tar.gz
bcm5719-llvm-1656366e4dcd4083272e92a38b9e62bd20448cf5.zip
Support for ELF Visibility
Emission for globals, using the correct data sections Function alignment can be computed for each target using TargetELFWriterInfo Some small fixes llvm-svn: 73201
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Target/TargetELFWriterInfo.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/include/llvm/Target/TargetELFWriterInfo.h b/llvm/include/llvm/Target/TargetELFWriterInfo.h
index e266a71f8c8..809846a0fbe 100644
--- a/llvm/include/llvm/Target/TargetELFWriterInfo.h
+++ b/llvm/include/llvm/Target/TargetELFWriterInfo.h
@@ -14,6 +14,10 @@
#ifndef LLVM_TARGET_TARGETELFWRITERINFO_H
#define LLVM_TARGET_TARGETELFWRITERINFO_H
+#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetMachine.h"
+#include "llvm/Function.h"
+
namespace llvm {
//===--------------------------------------------------------------------===//
@@ -21,9 +25,11 @@ namespace llvm {
//===--------------------------------------------------------------------===//
class TargetELFWriterInfo {
+ protected:
// EMachine - This field is the target specific value to emit as the
// e_machine member of the ELF header.
unsigned short EMachine;
+ TargetMachine &TM;
public:
// Machine architectures
@@ -44,10 +50,21 @@ namespace llvm {
EM_X86_64 = 62 // AMD64
};
- explicit TargetELFWriterInfo(MachineType machine) : EMachine(machine) {}
+ explicit TargetELFWriterInfo(TargetMachine &tm) : TM(tm) {}
virtual ~TargetELFWriterInfo() {}
unsigned short getEMachine() const { return EMachine; }
+
+ /// getFunctionAlignment - Returns the alignment for function 'F', targets
+ /// with different alignment constraints should overload this method
+ virtual unsigned getFunctionAlignment(const Function *F) const {
+ const TargetData *TD = TM.getTargetData();
+ unsigned FnAlign = F->getAlignment();
+ unsigned TDAlign = TD->getPointerABIAlignment();
+ unsigned Align = std::max(FnAlign, TDAlign);
+ assert(!(Align & (Align-1)) && "Alignment is not a power of two!");
+ return Align;
+ }
};
} // end llvm namespace
OpenPOWER on IntegriCloud