summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-05-03 01:01:51 +0000
committerChris Lattner <sabre@nondot.org>2006-05-03 01:01:51 +0000
commit7150a7038a3bfc0690463777357226193295b45c (patch)
tree000f8bd1cfda0d2193c3e08ad74a9ef8ce6614ef
parent77fe5b44593ce3b0cd86990a55e4444df0df19ac (diff)
downloadbcm5719-llvm-7150a7038a3bfc0690463777357226193295b45c.tar.gz
bcm5719-llvm-7150a7038a3bfc0690463777357226193295b45c.zip
Add a new emitAlignment method
llvm-svn: 28072
-rw-r--r--llvm/include/llvm/CodeGen/MachineCodeEmitter.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineCodeEmitter.h b/llvm/include/llvm/CodeGen/MachineCodeEmitter.h
index f05375fc5f4..43b14ca38f9 100644
--- a/llvm/include/llvm/CodeGen/MachineCodeEmitter.h
+++ b/llvm/include/llvm/CodeGen/MachineCodeEmitter.h
@@ -130,14 +130,22 @@ public:
}
}
- /// allocateSpace - Allocate a block of space in the current output buffer,
- /// returning null (and setting conditions to indicate buffer overflow) on
- /// failure. Alignment is the alignment in bytes of the buffer desired.
- void *allocateSpace(intptr_t Size, unsigned Alignment) {
+ /// emitAlignment - Move the CurBufferPtr pointer up the the specified
+ /// alignment (saturated to BufferEnd of course).
+ void emitAlignment(unsigned Alignment) {
if (Alignment == 0) Alignment = 1;
// Move the current buffer ptr up to the specified alignment.
CurBufferPtr =
(unsigned char*)(((intptr_t)CurBufferPtr+Alignment-1) & ~(Alignment-1));
+ if (CurBufferPtr > BufferEnd)
+ CurBufferPtr = BufferEnd;
+ }
+
+ /// allocateSpace - Allocate a block of space in the current output buffer,
+ /// returning null (and setting conditions to indicate buffer overflow) on
+ /// failure. Alignment is the alignment in bytes of the buffer desired.
+ void *allocateSpace(intptr_t Size, unsigned Alignment) {
+ emitAlignment(Alignment);
void *Result = CurBufferPtr;
// Allocate the space.
OpenPOWER on IntegriCloud