summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineCodeEmitter.h
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-06-04 00:15:51 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2009-06-04 00:15:51 +0000
commit186c670e15828327960d05a652ec43ae768c9b8e (patch)
treebae460595604d0b142e9b6972189fbdef2607823 /include/llvm/CodeGen/MachineCodeEmitter.h
parentd58902a19bc5056285f77d0310f4324355b35291 (diff)
downloadllvm-186c670e15828327960d05a652ec43ae768c9b8e.tar.gz
llvm-186c670e15828327960d05a652ec43ae768c9b8e.tar.bz2
llvm-186c670e15828327960d05a652ec43ae768c9b8e.tar.xz
Use uint8_t and int32_t in {JIT,Machine}CodeEmiters
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineCodeEmitter.h')
-rw-r--r--include/llvm/CodeGen/MachineCodeEmitter.h70
1 files changed, 35 insertions, 35 deletions
diff --git a/include/llvm/CodeGen/MachineCodeEmitter.h b/include/llvm/CodeGen/MachineCodeEmitter.h
index 226c4c2ad8..aaa41a48cb 100644
--- a/include/llvm/CodeGen/MachineCodeEmitter.h
+++ b/include/llvm/CodeGen/MachineCodeEmitter.h
@@ -50,14 +50,14 @@ class MachineCodeEmitter {
protected:
/// BufferBegin/BufferEnd - Pointers to the start and end of the memory
/// allocated for this code buffer.
- unsigned char *BufferBegin, *BufferEnd;
+ uint8_t *BufferBegin, *BufferEnd;
/// CurBufferPtr - Pointer to the next byte of memory to fill when emitting
/// code. This is guranteed to be in the range [BufferBegin,BufferEnd]. If
/// this pointer is at BufferEnd, it will never move due to code emission, and
/// all code emission requests will be ignored (this is the buffer overflow
/// condition).
- unsigned char *CurBufferPtr;
+ uint8_t *CurBufferPtr;
public:
virtual ~MachineCodeEmitter() {}
@@ -96,7 +96,7 @@ public:
/// emitByte - This callback is invoked when a byte needs to be written to the
/// output stream.
///
- void emitByte(unsigned char B) {
+ void emitByte(uint8_t B) {
if (CurBufferPtr != BufferEnd)
*CurBufferPtr++ = B;
}
@@ -106,10 +106,10 @@ public:
///
void emitWordLE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 0);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
} else {
CurBufferPtr = BufferEnd;
}
@@ -120,10 +120,10 @@ public:
///
void emitWordBE(unsigned W) {
if (4 <= BufferEnd-CurBufferPtr) {
- *CurBufferPtr++ = (unsigned char)(W >> 24);
- *CurBufferPtr++ = (unsigned char)(W >> 16);
- *CurBufferPtr++ = (unsigned char)(W >> 8);
- *CurBufferPtr++ = (unsigned char)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@@ -134,14 +134,14 @@ public:
///
void emitDWordLE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
- *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);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 32);
+ *CurBufferPtr++ = (uint8_t)(W >> 40);
+ *CurBufferPtr++ = (uint8_t)(W >> 48);
+ *CurBufferPtr++ = (uint8_t)(W >> 56);
} else {
CurBufferPtr = BufferEnd;
}
@@ -152,14 +152,14 @@ public:
///
void emitDWordBE(uint64_t W) {
if (8 <= BufferEnd-CurBufferPtr) {
- *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);
+ *CurBufferPtr++ = (uint8_t)(W >> 56);
+ *CurBufferPtr++ = (uint8_t)(W >> 48);
+ *CurBufferPtr++ = (uint8_t)(W >> 40);
+ *CurBufferPtr++ = (uint8_t)(W >> 32);
+ *CurBufferPtr++ = (uint8_t)(W >> 24);
+ *CurBufferPtr++ = (uint8_t)(W >> 16);
+ *CurBufferPtr++ = (uint8_t)(W >> 8);
+ *CurBufferPtr++ = (uint8_t)(W >> 0);
} else {
CurBufferPtr = BufferEnd;
}
@@ -173,8 +173,8 @@ public:
if(Alignment <= (uintptr_t)(BufferEnd-CurBufferPtr)) {
// Move the current buffer ptr up to the specified alignment.
CurBufferPtr =
- (unsigned char*)(((uintptr_t)CurBufferPtr+Alignment-1) &
- ~(uintptr_t)(Alignment-1));
+ (uint8_t*)(((uintptr_t)CurBufferPtr+Alignment-1) &
+ ~(uintptr_t)(Alignment-1));
} else {
CurBufferPtr = BufferEnd;
}
@@ -185,7 +185,7 @@ public:
/// written to the output stream.
void emitULEB128Bytes(unsigned Value) {
do {
- unsigned char Byte = Value & 0x7f;
+ uint8_t Byte = Value & 0x7f;
Value >>= 7;
if (Value) Byte |= 0x80;
emitByte(Byte);
@@ -194,12 +194,12 @@ public:
/// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be
/// written to the output stream.
- void emitSLEB128Bytes(int Value) {
- int Sign = Value >> (8 * sizeof(Value) - 1);
+ void emitSLEB128Bytes(int32_t Value) {
+ int32_t Sign = Value >> (8 * sizeof(Value) - 1);
bool IsMore;
do {
- unsigned char Byte = Value & 0x7f;
+ uint8_t Byte = Value & 0x7f;
Value >>= 7;
IsMore = Value != Sign || ((Byte ^ Sign) & 0x40) != 0;
if (IsMore) Byte |= 0x80;
@@ -212,14 +212,14 @@ public:
void emitString(const std::string &String) {
for (unsigned i = 0, N = static_cast<unsigned>(String.size());
i < N; ++i) {
- unsigned char C = String[i];
+ uint8_t C = String[i];
emitByte(C);
}
emitByte(0);
}
/// emitInt32 - Emit a int32 directive.
- void emitInt32(int Value) {
+ void emitInt32(int32_t Value) {
if (4 <= BufferEnd-CurBufferPtr) {
*((uint32_t*)CurBufferPtr) = Value;
CurBufferPtr += 4;