[llvm-dev] [ORC] SimpleCompiler and module transformations

Alex Denisov via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 9 01:32:11 PST 2016


Hi devs, hi Lang,

I use ORC’s SimpleCompiler to compile modules into object files and it works just great, however I’m having an issue:
a module gets changed a bit when I compile it (some transformations/optimizations applied).
I tried to set optimization level of a TargetMachine to None, but the module gets changed anyway.

The question is: how can I prevent a module from being modified during compilation?
I can make a clone of a module, but I’m curious if there are other ways to achieve the same goal.

More context:

When I run a program I try to get object file for a module from a cache.
If the object file exists, then I just proceed to a module analysis phase.
If the object does not exist, then I compile the module, put object file into a cache, and then proceed to a module analysis phase.
In other words:

  let object = cache.getObject(module);
  if object == null {
    object = compile(module)
    cache.putObject(object, module)
  }
  processModule(module)

When I run my program two times, then I basically analyze two different modules, even though they are loaded from the same bitcode file.

Please, let me know if more information/clarification is needed.

Any hints, suggestions, and recommendations are more than welcome :)

-- 
AlexDenisov
Software Engineer, http://lowlevelbits.org



More information about the llvm-dev mailing list