Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Show All 26 Lines | |||||
#include "PPCTargetStreamer.h" | #include "PPCTargetStreamer.h" | ||||
#include "TargetInfo/PowerPCTargetInfo.h" | #include "TargetInfo/PowerPCTargetInfo.h" | ||||
#include "llvm/ADT/MapVector.h" | #include "llvm/ADT/MapVector.h" | ||||
#include "llvm/ADT/SmallPtrSet.h" | #include "llvm/ADT/SmallPtrSet.h" | ||||
#include "llvm/ADT/StringRef.h" | #include "llvm/ADT/StringRef.h" | ||||
#include "llvm/ADT/Triple.h" | #include "llvm/ADT/Triple.h" | ||||
#include "llvm/ADT/Twine.h" | #include "llvm/ADT/Twine.h" | ||||
#include "llvm/BinaryFormat/ELF.h" | #include "llvm/BinaryFormat/ELF.h" | ||||
#include "llvm/BinaryFormat/MachO.h" | |||||
#include "llvm/CodeGen/AsmPrinter.h" | #include "llvm/CodeGen/AsmPrinter.h" | ||||
#include "llvm/CodeGen/MachineBasicBlock.h" | #include "llvm/CodeGen/MachineBasicBlock.h" | ||||
#include "llvm/CodeGen/MachineFunction.h" | #include "llvm/CodeGen/MachineFunction.h" | ||||
#include "llvm/CodeGen/MachineInstr.h" | #include "llvm/CodeGen/MachineInstr.h" | ||||
#include "llvm/CodeGen/MachineModuleInfoImpls.h" | #include "llvm/CodeGen/MachineModuleInfoImpls.h" | ||||
#include "llvm/CodeGen/MachineOperand.h" | #include "llvm/CodeGen/MachineOperand.h" | ||||
#include "llvm/CodeGen/MachineRegisterInfo.h" | #include "llvm/CodeGen/MachineRegisterInfo.h" | ||||
#include "llvm/CodeGen/StackMaps.h" | #include "llvm/CodeGen/StackMaps.h" | ||||
#include "llvm/CodeGen/TargetLoweringObjectFileImpl.h" | #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h" | ||||
#include "llvm/IR/DataLayout.h" | #include "llvm/IR/DataLayout.h" | ||||
#include "llvm/IR/GlobalValue.h" | #include "llvm/IR/GlobalValue.h" | ||||
#include "llvm/IR/GlobalVariable.h" | #include "llvm/IR/GlobalVariable.h" | ||||
#include "llvm/IR/Module.h" | #include "llvm/IR/Module.h" | ||||
#include "llvm/MC/MCAsmInfo.h" | #include "llvm/MC/MCAsmInfo.h" | ||||
#include "llvm/MC/MCContext.h" | #include "llvm/MC/MCContext.h" | ||||
#include "llvm/MC/MCDirectives.h" | #include "llvm/MC/MCDirectives.h" | ||||
#include "llvm/MC/MCExpr.h" | #include "llvm/MC/MCExpr.h" | ||||
#include "llvm/MC/MCInst.h" | #include "llvm/MC/MCInst.h" | ||||
#include "llvm/MC/MCInstBuilder.h" | #include "llvm/MC/MCInstBuilder.h" | ||||
#include "llvm/MC/MCSectionELF.h" | #include "llvm/MC/MCSectionELF.h" | ||||
#include "llvm/MC/MCSectionMachO.h" | |||||
#include "llvm/MC/MCSectionXCOFF.h" | #include "llvm/MC/MCSectionXCOFF.h" | ||||
#include "llvm/MC/MCStreamer.h" | #include "llvm/MC/MCStreamer.h" | ||||
#include "llvm/MC/MCSymbol.h" | #include "llvm/MC/MCSymbol.h" | ||||
#include "llvm/MC/MCSymbolELF.h" | #include "llvm/MC/MCSymbolELF.h" | ||||
#include "llvm/MC/MCSymbolXCOFF.h" | #include "llvm/MC/MCSymbolXCOFF.h" | ||||
#include "llvm/MC/SectionKind.h" | #include "llvm/MC/SectionKind.h" | ||||
#include "llvm/Support/Casting.h" | #include "llvm/Support/Casting.h" | ||||
#include "llvm/Support/CodeGen.h" | #include "llvm/Support/CodeGen.h" | ||||
▲ Show 20 Lines • Show All 1,150 Lines • ▼ Show 20 Lines | case PPC::MTOCRF8: | ||||
} | } | ||||
break; | break; | ||||
case PPC::LD: | case PPC::LD: | ||||
case PPC::STD: | case PPC::STD: | ||||
case PPC::LWA_32: | case PPC::LWA_32: | ||||
case PPC::LWA: { | case PPC::LWA: { | ||||
// Verify alignment is legal, so we don't create relocations | // Verify alignment is legal, so we don't create relocations | ||||
// that can't be supported. | // that can't be supported. | ||||
// FIXME: This test is currently disabled for Darwin. The test | |||||
// suite shows a handful of test cases that fail this check for | |||||
// Darwin. Those need to be investigated before this sanity test | |||||
// can be enabled for those subtargets. | |||||
unsigned OpNum = (MI->getOpcode() == PPC::STD) ? 2 : 1; | unsigned OpNum = (MI->getOpcode() == PPC::STD) ? 2 : 1; | ||||
const MachineOperand &MO = MI->getOperand(OpNum); | const MachineOperand &MO = MI->getOperand(OpNum); | ||||
if (MO.isGlobal()) { | if (MO.isGlobal()) { | ||||
const DataLayout &DL = MO.getGlobal()->getParent()->getDataLayout(); | const DataLayout &DL = MO.getGlobal()->getParent()->getDataLayout(); | ||||
if (MO.getGlobal()->getPointerAlignment(DL) < 4) | if (MO.getGlobal()->getPointerAlignment(DL) < 4) | ||||
llvm_unreachable("Global must be word-aligned for LD, STD, LWA!"); | llvm_unreachable("Global must be word-aligned for LD, STD, LWA!"); | ||||
} | } | ||||
// Now process the instruction normally. | // Now process the instruction normally. | ||||
▲ Show 20 Lines • Show All 822 Lines • ▼ Show 20 Lines | llvm::GlobalAlias::create( | ||||
(IsCtor ? llvm::Twine("__sinit") : llvm::Twine("__sterm")) + | (IsCtor ? llvm::Twine("__sinit") : llvm::Twine("__sterm")) + | ||||
llvm::Twine(convertToSinitPriority(S.Priority)) + | llvm::Twine(convertToSinitPriority(S.Priority)) + | ||||
llvm::Twine("_", FormatIndicatorAndUniqueModId) + | llvm::Twine("_", FormatIndicatorAndUniqueModId) + | ||||
llvm::Twine("_", llvm::utostr(Index++)), | llvm::Twine("_", llvm::utostr(Index++)), | ||||
cast<Function>(S.Func)); | cast<Function>(S.Func)); | ||||
} | } | ||||
} | } | ||||
/// createPPCAsmPrinterPass - Returns a pass that prints the PPC assembly code | // Return a pass that prints the PPC assembly code for a MachineFunction to the | ||||
void: Was this intentional? | |||||
I agree with @void , we should keep the comment but drop the , in a format that the Darwin assembler can deal with. nickdesaulniers: I agree with @void , we should keep the comment but drop the `, in a format that the Darwin… | |||||
This is intentional. Personally I don't think the comment is of any value. The purpose is obvious from its name. create*AsmPrinterPass is also in AMDGPUAsmPrinter.cpp, which does not have a comment. MaskRay: This is intentional. Personally I don't think the comment is of any value. The purpose is… | |||||
Ping MaskRay: Ping | |||||
MaskRay: @nickdesaulniers 🙄 | |||||
I would prefer you didn't remove the entire comment but, "or enter. I'm a sign, not a cop" nickdesaulniers: I would prefer you didn't remove the entire comment but,
"or enter. I'm a sign, not a cop"… | |||||
/// for a MachineFunction to the given output stream, in a format that the | // given output stream. | ||||
/// Darwin assembler can deal with. | |||||
/// | |||||
static AsmPrinter * | static AsmPrinter * | ||||
createPPCAsmPrinterPass(TargetMachine &tm, | createPPCAsmPrinterPass(TargetMachine &tm, | ||||
std::unique_ptr<MCStreamer> &&Streamer) { | std::unique_ptr<MCStreamer> &&Streamer) { | ||||
if (tm.getTargetTriple().isOSAIX()) | if (tm.getTargetTriple().isOSAIX()) | ||||
return new PPCAIXAsmPrinter(tm, std::move(Streamer)); | return new PPCAIXAsmPrinter(tm, std::move(Streamer)); | ||||
return new PPCLinuxAsmPrinter(tm, std::move(Streamer)); | return new PPCLinuxAsmPrinter(tm, std::move(Streamer)); | ||||
} | } | ||||
Show All 10 Lines |
Was this intentional?