1//===-- MipsTargetObjectFile.cpp - Mips object files ----------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "MipsTargetObjectFile.h"
11#include "MipsSubtarget.h"
12#include "llvm/DerivedTypes.h"
13#include "llvm/GlobalVariable.h"
14#include "llvm/MC/MCSectionELF.h"
15#include "llvm/Target/TargetData.h"
16#include "llvm/Target/TargetMachine.h"
17#include "llvm/Support/CommandLine.h"
18using namespace llvm;
19
--- 32 unchanged lines hidden (view full) ---
52 return IsGlobalInSmallSection(GV, TM, getKindForGlobal(GV, TM));
53}
54
55/// IsGlobalInSmallSection - Return true if this global address should be
56/// placed into small data/bss section.
57bool MipsTargetObjectFile::
58IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM,
59 SectionKind Kind) const {
60
61 // Only use small section for non linux targets.
62 const MipsSubtarget &Subtarget = TM.getSubtarget<MipsSubtarget>();
63 if (Subtarget.isLinux())
64 return false;
65
66 // Only global variables, not functions.
67 const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV);
68 if (!GVA)
69 return false;
70
71 // We can only do this for datarel or BSS objects for now.
72 if (!Kind.isBSS() && !Kind.isDataRel())
73 return false;
--- 27 unchanged lines hidden ---
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "MipsTargetObjectFile.h"
11#include "MipsSubtarget.h"
12#include "llvm/DerivedTypes.h"
13#include "llvm/GlobalVariable.h"
14#include "llvm/MC/MCSectionELF.h"
15#include "llvm/Target/TargetData.h"
16#include "llvm/Target/TargetMachine.h"
17#include "llvm/Support/CommandLine.h"
18using namespace llvm;
19
--- 32 unchanged lines hidden (view full) ---
52 return IsGlobalInSmallSection(GV, TM, getKindForGlobal(GV, TM));
53}
54
55/// IsGlobalInSmallSection - Return true if this global address should be
56/// placed into small data/bss section.
57bool MipsTargetObjectFile::
58IsGlobalInSmallSection(const GlobalValue *GV, const TargetMachine &TM,
59 SectionKind Kind) const {
60
61 // Only use small section for non linux targets.
62 const MipsSubtarget &Subtarget = TM.getSubtarget<MipsSubtarget>();
63 if (Subtarget.isLinux())
64 return false;
65
66 // Only global variables, not functions.
67 const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV);
68 if (!GVA)
69 return false;
70
71 // We can only do this for datarel or BSS objects for now.
72 if (!Kind.isBSS() && !Kind.isDataRel())
73 return false;
--- 27 unchanged lines hidden ---