Ignore:
Timestamp:
Apr 19, 2011, 11:12:07 PM (14 years ago)
Author:
Yuri Dario
Message:

clamav: update trunk to 0.97.

Location:
clamav/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • clamav/trunk

  • TabularUnified clamav/trunk/libclamav/c++/llvm/lib/CodeGen/MachineFunction.cpp

    r189 r319  
    2424#include "llvm/CodeGen/MachineInstr.h"
    2525#include "llvm/CodeGen/MachineJumpTableInfo.h"
     26#include "llvm/CodeGen/MachineModuleInfo.h"
    2627#include "llvm/CodeGen/MachineRegisterInfo.h"
    2728#include "llvm/CodeGen/Passes.h"
     
    4041using namespace llvm;
    4142
    42 namespace {
    43   struct Printer : public MachineFunctionPass {
    44     static char ID;
    45 
    46     raw_ostream &OS;
    47     const std::string Banner;
    48 
    49     Printer(raw_ostream &os, const std::string &banner)
    50       : MachineFunctionPass(&ID), OS(os), Banner(banner) {}
    51 
    52     const char *getPassName() const { return "MachineFunction Printer"; }
    53 
    54     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
    55       AU.setPreservesAll();
    56       MachineFunctionPass::getAnalysisUsage(AU);
    57     }
    58 
    59     bool runOnMachineFunction(MachineFunction &MF) {
    60       OS << "# " << Banner << ":\n";
    61       MF.print(OS);
    62       return false;
    63     }
    64   };
    65   char Printer::ID = 0;
    66 }
    67 
    68 /// Returns a newly-created MachineFunction Printer pass. The default banner is
    69 /// empty.
    70 ///
    71 FunctionPass *llvm::createMachineFunctionPrinterPass(raw_ostream &OS,
    72                                                      const std::string &Banner){
    73   return new Printer(OS, Banner);
    74 }
    75 
    7643//===----------------------------------------------------------------------===//
    7744// MachineFunction implementation
     
    8552}
    8653
    87 MachineFunction::MachineFunction(Function *F, const TargetMachine &TM,
    88                                  unsigned FunctionNum)
    89   : Fn(F), Target(TM) {
     54MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM,
     55                                 unsigned FunctionNum, MachineModuleInfo &mmi)
     56  : Fn(F), Target(TM), Ctx(mmi.getContext()), MMI(mmi) {
    9057  if (TM.getRegisterInfo())
    91     RegInfo = new (Allocator.Allocate<MachineRegisterInfo>())
    92                   MachineRegisterInfo(*TM.getRegisterInfo());
     58    RegInfo = new (Allocator) MachineRegisterInfo(*TM.getRegisterInfo());
    9359  else
    9460    RegInfo = 0;
    9561  MFInfo = 0;
    96   FrameInfo = new (Allocator.Allocate<MachineFrameInfo>())
    97                   MachineFrameInfo(*TM.getFrameInfo());
     62  FrameInfo = new (Allocator) MachineFrameInfo(*TM.getFrameInfo());
    9863  if (Fn->hasFnAttr(Attribute::StackAlignment))
    9964    FrameInfo->setMaxAlignment(Attribute::getStackAlignmentFromAttrs(
    10065        Fn->getAttributes().getFnAttributes()));
    101   ConstantPool = new (Allocator.Allocate<MachineConstantPool>())
    102                      MachineConstantPool(TM.getTargetData());
     66  ConstantPool = new (Allocator) MachineConstantPool(TM.getTargetData());
    10367  Alignment = TM.getTargetLowering()->getFunctionAlignment(F);
    10468  FunctionNumber = FunctionNum;
     
    13397  if (JumpTableInfo) return JumpTableInfo;
    13498 
    135   JumpTableInfo = new (Allocator.Allocate<MachineJumpTableInfo>())
     99  JumpTableInfo = new (Allocator)
    136100    MachineJumpTableInfo((MachineJumpTableInfo::JTEntryKind)EntryKind);
    137101  return JumpTableInfo;
     
    230194                                      int64_t o, uint64_t s,
    231195                                      unsigned base_alignment) {
    232   return new (Allocator.Allocate<MachineMemOperand>())
    233              MachineMemOperand(v, f, o, s, base_alignment);
     196  return new (Allocator) MachineMemOperand(v, f, o, s, base_alignment);
    234197}
    235198
     
    237200MachineFunction::getMachineMemOperand(const MachineMemOperand *MMO,
    238201                                      int64_t Offset, uint64_t Size) {
    239   return new (Allocator.Allocate<MachineMemOperand>())
     202  return new (Allocator)
    240203             MachineMemOperand(MMO->getValue(), MMO->getFlags(),
    241204                               int64_t(uint64_t(MMO->getOffset()) +
     
    416379  ViewGraph(this, "mf" + getFunction()->getNameStr());
    417380#else
    418   errs() << "SelectionDAG::viewGraph is only available in debug builds on "
     381  errs() << "MachineFunction::viewCFG is only available in debug builds on "
    419382         << "systems with Graphviz or gv!\n";
    420383#endif // NDEBUG
     
    426389  ViewGraph(this, "mf" + getFunction()->getNameStr(), true);
    427390#else
    428   errs() << "SelectionDAG::viewGraph is only available in debug builds on "
     391  errs() << "MachineFunction::viewCFGOnly is only available in debug builds on "
    429392         << "systems with Graphviz or gv!\n";
    430393#endif // NDEBUG
     
    435398unsigned MachineFunction::addLiveIn(unsigned PReg,
    436399                                    const TargetRegisterClass *RC) {
    437   assert(RC->contains(PReg) && "Not the correct regclass!");
    438   unsigned VReg = getRegInfo().createVirtualRegister(RC);
    439   getRegInfo().addLiveIn(PReg, VReg);
     400  MachineRegisterInfo &MRI = getRegInfo();
     401  unsigned VReg = MRI.getLiveInVirtReg(PReg);
     402  if (VReg) {
     403    assert(MRI.getRegClass(VReg) == RC && "Register class mismatch!");
     404    return VReg;
     405  }
     406  VReg = MRI.createVirtualRegister(RC);
     407  MRI.addLiveIn(PReg, VReg);
    440408  return VReg;
    441409}
    442 
    443 /// getDILocation - Get the DILocation for a given DebugLoc object.
    444 DILocation MachineFunction::getDILocation(DebugLoc DL) const {
    445   unsigned Idx = DL.getIndex();
    446   assert(Idx < DebugLocInfo.DebugLocations.size() &&
    447          "Invalid index into debug locations!");
    448   return DILocation(DebugLocInfo.DebugLocations[Idx]);
    449 }
    450 
    451410
    452411/// getJTISymbol - Return the MCSymbol for the specified non-empty jump table.
     
    479438///
    480439int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset,
    481                                         bool Immutable, bool isSS) {
     440                                        bool Immutable) {
    482441  assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
    483   Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, Immutable,
    484                                               isSS));
     442  // The alignment of the frame index can be determined from its offset from
     443  // the incoming frame position.  If the frame object is at offset 32 and
     444  // the stack is guaranteed to be 16-byte aligned, then we know that the
     445  // object is 16-byte aligned.
     446  unsigned StackAlign = TFI.getStackAlignment();
     447  unsigned Align = MinAlign(SPOffset, StackAlign);
     448  Objects.insert(Objects.begin(), StackObject(Size, Align, SPOffset, Immutable,
     449                                              /*isSS*/false, false));
    485450  return -++NumFixedObjects;
    486451}
     
    573538  case MachineJumpTableInfo::EK_Custom32:
    574539    return 4;
     540  case MachineJumpTableInfo::EK_Inline:
     541    return 0;
    575542  }
    576543  assert(0 && "Unknown jump table encoding!");
     
    590557  case MachineJumpTableInfo::EK_Custom32:
    591558    return TD.getABIIntegerTypeAlignment(32);
     559  case MachineJumpTableInfo::EK_Inline:
     560    return 1;
    592561  }
    593562  assert(0 && "Unknown jump table encoding!");
     
    673642/// CanShareConstantPoolEntry - Test whether the given two constants
    674643/// can be allocated the same constant pool entry.
    675 static bool CanShareConstantPoolEntry(Constant *A, Constant *B,
     644static bool CanShareConstantPoolEntry(const Constant *A, const Constant *B,
    676645                                      const TargetData *TD) {
    677646  // Handle the trivial case quickly.
     
    688657  // If a floating-point value and an integer value have the same encoding,
    689658  // they can share a constant-pool entry.
    690   if (ConstantFP *AFP = dyn_cast<ConstantFP>(A))
    691     if (ConstantInt *BI = dyn_cast<ConstantInt>(B))
     659  if (const ConstantFP *AFP = dyn_cast<ConstantFP>(A))
     660    if (const ConstantInt *BI = dyn_cast<ConstantInt>(B))
    692661      return AFP->getValueAPF().bitcastToAPInt() == BI->getValue();
    693   if (ConstantFP *BFP = dyn_cast<ConstantFP>(B))
    694     if (ConstantInt *AI = dyn_cast<ConstantInt>(A))
     662  if (const ConstantFP *BFP = dyn_cast<ConstantFP>(B))
     663    if (const ConstantInt *AI = dyn_cast<ConstantInt>(A))
    695664      return BFP->getValueAPF().bitcastToAPInt() == AI->getValue();
    696665
    697666  // Two vectors can share an entry if each pair of corresponding
    698667  // elements could.
    699   if (ConstantVector *AV = dyn_cast<ConstantVector>(A))
    700     if (ConstantVector *BV = dyn_cast<ConstantVector>(B)) {
     668  if (const ConstantVector *AV = dyn_cast<ConstantVector>(A))
     669    if (const ConstantVector *BV = dyn_cast<ConstantVector>(B)) {
    701670      if (AV->getType()->getNumElements() != BV->getType()->getNumElements())
    702671        return false;
     
    717686/// alignment for the object.
    718687///
    719 unsigned MachineConstantPool::getConstantPoolIndex(Constant *C,
     688unsigned MachineConstantPool::getConstantPoolIndex(const Constant *C,
    720689                                                   unsigned Alignment) {
    721690  assert(Alignment && "Alignment must be specified!");
Note: See TracChangeset for help on using the changeset viewer.