Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F4824808
pointerarithmetic.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Aug 25, 5:04 AM
Size
815 B
Mime Type
text/x-c++
Expires
Thu, Aug 27, 5:04 AM (1 d, 5 h)
Engine
blob
Format
Raw Data
Handle
286115
Attached To
rXR Xreate
pointerarithmetic.cpp
View Options
/*
* pointerarithmetic.cpp
*
* Author: pgess <v.melnychenko@xreate.org>
* Created on March 29, 2017, 11:52 AM
*/
#include "pointerarithmetic.h"
#include "llvmlayer.h"
#include <vector>
using namespace llvm;
namespace xreate { namespace compilation {
llvm::Value*
PointerArithmetic::add(llvm::Value *left, llvm::Value *right, Context context, const std::string& hintVarDecl){
LLVMLayer* llvm = context.pass->man->llvm;
if (left->getType()->isPointerTy() && right->getType()->isIntegerTy()){
std::vector<llvm::Value*> indexes{right};
//{llvm::ConstantInt::get(llvm::Type::getInt32Ty(llvm::getGlobalContext()), 0)};
//indexes.push_back(right);
return llvm->builder.CreateGEP(left, llvm::ArrayRef<llvm::Value*>(indexes), hintVarDecl);
}
return nullptr;
}
} }
Event Timeline
Log In to Comment