Changeset 626

Show
Ignore:
Timestamp:
08/12/08 10:00:13 (3 months ago)
Author:
weyrick
Message:

more llvm probing

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rphp/compiler/pDriver.cpp

    r625 r626  
    8484    // MP now owns mb and will delete 
    8585    // errMsg isn't needed. 
    86     delete errMsg; 
    87  
    88     llvm::ExecutionEngine* EE = llvm::ExecutionEngine::create(MP, false); 
     86    //delete errMsg; 
     87 
     88    //llvm::ExecutionEngine* EE = llvm::ExecutionEngine::create(MP, false); 
     89    llvm::ExecutionEngine* EE = llvm::ExecutionEngine::createJIT(MP, errMsg); 
     90    if (errMsg->length()) { 
     91        cerr << "no JIT available for this platform?: " << errMsg << endl; 
     92        delete errMsg; 
     93        return; 
     94    } 
    8995 
    9096    // EE now owns MP 
     
    176182 
    177183    // RUNTIME startup/shutdown test 
    178     const llvm::Type* rEnginePointer = llvm::PointerType::get(llvm::Type::Int8Ty,0); 
    179     llvm::FunctionType *runtimeStartupFuncType = llvm::FunctionType::get(rEnginePointer, std::vector<const llvm::Type*>(), false); 
    180     llvm::Function *runtimeStartupFunc = llvm::Function::Create(runtimeStartupFuncType, llvm::Function::ExternalLinkage, "rphp_newRuntimeEngine", M); 
    181  
    182     llvm::Instruction *runtimeStartInstr = llvm::CallInst::Create(runtimeStartupFunc, "runtime"); 
    183  
    184     std::vector<const llvm::Type*> engineSig(1, rEnginePointer); 
    185     llvm::FunctionType *runtimeDeleteFuncType = llvm::FunctionType::get(llvm::Type::VoidTy, engineSig, /*not vararg*/false); 
    186     llvm::Function *runtimeDeleteFunc = llvm::Function::Create(runtimeDeleteFuncType, llvm::Function::ExternalLinkage, "rphp_deleteRuntimeEngine", M); 
    187  
    188     std::vector<llvm::Value*> ArgsV; 
    189     ArgsV.push_back(runtimeStartInstr); 
    190  
    191     llvm::Instruction *runtimeDeleteInstr = llvm::CallInst::Create(runtimeDeleteFunc, ArgsV.begin(), ArgsV.end()); 
     184//     const llvm::Type* rEnginePointer = llvm::PointerType::get(llvm::Type::Int8Ty,0); 
     185//     llvm::FunctionType *runtimeStartupFuncType = llvm::FunctionType::get(rEnginePointer, std::vector<const llvm::Type*>(), false); 
     186//     llvm::Function *runtimeStartupFunc = llvm::Function::Create(runtimeStartupFuncType, llvm::Function::ExternalLinkage, "rphp_newRuntimeEngine", M); 
     187// 
     188//     llvm::Instruction *runtimeStartInstr = llvm::CallInst::Create(runtimeStartupFunc, "runtime"); 
     189// 
     190//     std::vector<const llvm::Type*> engineSig(1, rEnginePointer); 
     191//     llvm::FunctionType *runtimeDeleteFuncType = llvm::FunctionType::get(llvm::Type::VoidTy, engineSig, false); 
     192//     llvm::Function *runtimeDeleteFunc = llvm::Function::Create(runtimeDeleteFuncType, llvm::Function::ExternalLinkage, "rphp_deleteRuntimeEngine", M); 
     193// 
     194//     std::vector<llvm::Value*> ArgsV; 
     195//     ArgsV.push_back(runtimeStartInstr); 
     196// 
     197//     llvm::Instruction *runtimeDeleteInstr = llvm::CallInst::Create(runtimeDeleteFunc, ArgsV.begin(), ArgsV.end()); 
     198 
     199    llvm::FunctionType *helloFuncType = llvm::FunctionType::get(llvm::Type::VoidTy, std::vector<const llvm::Type*>(), false); 
     200    llvm::Function *helloFunc = llvm::Function::Create(helloFuncType, llvm::Function::ExternalLinkage, "sayHello", M); 
     201 
     202    llvm::Instruction *helloInstr = llvm::CallInst::Create(helloFunc); 
    192203 
    193204    // Get pointers to the constant integers... 
     
    202213    BB->getInstList().push_back(Add); 
    203214 
    204     BB->getInstList().push_back(runtimeStartInstr); 
    205     BB->getInstList().push_back(runtimeDeleteInstr); 
     215    //BB->getInstList().push_back(runtimeStartInstr); 
     216    //BB->getInstList().push_back(runtimeDeleteInstr); 
     217    BB->getInstList().push_back(helloInstr); 
    206218 
    207219    // Create the return instruction and add it to the basic block 
  • trunk/rphp/runtime/include/pRuntime.h

    r624 r626  
    7676extern "C" { 
    7777 
     78    void sayHello(void); 
     79 
    7880    // create a new runtime engine 
    7981    rphp::pRuntimeEngine* rphp_newRuntimeEngine(); 
  • trunk/rphp/runtime/pRuntime.cpp

    r624 r626  
    6363    } 
    6464 
     65    void sayHello() { 
     66        std::cout << "saying hello" << std::endl; 
     67    } 
     68     
    6569} 
    6670