~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to tools/lli/lli.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
                     clEnumValEnd));
160
160
 
161
161
  cl::opt<bool>
162
 
  EnableJITExceptionHandling("jit-enable-eh",
163
 
    cl::desc("Emit exception handling information"),
164
 
    cl::init(false));
165
 
 
166
 
  cl::opt<bool>
167
162
  GenerateSoftFloatCalls("soft-float",
168
163
    cl::desc("Generate software floating point library calls"),
169
164
    cl::init(false));
259
254
    EE->mapSectionAddress(const_cast<void*>(Offsets[i].first), Addr);
260
255
 
261
256
    DEBUG(dbgs() << "  Mapping local: " << Offsets[i].first
262
 
                 << " to remote: " << format("%p", Addr) << "\n");
 
257
                 << " to remote: 0x" << format("%llx", Addr) << "\n");
263
258
 
264
259
  }
265
260
 
274
269
      T->loadCode(Addr, Offsets[i].first, Sizes[i]);
275
270
 
276
271
      DEBUG(dbgs() << "  loading code: " << Offsets[i].first
277
 
            << " to remote: " << format("%p", Addr) << "\n");
 
272
            << " to remote: 0x" << format("%llx", Addr) << "\n");
278
273
    } else {
279
274
      T->loadData(Addr, Offsets[i].first, Sizes[i]);
280
275
 
281
276
      DEBUG(dbgs() << "  loading data: " << Offsets[i].first
282
 
            << " to remote: " << format("%p", Addr) << "\n");
 
277
            << " to remote: 0x" << format("%llx", Addr) << "\n");
283
278
    }
284
279
 
285
280
  }
342
337
    Mod->setTargetTriple(Triple::normalize(TargetTriple));
343
338
 
344
339
  // Enable MCJIT if desired.
345
 
  JITMemoryManager *JMM = 0;
 
340
  RTDyldMemoryManager *RTDyldMM = 0;
346
341
  if (UseMCJIT && !ForceInterpreter) {
347
342
    builder.setUseMCJIT(true);
348
343
    if (RemoteMCJIT)
349
 
      JMM = new RecordingMemoryManager();
 
344
      RTDyldMM = new RecordingMemoryManager();
350
345
    else
351
 
      JMM = new SectionMemoryManager();
352
 
    builder.setJITMemoryManager(JMM);
 
346
      RTDyldMM = new SectionMemoryManager();
 
347
    builder.setMCJITMemoryManager(RTDyldMM);
353
348
  } else {
354
349
    if (RemoteMCJIT) {
355
350
      errs() << "error: Remote process execution requires -use-mcjit\n";
381
376
 
382
377
  // Remote target execution doesn't handle EH or debug registration.
383
378
  if (!RemoteMCJIT) {
384
 
    Options.JITExceptionHandling = EnableJITExceptionHandling;
385
379
    Options.JITEmitDebugInfo = EmitJitDebugInfo;
386
380
    Options.JITEmitDebugInfoToDisk = EmitJitDebugInfoToDisk;
387
381
  }
467
461
 
468
462
  int Result;
469
463
  if (RemoteMCJIT) {
470
 
    RecordingMemoryManager *MM = static_cast<RecordingMemoryManager*>(JMM);
 
464
    RecordingMemoryManager *MM = static_cast<RecordingMemoryManager*>(RTDyldMM);
471
465
    // Everything is prepared now, so lay out our program for the target
472
466
    // address space, assign the section addresses to resolve any relocations,
473
467
    // and send it to the target.
489
483
    // FIXME: argv and envp handling.
490
484
    uint64_t Entry = (uint64_t)EE->getPointerToFunction(EntryFn);
491
485
 
492
 
    DEBUG(dbgs() << "Executing '" << EntryFn->getName() << "' at "
493
 
                 << format("%p", Entry) << "\n");
 
486
    DEBUG(dbgs() << "Executing '" << EntryFn->getName() << "' at 0x"
 
487
                 << format("%llx", Entry) << "\n");
494
488
 
495
489
    if (Target.executeCode(Entry, Result))
496
490
      errs() << "ERROR: " << Target.getErrorMsg() << "\n";
501
495
    // invalidated will be known.
502
496
    (void)EE->getPointerToFunction(EntryFn);
503
497
    // Clear instruction cache before code will be executed.
504
 
    if (JMM)
505
 
      static_cast<SectionMemoryManager*>(JMM)->invalidateInstructionCache();
 
498
    if (RTDyldMM)
 
499
      static_cast<SectionMemoryManager*>(RTDyldMM)->invalidateInstructionCache();
506
500
 
507
501
    // Run main.
508
502
    Result = EE->runFunctionAsMain(EntryFn, InputArgv, envp);