aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2005-11-05 09:21:28 +0000
committerNate Begeman <natebegeman@mac.com>2005-11-05 09:21:28 +0000
commit14b0529532904b9e5a1e34526b4a3209f3e5bc62 (patch)
tree43e99ef7bb1cdfbb2828eea5617026f6d426e787 /lib/VMCore/Instructions.cpp
parentae4664a9f2da955c9d2a3f38b28f0a4395851ace (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24196 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 7de5602f08..96a010b2f7 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -494,18 +494,18 @@ static Value *getAISize(Value *Amt) {
}
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 @@ const Type *AllocationInst::getAllocatedType() const {
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()) {
}
//===----------------------------------------------------------------------===//