Fix constant-offset emission for x86-64 absolute addresses. This

fixes a bunch of test-suite JIT failures on x86-64 in
-relocation-model=static mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58066 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2008-10-24 01:57:54 +00:00
parent b1e5edc27e
commit c9f3cc3bda
3 changed files with 58 additions and 11 deletions

View File

@ -125,6 +125,42 @@ public:
}
}
/// emitDWordLE - This callback is invoked when a 64-bit word needs to be
/// written to the output stream in little-endian format.
///
void emitDWordLE(uint64_t W) {
if (CurBufferPtr+8 <= BufferEnd) {
*CurBufferPtr++ = (unsigned char)(W >> 0);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 32);
*CurBufferPtr++ = (unsigned char)(W >> 40);
*CurBufferPtr++ = (unsigned char)(W >> 48);
*CurBufferPtr++ = (unsigned char)(W >> 56);
} else {
CurBufferPtr = BufferEnd;
}
}
/// emitDWordBE - This callback is invoked when a 64-bit word needs to be
/// written to the output stream in big-endian format.
///
void emitDWordBE(uint64_t W) {
if (CurBufferPtr+8 <= BufferEnd) {
*CurBufferPtr++ = (unsigned char)(W >> 56);
*CurBufferPtr++ = (unsigned char)(W >> 48);
*CurBufferPtr++ = (unsigned char)(W >> 40);
*CurBufferPtr++ = (unsigned char)(W >> 32);
*CurBufferPtr++ = (unsigned char)(W >> 24);
*CurBufferPtr++ = (unsigned char)(W >> 16);
*CurBufferPtr++ = (unsigned char)(W >> 8);
*CurBufferPtr++ = (unsigned char)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
}
/// emitAlignment - Move the CurBufferPtr pointer up the the specified
/// alignment (saturated to BufferEnd of course).
void emitAlignment(unsigned Alignment) {