aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/ELFWriter.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2007-01-17 03:47:54 +0000
committerBill Wendling <isanbard@gmail.com>2007-01-17 03:47:54 +0000
commit99b10272f903de0ad6da380baf998767409bf28c (patch)
treecd31f8dd6ded27dadf31051f26d88baa3557950e /include/llvm/CodeGen/ELFWriter.h
parent34f03fff2d117068b4d627922484d2d79ed9c025 (diff)
Removed methods which are now in the respective TargetObjInfo implementations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33287 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/ELFWriter.h')
-rw-r--r--include/llvm/CodeGen/ELFWriter.h101
1 files changed, 5 insertions, 96 deletions
diff --git a/include/llvm/CodeGen/ELFWriter.h b/include/llvm/CodeGen/ELFWriter.h
index b3914794f0..7b7a91c8d1 100644
--- a/include/llvm/CodeGen/ELFWriter.h
+++ b/include/llvm/CodeGen/ELFWriter.h
@@ -22,6 +22,7 @@ namespace llvm {
class Mangler;
class MachineCodeEmitter;
class ELFCodeEmitter;
+ class TargetObjInfo;
/// ELFWriter - This class implements the common target-independent code for
/// writing ELF files. Targets should derive a class from this to
@@ -49,6 +50,10 @@ namespace llvm {
///
TargetMachine &TM;
+ /// Target object writer info.
+ ///
+ const TargetObjInfo *TOI;
+
/// Mang - The object used to perform name mangling for this module.
///
Mangler *Mang;
@@ -214,102 +219,6 @@ namespace llvm {
unsigned ELFHeader_e_shoff_Offset; // e_shoff in ELF header.
unsigned ELFHeader_e_shstrndx_Offset; // e_shstrndx in ELF header.
unsigned ELFHeader_e_shnum_Offset; // e_shnum in ELF header.
-
-
- // align - Emit padding into the file until the current output position is
- // aligned to the specified power of two boundary.
- static void align(DataBuffer &Output, unsigned Boundary) {
- assert(Boundary && (Boundary & (Boundary-1)) == 0 &&
- "Must align to 2^k boundary");
- size_t Size = Output.size();
- if (Size & (Boundary-1)) {
- // Add padding to get alignment to the correct place.
- size_t Pad = Boundary-(Size & (Boundary-1));
- Output.resize(Size+Pad);
- }
- }
-
- static void outbyte(DataBuffer &Output, unsigned char X) {
- Output.push_back(X);
- }
- void outhalf(DataBuffer &Output, unsigned short X) {
- if (isLittleEndian) {
- Output.push_back(X&255);
- Output.push_back(X >> 8);
- } else {
- Output.push_back(X >> 8);
- Output.push_back(X&255);
- }
- }
- void outword(DataBuffer &Output, unsigned X) {
- if (isLittleEndian) {
- Output.push_back((X >> 0) & 255);
- Output.push_back((X >> 8) & 255);
- Output.push_back((X >> 16) & 255);
- Output.push_back((X >> 24) & 255);
- } else {
- Output.push_back((X >> 24) & 255);
- Output.push_back((X >> 16) & 255);
- Output.push_back((X >> 8) & 255);
- Output.push_back((X >> 0) & 255);
- }
- }
- void outxword(DataBuffer &Output, uint64_t X) {
- if (isLittleEndian) {
- Output.push_back(unsigned(X >> 0) & 255);
- Output.push_back(unsigned(X >> 8) & 255);
- Output.push_back(unsigned(X >> 16) & 255);
- Output.push_back(unsigned(X >> 24) & 255);
- Output.push_back(unsigned(X >> 32) & 255);
- Output.push_back(unsigned(X >> 40) & 255);
- Output.push_back(unsigned(X >> 48) & 255);
- Output.push_back(unsigned(X >> 56) & 255);
- } else {
- Output.push_back(unsigned(X >> 56) & 255);
- Output.push_back(unsigned(X >> 48) & 255);
- Output.push_back(unsigned(X >> 40) & 255);
- Output.push_back(unsigned(X >> 32) & 255);
- Output.push_back(unsigned(X >> 24) & 255);
- Output.push_back(unsigned(X >> 16) & 255);
- Output.push_back(unsigned(X >> 8) & 255);
- Output.push_back(unsigned(X >> 0) & 255);
- }
- }
- void outaddr32(DataBuffer &Output, unsigned X) {
- outword(Output, X);
- }
- void outaddr64(DataBuffer &Output, uint64_t X) {
- outxword(Output, X);
- }
- void outaddr(DataBuffer &Output, uint64_t X) {
- if (!is64Bit)
- outword(Output, (unsigned)X);
- else
- outxword(Output, X);
- }
-
- // fix functions - Replace an existing entry at an offset.
- void fixhalf(DataBuffer &Output, unsigned short X, unsigned Offset) {
- unsigned char *P = &Output[Offset];
- P[0] = (X >> (isLittleEndian ? 0 : 8)) & 255;
- P[1] = (X >> (isLittleEndian ? 8 : 0)) & 255;
- }
-
- void fixword(DataBuffer &Output, unsigned X, unsigned Offset) {
- unsigned char *P = &Output[Offset];
- P[0] = (X >> (isLittleEndian ? 0 : 24)) & 255;
- P[1] = (X >> (isLittleEndian ? 8 : 16)) & 255;
- P[2] = (X >> (isLittleEndian ? 16 : 8)) & 255;
- P[3] = (X >> (isLittleEndian ? 24 : 0)) & 255;
- }
-
- void fixaddr(DataBuffer &Output, uint64_t X, unsigned Offset) {
- if (!is64Bit)
- fixword(Output, (unsigned)X, Offset);
- else
- assert(0 && "Emission of 64-bit data not implemented yet!");
- }
-
private:
void EmitGlobal(GlobalVariable *GV);