Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/llvm2ice.cpp

Issue 828873002: Subzero: Start writing out some relocation sections (text) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: review fixes Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/assembler_ia32.cpp ('k') | tests_lit/llvm2ice_tests/elf_container.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===// 1 //===- subzero/src/llvm2ice.cpp - Driver for testing ----------------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file defines a driver that uses LLVM capabilities to parse a 10 // This file defines a driver that uses LLVM capabilities to parse a
11 // bitcode file and build the LLVM IR, and then convert the LLVM basic 11 // bitcode file and build the LLVM IR, and then convert the LLVM basic
12 // blocks, instructions, and operands into their Subzero equivalents. 12 // blocks, instructions, and operands into their Subzero equivalents.
13 // 13 //
14 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
15 15
16 #include <fstream> 16 #include <fstream>
17 #include <iostream> 17 #include <iostream>
18 18
19 #include "llvm/ADT/STLExtras.h" 19 #include "llvm/ADT/STLExtras.h"
20 #include "llvm/IR/LLVMContext.h" 20 #include "llvm/IR/LLVMContext.h"
21 #include "llvm/IRReader/IRReader.h" 21 #include "llvm/IRReader/IRReader.h"
22 #include "llvm/Support/CommandLine.h" 22 #include "llvm/Support/CommandLine.h"
23 #include "llvm/Support/FileSystem.h" 23 #include "llvm/Support/FileSystem.h"
24 #include "llvm/Support/raw_os_ostream.h" 24 #include "llvm/Support/raw_os_ostream.h"
25 #include "llvm/Support/SourceMgr.h" 25 #include "llvm/Support/SourceMgr.h"
26 26
27 #include "IceCfg.h" 27 #include "IceCfg.h"
28 #include "IceClFlags.h" 28 #include "IceClFlags.h"
29 #include "IceConverter.h" 29 #include "IceConverter.h"
30 #include "IceELFObjectWriter.h"
31 #include "IceELFStreamer.h"
30 #include "PNaClTranslator.h" 32 #include "PNaClTranslator.h"
31 33
32 using namespace llvm; 34 using namespace llvm;
33 35
34 static cl::list<Ice::VerboseItem> VerboseList( 36 static cl::list<Ice::VerboseItem> VerboseList(
35 "verbose", cl::CommaSeparated, 37 "verbose", cl::CommaSeparated,
36 cl::desc("Verbose options (can be comma-separated):"), 38 cl::desc("Verbose options (can be comma-separated):"),
37 cl::values( 39 cl::values(
38 clEnumValN(Ice::IceV_Instructions, "inst", "Print basic instructions"), 40 clEnumValN(Ice::IceV_Instructions, "inst", "Print basic instructions"),
39 clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"), 41 clEnumValN(Ice::IceV_Deleted, "del", "Include deleted instructions"),
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 341 }
340 Os->SetUnbuffered(); 342 Os->SetUnbuffered();
341 } 343 }
342 344
343 Ice::GlobalContext Ctx(Ls.get(), Os.get(), ELFStr.get(), VMask, TargetArch, 345 Ice::GlobalContext Ctx(Ls.get(), Os.get(), ELFStr.get(), VMask, TargetArch,
344 OptLevel, TestPrefix, Flags); 346 OptLevel, TestPrefix, Flags);
345 347
346 Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx); 348 Ice::TimerMarker T(Ice::TimerStack::TT_szmain, &Ctx);
347 349
348 if (UseELFWriter) { 350 if (UseELFWriter) {
351 Ice::TimerMarker T1(Ice::TimerStack::TT_emit, &Ctx);
349 Ctx.getObjectWriter()->writeInitialELFHeader(); 352 Ctx.getObjectWriter()->writeInitialELFHeader();
350 } 353 }
351 354
352 int ErrorStatus = 0; 355 int ErrorStatus = 0;
353 if (BuildOnRead) { 356 if (BuildOnRead) {
354 Ice::PNaClTranslator Translator(&Ctx, Flags); 357 Ice::PNaClTranslator Translator(&Ctx, Flags);
355 Translator.translate(IRFilename); 358 Translator.translate(IRFilename);
356 ErrorStatus = Translator.getErrorStatus(); 359 ErrorStatus = Translator.getErrorStatus();
357 } else if (ALLOW_LLVM_IR) { 360 } else if (ALLOW_LLVM_IR) {
358 // Parse the input LLVM IR file into a module. 361 // Parse the input LLVM IR file into a module.
(...skipping 11 matching lines...) Expand all
370 373
371 Ice::Converter Converter(Mod, &Ctx, Flags); 374 Ice::Converter Converter(Mod, &Ctx, Flags);
372 Converter.convertToIce(); 375 Converter.convertToIce();
373 ErrorStatus = Converter.getErrorStatus(); 376 ErrorStatus = Converter.getErrorStatus();
374 } else { 377 } else {
375 *Ls << "Error: Build doesn't allow LLVM IR, " 378 *Ls << "Error: Build doesn't allow LLVM IR, "
376 << "--build-on-read=0 not allowed\n"; 379 << "--build-on-read=0 not allowed\n";
377 return GetReturnValue(1); 380 return GetReturnValue(1);
378 } 381 }
379 if (UseELFWriter) { 382 if (UseELFWriter) {
383 Ice::TimerMarker T1(Ice::TimerStack::TT_emit, &Ctx);
380 Ctx.getObjectWriter()->writeNonUserSections(); 384 Ctx.getObjectWriter()->writeNonUserSections();
381 } 385 }
382 if (SubzeroTimingEnabled) 386 if (SubzeroTimingEnabled)
383 Ctx.dumpTimers(); 387 Ctx.dumpTimers();
384 if (TimeEachFunction) { 388 if (TimeEachFunction) {
385 const bool DumpCumulative = false; 389 const bool DumpCumulative = false;
386 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative); 390 Ctx.dumpTimers(Ice::GlobalContext::TSK_Funcs, DumpCumulative);
387 } 391 }
388 const bool FinalStats = true; 392 const bool FinalStats = true;
389 Ctx.dumpStats("_FINAL_", FinalStats); 393 Ctx.dumpStats("_FINAL_", FinalStats);
390 return GetReturnValue(ErrorStatus); 394 return GetReturnValue(ErrorStatus);
391 } 395 }
OLDNEW
« no previous file with comments | « src/assembler_ia32.cpp ('k') | tests_lit/llvm2ice_tests/elf_container.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698