WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit d216bf15 authored by qinsoon's avatar qinsoon
Browse files

allow building int128 constant by API

parent df19c5f6
......@@ -63,6 +63,7 @@ pub struct NodeFuncSig { pub id: MuID, pub paramtys: Vec<MuTypeNode>, pub rettys
#[derive(Debug)]
pub enum NodeConst {
ConstInt { id: MuID, ty: MuTypeNode, value: u64 },
ConstIntEx { id: MuID, ty: MuTypeNode, value: Vec<u64>},
ConstFloat { id: MuID, ty: MuTypeNode, value: f32 },
ConstDouble { id: MuID, ty: MuTypeNode, value: f64 },
ConstNull { id: MuID, ty: MuTypeNode },
......
......@@ -211,7 +211,8 @@ impl MuIRBuilder {
}
pub fn new_const_int_ex(&mut self, id: MuID, ty: MuID, values: &[u64]) {
panic!("Not implemented")
self.bundle.consts.insert(id, Box::new(NodeConst::ConstIntEx {id: id,
ty: ty, value: values.to_vec()}));
}
pub fn new_const_float(&mut self, id: MuID, ty: MuID, value: f32) {
......@@ -1108,6 +1109,11 @@ impl<'lb, 'lvm> BundleLoader<'lb, 'lvm> {
let c = Constant::Int(value);
(c, t)
},
NodeConst::ConstIntEx { id: _, ty, ref value } => {
let t = self.ensure_type_rec(ty);
let c = Constant::IntEx(value.clone());
(c, t)
},
NodeConst::ConstFloat { id: _, ty, value } => {
let t = self.ensure_type_rec(ty);
let c = Constant::Float(value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment