add various wrappers for gpu code generation
This commit is contained in:
@@ -211,7 +211,7 @@ pub(crate) unsafe fn create_module<'ll>(
|
||||
|
||||
// Ensure the data-layout values hardcoded remain the defaults.
|
||||
{
|
||||
let tm = crate::back::write::create_informational_target_machine(tcx.sess, false);
|
||||
let tm = crate::back::write::create_informational_target_machine(sess, false);
|
||||
unsafe {
|
||||
llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm.raw());
|
||||
}
|
||||
@@ -680,6 +680,22 @@ impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> {
|
||||
unsafe { llvm::LLVMConstInt(ty, val, llvm::False) }
|
||||
}
|
||||
|
||||
pub(crate) fn get_const_i64(&self, n: u64) -> &'ll Value {
|
||||
self.get_const_int(self.type_i64(), n)
|
||||
}
|
||||
|
||||
pub(crate) fn get_const_i32(&self, n: u64) -> &'ll Value {
|
||||
self.get_const_int(self.type_i32(), n)
|
||||
}
|
||||
|
||||
pub(crate) fn get_const_i16(&self, n: u64) -> &'ll Value {
|
||||
self.get_const_int(self.type_i16(), n)
|
||||
}
|
||||
|
||||
pub(crate) fn get_const_i8(&self, n: u64) -> &'ll Value {
|
||||
self.get_const_int(self.type_i8(), n)
|
||||
}
|
||||
|
||||
pub(crate) fn get_function(&self, name: &str) -> Option<&'ll Value> {
|
||||
let name = SmallCStr::new(name);
|
||||
unsafe { llvm::LLVMGetNamedFunction((**self).borrow().llmod, name.as_ptr()) }
|
||||
|
||||
Reference in New Issue
Block a user