[llvm-commits] CVS: llvm/include/llvm/Instructions.h

Nate Begeman natebegeman at mac.com
Sat Nov 5 01:21:43 PST 2005



Changes in directory llvm/include/llvm:

Instructions.h updated: 1.27 -> 1.28
---
Log message:

Add support alignment of allocation instructions.
Add support for specifying alignment and size of setjmp jmpbufs.

No targets currently do anything with this information, nor is it presrved
in the bytecode representation.  That's coming up next.


---
Diffs of the changes:  (+28 -8)

 Instructions.h |   36 ++++++++++++++++++++++++++++--------
 1 files changed, 28 insertions(+), 8 deletions(-)


Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.27 llvm/include/llvm/Instructions.h:1.28
--- llvm/include/llvm/Instructions.h:1.27	Thu Aug  4 19:49:06 2005
+++ llvm/include/llvm/Instructions.h	Sat Nov  5 03:21:28 2005
@@ -33,10 +33,11 @@
 /// AllocaInst.
 ///
 class AllocationInst : public UnaryInstruction {
+  unsigned Alignment;
 protected:
-  AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
+  AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align,
                  const std::string &Name = "", Instruction *InsertBefore = 0);
-  AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
+  AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align,
                  const std::string &Name, BasicBlock *InsertAtEnd);
 
 public:
@@ -63,6 +64,11 @@
   ///
   const Type *getAllocatedType() const;
 
+  /// getAlignment - Return the alignment of the memory that is being allocated
+  /// by the instruction.
+  ///
+  unsigned getAlignment() const { return Alignment; }
+  
   virtual Instruction *clone() const = 0;
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -89,11 +95,18 @@
   explicit MallocInst(const Type *Ty, Value *ArraySize = 0,
                       const std::string &Name = "",
                       Instruction *InsertBefore = 0)
-    : AllocationInst(Ty, ArraySize, Malloc, Name, InsertBefore) {}
+    : AllocationInst(Ty, ArraySize, Malloc, 0, Name, InsertBefore) {}
   MallocInst(const Type *Ty, Value *ArraySize, const std::string &Name,
              BasicBlock *InsertAtEnd)
-    : AllocationInst(Ty, ArraySize, Malloc, Name, InsertAtEnd) {}
-
+    : AllocationInst(Ty, ArraySize, Malloc, 0, Name, InsertAtEnd) {}
+  MallocInst(const Type *Ty, Value *ArraySize, unsigned Align, 
+             const std::string &Name, BasicBlock *InsertAtEnd)
+  : AllocationInst(Ty, ArraySize, Malloc, Align, Name, InsertAtEnd) {}
+  explicit MallocInst(const Type *Ty, Value *ArraySize, unsigned Align,
+                      const std::string &Name = "",
+                      Instruction *InsertBefore = 0)
+  : AllocationInst(Ty, ArraySize, Malloc, Align, Name, InsertBefore) {}
+  
   virtual MallocInst *clone() const;
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -119,11 +132,18 @@
   explicit AllocaInst(const Type *Ty, Value *ArraySize = 0,
                       const std::string &Name = "",
                       Instruction *InsertBefore = 0)
-    : AllocationInst(Ty, ArraySize, Alloca, Name, InsertBefore) {}
+    : AllocationInst(Ty, ArraySize, Alloca, 0, Name, InsertBefore) {}
   AllocaInst(const Type *Ty, Value *ArraySize, const std::string &Name,
              BasicBlock *InsertAtEnd)
-    : AllocationInst(Ty, ArraySize, Alloca, Name, InsertAtEnd) {}
-
+    : AllocationInst(Ty, ArraySize, Alloca, 0, Name, InsertAtEnd) {}
+  AllocaInst(const Type *Ty, Value *ArraySize, unsigned Align,
+             const std::string &Name, BasicBlock *InsertAtEnd)
+  : AllocationInst(Ty, ArraySize, Alloca, Align, Name, InsertAtEnd) {}
+  explicit AllocaInst(const Type *Ty, Value *ArraySize, unsigned Align,
+                      const std::string &Name = "",
+                      Instruction *InsertBefore = 0)
+  : AllocationInst(Ty, ArraySize, Alloca, Align, Name, InsertBefore) {}
+  
   virtual AllocaInst *clone() const;
 
   // Methods for support type inquiry through isa, cast, and dyn_cast:






More information about the llvm-commits mailing list