ptx: fix lint and compiler warnings

llvm-svn: 126838
This commit is contained in:
Che-Liang Chiou 2011-03-02 07:58:46 +00:00
parent 59515dc703
commit 7ed32cc51b
3 changed files with 13 additions and 9 deletions

View File

@ -361,7 +361,8 @@ void PTXAsmPrinter::EmitFunctionDeclaration() {
unsigned cnt = 0;
//for (int i = 0, e = MFI->getNumArg(); i != e; ++i) {
for(PTXMachineFunctionInfo::reg_reverse_iterator
i = MFI->argRegReverseBegin(), e = MFI->argRegReverseEnd(), b = i; i != e; ++i) {
i = MFI->argRegReverseBegin(), e = MFI->argRegReverseEnd(), b = i;
i != e; ++i) {
reg = *i;
assert(reg != PTX::NoRegister && "Not a valid register!");
if (i != b)
@ -374,7 +375,8 @@ void PTXAsmPrinter::EmitFunctionDeclaration() {
}
} else {
for (PTXMachineFunctionInfo::reg_reverse_iterator
i = MFI->argRegReverseBegin(), e = MFI->argRegReverseEnd(), b = i; i != e; ++i) {
i = MFI->argRegReverseBegin(), e = MFI->argRegReverseEnd(), b = i;
i != e; ++i) {
reg = *i;
assert(reg != PTX::NoRegister && "Not a valid register!");
if (i != b)

View File

@ -36,23 +36,25 @@ extern "C" void LLVMInitializePTXTarget() {
}
namespace {
const char* DataLayout32 = "e-p:32:32-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64";
const char* DataLayout64 = "e-p:64:64-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64";
const char* DataLayout32 =
"e-p:32:32-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64";
const char* DataLayout64 =
"e-p:64:64-i64:32:32-f64:32:32-v128:32:128-v64:32:64-n32:64";
}
// DataLayout and FrameLowering are filled with dummy data
PTXTargetMachine::PTXTargetMachine(const Target &T,
const std::string &TT,
const std::string &FS)
: Subtarget(TT, FS),
: LLVMTargetMachine(T, TT),
// FIXME: This feels like a dirty hack, but Subtarget does not appear to be
// initialized at this point, and we need to finish initialization of
// DataLayout.
DataLayout((FS.find("64bit") != FS.npos) ? DataLayout64 : DataLayout32),
LLVMTargetMachine(T, TT),
Subtarget(TT, FS),
FrameLowering(Subtarget),
TLInfo(*this),
InstrInfo(*this) {
InstrInfo(*this),
TLInfo(*this) {
}
bool PTXTargetMachine::addInstSelector(PassManagerBase &PM,

View File

@ -26,10 +26,10 @@ namespace llvm {
class PTXTargetMachine : public LLVMTargetMachine {
private:
const TargetData DataLayout;
PTXSubtarget Subtarget; // has to be initialized before FrameLowering
PTXFrameLowering FrameLowering;
PTXInstrInfo InstrInfo;
PTXTargetLowering TLInfo;
PTXSubtarget Subtarget;
public:
PTXTargetMachine(const Target &T, const std::string &TT,