switch (Token.kind()) {
case MIToken::NamedIRValue: {
V = MF.getFunction()->getValueSymbolTable().lookup(Token.stringValue());
- if (!V)
- V = MF.getFunction()->getParent()->getValueSymbolTable().lookup(
- Token.stringValue());
break;
}
case MIToken::IRValue: {
V = getIRValue(SlotNumber);
break;
}
+ case MIToken::NamedGlobalValue:
+ case MIToken::GlobalValue: {
+ GlobalValue *GV = nullptr;
+ if (parseGlobalValue(GV))
+ return true;
+ V = GV;
+ break;
+ }
default:
llvm_unreachable("The current token should be an IR block reference");
}
Dest = MachinePointerInfo(PSV, Offset);
return false;
}
- if (Token.isNot(MIToken::NamedIRValue) && Token.isNot(MIToken::IRValue))
+ if (Token.isNot(MIToken::NamedIRValue) && Token.isNot(MIToken::IRValue) &&
+ Token.isNot(MIToken::GlobalValue) &&
+ Token.isNot(MIToken::NamedGlobalValue))
return error("expected an IR value reference");
const Value *V = nullptr;
if (parseIRValue(V))
frame-setup PUSH64r killed %rbx, implicit-def %rsp, implicit %rsp
%rsp = frame-setup SUB64ri8 %rsp, 32, implicit-def dead %eflags
- %rbx = LOAD_STACK_GUARD :: (invariant load 8 from %ir.__stack_chk_guard)
+ %rbx = LOAD_STACK_GUARD :: (invariant load 8 from @__stack_chk_guard)
MOV64mr %rsp, 1, _, 24, _, %rbx
%rsi = LEA64r %rsp, 1, _, 19, _
MOV64mr %rsp, 1, _, 8, _, %rsi
ret i32 %b
}
+ @0 = external global i32
+
define i32 @global_value() {
entry:
%a = load i32, i32* @G
%b = add i32 %a, 1
- ret i32 %b
+ %c = load i32, i32* @0
+ %d = add i32 %b, %c
+ ret i32 %d
}
define i32 @jumptable_psv(i32 %in) {
body: |
bb.0.entry:
%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
+ ; CHECK-LABEL: name: global_value
+ ; CHECK: %eax = MOV32rm killed %rax, 1, _, 0, _, implicit-def %rax :: (load 4 from @G)
+ ; CHECK: %ecx = MOV32rm killed %rcx, 1, _, 0, _, implicit-def %rcx :: (load 4 from @0)
+ %eax = MOV32rm killed %rax, 1, _, 0, _, implicit-def %rax :: (load 4 from @G)
+ %rcx = MOV64rm %rip, 1, _, @0, _
+ %ecx = MOV32rm killed %rcx, 1, _, 0, _, implicit-def %rcx :: (load 4 from @0)
+ %eax = LEA64_32r killed %rax, 1, killed %rcx, 1, _
RETQ %eax
...
---
bb.0.entry:
%rax = MOV64rm %rip, 1, _, @a, _ :: (load 8 from got)
; CHECK-LABEL: name: tbaa_metadata
- ; CHECK: %eax = MOV32rm killed %rax, 1, _, 0, _, implicit-def %rax :: (load 4 from %ir.a, !tbaa !2)
+ ; CHECK: %eax = MOV32rm killed %rax, 1, _, 0, _, implicit-def %rax :: (load 4 from @a, !tbaa !2)
; CHECK-NEXT: %eax = MOV32rm killed %rax, 1, _, 0, _ :: (load 4 from %ir.total_len2, !tbaa !6)
- %eax = MOV32rm killed %rax, 1, _, 0, _, implicit-def %rax :: (load 4 from %ir.a, !tbaa !2)
+ %eax = MOV32rm killed %rax, 1, _, 0, _, implicit-def %rax :: (load 4 from @a, !tbaa !2)
%eax = MOV32rm killed %rax, 1, _, 0, _ :: (load 4 from %ir.total_len2, !tbaa !6)
RETQ %eax
...