1
2 #include "radeon_llvm_emit.h"
3
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>
9 #include <stdio.h>
10
11 #include <llvm-c/Core.h>
12
13 using namespace llvm;
14
15 static cl::opt<std::string>
16 InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
17
18 static cl::opt<std::string>
19 TargetGPUName("gpu", cl::desc("target gpu name"), cl::value_desc("gpu_name"));
20
main(int argc,char ** argv)21 int main(int argc, char ** argv)
22 {
23 unsigned char * bytes;
24 unsigned byte_count;
25
26 std::auto_ptr<Module> M;
27 LLVMContext &Context = getGlobalContext();
28 SMDiagnostic Err;
29 cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
30 M.reset(ParseIRFile(InputFilename, Err, Context));
31
32 Module * mod = M.get();
33
34 radeon_llvm_compile(wrap(mod), &bytes, &byte_count, TargetGPUName.c_str(), 1);
35 }
36