diff options
author | Bill Wendling <isanbard@gmail.com> | 2007-01-17 03:46:30 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2007-01-17 03:46:30 +0000 |
commit | 34f03fff2d117068b4d627922484d2d79ed9c025 (patch) | |
tree | 868772a7dae20d74fe17363bde2c2354ad973b97 /include | |
parent | 2c13f6657a8d7543b7202c23be0ae351f9bec1ed (diff) | |
download | external_llvm-34f03fff2d117068b4d627922484d2d79ed9c025.zip external_llvm-34f03fff2d117068b4d627922484d2d79ed9c025.tar.gz external_llvm-34f03fff2d117068b4d627922484d2d79ed9c025.tar.bz2 |
New "TargetObjInfo" class. This holds information that the object writers will
use to write things to the file. It's abstract so each target should implement
its own version for each writer type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33286 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Target/TargetObjInfo.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetObjInfo.h b/include/llvm/Target/TargetObjInfo.h new file mode 100644 index 0000000..ffad354 --- /dev/null +++ b/include/llvm/Target/TargetObjInfo.h @@ -0,0 +1,57 @@ +//===-- llvm/Target/TargetObjInfo.h - Object File Info ----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Bill Wendling and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains a class to be used as the basis for target specific object +// writers. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_TARGET_OBJ_INFO_H +#define LLVM_TARGET_OBJ_INFO_H + +#include <string> +#include <vector> + +namespace llvm { + + struct TargetObjInfo { + TargetObjInfo() {} + virtual ~TargetObjInfo() {} + + typedef std::vector<unsigned char> DataBuffer; + + virtual void align(DataBuffer &Output, unsigned Boundary) const = 0; + + //===------------------------------------------------------------------===// + // Out Functions - Output the specified value to the data buffer. + + virtual void outbyte(DataBuffer &Output, unsigned char X) const = 0; + virtual void outhalf(DataBuffer &Output, unsigned short X) const = 0; + virtual void outword(DataBuffer &Output, unsigned X) const = 0; + virtual void outxword(DataBuffer &Output, uint64_t X) const = 0; + virtual void outaddr32(DataBuffer &Output, unsigned X) const = 0; + virtual void outaddr64(DataBuffer &Output, uint64_t X) const = 0; + virtual void outaddr(DataBuffer &Output, uint64_t X) const = 0; + virtual void outstring(DataBuffer &Output, std::string &S, + unsigned Length) const = 0; + + //===------------------------------------------------------------------===// + // Fix Functions - Replace an existing entry at an offset. + + virtual void fixhalf(DataBuffer &Output, unsigned short X, + unsigned Offset) const = 0; + virtual void fixword(DataBuffer &Output, unsigned X, + unsigned Offset) const = 0; + virtual void fixaddr(DataBuffer &Output, uint64_t X, + unsigned Offset) const = 0; + }; + +} // end llvm namespace + +#endif // LLVM_TARGET_OBJ_INFO_H |