Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F4823249
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
Mon, Aug 24, 9:32 PM
Size
815 B
Mime Type
text/x-c++
Expires
Wed, Aug 26, 9:32 PM (1 d, 4 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