def set_weights(self, weights): operands = [MetaDataString(self.module, "branch_weights")] for w in weights: if w < 0: raise ValueError("branch weight must be a positive integer") operands.append(Constant(types.IntType(32), w)) md = self.module.add_metadata(operands) self.set_metadata("prof", md)
def add_case(self, val, block): assert isinstance(block, Block) if not isinstance(val, Value): val = Constant(self.value.type, val) self.cases.append((val, block))