MCPcopy Create free account
hub / github.com/beefytech/Beef / HandleNextCmd

Method HandleNextCmd

IDEHelper/Compiler/BfIRCodeGen.cpp:2030–5580  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2028}
2029
2030void BfIRCodeGen::HandleNextCmd()
2031{
2032 if (mFailed)
2033 return;
2034
2035 int curId = mCmdCount;
2036
2037 BfIRCmd cmd = (BfIRCmd)mStream->Read();
2038 mCmdCount++;
2039
2040 switch (cmd)
2041 {
2042 case BfIRCmd_Module_Start:
2043 {
2044 CMD_PARAM(String, moduleName);
2045 CMD_PARAM(int, ptrSize);
2046 CMD_PARAM(bool, isOptimized);
2047
2048 BF_ASSERT(mLLVMModule == NULL);
2049 mModuleName = moduleName;
2050 mPtrSize = ptrSize;
2051 mIsOptimized = isOptimized;
2052 mLLVMModule = new llvm::Module(moduleName.c_str(), *mLLVMContext);
2053 mIRBuilder = new llvm::IRBuilder<>(*mLLVMContext);
2054
2055 //OutputDebugStrF("-------- Starting Module %s --------\n", moduleName.c_str());
2056 }
2057 break;
2058 case BfIRCmd_Module_SetTargetTriple:
2059 {
2060 CMD_PARAM(String, targetTriple);
2061 CMD_PARAM(String, targetCPU);
2062
2063 mTargetTriple.Set(targetTriple);
2064 mTargetCPU = targetCPU;
2065
2066 if (targetTriple.IsEmpty())
2067 mLLVMModule->setTargetTriple(llvm::sys::getDefaultTargetTriple());
2068 else
2069 mLLVMModule->setTargetTriple(targetTriple.c_str());
2070
2071 InitTarget();
2072 }
2073 break;
2074 case BfIRCmd_Module_AddModuleFlag:
2075 {
2076 CMD_PARAM(String, flag);
2077 CMD_PARAM(int, val);
2078 mLLVMModule->addModuleFlag(llvm::Module::Warning, flag.c_str(), val);
2079
2080 if (flag == "CodeView")
2081 mIsCodeView = true;
2082 }
2083 break;
2084 case BfIRCmd_WriteIR:
2085 {
2086 CMD_PARAM(String, fileName);
2087 std::error_code ec;

Callers 2

SetBackendMethod · 0.45
NewCmdInsertedMethod · 0.45

Calls 15

FailFunction · 0.85
ReadFunction · 0.85
GetLLVMCallingConvFunction · 0.85
LLVMMapAttributeFunction · 0.85
StringClass · 0.85
CreateAddMethod · 0.80
CreateSubMethod · 0.80
CreateMulMethod · 0.80
CreateAndMethod · 0.80
CreateOrMethod · 0.80
CreateXorMethod · 0.80
CreateShlMethod · 0.80

Tested by

no test coverage detected