1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

MIR Parser: Allow the MI IR references to reference global values.

This commit fixes a bug where MI parser couldn't resolve the named IR
references that referenced named global values.

llvm-svn: 244817
This commit is contained in:
Alex Lorenz 2015-08-12 21:27:16 +00:00
parent 25000271ea
commit 143b52b95d
2 changed files with 24 additions and 0 deletions

View File

@ -1085,6 +1085,9 @@ bool MIParser::parseIRValue(Value *&V) {
switch (Token.kind()) {
case MIToken::NamedIRValue: {
V = MF.getFunction()->getValueSymbolTable().lookup(Token.stringValue());
if (!V)
V = MF.getFunction()->getParent()->getValueSymbolTable().lookup(
Token.stringValue());
if (!V)
return error(Twine("use of undefined IR value '") + Token.range() + "'");
break;

View File

@ -84,6 +84,13 @@
ret i32 %b
}
define i32 @global_value() {
entry:
%a = load i32, i32* @G
%b = add i32 %a, 1
ret i32 %b
}
define i32 @jumptable_psv(i32 %in) {
entry:
switch i32 %in, label %def [
@ -290,6 +297,20 @@ body:
- 'RETQ %eax'
...
---
name: global_value
tracksRegLiveness: true
body:
- id: 0
name: entry
instructions:
- '%rax = MOV64rm %rip, 1, _, @G, _'
# CHECK: name: global_value
# CHECK: %eax = MOV32rm killed %rax, 1, _, 0, _ :: (load 4 from %ir.G)
- '%eax = MOV32rm killed %rax, 1, _, 0, _ :: (load 4 from %ir.G)'
- '%eax = INC32r killed %eax, implicit-def dead %eflags'
- 'RETQ %eax'
...
---
name: jumptable_psv
tracksRegLiveness: true
liveins: