llvm.org GIT mirror llvm / 78f9b57
MIR Serialization: Serialize the global value call entry pseudo source values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245097 91177308-0d34-0410-b5e6-96231b3b80d8 Alex Lorenz 4 years ago
5 changed file(s) with 67 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
117117 public:
118118 GlobalValuePseudoSourceValue(const GlobalValue *GV);
119119
120 static inline bool classof(const PseudoSourceValue *V) {
121 return V->kind() == GlobalValueCallEntry;
122 }
123
120124 const GlobalValue *getValue() const { return GV; }
121125 };
122126
14361436 // The token was already consumed, so use return here instead of break.
14371437 return false;
14381438 }
1439 case MIToken::GlobalValue:
1440 case MIToken::NamedGlobalValue: {
1441 GlobalValue *GV = nullptr;
1442 if (parseGlobalValue(GV))
1443 return true;
1444 PSV = MF.getPSVManager().getGlobalValueCallEntry(GV);
1445 break;
1446 }
14391447 // TODO: Parse the other pseudo source values.
14401448 default:
14411449 llvm_unreachable("The current token should be pseudo source value");
14471455 bool MIParser::parseMachinePointerInfo(MachinePointerInfo &Dest) {
14481456 if (Token.is(MIToken::kw_constant_pool) || Token.is(MIToken::kw_stack) ||
14491457 Token.is(MIToken::kw_got) || Token.is(MIToken::kw_jump_table) ||
1450 Token.is(MIToken::FixedStackObject)) {
1458 Token.is(MIToken::FixedStackObject) || Token.is(MIToken::GlobalValue) ||
1459 Token.is(MIToken::NamedGlobalValue)) {
14511460 const PseudoSourceValue *PSV = nullptr;
14521461 if (parseMemoryPseudoSourceValue(PSV))
14531462 return true;
762762 printStackObjectReference(
763763 cast(PVal)->getFrameIndex());
764764 break;
765 case PseudoSourceValue::GlobalValueCallEntry:
766 cast(PVal)->getValue()->printAsOperand(
767 OS, /*PrintType=*/false, MST);
768 break;
765769 default:
766770 // TODO: Print the other pseudo source values.
767771 OS << "";
0 if not 'Mips' in config.root.targets:
1 config.unsupported = True
0 # RUN: llc -march=mipsel -mcpu=mips16 -relocation-model=pic -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
1 # This test ensures that the MIR parser parses the call entry pseudo source
2 # values in memory operands correctly.
3
4 --- |
5 define i32 @test(i32 %a) {
6 entry:
7 %call = call i32 @foo(i32 %a)
8 ret i32 0
9 }
10
11 declare i32 @foo(i32)
12 ...
13 ---
14 name: test
15 tracksRegLiveness: true
16 liveins:
17 - { reg: '%a0' }
18 frameInfo:
19 stackSize: 24
20 maxAlignment: 4
21 adjustsStack: true
22 hasCalls: true
23 maxCallFrameSize: 16
24 stack:
25 - { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4,
26 callee-saved-register: '%ra' }
27 body: |
28 bb.0.entry:
29 liveins: %a0, %ra
30
31 Save16 %ra, 24, implicit-def %sp, implicit %sp
32 CFI_INSTRUCTION .cfi_def_cfa_offset 24
33 CFI_INSTRUCTION .cfi_offset %ra_64, -4
34 %v0, %v1 = GotPrologue16 $_gp_disp, $_gp_disp
35 %v0 = SllX16 killed %v0, 16
36 %v0 = AdduRxRyRz16 killed %v1, killed %v0
37 ; CHECK-LABEL: name: test
38 ; CHECK: %v1 = LwRxRyOffMemX16 %v0, @foo, 0 :: (load 4 from @foo)
39 %v1 = LwRxRyOffMemX16 %v0, @foo, 0 :: (load 4 from @foo)
40 %t9 = COPY %v1
41 %gp = COPY killed %v0
42 JumpLinkReg16 killed %v1, csr_o32, implicit-def %ra, implicit killed %t9, implicit %a0, implicit killed %gp, implicit-def %sp, implicit-def dead %v0
43 %v0 = LiRxImmX16 0
44 %ra = Restore16 24, implicit-def %sp, implicit %sp
45 RetRA16 implicit %v0
46 ...