mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-15 22:28:18 +00:00
Fix PR299: [Sparc] Code generator asserts on alloc of zero size type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12504 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1156,12 +1156,18 @@ CreateCodeForFixedSizeAlloca(const TargetMachine& target,
|
|||||||
unsigned numElements,
|
unsigned numElements,
|
||||||
std::vector<MachineInstr*>& getMvec)
|
std::vector<MachineInstr*>& getMvec)
|
||||||
{
|
{
|
||||||
assert(tsize > 0 && "Illegal (zero) type size for alloca");
|
|
||||||
assert(result && result->getParent() &&
|
assert(result && result->getParent() &&
|
||||||
"Result value is not part of a function?");
|
"Result value is not part of a function?");
|
||||||
Function *F = result->getParent()->getParent();
|
Function *F = result->getParent()->getParent();
|
||||||
MachineFunction &mcInfo = MachineFunction::get(F);
|
MachineFunction &mcInfo = MachineFunction::get(F);
|
||||||
|
|
||||||
|
// If the alloca is of zero bytes (which is perfectly legal) we bump it up to
|
||||||
|
// one byte. This is unnecessary, but I really don't want to break any
|
||||||
|
// fragile logic in this code. FIXME.
|
||||||
|
if (tsize == 0)
|
||||||
|
tsize = 1;
|
||||||
|
|
||||||
|
|
||||||
// Put the variable in the dynamically sized area of the frame if either:
|
// Put the variable in the dynamically sized area of the frame if either:
|
||||||
// (a) The offset is too large to use as an immediate in load/stores
|
// (a) The offset is too large to use as an immediate in load/stores
|
||||||
// (check LDX because all load/stores have the same-size immed. field).
|
// (check LDX because all load/stores have the same-size immed. field).
|
||||||
|
Reference in New Issue
Block a user