~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to clang/lib/CodeGen/CGBuiltin.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1502
1502
Value *CodeGenFunction::EmitTargetBuiltinExpr(unsigned BuiltinID,
1503
1503
                                              const CallExpr *E) {
1504
1504
  switch (getTarget().getTriple().getArch()) {
 
1505
  case llvm::Triple::aarch64:
 
1506
    return EmitAArch64BuiltinExpr(BuiltinID, E);
1505
1507
  case llvm::Triple::arm:
1506
1508
  case llvm::Triple::thumb:
1507
1509
    return EmitARMBuiltinExpr(BuiltinID, E);
1621
1623
  return std::make_pair(EmitScalarExpr(Addr), Align);
1622
1624
}
1623
1625
 
 
1626
Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
 
1627
                                               const CallExpr *E) {
 
1628
  if (BuiltinID == AArch64::BI__clear_cache) {
 
1629
    assert(E->getNumArgs() == 2 &&
 
1630
           "Variadic __clear_cache slipped through on AArch64");
 
1631
 
 
1632
    const FunctionDecl *FD = E->getDirectCallee();
 
1633
    SmallVector<Value *, 2> Ops;
 
1634
    for (unsigned i = 0; i < E->getNumArgs(); i++)
 
1635
      Ops.push_back(EmitScalarExpr(E->getArg(i)));
 
1636
    llvm::Type *Ty = CGM.getTypes().ConvertType(FD->getType());
 
1637
    llvm::FunctionType *FTy = cast<llvm::FunctionType>(Ty);
 
1638
    StringRef Name = FD->getName();
 
1639
    return EmitNounwindRuntimeCall(CGM.CreateRuntimeFunction(FTy, Name), Ops);
 
1640
  }
 
1641
 
 
1642
  return 0;
 
1643
}
 
1644
 
1624
1645
Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
1625
1646
                                           const CallExpr *E) {
1626
1647
  if (BuiltinID == ARM::BI__clear_cache) {
 
1648
    assert(E->getNumArgs() == 2 && "__clear_cache takes 2 arguments");
1627
1649
    const FunctionDecl *FD = E->getDirectCallee();
1628
 
    // Oddly people write this call without args on occasion and gcc accepts
1629
 
    // it - it's also marked as varargs in the description file.
1630
1650
    SmallVector<Value*, 2> Ops;
1631
 
    for (unsigned i = 0; i < E->getNumArgs(); i++)
 
1651
    for (unsigned i = 0; i < 2; i++)
1632
1652
      Ops.push_back(EmitScalarExpr(E->getArg(i)));
1633
1653
    llvm::Type *Ty = CGM.getTypes().ConvertType(FD->getType());
1634
1654
    llvm::FunctionType *FTy = cast<llvm::FunctionType>(Ty);