llvm.org GIT mirror llvm / 643f4bc
MIR Serialization: Serialize the external symbol call entry pseudo source values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245098 91177308-0d34-0410-b5e6-96231b3b80d8 Alex Lorenz 4 years ago
4 changed file(s) with 69 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
131131 public:
132132 ExternalSymbolPseudoSourceValue(const char *ES);
133133
134 static inline bool classof(const PseudoSourceValue *V) {
135 return V->kind() == ExternalSymbolCallEntry;
136 }
137
134138 const char *getSymbol() const { return ES; }
135139 };
136140
14441444 PSV = MF.getPSVManager().getGlobalValueCallEntry(GV);
14451445 break;
14461446 }
1447 // TODO: Parse the other pseudo source values.
1447 case MIToken::ExternalSymbol:
1448 PSV = MF.getPSVManager().getExternalSymbolCallEntry(
1449 MF.createExternalSymbolName(Token.stringValue()));
1450 break;
14481451 default:
14491452 llvm_unreachable("The current token should be pseudo source value");
14501453 }
14561459 if (Token.is(MIToken::kw_constant_pool) || Token.is(MIToken::kw_stack) ||
14571460 Token.is(MIToken::kw_got) || Token.is(MIToken::kw_jump_table) ||
14581461 Token.is(MIToken::FixedStackObject) || Token.is(MIToken::GlobalValue) ||
1459 Token.is(MIToken::NamedGlobalValue)) {
1462 Token.is(MIToken::NamedGlobalValue) ||
1463 Token.is(MIToken::ExternalSymbol)) {
14601464 const PseudoSourceValue *PSV = nullptr;
14611465 if (parseMemoryPseudoSourceValue(PSV))
14621466 return true;
766766 cast(PVal)->getValue()->printAsOperand(
767767 OS, /*PrintType=*/false, MST);
768768 break;
769 default:
770 // TODO: Print the other pseudo source values.
771 OS << "";
769 case PseudoSourceValue::ExternalSymbolCallEntry:
770 OS << '$';
771 printLLVMNameWithoutPrefix(
772 OS, cast(PVal)->getSymbol());
772773 break;
773774 }
774775 }
99 }
1010
1111 declare i32 @foo(i32)
12
13 define float @test2() #0 {
14 entry:
15 %call = tail call float bitcast (float (...)* @g to float ()*)()
16 call void @__mips16_ret_sf(float %call)
17 ret float %call
18 }
19
20 declare float @g(...)
21
22 declare void @__mips16_ret_sf(float) #1
23
24 attributes #0 = { "saveS2" }
25 attributes #1 = { noinline readnone "__Mips16RetHelper" }
1226 ...
1327 ---
1428 name: test
4458 %ra = Restore16 24, implicit-def %sp, implicit %sp
4559 RetRA16 implicit %v0
4660 ...
61 ---
62 name: test2
63 tracksRegLiveness: true
64 frameInfo:
65 stackSize: 32
66 maxAlignment: 4
67 adjustsStack: true
68 hasCalls: true
69 maxCallFrameSize: 16
70 stack:
71 - { id: 0, type: spill-slot, offset: -4, size: 4, alignment: 4,
72 callee-saved-register: '%ra' }
73 - { id: 1, type: spill-slot, offset: -8, size: 4, alignment: 4,
74 callee-saved-register: '%s2' }
75 - { id: 2, type: spill-slot, offset: -12, size: 4, alignment: 4,
76 callee-saved-register: '%s0' }
77 body: |
78 bb.0.entry:
79 liveins: %ra, %s2, %s0, %ra, %s2, %s0
80
81 SaveX16 %s0, %ra, %s2, 32, implicit-def %sp, implicit %sp
82 CFI_INSTRUCTION .cfi_def_cfa_offset 32
83 CFI_INSTRUCTION .cfi_offset %ra_64, -4
84 CFI_INSTRUCTION .cfi_offset %s2_64, -8
85 CFI_INSTRUCTION .cfi_offset %s0_64, -12
86 %v0, %v1 = GotPrologue16 $_gp_disp, $_gp_disp
87 %v0 = SllX16 killed %v0, 16
88 %s0 = AdduRxRyRz16 killed %v1, killed %v0
89 %v0 = LwRxRyOffMemX16 %s0, @g, 0 :: (load 4 from @g)
90 ; CHECK-LABEL: test2
91 ; CHECK: %v1 = LwRxRyOffMemX16 %s0, $__mips16_call_stub_sf_0, 0 :: (load 4 from $__mips16_call_stub_sf_0)
92 %v1 = LwRxRyOffMemX16 %s0, $__mips16_call_stub_sf_0, 0 :: (load 4 from $__mips16_call_stub_sf_0)
93 %gp = COPY %s0
94 JumpLinkReg16 killed %v1, csr_o32, implicit-def %ra, implicit %v0, implicit killed %gp, implicit-def %sp, implicit-def %v0
95 %v1 = LwRxRyOffMemX16 %s0, @__mips16_ret_sf, 0 :: (load 4 from @__mips16_ret_sf)
96 %t9 = COPY %v1
97 %gp = COPY killed %s0
98 JumpLinkReg16 killed %v1, csr_mips16rethelper, implicit-def %ra, implicit killed %t9, implicit %v0, implicit killed %gp, implicit-def %sp
99 %s0, %ra, %s2 = RestoreX16 32, implicit-def %sp, implicit %sp
100 RetRA16 implicit %v0
101 ...