diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /lib/Target/AVR | |
parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) |
Diffstat (limited to 'lib/Target/AVR')
-rw-r--r-- | lib/Target/AVR/AVRAsmPrinter.cpp | 3 | ||||
-rw-r--r-- | lib/Target/AVR/AVRExpandPseudoInsts.cpp | 17 | ||||
-rw-r--r-- | lib/Target/AVR/AVRISelLowering.cpp | 31 | ||||
-rw-r--r-- | lib/Target/AVR/AVRInstrInfo.td | 4 | ||||
-rw-r--r-- | lib/Target/AVR/AVRInstrumentFunctions.cpp | 2 | ||||
-rw-r--r-- | lib/Target/AVR/AVRMCInstLower.cpp | 2 | ||||
-rw-r--r-- | lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp | 2 | ||||
-rw-r--r-- | lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h | 2 | ||||
-rw-r--r-- | lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp | 2 | ||||
-rw-r--r-- | lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp | 1 | ||||
-rw-r--r-- | lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp | 1 | ||||
-rw-r--r-- | lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h | 2 |
12 files changed, 39 insertions, 30 deletions
diff --git a/lib/Target/AVR/AVRAsmPrinter.cpp b/lib/Target/AVR/AVRAsmPrinter.cpp index 4afdd3a0ec08..50bb50b44f27 100644 --- a/lib/Target/AVR/AVRAsmPrinter.cpp +++ b/lib/Target/AVR/AVRAsmPrinter.cpp @@ -130,7 +130,8 @@ bool AVRAsmPrinter::PrintAsmOperand(const MachineInstr *MI, unsigned OpNum, } } - printOperand(MI, OpNum, O); + if (Error) + printOperand(MI, OpNum, O); return false; } diff --git a/lib/Target/AVR/AVRExpandPseudoInsts.cpp b/lib/Target/AVR/AVRExpandPseudoInsts.cpp index 1b2f2cec0bca..13080a5d72f0 100644 --- a/lib/Target/AVR/AVRExpandPseudoInsts.cpp +++ b/lib/Target/AVR/AVRExpandPseudoInsts.cpp @@ -509,8 +509,8 @@ bool AVRExpandPseudo::expand<AVR::LDIWRdK>(Block &MBB, BlockIt MBBI) { const BlockAddress *BA = MI.getOperand(1).getBlockAddress(); unsigned TF = MI.getOperand(1).getTargetFlags(); - MIBLO.addOperand(MachineOperand::CreateBA(BA, TF | AVRII::MO_LO)); - MIBHI.addOperand(MachineOperand::CreateBA(BA, TF | AVRII::MO_HI)); + MIBLO.add(MachineOperand::CreateBA(BA, TF | AVRII::MO_LO)); + MIBHI.add(MachineOperand::CreateBA(BA, TF | AVRII::MO_HI)); break; } case MachineOperand::MO_Immediate: { @@ -785,9 +785,8 @@ bool AVRExpandPseudo::expandAtomicBinaryOp(unsigned Opcode, auto Op1 = MI.getOperand(0); auto Op2 = MI.getOperand(1); - MachineInstr &NewInst = *buildMI(MBB, MBBI, Opcode) - .addOperand(Op1).addOperand(Op2) - .getInstr(); + MachineInstr &NewInst = + *buildMI(MBB, MBBI, Opcode).add(Op1).add(Op2).getInstr(); f(NewInst); }); } @@ -810,15 +809,13 @@ bool AVRExpandPseudo::expandAtomicArithmeticOp(unsigned Width, unsigned StoreOpcode = (Width == 8) ? AVR::STPtrRr : AVR::STWPtrRr; // Create the load - buildMI(MBB, MBBI, LoadOpcode).addOperand(Op1).addOperand(Op2); + buildMI(MBB, MBBI, LoadOpcode).add(Op1).add(Op2); // Create the arithmetic op - buildMI(MBB, MBBI, ArithOpcode) - .addOperand(Op1).addOperand(Op1) - .addOperand(Op2); + buildMI(MBB, MBBI, ArithOpcode).add(Op1).add(Op1).add(Op2); // Create the store - buildMI(MBB, MBBI, StoreOpcode).addOperand(Op2).addOperand(Op1); + buildMI(MBB, MBBI, StoreOpcode).add(Op2).add(Op1); }); } diff --git a/lib/Target/AVR/AVRISelLowering.cpp b/lib/Target/AVR/AVRISelLowering.cpp index 07fc3f6890b8..0b95d3819399 100644 --- a/lib/Target/AVR/AVRISelLowering.cpp +++ b/lib/Target/AVR/AVRISelLowering.cpp @@ -48,6 +48,8 @@ AVRTargetLowering::AVRTargetLowering(AVRTargetMachine &tm) setOperationAction(ISD::GlobalAddress, MVT::i16, Custom); setOperationAction(ISD::BlockAddress, MVT::i16, Custom); + setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); + setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand); setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i8, Expand); setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i16, Expand); @@ -311,7 +313,7 @@ SDValue AVRTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const { unsigned Opcode = Op->getOpcode(); assert((Opcode == ISD::SDIVREM || Opcode == ISD::UDIVREM) && "Invalid opcode for Div/Rem lowering"); - bool isSigned = (Opcode == ISD::SDIVREM); + bool IsSigned = (Opcode == ISD::SDIVREM); EVT VT = Op->getValueType(0); Type *Ty = VT.getTypeForEVT(*DAG.getContext()); @@ -320,16 +322,16 @@ SDValue AVRTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const { default: llvm_unreachable("Unexpected request for libcall!"); case MVT::i8: - LC = isSigned ? RTLIB::SDIVREM_I8 : RTLIB::UDIVREM_I8; + LC = IsSigned ? RTLIB::SDIVREM_I8 : RTLIB::UDIVREM_I8; break; case MVT::i16: - LC = isSigned ? RTLIB::SDIVREM_I16 : RTLIB::UDIVREM_I16; + LC = IsSigned ? RTLIB::SDIVREM_I16 : RTLIB::UDIVREM_I16; break; case MVT::i32: - LC = isSigned ? RTLIB::SDIVREM_I32 : RTLIB::UDIVREM_I32; + LC = IsSigned ? RTLIB::SDIVREM_I32 : RTLIB::UDIVREM_I32; break; case MVT::i64: - LC = isSigned ? RTLIB::SDIVREM_I64 : RTLIB::UDIVREM_I64; + LC = IsSigned ? RTLIB::SDIVREM_I64 : RTLIB::UDIVREM_I64; break; } @@ -340,8 +342,8 @@ SDValue AVRTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const { for (SDValue const &Value : Op->op_values()) { Entry.Node = Value; Entry.Ty = Value.getValueType().getTypeForEVT(*DAG.getContext()); - Entry.isSExt = isSigned; - Entry.isZExt = !isSigned; + Entry.IsSExt = IsSigned; + Entry.IsZExt = !IsSigned; Args.push_back(Entry); } @@ -354,10 +356,10 @@ SDValue AVRTargetLowering::LowerDivRem(SDValue Op, SelectionDAG &DAG) const { TargetLowering::CallLoweringInfo CLI(DAG); CLI.setDebugLoc(dl) .setChain(InChain) - .setCallee(getLibcallCallingConv(LC), RetTy, Callee, std::move(Args)) + .setLibCallee(getLibcallCallingConv(LC), RetTy, Callee, std::move(Args)) .setInRegister() - .setSExtResult(isSigned) - .setZExtResult(!isSigned); + .setSExtResult(IsSigned) + .setZExtResult(!IsSigned); std::pair<SDValue, SDValue> CallInfo = LowerCallTo(CLI); return CallInfo.first; @@ -932,6 +934,12 @@ static void analyzeStandardArguments(TargetLowering::CallLoweringInfo *CLI, bool UsesStack = false; for (unsigned i = 0, pos = 0, e = Args.size(); i != e; ++i) { unsigned Size = Args[i]; + + // If we have a zero-sized argument, don't attempt to lower it. + // AVR-GCC does not support zero-sized arguments and so we need not + // worry about ABI compatibility. + if (Size == 0) continue; + MVT LocVT = (IsCall) ? (*Outs)[pos].VT : (*Ins)[pos].VT; // If we have plenty of regs to pass the whole argument do it. @@ -1373,7 +1381,7 @@ AVRTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv, // Don't emit the ret/reti instruction when the naked attribute is present in // the function being compiled. if (MF.getFunction()->getAttributes().hasAttribute( - AttributeSet::FunctionIndex, Attribute::Naked)) { + AttributeList::FunctionIndex, Attribute::Naked)) { return Chain; } @@ -1975,4 +1983,3 @@ unsigned AVRTargetLowering::getRegisterByName(const char *RegName, } } // end of namespace llvm - diff --git a/lib/Target/AVR/AVRInstrInfo.td b/lib/Target/AVR/AVRInstrInfo.td index bc66379ab708..693d80a1c06f 100644 --- a/lib/Target/AVR/AVRInstrInfo.td +++ b/lib/Target/AVR/AVRInstrInfo.td @@ -694,7 +694,7 @@ Defs = [SREG] in } //===----------------------------------------------------------------------===// -// One's/Two's Compliment +// One's/Two's Complement //===----------------------------------------------------------------------===// let Constraints = "$src = $rd", Defs = [SREG] in @@ -1718,7 +1718,7 @@ Defs = [SREG] in (implicit SREG)]>; // CBR Rd, K - // Alias for `ANDI Rd, COM(K)` where COM(K) is the compliment of K. + // Alias for `ANDI Rd, COM(K)` where COM(K) is the complement of K. // FIXME: This uses the 'complement' encoder. We need it to also use the // imm_ldi8 encoder. This will cause no fixups to be created on this instruction. def CBRRdK : FRdK<0b0111, diff --git a/lib/Target/AVR/AVRInstrumentFunctions.cpp b/lib/Target/AVR/AVRInstrumentFunctions.cpp index 5553dc2da31b..e7fca74e1701 100644 --- a/lib/Target/AVR/AVRInstrumentFunctions.cpp +++ b/lib/Target/AVR/AVRInstrumentFunctions.cpp @@ -96,7 +96,7 @@ static void BuildSignatureCall(StringRef SymName, BasicBlock &BB, Function &F) { Value *FunctionName = CreateStringPtr(BB, F.getName()); Value *Args[] = {FunctionName, - ConstantInt::get(I16, F.getArgumentList().size())}; + ConstantInt::get(I16, F.arg_size())}; CallInst::Create(Fn, Args, "", &BB); } diff --git a/lib/Target/AVR/AVRMCInstLower.cpp b/lib/Target/AVR/AVRMCInstLower.cpp index 342fe558813a..475dda420e89 100644 --- a/lib/Target/AVR/AVRMCInstLower.cpp +++ b/lib/Target/AVR/AVRMCInstLower.cpp @@ -56,7 +56,7 @@ void AVRMCInstLower::lowerInstruction(const MachineInstr &MI, MCInst &OutMI) con switch (MO.getType()) { default: - MI.dump(); + MI.print(errs()); llvm_unreachable("unknown operand type"); case MachineOperand::MO_Register: // Ignore all implicit register operands. diff --git a/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp b/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp index 081d8b5740ef..5c3b45ac2328 100644 --- a/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp +++ b/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp @@ -335,7 +335,7 @@ MCObjectWriter *AVRAsmBackend::createObjectWriter(raw_pwrite_stream &OS) const { void AVRAsmBackend::applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, uint64_t Value, - bool IsPCRel) const { + bool IsPCRel, MCContext &Ctx) const { if (Value == 0) return; // Doesn't change encoding. diff --git a/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h b/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h index 7ff4b8f350f6..f2be2494684a 100644 --- a/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h +++ b/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h @@ -41,7 +41,7 @@ public: MCObjectWriter *createObjectWriter(raw_pwrite_stream &OS) const override; void applyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, - uint64_t Value, bool IsPCRel) const override; + uint64_t Value, bool IsPCRel, MCContext &Ctx) const override; const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override; diff --git a/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp b/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp index 481de320b22f..713754821005 100644 --- a/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp +++ b/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp @@ -1,5 +1,7 @@ #include "AVRELFStreamer.h" +#include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/ELF.h" #include "llvm/Support/FormattedStream.h" diff --git a/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp b/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp index cca3bcc4968a..9f2ee8cf8035 100644 --- a/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp +++ b/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp @@ -23,6 +23,7 @@ AVRMCAsmInfo::AVRMCAsmInfo(const Triple &TT) { CommentString = ";"; PrivateGlobalPrefix = ".L"; UsesELFSectionDirectiveForBSS = true; + UseIntegratedAssembler = true; } } // end of namespace llvm diff --git a/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp b/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp index e6dc8868c705..c3d43ebb407e 100644 --- a/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp +++ b/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp @@ -25,6 +25,7 @@ #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSubtargetInfo.h" +#include "llvm/Support/Casting.h" #include "llvm/Support/raw_ostream.h" #define DEBUG_TYPE "mccodeemitter" diff --git a/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h b/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h index 5fa425c296a5..4cee8d904c9d 100644 --- a/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h +++ b/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.h @@ -63,7 +63,7 @@ private: SmallVectorImpl<MCFixup> &Fixups, const MCSubtargetInfo &STI) const; - /// Takes the compliment of a number (~0 - val). + /// Takes the complement of a number (~0 - val). unsigned encodeComplement(const MCInst &MI, unsigned OpNo, SmallVectorImpl<MCFixup> &Fixups, const MCSubtargetInfo &STI) const; |