Mercurial > projects > ldc
comparison gen/tollvm.cpp @ 246:b604c56945b0 trunk
[svn r263] Changed *** ATTENTION *** to warnings.
Implemented debug info for dynamic arrays, start of general composite support.
author | lindquist |
---|---|
date | Mon, 09 Jun 2008 15:52:22 +0200 |
parents | a95056b3c996 |
children | a9dae3da4e87 |
comparison
equal
deleted
inserted
replaced
245:d61ce72c39ab | 246:b604c56945b0 |
---|---|
502 LLConstant* DtoConstString(const char* str) | 502 LLConstant* DtoConstString(const char* str) |
503 { | 503 { |
504 std::string s(str); | 504 std::string s(str); |
505 LLConstant* init = llvm::ConstantArray::get(s, true); | 505 LLConstant* init = llvm::ConstantArray::get(s, true); |
506 llvm::GlobalVariable* gvar = new llvm::GlobalVariable( | 506 llvm::GlobalVariable* gvar = new llvm::GlobalVariable( |
507 init->getType(), true,llvm::GlobalValue::InternalLinkage, init, "stringliteral", gIR->module); | 507 init->getType(), true,llvm::GlobalValue::InternalLinkage, init, ".str", gIR->module); |
508 LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; | 508 LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; |
509 return DtoConstSlice( | 509 return DtoConstSlice( |
510 DtoConstSize_t(s.length()), | 510 DtoConstSize_t(s.length()), |
511 llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2) | 511 llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2) |
512 ); | 512 ); |
514 LLConstant* DtoConstStringPtr(const char* str, const char* section) | 514 LLConstant* DtoConstStringPtr(const char* str, const char* section) |
515 { | 515 { |
516 std::string s(str); | 516 std::string s(str); |
517 LLConstant* init = llvm::ConstantArray::get(s, true); | 517 LLConstant* init = llvm::ConstantArray::get(s, true); |
518 llvm::GlobalVariable* gvar = new llvm::GlobalVariable( | 518 llvm::GlobalVariable* gvar = new llvm::GlobalVariable( |
519 init->getType(), true,llvm::GlobalValue::InternalLinkage, init, "stringliteral", gIR->module); | 519 init->getType(), true,llvm::GlobalValue::InternalLinkage, init, ".str", gIR->module); |
520 if (section) gvar->setSection(section); | 520 if (section) gvar->setSection(section); |
521 LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; | 521 LLConstant* idxs[2] = { DtoConstUint(0), DtoConstUint(0) }; |
522 return llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); | 522 return llvm::ConstantExpr::getGetElementPtr(gvar,idxs,2); |
523 } | 523 } |
524 | 524 |