mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-15 19:24:33 +00:00
Shrink the size of AllocationInst by using its SubclassData
field to store the alignment value instead of haing a separate field. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48727 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -677,8 +677,8 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
||||
unsigned Align, const std::string &Name,
|
||||
Instruction *InsertBefore)
|
||||
: UnaryInstruction(PointerType::getUnqual(Ty), iTy, getAISize(ArraySize),
|
||||
InsertBefore), Alignment(Align) {
|
||||
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
|
||||
InsertBefore) {
|
||||
setAlignment(Align);
|
||||
assert(Ty != Type::VoidTy && "Cannot allocate void!");
|
||||
setName(Name);
|
||||
}
|
||||
@@ -687,8 +687,8 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
||||
unsigned Align, const std::string &Name,
|
||||
BasicBlock *InsertAtEnd)
|
||||
: UnaryInstruction(PointerType::getUnqual(Ty), iTy, getAISize(ArraySize),
|
||||
InsertAtEnd), Alignment(Align) {
|
||||
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
|
||||
InsertAtEnd) {
|
||||
setAlignment(Align);
|
||||
assert(Ty != Type::VoidTy && "Cannot allocate void!");
|
||||
setName(Name);
|
||||
}
|
||||
@@ -697,6 +697,12 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy,
|
||||
AllocationInst::~AllocationInst() {
|
||||
}
|
||||
|
||||
void AllocationInst::setAlignment(unsigned Align) {
|
||||
assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!");
|
||||
SubclassData = Log2_32(Align) + 1;
|
||||
assert(getAlignment() == Align && "Alignment representation error!");
|
||||
}
|
||||
|
||||
bool AllocationInst::isArrayAllocation() const {
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(getOperand(0)))
|
||||
return CI->getZExtValue() != 1;
|
||||
|
Reference in New Issue
Block a user