aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprComplex.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-12-01 11:08:04 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-12-01 11:08:04 +0000
commit1569ce68681d909594d64f9b056d71f5dd7563bf (patch)
tree867cbbe32a66fd7d62dd9ce9df23a23fefdb8290 /lib/CodeGen/CGExprComplex.cpp
parentf5bd02d290ff15268853e0456c130a1afa15e907 (diff)
downloadsrc-1569ce68681d909594d64f9b056d71f5dd7563bf.tar.gz
src-1569ce68681d909594d64f9b056d71f5dd7563bf.zip
Notes
Diffstat (limited to 'lib/CodeGen/CGExprComplex.cpp')
-rw-r--r--lib/CodeGen/CGExprComplex.cpp31
1 files changed, 7 insertions, 24 deletions
diff --git a/lib/CodeGen/CGExprComplex.cpp b/lib/CodeGen/CGExprComplex.cpp
index 9e81e4fbeabe..7fa8ffbd5515 100644
--- a/lib/CodeGen/CGExprComplex.cpp
+++ b/lib/CodeGen/CGExprComplex.cpp
@@ -18,7 +18,6 @@
#include "llvm/Constants.h"
#include "llvm/Function.h"
#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Compiler.h"
using namespace clang;
using namespace CodeGen;
@@ -29,7 +28,7 @@ using namespace CodeGen;
typedef CodeGenFunction::ComplexPairTy ComplexPairTy;
namespace {
-class VISIBILITY_HIDDEN ComplexExprEmitter
+class ComplexExprEmitter
: public StmtVisitor<ComplexExprEmitter, ComplexPairTy> {
CodeGenFunction &CGF;
CGBuilderTy &Builder;
@@ -261,34 +260,18 @@ public:
/// load the real and imaginary pieces, returning them as Real/Imag.
ComplexPairTy ComplexExprEmitter::EmitLoadOfComplex(llvm::Value *SrcPtr,
bool isVolatile) {
- llvm::SmallString<64> Name(SrcPtr->getName().begin(),
- SrcPtr->getName().end());
-
llvm::Value *Real=0, *Imag=0;
if (!IgnoreReal) {
- // FIXME: Clean this up once builder takes Twine/StringRef.
- Name += ".realp";
- llvm::Value *RealPtr = Builder.CreateStructGEP(SrcPtr, 0,
- Name.str().str().c_str());
-
- Name.pop_back(); // .realp -> .real
- // FIXME: Clean this up once builder takes Twine/StringRef.
- Real = Builder.CreateLoad(RealPtr, isVolatile,
- Name.str().str().c_str());
- Name.resize(Name.size()-4); // .real -> .imagp
+ llvm::Value *RealP = Builder.CreateStructGEP(SrcPtr, 0,
+ SrcPtr->getName() + ".realp");
+ Real = Builder.CreateLoad(RealP, isVolatile, SrcPtr->getName() + ".real");
}
if (!IgnoreImag) {
- Name += "imagp";
-
- // FIXME: Clean this up once builder takes Twine/StringRef.
- llvm::Value *ImagPtr = Builder.CreateStructGEP(SrcPtr, 1,
- Name.str().str().c_str());
-
- Name.pop_back(); // .imagp -> .imag
- // FIXME: Clean this up once builder takes Twine/StringRef.
- Imag = Builder.CreateLoad(ImagPtr, isVolatile, Name.str().str().c_str());
+ llvm::Value *ImagP = Builder.CreateStructGEP(SrcPtr, 1,
+ SrcPtr->getName() + ".imagp");
+ Imag = Builder.CreateLoad(ImagP, isVolatile, SrcPtr->getName() + ".imag");
}
return ComplexPairTy(Real, Imag);
}