mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
Add an inalloca flag to allocas
Summary: The only current use of this flag is to mark the alloca as dynamic, even if its in the entry block. The stack adjustment for the alloca can never be folded into the prologue because the call may clear it and it has to be allocated at the top of the stack. Reviewers: majnemer CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2571 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199525 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
01d9f5972a
commit
3cbfa1617f
10 files changed
+99
-29
No files matched your search
+21
-10
@@ -4069,31 +4069,42 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
/// ParseAlloc
|
||||
/// ::= 'alloca' Type (',' TypeAndValue)? (',' OptionalInfo)?
|
||||
/// ::= 'alloca' Type (',' 'inalloca')? (',' TypeAndValue)? (',' OptionalInfo)?
|
||||
int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
|
||||
Value *Size = 0;
|
||||
LocTy SizeLoc;
|
||||
unsigned Alignment = 0;
|
||||
bool IsInAlloca = false;
|
||||
Type *Ty = 0;
|
||||
if (ParseType(Ty)) return true;
|
||||
|
||||
bool AteExtraComma = false;
|
||||
if (EatIfPresent(lltok::comma)) {
|
||||
if (Lex.getKind() == lltok::kw_align) {
|
||||
if (ParseOptionalAlignment(Alignment)) return true;
|
||||
} else if (Lex.getKind() == lltok::MetadataVar) {
|
||||
AteExtraComma = true;
|
||||
} else {
|
||||
if (ParseTypeAndValue(Size, SizeLoc, PFS) ||
|
||||
ParseOptionalCommaAlign(Alignment, AteExtraComma))
|
||||
return true;
|
||||
bool HaveComma = true;
|
||||
if (EatIfPresent(lltok::kw_inalloca)) {
|
||||
IsInAlloca = true;
|
||||
HaveComma = EatIfPresent(lltok::comma);
|
||||
}
|
||||
|
||||
if (HaveComma) {
|
||||
if (Lex.getKind() == lltok::kw_align) {
|
||||
if (ParseOptionalAlignment(Alignment)) return true;
|
||||
} else if (Lex.getKind() == lltok::MetadataVar) {
|
||||
AteExtraComma = true;
|
||||
} else {
|
||||
if (ParseTypeAndValue(Size, SizeLoc, PFS) ||
|
||||
ParseOptionalCommaAlign(Alignment, AteExtraComma))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Size && !Size->getType()->isIntegerTy())
|
||||
return Error(SizeLoc, "element count must have integer type");
|
||||
|
||||
Inst = new AllocaInst(Ty, Size, Alignment);
|
||||
AllocaInst *AI = new AllocaInst(Ty, Size, Alignment);
|
||||
AI->setUsedWithInAlloca(IsInAlloca);
|
||||
Inst = AI;
|
||||
return AteExtraComma ? InstExtraComma : InstNormal;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@ namespace llvm {
|
||||
AtomicOrdering &Ordering);
|
||||
bool ParseOptionalStackAlignment(unsigned &Alignment);
|
||||
bool ParseOptionalCommaAlign(unsigned &Alignment, bool &AteExtraComma);
|
||||
bool ParseOptionalCommaInAlloca(bool &IsInAlloca);
|
||||
bool ParseIndexList(SmallVectorImpl<unsigned> &Indices,bool &AteExtraComma);
|
||||
bool ParseIndexList(SmallVectorImpl<unsigned> &Indices) {
|
||||
bool AteExtraComma;
|
||||
|
||||
Reference in new issue
Block a user