mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
MIR Parser: Report an error when a constant pool item is redefined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243696 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -285,7 +285,7 @@ template <> struct MappingTraits<FixedMachineStackObject> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct MachineConstantPoolValue {
|
struct MachineConstantPoolValue {
|
||||||
unsigned ID;
|
UnsignedValue ID;
|
||||||
StringValue Value;
|
StringValue Value;
|
||||||
unsigned Alignment = 0;
|
unsigned Alignment = 0;
|
||||||
};
|
};
|
||||||
|
@@ -559,9 +559,12 @@ bool MIRParserImpl::initializeConstantPool(
|
|||||||
YamlConstant.Alignment
|
YamlConstant.Alignment
|
||||||
? YamlConstant.Alignment
|
? YamlConstant.Alignment
|
||||||
: M.getDataLayout().getPrefTypeAlignment(Value->getType());
|
: M.getDataLayout().getPrefTypeAlignment(Value->getType());
|
||||||
// TODO: Report an error when the same constant pool value ID is redefined.
|
unsigned Index = ConstantPool.getConstantPoolIndex(Value, Alignment);
|
||||||
ConstantPoolSlots.insert(std::make_pair(
|
if (!ConstantPoolSlots.insert(std::make_pair(YamlConstant.ID.Value, Index))
|
||||||
YamlConstant.ID, ConstantPool.getConstantPoolIndex(Value, Alignment)));
|
.second)
|
||||||
|
return error(YamlConstant.ID.SourceRange.Start,
|
||||||
|
Twine("redefinition of constant pool item '%const.") +
|
||||||
|
Twine(YamlConstant.ID.Value) + "'");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,27 @@
|
|||||||
|
# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
--- |
|
||||||
|
|
||||||
|
define double @test(double %a, float %b) {
|
||||||
|
entry:
|
||||||
|
%c = fadd double %a, 3.250000e+00
|
||||||
|
ret double %c
|
||||||
|
}
|
||||||
|
|
||||||
|
...
|
||||||
|
---
|
||||||
|
name: test
|
||||||
|
constants:
|
||||||
|
- id: 0
|
||||||
|
value: 'double 3.250000e+00'
|
||||||
|
# CHECK: [[@LINE+1]]:18: redefinition of constant pool item '%const.0'
|
||||||
|
- id: 0
|
||||||
|
value: 'double 3.250000e+00'
|
||||||
|
body:
|
||||||
|
- id: 0
|
||||||
|
name: entry
|
||||||
|
instructions:
|
||||||
|
- '%xmm0 = ADDSDrm killed %xmm0, %rip, 1, _, %const.0, _'
|
||||||
|
- 'RETQ %xmm0'
|
||||||
|
...
|
||||||
|
|
Reference in New Issue
Block a user