[llvm] r237522 - MC: Lower the default alignment of MCContext's operator new to 8

Benjamin Kramer benny.kra at googlemail.com
Sat May 16 06:54:08 PDT 2015


Author: d0k
Date: Sat May 16 08:54:08 2015
New Revision: 237522

URL: http://llvm.org/viewvc/llvm-project?rev=237522&view=rev
Log:
MC: Lower the default alignment of MCContext's operator new to 8

This is more than sufficient for all MC types.

Modified:
    llvm/trunk/include/llvm/MC/MCContext.h

Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=237522&r1=237521&r2=237522&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Sat May 16 08:54:08 2015
@@ -533,10 +533,10 @@ namespace llvm {
 /// this ever changes, this operator will have to be changed, too.)
 /// Usage looks like this (assuming there's an MCContext 'Context' in scope):
 /// \code
-/// // Default alignment (16)
+/// // Default alignment (8)
 /// IntegerLiteral *Ex = new (Context) IntegerLiteral(arguments);
 /// // Specific alignment
-/// IntegerLiteral *Ex2 = new (Context, 8) IntegerLiteral(arguments);
+/// IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);
 /// \endcode
 /// Please note that you cannot use delete on the pointer; it must be
 /// deallocated using an explicit destructor call followed by
@@ -548,7 +548,7 @@ namespace llvm {
 ///                  allocator supports it).
 /// \return The allocated memory. Could be NULL.
 inline void *operator new(size_t Bytes, llvm::MCContext &C,
-                          size_t Alignment = 16) throw () {
+                          size_t Alignment = 8) throw() {
   return C.Allocate(Bytes, Alignment);
 }
 /// \brief Placement delete companion to the new above.
@@ -567,10 +567,10 @@ inline void operator delete(void *Ptr, l
 /// null on error.
 /// Usage looks like this (assuming there's an MCContext 'Context' in scope):
 /// \code
-/// // Default alignment (16)
+/// // Default alignment (8)
 /// char *data = new (Context) char[10];
 /// // Specific alignment
-/// char *data = new (Context, 8) char[10];
+/// char *data = new (Context, 4) char[10];
 /// \endcode
 /// Please note that you cannot use delete on the pointer; it must be
 /// deallocated using an explicit destructor call followed by
@@ -582,7 +582,7 @@ inline void operator delete(void *Ptr, l
 ///                  allocator supports it).
 /// \return The allocated memory. Could be NULL.
 inline void *operator new[](size_t Bytes, llvm::MCContext& C,
-                            size_t Alignment = 16) throw () {
+                            size_t Alignment = 8) throw() {
   return C.Allocate(Bytes, Alignment);
 }
 





More information about the llvm-commits mailing list