using namespace llvm;
-ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM) {
- ETM = &TM;
+ELFTargetAsmInfo::ELFTargetAsmInfo(const TargetMachine &TM)
+ : TargetAsmInfo(TM) {
BSSSection_ = getUnnamedSection("\t.bss",
SectionFlags::Writeable | SectionFlags::BSS);
if (const Function *F = dyn_cast<Function>(GV)) {
switch (F->getLinkage()) {
default: assert(0 && "Unknown linkage type!");
+ case Function::PrivateLinkage:
case Function::InternalLinkage:
case Function::DLLExportLinkage:
case Function::ExternalLinkage:
}
} else
assert(0 && "Unsupported global");
+
+ return NULL;
}
const Section*
inline const Section*
ELFTargetAsmInfo::MergeableConstSection(const Type *Ty) const {
- const TargetData *TD = ETM->getTargetData();
+ const TargetData *TD = TM.getTargetData();
// FIXME: string here is temporary, until stuff will fully land in.
// We cannot use {Four,Eight,Sixteen}ByteConstantSection here, since it's
// currently directly used by asmprinter.
- unsigned Size = TD->getABITypeSize(Ty);
+ unsigned Size = TD->getTypePaddedSize(Ty);
if (Size == 4 || Size == 8 || Size == 16) {
std::string Name = ".rodata.cst" + utostr(Size);
const Section*
ELFTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const {
- const TargetData *TD = ETM->getTargetData();
+ const TargetData *TD = TM.getTargetData();
Constant *C = cast<GlobalVariable>(GV)->getInitializer();
- const ConstantArray *CVA = cast<ConstantArray>(C);
- const Type *Ty = CVA->getType()->getElementType();
+ const Type *Ty = cast<ArrayType>(C->getType())->getElementType();
- unsigned Size = TD->getABITypeSize(Ty);
+ unsigned Size = TD->getTypePaddedSize(Ty);
if (Size <= 16) {
assert(getCStringSection() && "Should have string section prefix");
// We also need alignment here
- const TargetData *TD = ETM->getTargetData();
unsigned Align = TD->getPrefTypeAlignment(Ty);
if (Align < Size)
Align = Size;
return Flags;
}
-