Fix thinko

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53309 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2008-07-09 13:24:38 +00:00
parent c6f4947d48
commit 0e48a0ca16
2 changed files with 8 additions and 4 deletions

View File

@ -167,7 +167,6 @@ TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
bool isThreadLocal = GVar->isThreadLocal(); bool isThreadLocal = GVar->isThreadLocal();
assert(GVar && "Invalid global value for section selection"); assert(GVar && "Invalid global value for section selection");
SectionKind::Kind kind;
if (isSuitableForBSS(GVar)) { if (isSuitableForBSS(GVar)) {
// Variable can be easily put to BSS section. // Variable can be easily put to BSS section.
return (isThreadLocal ? SectionKind::ThreadBSS : SectionKind::BSS); return (isThreadLocal ? SectionKind::ThreadBSS : SectionKind::BSS);
@ -177,14 +176,14 @@ TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
// note, there is no thread-local r/o section. // note, there is no thread-local r/o section.
Constant *C = GVar->getInitializer(); Constant *C = GVar->getInitializer();
if (C->ContainsRelocations()) if (C->ContainsRelocations())
kind = SectionKind::ROData; return SectionKind::ROData;
else { else {
const ConstantArray *CVA = dyn_cast<ConstantArray>(C); const ConstantArray *CVA = dyn_cast<ConstantArray>(C);
// Check, if initializer is a null-terminated string // Check, if initializer is a null-terminated string
if (CVA && CVA->isCString()) if (CVA && CVA->isCString())
kind = SectionKind::RODataMergeStr; return SectionKind::RODataMergeStr;
else else
kind = SectionKind::RODataMergeConst; return SectionKind::RODataMergeConst;
} }
} }

View File

@ -32,6 +32,8 @@
#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetOptions.h"
using namespace llvm; using namespace llvm;
#include <iostream>
STATISTIC(EmittedInsts, "Number of machine instrs printed"); STATISTIC(EmittedInsts, "Number of machine instrs printed");
static std::string getPICLabelString(unsigned FnNum, static std::string getPICLabelString(unsigned FnNum,
@ -772,6 +774,9 @@ void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
if (!GVar->hasInitializer()) if (!GVar->hasInitializer())
return; // External global require no code return; // External global require no code
GVar->dump();
std::cout << TAI->SectionForGlobal(GVar) << std::endl;
// Check to see if this is a special global used by LLVM, if so, emit it. // Check to see if this is a special global used by LLVM, if so, emit it.
if (EmitSpecialLLVMGlobal(GVar)) { if (EmitSpecialLLVMGlobal(GVar)) {
if (Subtarget->isTargetDarwin() && if (Subtarget->isTargetDarwin() &&