1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

MIR Parser: Report an error when a fixed stack object is redefined.

llvm-svn: 244534
This commit is contained in:
Alex Lorenz 2015-08-10 23:45:02 +00:00
parent ed1bfffcbb
commit 4b65d19694
3 changed files with 37 additions and 3 deletions

View File

@ -245,7 +245,7 @@ template <> struct MappingTraits<MachineStackObject> {
/// MachineFrameInfo class.
struct FixedMachineStackObject {
enum ObjectType { DefaultType, SpillSlot };
unsigned ID;
UnsignedValue ID;
ObjectType Type = DefaultType;
int64_t Offset = 0;
uint64_t Size = 0;

View File

@ -489,8 +489,12 @@ bool MIRParserImpl::initializeFrameInfo(MachineFunction &MF,
else
ObjectIdx = MFI.CreateFixedSpillStackObject(Object.Size, Object.Offset);
MFI.setObjectAlignment(ObjectIdx, Object.Alignment);
// TODO: Report an error when objects are redefined.
PFS.FixedStackObjectSlots.insert(std::make_pair(Object.ID, ObjectIdx));
if (!PFS.FixedStackObjectSlots.insert(std::make_pair(Object.ID.Value,
ObjectIdx))
.second)
return error(Object.ID.SourceRange.Start,
Twine("redefinition of fixed stack object '%fixed-stack.") +
Twine(Object.ID.Value) + "'");
if (parseCalleeSavedRegister(MF, PFS, CSIInfo, Object.CalleeSavedRegister,
ObjectIdx))
return true;

View File

@ -0,0 +1,30 @@
# RUN: not llc -march=x86 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
--- |
define i32 @test(i32 %a, i32 %b) #0 {
entry:
%c = add i32 %a, %b
ret i32 %c
}
attributes #0 = { "no-frame-pointer-elim"="false" }
...
---
name: test
tracksRegLiveness: true
frameInfo:
maxAlignment: 4
fixedStack:
- { id: 0, offset: 4, size: 4, alignment: 4, isImmutable: true, isAliased: false }
# CHECK: [[@LINE+1]]:11: redefinition of fixed stack object '%fixed-stack.0'
- { id: 0, offset: 0, size: 4, alignment: 16, isImmutable: true, isAliased: false }
body:
- id: 0
name: entry
instructions:
- '%eax = MOV32rm %esp, 1, _, 4, _'
- '%eax = ADD32rm killed %eax, %esp, 1, _, 8, _, implicit-def dead %eflags'
- 'RETL %eax'
...