2 #include "radeon_llvm_emit.h"
4 #include <llvm/Support/CommandLine.h>
5 #include <llvm/Support/IRReader.h>
6 #include <llvm/Support/SourceMgr.h>
7 #include <llvm/LLVMContext.h>
8 #include <llvm/Module.h>
11 #include <llvm-c/Core.h>
15 static cl::opt
<std::string
>
16 InputFilename(cl::Positional
, cl::desc("<input bitcode>"), cl::init("-"));
18 static cl::opt
<std::string
>
19 TargetGPUName("gpu", cl::desc("target gpu name"), cl::value_desc("gpu_name"));
21 int main(int argc
, char ** argv
)
23 unsigned char * bytes
;
26 std::auto_ptr
<Module
> M
;
27 LLVMContext
&Context
= getGlobalContext();
29 cl::ParseCommandLineOptions(argc
, argv
, "llvm system compiler\n");
30 M
.reset(ParseIRFile(InputFilename
, Err
, Context
));
32 Module
* mod
= M
.get();
34 radeon_llvm_compile(wrap(mod
), &bytes
, &byte_count
, TargetGPUName
.c_str(), 1);