llvm.org GIT mirror llvm / 0633373
Fix GCMetadaPrinter::finishAssembly not executed, patch by Yiannis Tsiouris. Due to the execution order of doFinalization functions, the GC information were deleted before AsmPrinter::doFinalization was executed. Thus, the GCMetadataPrinter::finishAssembly was never called. The patch fixes that by moving the code of the GCInfoDeleter::doFinalization to Printer::doFinalization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175528 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 7 years ago
3 changed file(s) with 34 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
3636 void getAnalysisUsage(AnalysisUsage &AU) const;
3737
3838 bool runOnFunction(Function &F);
39 };
40
41 class Deleter : public FunctionPass {
42 static char ID;
43
44 public:
45 Deleter();
46
47 const char *getPassName() const;
48 void getAnalysisUsage(AnalysisUsage &AU) const;
49
50 bool runOnFunction(Function &F);
5139 bool doFinalization(Module &M);
5240 };
53
41
5442 }
5543
5644 INITIALIZE_PASS(GCModuleInfo, "collector-metadata",
181169 return false;
182170 }
183171
184 // -----------------------------------------------------------------------------
185
186 char Deleter::ID = 0;
187
188 FunctionPass *llvm::createGCInfoDeleter() {
189 return new Deleter();
190 }
191
192 Deleter::Deleter() : FunctionPass(ID) {}
193
194 const char *Deleter::getPassName() const {
195 return "Delete Garbage Collector Information";
196 }
197
198 void Deleter::getAnalysisUsage(AnalysisUsage &AU) const {
199 AU.setPreservesAll();
200 AU.addRequired();
201 }
202
203 bool Deleter::runOnFunction(Function &MF) {
204 return false;
205 }
206
207 bool Deleter::doFinalization(Module &M) {
172 bool Printer::doFinalization(Module &M) {
208173 GCModuleInfo *GMI = getAnalysisIfAvailable();
209 assert(GMI && "Deleter didn't require GCModuleInfo?!");
174 assert(GMI && "Printer didn't require GCModuleInfo?!");
210175 GMI->clear();
211176 return false;
212177 }
225225
226226 PM.add(Printer);
227227
228 PM.add(createGCInfoDeleter());
229228 return false;
230229 }
231230
244243 return true;
245244
246245 addCodeEmitter(PM, JCE);
247 PM.add(createGCInfoDeleter());
248246
249247 return false; // success!
250248 }
0 ; RUN: llc < %s -mtriple=x86_64-linux-gnu | FileCheck %s
1
2 define i32 @main(i32 %x) nounwind gc "ocaml" {
3 ; CHECK: .text
4 ; CHECK-NEXT: .globl caml_3C_stdin_3E___code_begin
5 ; CHECK-NEXT: caml_3C_stdin_3E___code_begin:
6 ; CHECK-NEXT: .data
7 ; CHECK-NEXT: .globl caml_3C_stdin_3E___data_begin
8 ; CHECK-NEXT: caml_3C_stdin_3E___data_begin:
9
10 %puts = tail call i32 @foo(i32 %x)
11 ret i32 0
12
13 ; CHECK: .globl caml_3C_stdin_3E___code_end
14 ; CHECK-NEXT: caml_3C_stdin_3E___code_end:
15 ; CHECK-NEXT: .data
16 ; CHECK-NEXT: .globl caml_3C_stdin_3E___data_end
17 ; CHECK-NEXT: caml_3C_stdin_3E___data_end:
18 ; CHECK-NEXT: .quad 0
19 ; CHECK-NEXT: .globl caml_3C_stdin_3E___frametable
20 ; CHECK-NEXT: caml_3C_stdin_3E___frametable:
21 ; CHECK-NEXT: .short 1
22 ; CHECK-NEXT: .align 8
23 ; CHECK-NEXT: # live roots for main
24 ; CHECK-NEXT: .quad .Ltmp0
25 ; CHECK-NEXT: .short 8
26 ; CHECK-NEXT: .short 0
27 ; CHECK-NEXT: .align 8
28 }
29
30 declare i32 @foo(i32)