mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-19 13:38:56 +00:00
Remove what little AIX support we have. It has never been tested and isn't
complete. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29156 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fb5115e84c
commit
ba4733d901
@ -24,7 +24,6 @@ class PPCTargetMachine;
|
|||||||
FunctionPass *createPPCBranchSelectionPass();
|
FunctionPass *createPPCBranchSelectionPass();
|
||||||
FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
|
FunctionPass *createPPCISelDag(PPCTargetMachine &TM);
|
||||||
FunctionPass *createDarwinAsmPrinter(std::ostream &OS, PPCTargetMachine &TM);
|
FunctionPass *createDarwinAsmPrinter(std::ostream &OS, PPCTargetMachine &TM);
|
||||||
FunctionPass *createAIXAsmPrinter(std::ostream &OS, PPCTargetMachine &TM);
|
|
||||||
} // end namespace llvm;
|
} // end namespace llvm;
|
||||||
|
|
||||||
// GCC #defines PPC on Linux but we use it as our namespace name
|
// GCC #defines PPC on Linux but we use it as our namespace name
|
||||||
|
@ -306,32 +306,6 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// AIXAsmPrinter - PowerPC assembly printer, customized for AIX
|
|
||||||
///
|
|
||||||
struct VISIBILITY_HIDDEN AIXAsmPrinter : public PPCAsmPrinter {
|
|
||||||
/// Map for labels corresponding to global variables
|
|
||||||
///
|
|
||||||
std::map<const GlobalVariable*,std::string> GVToLabelMap;
|
|
||||||
|
|
||||||
AIXAsmPrinter(std::ostream &O, TargetMachine &TM)
|
|
||||||
: PPCAsmPrinter(O, TM) {
|
|
||||||
CommentString = "#";
|
|
||||||
GlobalPrefix = ".";
|
|
||||||
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
|
|
||||||
Data64bitsDirective = 0; // we can't emit a 64-bit unit
|
|
||||||
AlignmentIsInBytes = false; // Alignment is by power of 2.
|
|
||||||
ConstantPoolSection = "\t.const\t";
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual const char *getPassName() const {
|
|
||||||
return "AIX PPC Assembly Printer";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool runOnMachineFunction(MachineFunction &F);
|
|
||||||
bool doInitialization(Module &M);
|
|
||||||
bool doFinalization(Module &M);
|
|
||||||
};
|
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
|
|
||||||
/// createDarwinAsmPrinterPass - Returns a pass that prints the PPC assembly
|
/// createDarwinAsmPrinterPass - Returns a pass that prints the PPC assembly
|
||||||
@ -343,14 +317,6 @@ FunctionPass *llvm::createDarwinAsmPrinter(std::ostream &o,
|
|||||||
return new DarwinAsmPrinter(o, tm);
|
return new DarwinAsmPrinter(o, tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// createAIXAsmPrinterPass - Returns a pass that prints the PPC assembly code
|
|
||||||
/// for a MachineFunction to the given output stream, in a format that the
|
|
||||||
/// AIX 5L assembler can deal with.
|
|
||||||
///
|
|
||||||
FunctionPass *llvm::createAIXAsmPrinter(std::ostream &o, PPCTargetMachine &tm) {
|
|
||||||
return new AIXAsmPrinter(o, tm);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Include the auto-generated portion of the assembly writer
|
// Include the auto-generated portion of the assembly writer
|
||||||
#include "PPCGenAsmWriter.inc"
|
#include "PPCGenAsmWriter.inc"
|
||||||
|
|
||||||
@ -717,123 +683,3 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
|
|||||||
return false; // success
|
return false; // success
|
||||||
}
|
}
|
||||||
|
|
||||||
/// runOnMachineFunction - This uses the printMachineInstruction()
|
|
||||||
/// method to print assembly for each instruction.
|
|
||||||
///
|
|
||||||
bool AIXAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|
||||||
SetupMachineFunction(MF);
|
|
||||||
|
|
||||||
// Print out constants referenced by the function
|
|
||||||
EmitConstantPool(MF.getConstantPool());
|
|
||||||
|
|
||||||
// Print out header for the function.
|
|
||||||
O << "\t.csect .text[PR]\n"
|
|
||||||
<< "\t.align 2\n"
|
|
||||||
<< "\t.globl " << CurrentFnName << '\n'
|
|
||||||
<< "\t.globl ." << CurrentFnName << '\n'
|
|
||||||
<< "\t.csect " << CurrentFnName << "[DS],3\n"
|
|
||||||
<< CurrentFnName << ":\n"
|
|
||||||
<< "\t.llong ." << CurrentFnName << ", TOC[tc0], 0\n"
|
|
||||||
<< "\t.csect .text[PR]\n"
|
|
||||||
<< '.' << CurrentFnName << ":\n";
|
|
||||||
|
|
||||||
// Print out code for the function.
|
|
||||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
|
||||||
I != E; ++I) {
|
|
||||||
printBasicBlockLabel(I);
|
|
||||||
O << '\n';
|
|
||||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
|
||||||
II != E; ++II) {
|
|
||||||
// Print the assembly for the instruction.
|
|
||||||
O << "\t";
|
|
||||||
printMachineInstruction(II);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
O << "LT.." << CurrentFnName << ":\n"
|
|
||||||
<< "\t.long 0\n"
|
|
||||||
<< "\t.byte 0,0,32,65,128,0,0,0\n"
|
|
||||||
<< "\t.long LT.." << CurrentFnName << "-." << CurrentFnName << '\n'
|
|
||||||
<< "\t.short 3\n"
|
|
||||||
<< "\t.byte \"" << CurrentFnName << "\"\n"
|
|
||||||
<< "\t.align 2\n";
|
|
||||||
|
|
||||||
// We didn't modify anything.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AIXAsmPrinter::doInitialization(Module &M) {
|
|
||||||
SwitchToDataSection("", 0);
|
|
||||||
|
|
||||||
O << "\t.machine \"ppc64\"\n"
|
|
||||||
<< "\t.toc\n"
|
|
||||||
<< "\t.csect .text[PR]\n";
|
|
||||||
|
|
||||||
// Print out module-level global variables
|
|
||||||
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
|
||||||
I != E; ++I) {
|
|
||||||
if (!I->hasInitializer())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
std::string Name = I->getName();
|
|
||||||
Constant *C = I->getInitializer();
|
|
||||||
// N.B.: We are defaulting to writable strings
|
|
||||||
if (I->hasExternalLinkage()) {
|
|
||||||
O << "\t.globl " << Name << '\n'
|
|
||||||
<< "\t.csect .data[RW],3\n";
|
|
||||||
} else {
|
|
||||||
O << "\t.csect _global.rw_c[RW],3\n";
|
|
||||||
}
|
|
||||||
O << Name << ":\n";
|
|
||||||
EmitGlobalConstant(C);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Output labels for globals
|
|
||||||
if (M.global_begin() != M.global_end()) O << "\t.toc\n";
|
|
||||||
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
|
||||||
I != E; ++I) {
|
|
||||||
const GlobalVariable *GV = I;
|
|
||||||
// Do not output labels for unused variables
|
|
||||||
if (GV->isExternal() && GV->use_begin() == GV->use_end())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
IncrementFunctionNumber();
|
|
||||||
std::string Name = GV->getName();
|
|
||||||
std::string Label = "LC.." + utostr(getFunctionNumber());
|
|
||||||
GVToLabelMap[GV] = Label;
|
|
||||||
O << Label << ":\n"
|
|
||||||
<< "\t.tc " << Name << "[TC]," << Name;
|
|
||||||
if (GV->isExternal()) O << "[RW]";
|
|
||||||
O << '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
AsmPrinter::doInitialization(M);
|
|
||||||
return false; // success
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AIXAsmPrinter::doFinalization(Module &M) {
|
|
||||||
const TargetData *TD = TM.getTargetData();
|
|
||||||
// Print out module-level global variables
|
|
||||||
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
|
|
||||||
I != E; ++I) {
|
|
||||||
if (I->hasInitializer() || I->hasExternalLinkage())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
std::string Name = I->getName();
|
|
||||||
if (I->hasInternalLinkage()) {
|
|
||||||
O << "\t.lcomm " << Name << ",16,_global.bss_c";
|
|
||||||
} else {
|
|
||||||
O << "\t.comm " << Name << "," << TD->getTypeSize(I->getType())
|
|
||||||
<< "," << Log2_32((unsigned)TD->getTypeAlignment(I->getType()));
|
|
||||||
}
|
|
||||||
O << "\t\t" << CommentString << " ";
|
|
||||||
WriteAsOperand(O, I, false, true, &M);
|
|
||||||
O << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
O << "_section_.text:\n"
|
|
||||||
<< "\t.csect .data[RW],3\n"
|
|
||||||
<< "\t.llong _section_.text\n";
|
|
||||||
AsmPrinter::doFinalization(M);
|
|
||||||
return false; // success
|
|
||||||
}
|
|
||||||
|
@ -66,7 +66,6 @@ PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit)
|
|||||||
, HasAltivec(false)
|
, HasAltivec(false)
|
||||||
, HasFSQRT(false)
|
, HasFSQRT(false)
|
||||||
, HasSTFIWX(false)
|
, HasSTFIWX(false)
|
||||||
, IsAIX(false)
|
|
||||||
, IsDarwin(false) {
|
, IsDarwin(false) {
|
||||||
|
|
||||||
// Determine default and user specified characteristics
|
// Determine default and user specified characteristics
|
||||||
@ -102,12 +101,8 @@ PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit)
|
|||||||
const std::string& TT = M.getTargetTriple();
|
const std::string& TT = M.getTargetTriple();
|
||||||
if (TT.length() > 5) {
|
if (TT.length() > 5) {
|
||||||
IsDarwin = TT.find("-darwin") != std::string::npos;
|
IsDarwin = TT.find("-darwin") != std::string::npos;
|
||||||
if (!IsDarwin)
|
|
||||||
IsAIX = TT.find("-aix") != std::string::npos;
|
|
||||||
} else if (TT.empty()) {
|
} else if (TT.empty()) {
|
||||||
#if defined(_POWER)
|
#if defined(__APPLE__)
|
||||||
IsAIX = true;
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
IsDarwin = true;
|
IsDarwin = true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ protected:
|
|||||||
bool HasAltivec;
|
bool HasAltivec;
|
||||||
bool HasFSQRT;
|
bool HasFSQRT;
|
||||||
bool HasSTFIWX;
|
bool HasSTFIWX;
|
||||||
bool IsAIX;
|
|
||||||
bool IsDarwin;
|
bool IsDarwin;
|
||||||
public:
|
public:
|
||||||
/// This constructor initializes the data members to match that
|
/// This constructor initializes the data members to match that
|
||||||
@ -86,7 +85,6 @@ public:
|
|||||||
bool hasAltivec() const { return HasAltivec; }
|
bool hasAltivec() const { return HasAltivec; }
|
||||||
bool isGigaProcessor() const { return IsGigaProcessor; }
|
bool isGigaProcessor() const { return IsGigaProcessor; }
|
||||||
|
|
||||||
bool isAIX() const { return IsAIX; }
|
|
||||||
bool isDarwin() const { return IsDarwin; }
|
bool isDarwin() const { return IsDarwin; }
|
||||||
};
|
};
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
@ -146,11 +146,6 @@ bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM,
|
|||||||
// Must run branch selection immediately preceding the asm printer
|
// Must run branch selection immediately preceding the asm printer
|
||||||
PM.add(createPPCBranchSelectionPass());
|
PM.add(createPPCBranchSelectionPass());
|
||||||
|
|
||||||
// Decide which asm printer to use. If the user has not specified one on
|
|
||||||
// the command line, choose whichever one matches the default (current host).
|
|
||||||
if (Subtarget.isAIX())
|
|
||||||
PM.add(createAIXAsmPrinter(Out, *this));
|
|
||||||
else
|
|
||||||
PM.add(createDarwinAsmPrinter(Out, *this));
|
PM.add(createDarwinAsmPrinter(Out, *this));
|
||||||
|
|
||||||
PM.add(createMachineCodeDeleter());
|
PM.add(createMachineCodeDeleter());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user