Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F4826089
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, 9:49 AM
Size
834 B
Mime Type
text/x-c++
Expires
Thu, Aug 27, 9:49 AM (1 d, 5 h)
Engine
blob
Format
Raw Data
Handle
287091
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 pointerarithmetic {
llvm::Value*
PointerArithmetic::add(llvm::Value *left, llvm::Value *right, compilation::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