[llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Instructions.cpp

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



Changes in directory llvm/lib/VMCore:

AsmWriter.cpp updated: 1.181 -> 1.182
Instructions.cpp updated: 1.26 -> 1.27
---
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:  (+9 -6)

 AsmWriter.cpp    |    3 +++
 Instructions.cpp |   12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)


Index: llvm/lib/VMCore/AsmWriter.cpp
diff -u llvm/lib/VMCore/AsmWriter.cpp:1.181 llvm/lib/VMCore/AsmWriter.cpp:1.182
--- llvm/lib/VMCore/AsmWriter.cpp:1.181	Wed Aug 17 14:33:31 2005
+++ llvm/lib/VMCore/AsmWriter.cpp	Sat Nov  5 03:21:28 2005
@@ -1172,6 +1172,9 @@
       Out << ',';
       writeOperand(AI->getArraySize(), true);
     }
+    if (AI->getAlignment()) {
+      Out << ", " << AI->getAlignment();
+    }
   } else if (isa<CastInst>(I)) {
     if (Operand) writeOperand(Operand, true);   // Work with broken code
     Out << " to ";


Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.26 llvm/lib/VMCore/Instructions.cpp:1.27
--- llvm/lib/VMCore/Instructions.cpp:1.26	Fri Aug  5 10:37:31 2005
+++ llvm/lib/VMCore/Instructions.cpp	Sat Nov  5 03:21:28 2005
@@ -494,18 +494,18 @@
 }
 
 AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
-                               const std::string &Name,
+                               unsigned Align, const std::string &Name,
                                Instruction *InsertBefore)
   : UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize),
-                     Name, InsertBefore) {
+                     Name, InsertBefore), Alignment(Align) {
   assert(Ty != Type::VoidTy && "Cannot allocate void!");
 }
 
 AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
-                               const std::string &Name,
+                               unsigned Align, const std::string &Name,
                                BasicBlock *InsertAtEnd)
   : UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize),
-                     Name, InsertAtEnd) {
+                     Name, InsertAtEnd), Alignment(Align) {
   assert(Ty != Type::VoidTy && "Cannot allocate void!");
 }
 
@@ -521,12 +521,12 @@
 
 AllocaInst::AllocaInst(const AllocaInst &AI)
   : AllocationInst(AI.getType()->getElementType(), (Value*)AI.getOperand(0),
-                   Instruction::Alloca) {
+                   Instruction::Alloca, AI.getAlignment()) {
 }
 
 MallocInst::MallocInst(const MallocInst &MI)
   : AllocationInst(MI.getType()->getElementType(), (Value*)MI.getOperand(0),
-                   Instruction::Malloc) {
+                   Instruction::Malloc, MI.getAlignment()) {
 }
 
 //===----------------------------------------------------------------------===//






More information about the llvm-commits mailing list