[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineCodeEmitter.h

Chris Lattner lattner at cs.uiuc.edu
Tue May 2 18:02:03 PDT 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineCodeEmitter.h updated: 1.38 -> 1.39
---
Log message:

Add a new emitAlignment method


---
Diffs of the changes:  (+12 -4)

 MachineCodeEmitter.h |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineCodeEmitter.h
diff -u llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.38 llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.39
--- llvm/include/llvm/CodeGen/MachineCodeEmitter.h:1.38	Tue May  2 19:32:55 2006
+++ llvm/include/llvm/CodeGen/MachineCodeEmitter.h	Tue May  2 20:01:51 2006
@@ -130,14 +130,22 @@
     }
   }
 
-  /// 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.






More information about the llvm-commits mailing list