mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
Revert r111230, we have to find a better place for the host-specific code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111232 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6ccd0da0fe
commit
73c32f60c4
@ -10,10 +10,8 @@
|
|||||||
#ifndef LLVM_MC_MCOBJECTWRITER_H
|
#ifndef LLVM_MC_MCOBJECTWRITER_H
|
||||||
#define LLVM_MC_MCOBJECTWRITER_H
|
#define LLVM_MC_MCOBJECTWRITER_H
|
||||||
|
|
||||||
#include "llvm/Support/MathExtras.h"
|
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/System/DataTypes.h"
|
#include "llvm/System/DataTypes.h"
|
||||||
#include "llvm/System/Host.h"
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
@ -94,57 +92,54 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WriteLE16(uint16_t Value) {
|
void WriteLE16(uint16_t Value) {
|
||||||
if (sys::isBigEndianHost())
|
Write8(uint8_t(Value >> 0));
|
||||||
Value = ByteSwap_16(Value);
|
Write8(uint8_t(Value >> 8));
|
||||||
OS << StringRef((const char*)&Value, sizeof(Value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteLE32(uint32_t Value) {
|
void WriteLE32(uint32_t Value) {
|
||||||
if (sys::isBigEndianHost())
|
WriteLE16(uint16_t(Value >> 0));
|
||||||
Value = ByteSwap_32(Value);
|
WriteLE16(uint16_t(Value >> 16));
|
||||||
OS << StringRef((const char*)&Value, sizeof(Value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteLE64(uint64_t Value) {
|
void WriteLE64(uint64_t Value) {
|
||||||
if (sys::isBigEndianHost())
|
WriteLE32(uint32_t(Value >> 0));
|
||||||
Value = ByteSwap_64(Value);
|
WriteLE32(uint32_t(Value >> 32));
|
||||||
OS << StringRef((const char*)&Value, sizeof(Value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteBE16(uint16_t Value) {
|
void WriteBE16(uint16_t Value) {
|
||||||
if (sys::isLittleEndianHost())
|
Write8(uint8_t(Value >> 8));
|
||||||
Value = ByteSwap_16(Value);
|
Write8(uint8_t(Value >> 0));
|
||||||
OS << StringRef((const char*)&Value, sizeof(Value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteBE32(uint32_t Value) {
|
void WriteBE32(uint32_t Value) {
|
||||||
if (sys::isLittleEndianHost())
|
WriteBE16(uint16_t(Value >> 16));
|
||||||
Value = ByteSwap_32(Value);
|
WriteBE16(uint16_t(Value >> 0));
|
||||||
OS << StringRef((const char*)&Value, sizeof(Value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteBE64(uint64_t Value) {
|
void WriteBE64(uint64_t Value) {
|
||||||
if (sys::isLittleEndianHost())
|
WriteBE32(uint32_t(Value >> 32));
|
||||||
Value = ByteSwap_64(Value);
|
WriteBE32(uint32_t(Value >> 0));
|
||||||
OS << StringRef((const char*)&Value, sizeof(Value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Write16(uint16_t Value) {
|
void Write16(uint16_t Value) {
|
||||||
if (IsLittleEndian != sys::isLittleEndianHost())
|
if (IsLittleEndian)
|
||||||
Value = ByteSwap_16(Value);
|
WriteLE16(Value);
|
||||||
OS << StringRef((const char*)&Value, sizeof(Value));
|
else
|
||||||
|
WriteBE16(Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Write32(uint32_t Value) {
|
void Write32(uint32_t Value) {
|
||||||
if (IsLittleEndian != sys::isLittleEndianHost())
|
if (IsLittleEndian)
|
||||||
Value = ByteSwap_32(Value);
|
WriteLE32(Value);
|
||||||
OS << StringRef((const char*)&Value, sizeof(Value));
|
else
|
||||||
|
WriteBE32(Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Write64(uint64_t Value) {
|
void Write64(uint64_t Value) {
|
||||||
if (IsLittleEndian != sys::isLittleEndianHost())
|
if (IsLittleEndian)
|
||||||
Value = ByteSwap_64(Value);
|
WriteLE64(Value);
|
||||||
OS << StringRef((const char*)&Value, sizeof(Value));
|
else
|
||||||
|
WriteBE64(Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteZeros(unsigned N) {
|
void WriteZeros(unsigned N) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user